Introduction: Tweet Your Shoes to Change Colour
Judges Prize in the
IoT Builders Contest
"Tweet my boots to make them change colour". This was a brilliant way to get out of making small talk when networking at conferences. I hacked my LED boots so anyone anywhere could change the colour by tweeting them. I bought the boots online. Originally, I pressed a button in the boot to change their colour. I removed the electronics module from the boots and replaced them with something I could control by wifi. Now when you tweet "#Cheerlights" and a colour, they change to that colour.
The theory is:
Cheerlights API (in the cloud)
via magic to:
IBM's Watson Internet of Things Platform, on Bluemix (a different cloud)
via WiFi to:
Adafruit Feather Huzzah (in your boot)
via physical connection to:
LEDs (in your boot)
Steps described in detail later:
- Remove original electronics
- Add extra electronics (Open Collector Driver)
- Connect Huzzah to wifi and the cloud
- Adapt the battery and switch
- Charge the battery
- Protect electronics with hardboard
- Write the software (Node-RED)
- Get WiFi when out and about
- Spread the joy / network without small talk.
Keywords: Adafruit Feather, IBM Watson IoT, Node-RED, Cheerlights, WiFi
Parts used: (Total cost about £75)
- LED Boots (£20 - £30) (e.g. these)
- 2 off Adafruit Feather Huzzah (£19 each)
- (You could replace the Huzzah's with WeMos D1 minis - about £4 each)
- 2 off 3.7V 500mAh LiPo batteries (£7.50 each)
- Electronics and other bits (About £10 total)
- 3 off NPN BC307 Transistor
- 3 off 1k ohm Resistor
- 1 off 15 ohm Resistor
- Stranded wire for connecting
- Switch (e.g. https://www.adafruit.com/products/805)
- 2 off 15 cm Female Micro USB B to Male Micro USB B
- Heat shrink
- Perfboard or veroboard or similar
- Small amount of soldering
Additional safety notes:
This project uses LiPo batteries. Do not abuse these batteries, do not short, bend, crush or puncture. Never charge or use unattended. Always inspect batteries and surrounding circuitry constantly for any damage, loose wiring, or possibility of short circuits. As with all Lithium ion polymer batteries and with any power source - they should be used by experts who are comfortable working with power supplies.
If misused LiPo batteries can cause serious injury. Continue at your own risk.
Many thanks to Andy Stanford-Clark and James Macfarlane for their help and advice in making this project - particularly the arduino sketch. And thanks to those at IBM WOW who enjoyed tweeting the boots!
Step 1: Remove the Original Electronics
Note: Boots may be different - my photos may not match your experience.
- Remove the insole of the boot and carefully slice the fabric inner to expose the sealed battery pack.
- Unclip the two connectors - the micro USB charger socket and the LEDs.
- Check that the LEDs are RGB LEDs inside (and not neopixels). RGB LEDs have four wires going to them - one for red, green, blue and positive. (Neopixels will have three - data in, positive and ground). See Adafruit's uberguide for a great description of the difference between RGB LEDs and neopixels https://learn.adafruit.com/adafruit-neopixel-uberguide/overview.
- Check the voltage of the battery. The 3.7V batteries I removed were replaced with ones of the same voltage.
Step 2: Extra Electronics
The GPIO pins on the Huzzah (or indeed most micro-controllers) are not powerful enough to drive more than a couple of LEDs directly. We therefore need to add a bit of electronics.
- Make a note of which pins are used for what on the LED connector from the original electronics, and cut the connector off, leaving a long enough tail to make a joint. On the original circuit board, the Red (R), Green (G), Blue (B) Gnd (-) and Positive (+) were labelled.
- Normally, you need a current limit resistor between the transistors and the LEDs, because they run at a lower voltage than the supply. I measured the voltage in the original electronics, and by luck, the green and blue LEDs run at more or less the same voltage as the supply. However, the red needed to lose some excess voltage - hence the 15 ohm resistor. This choice of resistor (or lack of resistor) will only work for this combination of battery and string of LEDs. If your boots have a different type of LED, you may need a current limit resistor on each colour. The limiting resistor also had the side effect of (almost) matching the brightness of the red LEDs to the green and blue LEDs.
- On veroboard or perfboard, make the circuit as per the circuit diagram above - take into account any changes in current limiting resistors you may need.
- Use the connector you just cut off for the LED connectors.
- For testing purposes, plug the connector into the LEDs connector in the boots. Don't worry about fitting the electronics in the sole yet.
Step 3: Connect the Huzzah to the Cloud
I connected the Huzzah to IBM's Watson Internet of Things Platform on Bluemix. The instructions for how to do this with a WeMos device are here: https://www.instructables.com/id/Connect-Your-Thing...
The main difference with a Feather Huzzah are the pins you connect to, the board you select and the code. We will do this for one boot first:
1 Complete steps 2-7 of the Connect-Your-Thing Instructable, substitute "Huzzah" for "WeMos" (Ignore step 1).
At step 6.4 I named the Device Type as Huzzah_Boot, and at 6.7 I named the Device ID as Boot1. This is what you also put in the IBMIoT node.
2 Repeat step 6 of the Connect-Your-Thing Instructable to add a Device ID for Boot 2. Use the device type Huzzah_Boot that you have already set up, and now chose a new Device ID (Boot2).
3 Go back to the Node-RED flow and copy and paste the Boot1 IBMIoT output node. Change the Device ID and name to Boot2. Connect the new node to the inject node. Click Deploy.
4 Instead of step 8 on the Connect-Your-Thing Instructable, start with the following:
5 Use the latest open-source Arduino software (IDE). You can download it here: https://www.arduino.cc.
6 The following library will also be needed. The instructions to install a library are given here: https://www.arduino.cc/en/Guide/Libraries
"PubSubClient.h" file available at: https://github.com/knolleary/pubsubclient
7 You will also need to install the ESP8266 wifi board - follow the instructions at https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/using-arduino-ide
8 You need to make a change to the PubSubClient.h file. It should be in your Arduino installation in a subdirectory called libraries/PubSubClient/src
9 Open the file using a text editor. Look for "#define MQTT_KEEPALIVE 15" and change the 15 to 60. Save the change.
10 Restart the Arduino software.
11 Plug in on of the Huzzahs into your computer using a USB cable.
10 In the Tools menu:
Select the "Adafruit Huzzah ESP8266" board in the board manager menu. If it is not there, restart the Arduino software and try again.
Select CPU frequency: 160MHz
Select Flash Size 4M (3M SPIFFS)
Select: Upload speed 115200
Port: Make sure this is the port the Huzzah is plugged in to.
11 Download and open the Arduino file LucyBootsInstructables_v4.ino
12 Now, for the first Huzzah, complete parts 9 onwards of Step 8 on the Connect-Your-Thing, and then do step 9.
13 For the second Huzzah, you will need to make a new arduino flow. Use "save as" and save the flow as something else. Now edit it to include the Client ID and password of Boot2. Save and upload that to the second Huzzah. Upload and test as before.
Step 4: Battery and Switch
CAUTION - LiPo Batteries.
From Adafuit's web site: "As with all Lithium ion polymer batteries and with any power source - they should be used by experts who are comfortable working with power supplies."
- I used two 3.7V 500mAh LiPo batteries https://www.adafruit.com/products/1578
- Cut the red (positive) wire and inserted a switch https://www.adafruit.com/products/805. The switch has three legs. Solder to the middle and one of the ends. Cut the other leg off.
- The battery slides in the side of the boot padding, with the switch protruding from the top. This allows you to switch them off when required. It also protects the boot slightly.
CAUTION: I managed to bend and fold the LiPo by wearing it in this position. I was lucky not to get hurt.
Step 5: Charging the Battery
The charger socket that came with the boots was "power only" - I could not transfer data down the USB cable. I made my own 15cm Female Micro USB B Male Micro USB B cables. If you can buy the cables it is far simpler! Alternatively, you could take the electronics out of the boots to update the code on the Huzzahs.
Note: If you are using a WeMos you will need to put in extra electronics to be able to charge the battery. You also will need to add a JST battery socket to the WeMos.
- Replace the power charger socket in the boot with a 15 cm Female Micro USB B Male Micro USB B.
I do not recommend charging your boots with your feet still inside them!
Step 6: Protect the Electronics
I 3D-printed a case for the Feather Huzzah and the extra circuit. However, to make it fit inside the shoes, this had to be very thin and broke after my first few hours walking. Next time, I would put a hardboard layer under the electronics, between the ridges on the inside of the sole.
- Make sure the electronics and Feather Huzzah fit into the cavity left in the insole. I had to remove some of the boot support ribs.
- Insert something robust (non-metalic) and slim into the sole of the shoe, to protect the electronics from damage from underneath.
- Make an extra "insole" to place over the electronics, to protect it and your foot.
- Attach all the cables, battery charger etc to everything, and see if it all fits. If so cover the electronics with the extra insole, replace the original insole and try your foot in it.
- The switch and the female USB B socket should be accessible even with your foot inside. However, as I said in the previous step, I do not recommend charging your boots with your feet still inside them.
Step 7: Node-RED Code
The hardware is complete, and you should be able to manually change the colour of the boots from the Node-RED flow on IBM's Bluemix cloud that you set up. You can access your Bluemix account from anywhere in the world and change the colour of your boots. You do not need to be near them.
You can manually change the colour of the boots. Now join in the CheerLights* fun and synchronise with other CheerLights around the world.
To do this, you need to add some more bits to your Node-RED flow. I have added the complete flow on github. You can copy the flow and import it in to your Node-RED flow. Remove the IBMIoT nodes in the flow, and replace them with your ones. Click on the "Cheerlights" or the "Manual" inject nodes to toggle between the two.
*CheerLights is an “Internet of Things” project created by Hans Scharler that allows people’s lights all across the world to synchronize colour by using twitter. For example, sending the tweet "#CheerLights red" will cause a chain reaction and all of the CheerLights displays and apps everywhere will change their colour to red.
Step 8: Out and About
The boots rely on being connected to WiFi. If you are out and about, you could make or purchase a mobile wifi hotspot and connect to that. I made an access point using a Raspberry Pi - but this relied on there being another wifi (which was behind a captive portal) that the Pi could connect to. I followed Adafruit's instructions for the Pi laptop and the access point. Next time I will use a larger wifi aerial on the Pi.
Step 9: Congratulations!
Done all that? You should now have twitter enabled boots. Go forth, spread the joy and network without awkward small talk.
We have a be nice policy.
Please be positive and constructive.