Rui @ randomnerdtutorials.com tipped us with his latest tutorial. He writes:
In this project you’ll create a standalone web server with a Raspberry Pi that can toggle two LEDs from an ESP8266 using MQTT protocol. You can replace those LEDs with any output (like a relay that controls a lamp).
Raspberry Pi Publishing MQTT Messages to ESP8266 – [Link]
Internet of LEGO “IoL” is an interactive LEGO city built and designed by Cory Guynn, a cloud computing and IoT enthusiast. This project combines computer and electronics engineering with our favorite childhood toy, LEGO!
A recently added project is a digital billboard that broadcasts the weather information from IoL local weather station. It uses a Raspberry Pi running Node-RED to collect weather data from the local station and display it on an OLED screen powered by an ESP8266.
WeMos D1 mini is a cheap mini wifi board based on ESP8266 and compatible with Arduino and NodeMCU. It has 11 digital I/O pins that support PWM, I2C, and interrupts, and has only one analog input with a microUSB connector. The WeMos D1 is available for only $4 and is supported by many shields.
The 128X64 OLED is about 1.3″ display, it is very readable due to its high contrast. This display is made of 128×64 individual white OLED pixels, each one is turned on or off by the controller chip. No backlight is required because the display makes its own light, which reduces the power required to run the OLED.
OLED’s driver chip, SSD1306 can communicate in two ways: I2C or SPI. The OLED itself require a 3.3V power supply and 3.3V logic levels for communication.
The display uses I2C connection at this project, so you will need to solder the two jumpers (SJ1/2) on the back of the OLED, then use the ‘Data’ pin as ‘I2C SDA’ pin and ‘CLK’ pin as ‘I2C SCL’. The WeMos D1, OLED, LEDs, and resistors are connected as shown in the figure.
To simplify configuring WeMos D1, a special firmware called “ESPEasy” has been used. It is a free and open-source web configurable software framework for IoT, which allows the device to be configured using the web browser instead of writing codes.
ESPEasy can be uploaded to the WeMos D1 using the Arduino IDE by installing the ESP8266 board support from Boards Manager, and then uploading the ESPEasy firmware as described in this tutorial.
MQTT is a lightweight machine-to-machine publish/subscription messaging protocol. It works like Twitter where each device will subscribe and/or publish to a topic, much like a #hashtag, and the payload will then contain the data being transmitted.
Mosquitto is a free open source broker that works perfectly on a Raspberry Pi. It is a MQTT server manages the MQTT message flow, and connects with all devices.
The last step is configuring the Raspberry Pi on the weather station for sending the information to the billboard. An easy way for that is using Node-Red, a visual tool for wiring together hardware devices, APIs and online services for IoT applications.
You can use it with your own weather station or any other sources of data, just change the MQTT input nodes to match your topics. To build a weather station check this IoL project and this ChipKIT-based station. Alternatively, you could get weather data using the Weather Underground service with the Node-RED node.
Xose Pérez @ tinkerman.cat build a MQTT LED matrix display to get notification messages.
My MQTT network at home moves up and down a lot of messages: sensor values, triggers, notifications, device statuses,… I use Node-RED to forward the important ones to PushOver and some others to a Blynk application. But I also happen to have an LED display at home and that means FUN.
Tibbo created two small programs that illustrate how easy it is to write MQTT-enabled apps in Tibbo BASIC or Tibbo C.
To illustrate the use of the MQTT library, we have created two simple Tibbo BASIC applications called “mqtt_publisher” and “mqtt_subscriber”.
In our MQTT demo, the publisher device is monitoring three buttons (Tibbits #38). This is done through the keypad (kp.) object.
The three buttons on the publisher device correspond to the red, yellow, and green LEDs (Tibbits #39) on the subscriber device.
As buttons are pushed and released, the publisher device calls mqtt_publish() with topics “LED/Red”, “LED/Green”, and “LED/Red”. Each topic’s data is either 0 for “button released” or 1 for “button pressed”. The related code is in the on_kp() event handler.
The subscriber device subscribes to all three topics with a single call to mqtt_sub() and the line “LED/#”. This is done once, inside callback_mqtt_connect_ok().
With every notification message received from the server, the subscriber device gets callback_mqtt_notif() invoked. The LEDs are turned on and off inside this functions’s body. (more…)
The RFM69GW is a RFM69 to MQTT gateway that uses the ubiquitous ESP8266 chip. There are two or three similar projects that I’m aware of but I’ve put together some hardware and firmware features that make it different. by Xose Pérez:
I’m using Felix Rusu’s RFM69_ATC library so it supports Monteino nodes with Auto Transmission Control feature enabled for an adaptative transmission power: longer battery life & less radio pollution
RFM69CW footprint, compatible with RFM12B and hence with old Monteinos or even with JeeNodes (untested)
Web configurable map between node messages and MQTT topics.
EEPROM persistent configuration using the awesome Embedis library by PatternAgents
Martin @ harizanov.com has published an article on how to forward traffic from RFM69 to MQTT using ESP8266:
I’ve mentioned my plans for this project during the IoT hangout session few months ago, it has finally materialized as working prototype. The blocker so far was the lack of ESP8266 RFM69 driver and free time on my end, so I’ve teamed up with Andrey Balarev to solve this. Andrey is an IoT enthusiast + embedded systems developer and has done excellent job in porting LowPowerLab’s RFM69 library for the ESP8266.