Tomorrow is Valentines Day and I decide to do a little something about it. And what better way than to combine all the buzzwords that are strangulating us today : Cloud, IoT, APIs, HTTP, DIY Electronics and more.
What I wanted to create (again not an original idea) is a little heart (made of paper) that is connected to the Internet and is listening for any messages. If it gets a message (hopefully from me only!) — a few LEDs will light up and the heart will start swaying. In summary, whenever I feel like sending a “I love you” message to my wife – I can do a HTTP POST over the Internet. How romantic !
Here is the sequence:
- Send message from phone or laptop
- Message travels over the Internet
- Electronic Heart that is connected to the Internet gets the message and then starts swaying.
See it in action here:
The Electronics part
I used the impressive littleBits over here to make things a bit simpler for me. Especially the CloudBit module makes thing simpler since it is connected to the net and can receive and send out signals. In our case, all we want to do is power on the CloudBit module and then receive the signal (high). Once it gets it, it will drive an output signal (1) – through a pulse which then powers 2 LEDs and one servo motor. The paper heart is stuck to the servo motor. Not bad …eh?
Take a look at the assembly below:
The parts are listed below (from the left):
- USB Power module
- Cloud Bit module .. notice the WiFi Dongle on it – so that we can connect it to the net. Once configured and connected, it has a unique Device ID and Access Token ID …. so that you can use the littleBits API to send messages to it. Read documentation here.
- Pulse module. Once the Cloud Bit gets the message, it will send a high (1) to the Pulse module. We can control the speed of the pulse …. notice the “speed” label on the pulse module.
- A branch module that sends out the input that it received from the pulse module to 3 components : 2 LEDs and one Servo Motor module.
So, all we need to do is stick the heart now on the Servo module blade (I stole a few lego blocks from my son’s kit to place the motor at a high level so that it can turn). I wrapped the LEDs around the heart. The final project is shown below:
Once the unit is powered on, all we need to do is send it a HTTP POST message, which went something like this:
curl -i -XPOST -H &quot;Authorization: Bearer ACCESS_TOKEN&quot; https://api-http.littlebitscloud.cc/v3/devices/DEVICE_ID/output
Happy Valentines Day to everyone.