Getting Started with RabbitMax Flex IoT and Automation Hat for Raspberry Pi

At the beginning of the month I showed how to assemble RabbitMax Flex, a Raspberry Pi HAT compliant add-on board for Raspberry Pi boards with 40-pin header, that targets IoT and home automation project with its relay, IR transmitter and receiver, I2C headers for sensors, buzzer, RGB LED, and more.  Since I’ve already described the hardware, I’ve spend some time this week-end following the user’s guide to play around with the board using a Raspberry Pi 2 board, and try various features.

rabbitmax-flex-demo

The user’s manual explains that you need the latest version of Raspbian, but I’d not played with my Raspberry Pi 2 board for a while, so the kernel and firmware were quite old:


So the first thing I had to do was to upgrade Raspbian. There are basically two options to upgrade, either downloading and dumping the latest Raspbian firmware image to your micro SD card, and update it from the command line, for example through SSH, and I went with the latter what :


This took several hours on my board, so in hindsight it may not have been the best options. In order to complete the update, I had to reboot the board, and could confirm the Linux kernel and Broadcom firmware had both been updated:


Now we can install I2C tools and vim in order to play with RabbitMax Flex sensors:


We also need to enable I2C though raspi-config:


and go to Advanced->A7 I2C to enable I2C.

raspberry-pi-i2c-configuration

We need to reboot the board again to make sure I2C drivers are automatically loaded at boot time.

RabbitMax Flex user’s manual recommends to use a USB to serial debug at this stage, but it’s just as simple, and IMHO more convenient, to execute command using an SSH terminal. So let’s carry on with software installation with some more dependencies and wiringPi library to control GPIOs:


The system configuration is now complete, and we can use some code samples provided by Leon Anavi, RabbitMax Flex’s developer:


There are eight samples in the directory available in C (using wiringPi library) and/or Python (using python-rpi.gpio):

  • button – Sample to detect when the button is released
  • lcd – Displays “RabbitMax rabbitmax.com” on the LCD display (C language only)
  • rgb-led – Changes RGB LED color every two seconds in loop between red, green and blue
  • sensor-light – Displays BH1750 light sensor intensity in Lux (C language only)
  • buzzer – Turns on the on-board buzzer (beep sample), and plays Star Wars music (starwars sample).
  • relay – Turns on the relay for 3 seconds, and turn it off
  • sensor-humidity – Prints temperature & humidity values from HTU21D I2C sensor (C language only)
  • sensor-temperature – Prints temperature & pressure values from BMP180 I2C sensor (C language only)
RabbitMax Flex LCD Sample
RabbitMax Flex LCD Sample

The first sample I tried was the C code for the button:


WiringPi requires to run the code as root/sudo, but it might be to change some permissions to fix this. The Python sample is even easier to use:


It’s much more fun to use the board with some I2C sensors (up to 5 are supported through the headers on the add-on board), andLeon send me a BMP180 temperature and pressure sensor, and I also connected a Grove module (accelerometer) I got from Wio Link Starter Kit. i2cdetect had no problems detecting both:


0x77 address is used by BMP180 sensor, while 0x4c address is for the grove module.

So now that we’ve made sure the BMP180 sensor has been detected we can try the sample:


The reported temperature matches the actual temperature in my room.

I initially planned to write a sample demo control my aircon using the button and the temperature sensor, so I also had to configure LIRC both to capture my aircon remote control codes, and send back the codes though the IR transmitter.

Again this is very well explained in the user’s guide, and I started by installed LIRC.

There’s no support in raspi-config for LIRC, so we have to edit /etc/modules and add the IR pins by adding the following lines:

We also have to changed four lines in /etc/lirc/hardware.conf:


and finally I had to edit  /boot/config.txt to add lirc support to dtoverlay:


Configure is done, and we can restart the Raspberry Pi board to make sure the changes are applied:


Now I’m going to capture key code from my aircon remote. First, we need to stop the service, and list of available remote key names:


Now in theory I can assign remote codes to the actual output from my aircon remote, and the idea was to use KEY_POWER for the remote power button, and KEY_DOWN to set the temperature to 25 C with the command:


Sadly, maybe one out of 25 key presses from my remote control were detected. Maybe an issue with the protocol used or timing, but I found out that I had no such problem with my TV remote control, and could complete the setup:


I configured three keys:


That means that my test/demo project had now become rather silly, as instead of turning on my aircon when it gets hot, I’d turn on the TV 🙂 But I guess it’s good enough for a review, and as a learning experience.

Now we can backup the old lirc config, replace it with ours, and restart LIRC daemon:


I could also confirm I could turn on and off the TV with my Raspberry Pi 2 and RabbitMax Flex board using the following command:


From there, it was quite straightforward to write my “useless TV demo” based on code from the samples that turns on and off the TV whenever I release the push button, or when the temperature crosses 30 Celsius, and showing the power status and temperature on the LCD display:


It works pretty well, as you can see from the video.

You’ll also find the demo code on github.

Beside Raspbian, Leon is also working on “RabbitMax IoT GNU/Linux Distribution” built with the Yocto Project where all hardware configuration is done, running an MQTT server, as well as an GHTML8 web interface designed with jQuery Mobile and Node.js API.

You can get the source code for that, as well as the documentation, C & Python sample projects, tools, and later on KiCAD files on RabbitMax github’s account, as well as some extra info on RabbitMax.com website. You can purchase the board now for $49.90 on Tindie.com without the LCD nor sensors, but it might be a good idea to wait for the crowdfunding campaign that should start shortly, with the board offered for half the Tindie price, and probably some kits with LCD, and sensors.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX Rockchip RK3588 mini-ITX motherboard

One Reply to “Getting Started with RabbitMax Flex IoT and Automation Hat for Raspberry Pi”

Leave a Reply

Your email address will not be published. Required fields are marked *

Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...
Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...