User manual
know the project: It's about globally networked coloured lights that can be simultaneously controlled through Twitter commands. Another version
of this project was part of last year's Advent calendar. This year we have the version with MQTT and expanded functions.
Behind today's door is a 1-kohm resistor. The layout consists of the RGB LED with series resistors and a button.
Download today's programme. Before you can transfer the programme to the NanoESP, you have to install a library. This is the Crossfade library by
Radek
Wierzbicki (source: https://github.com/radekw/Arduino/tree/5f24ce7c8db9dfbb5252b59824c3217d851b3a3c). For practical reasons, a copy of the
library version used is contained as a ZIP file in the Sketch folder. You can easily add integrate this through the Library Manager in the Arduino IDE
by selecting the ZIP directory in the Sketch folder Sketch > Integrate library > Integrate .ZIP library. Now the programme compiles, and you can
upload it to the NanoESP.
After uploading the programme, now go back to the site www.hivemq.com/try-out/ and establish a connection to the broker.fkainka.de broker.
There, with the topic
NanoESP/MyMQTTiD/rgb/mode
you can switch the mode between Cheerlights and personal colours by publishing a 1 or a 0. It's important that for all messages you activate the
Retain check box before you send the message with the Publish button next to it on the right. Retain means something like Save because the
broker stores the message. Now, as soon as a device subscribes to the topic, the saved message is sent in its entirety to the device. You can thus
save states. Incidentally, the button on the breadboard likewise switches the mode using a message with Retain flag. So later on, you don't
always have to go to the Try Out site to switch the mode.
In personal mode (mode 0), you can give the RGB LED a colour by publishing a message in the topic
NanoESP/MyMQTTiD/rgb/color
in the form
rgb(X,X,X)
. The X stands here respectively for a PWM value between 0 and 255. The sequence of colours is red, green, blue. So for a green colour with
maximum brightness, you have to publish
rgb(0,255,0)
. Don't forget to check the Retain box.
In Cheerlights mode (mode 1), the board subscribes to a topic to which the current Cheerlights colour is published. You can change this colour by
composing a Twitter message and thereby changing your colour and also the colour of all other Cheerlights users. First, the message must
contain #Cheerlights, @Cheerlights or simply the keyword Cheerlights; second, one of the predefined colours must come after the keyword. The
predefined colours include:
red, green, blue, cyan, white, warmwhite, purple, magenta, yellow, orange, pink
A potential tweet thus looks like this:
Testing my #cheerlights #MQTT project on my #NanoESP with the color blue
You thereby give yourself and the whole world a new colour. But if you prefer your personal colours without someone else butting in, simply
switch back to the personal mode, and now the LED changes back to your predefined colour.
Day 23: MQTT Climate
Behind the door for today is a battery clip for a 9 V block, with which you can make the entire system moveable. An alternative to a battery is a
power bank (a rechargeable battery pack, normally for mobile phones). You can see in today's layout picture how to connect a 9 V battery
correctly.
This is how you can connect a 9 V battery to today's layout.
Climate data should be captured again today. But this time they are published through the MQTT broker and are thus accessible worldwide. The
data could thus be called up via a plug-in and stored in a database.
Download today's programme and program your NanoESP with it. After a short time, the board is connected to the WLAN and the broker and
begins to send the measurement data. Now go to the http://www.hivemq.com/try-out/ page and connect to the broker. Subscribe to these
topics:
NanoESP/MyMQTTiD/climate/temp










