Introduction: Marvellous Notifications - Ironman Edition
"Excelsior" - Stan Lee.
This instructable is dedicated to the late father of my favourite superheroes.
For some time I had this Iron-man statue on the shelf. It's a toy of a dubious origins given to me after an argument with a friend. I claimed I could make it look better. The time went by and the toy was just sitting there on my shelf for months and months, neither played with the not very interactive LED light or painted.
It was time to change this!
Let's put some life into this Ironman, paint it and add the Jarvis-worth computing power! It's a testament to how much fun a single LED can give you if used correctly!
- Fully "connected" controllable RGB LED light - yes just one!
- Can announce your Facebook, Twitter, WhatsApp other notifications
- Compatible with Alexa (if you want it to)
- Totally SuperHero friendly
- Jarvis inside (it's ESP8266 but that's the closest I could find)
Cost: about 5 USD
Difficulty: Superhero easy
(Note the project requires a NodeRED server for IoT connectivity)
There is a competition going on - if I can win it with a single LED project that would be a truly marvellous experience! Votes much appreciated!
The instructable is totally based on this lovely write up made by me! You can read more about it there, but be warn this instructable is action packed with humour!
Step 1: Hardware
This is going to be the shortest hardware list ever:
- ESP8266-01 - just like this one ($3)
- 1 RGB LED WS2812b you need just one - it's priceless!
- 5V to 3.3V stepdown (to make it USB powered) ($2)
You will also need a soldering iron (man), some hero alike patience, steady fingers and laser guns because you cannot have enough of lasers. Also if you can crawl up the building... stop reading this Peter and go and save the city!
It's clear I'm just trying to make this step looks serious. The truth is - this is a fun project to get your footing into MQTT, NodeRED, ESP8266 and some basic electronics. You could use batteries to power this but ESP without the sleep mode will chew through them very quickly.
Step 2: Putting Jarvis(esp8266) Into Ironman
It's not called luck! I totally planned that:
- WS2812b has a sticky tape and fits on the back plate of the ESP
- ESP8266 fits inside the Ironman head (Tony is big headed indeed!)
Fun fact: My current housemate has codename "Iron-man" (do not tell him that, he is not aware of this). I pick the codenames each time I have to look for a new housemate, prior to selection (I went through Batman and Superman already). Not only his name happened to be Anthony, but the first question he asked was about ironing board!
As much as you might be tempted to put it all together - don't do this just yet. Once the WS2812b is soldered to the ESP8266 with all the wires, it will be harder to flash the code.
With that in mind - time for Jarvis level AI
Step 3: Software "Hello Jarvis"
There are two components of this set up:
The NodeRED is super easy to use and you can do a lot of incredible things with this. From basic automation to telling our toy Jarvis what to do! I have a tutorial for beginners if you want to expand your knowledge further. It's not needed for this instructable. If you want to make the lights happen - just keep on reading.
The server is responsible for 2 things:
- to capture triggers (incoming notification, button press etc)
- send the command to light up the light
To communicate with ESP8266 I'm using a string which is constructed with the following way:
<p>Format: (num:red:green:blue:LedON:LedOFF:Brightness:loop)<br> num: int 0-255 // number of blinks red: int 0-255 // red channel (use color picker) green: int 0-255 // green channel (use color picker) blue: int 0-255 // blue channel (use color picker) LedOn/Off: int mills 100 - 1000 // LED and break timings Brightness: int 0-255 // LED brightness loop: int 0,1,2 // mode (count/constant blinking/clear)</p>
Based on this key a sample message like this:
Would translate into 3 Blue pulses lasting 1 sec every 300 ms at the full brightness.
This will be sent via MQTT to the ESP8266. It's up to you what will cause the blinks to happen. I will cover a couple of sample scenarios:
Obviously to capture messages and notifications I’m going to use Tasker and AutoNotification plugin. Each time I receive a message of a certain type – let’s do WhatsApp and SMS – I want the Ironman to blink x times in y colour.
On Android devices, you can use Tasker to check what notification has been issued and do something based on this. AutoNotification will monitor each notification and if it is issued by SMS app or Whatsapp it will send an HTTP Post to NodeRED. I have a lot of Tasker tutorials if you want to know more about it.
For WhatsApp I’m going to blink LED 6 times, set the colour to green
For SMS I want LED to turn blue and blink 10 times led-
You can download and import the complete Tasker profile with all the files attached to this instructable.
Using MQTT - I'm sending the sting with information on how the LED should behave. You have to flash the ESP (maybe use this DIY flash adapter) using Arduino IDE with the custom code. The code is ready for you, and all you have to do is modify the credentials.h file with your WiFi access and NodeRED server info.
<p>#define SSID_NAME "xxxxxxx";<br>#define SSID_PASS "xxxxxxx"; #define MQTT_SERVER "192.168.1.183"; #define MQTT_USER "xxxxxx"; #define MQTT_PASS "xxxxxx"; #define MQTT_CLIENT "Ironman2";</p>
If you are not sure how to flash the ESP8266 - here is the guide for you. Note that to operate LED you will need FastLED library from the Arduino IDE.
Step 4: Avengers Assemble!
It's time to put it all together! There is a couple of things to do. You can see the connection circuit but in the nutshell:
- USB cable connects the power pins (1 and 4) to the 5V to 3.3V stepdown
- 3.3V is used to power the RGB LED and ESP8266 (remember to power CH-EN pin)
- The signal is sent from GPIO02 to the LED
Double check all the wires, as mistakes at this step can be costly! You are almost ready! It's time for the last step!
Step 5: It's Like Watching the Paint Dry
Fortunately, I sped the footage up for you - so you don't have to endure 2h painting session! Use acrylic paints and your imagination to make something average look epic!
And if you feeling like buying me a coffee or supporting me in a more continuous way:
I hope you have enjoyed the project!
Participated in the
Make it Glow Contest 2018