Internet Valentine

by bekathwia in Circuits > Arduino

18668 Views, 155 Favorites, 0 Comments

Internet Valentine

iot-valentine-39.gif
Internet Valentine // Becky Stern
iot-valentine-37.jpg

Send your valentine a note through the net! This DIY electronics project uses a small vibrating motor to gently wave a tissue paper heart and flash an LED when it receives instructions over the internet from another device. I built two versions of the ESP8266 wifi circuit, also equipped with two buttons for triggering the two commands. The devices talk over the Adafruit IO cloud data service to communicate with each other from anywhere with wifi, and I'll show you how to activate your valentine with the API gateway service IFTTT as well, in case you only want to build one valentine circuit.

This is a pretty easy Internet of Things project! Before you dive in, you should have a workable knowledge of the Arduino software and electronics soldering. Try my beginner Arduino Class and/or Randy Sarafan's basic Electronics Class to get up to speed!

To keep up with what I'm working on, follow me on YouTube, Instagram, Twitter, Pinterest, and subscribe to my newsletter.

What You'll Need

iot-valentine-00.jpg
iot-valentine-08.jpg

For this project I created two devices that communicate with one another, but this project works fine with just one device, triggered over the internet with your phone or computer (we'll cover that later). Regardless of the number of transceivers you're making, I highly recommend creating one solderless breadboard prototype and duplicating it with a new set of parts in soldered form, rather than disassembling the working prototype. It makes building and troubleshooting the final board much easier.

For each device:

Gather the following tools:

As an Amazon Associate I earn from qualifying purchases you make using my affiliate links.

Create/log in to accounts on the following sites:

I've Got Your Code

Screen Shot 2017-01-31 at 10.22.35 AM.png
Screen-Shot-2017-02-01-at-11.20.00-AM.jpg

The circuit for this project uses an ESP8266 wifi chip, either in a Huzzah wifi breakout board or Adafruit Feather Huzzah board. If using the breakout board, an FTDI cable is also required to program the board, and a lipoly charger to add battery power. Thoroughly read the product documentation with your chosen board to better understand its pinouts and special features. It may be possible to use other ESP9266 boards for this project, but I haven't tried them.

Circuit diagrams for both versions are provided above. Both circuits connect pushbuttons through ground to pins 4 and 14, an LED connected to pin 15, and a transistor circuit driving a small vibrating motor connected to pin 5.

Before you can program ESP8266 boards with Arduino, you'll have to add board support to the software. Use the boards manager to add support for these boards and upload a blink test program before proceeding. Remember that with the Huzzah breakout board, you must use a combination of button presses to put the board into bootloader mode before uploading new code.

Build your circuit on a solderless breadboard according to the diagram.

Create a new feed in your Adafruit IO account called "command." Find your AIO key (on the Settings page).

Download the project code attached to this step and open it with the Arduino IDE, then update the settings in config.h to match your Adafruit IO username and key as well as your wifi network name and password. Be sure you have the Arduino libraries "Adafruit IO Arduino" "ArduinoHttpClient" and "Adafruit MQTT" installed. Then upload the code to your board.

Awl Through the Middle

iot-valentine-01.jpg

Cut out a piece of sturdy art board to match your shadowbox frame (mine is 4x6 inches) using a metal ruler, cutting mat, and utility/craft knife. Be careful not to cut your fingers! Pierce with an awl in the upper middle area, and wiggle awl to open hole to about 3/16" (4-5mm). This will allow the wires for the mini vibrating motor to pass through the board.

Wound Up Like a Spring

iot-valentine-02.jpg
iot-valentine-03.jpg
iot-valentine-04.jpg

The trick to getting the paper heart to wiggle is to mount it on something that can move easily, like a spring. Use some thin wire to create a coil by wrapping around a chopstick or similar small object. Leave tails on both ends of the spring, and thread one through the hole in your board. Tape it at the back to hold the spring in place.

If you don't have a suitable wire, improvise with what you've got. Perhaps a small ziptie, hair clip, or other item could be substituted for the mounting spring.

Paper Heart

iot-valentine-05.jpg
iot-valentine-06.jpg
iot-valentine-07.jpg

To make layered tissue paper hearts, sew a straight stitch through a new, still-folded packet of tissue paper. Fold along the sewn line and sketch out a half-heart shape with a pencil, then cut out the shape and unfold the heart. Clean up any rough edges with your scissors.

Connected Through Wires

iot-valentine-09.jpg
iot-valentine-10.jpg

Extend the reach of your motor's wires by soldering on pieces of stranded wire and insulating the connections with heat-shrink tubing. Do the same with an LED.

Dancing Heart

iot-valentine-11.jpg
iot-valentine-13.jpg

Thread the motor's wires through the spring (collapsing it first can help) and hot glue it to the spring's wire tail and the back of a paper heart, double checking the wire does not bridge the motor's electrical connections. Hook up the motor to your breadboard prototype and activate the motor to test it's springiness. Adjust the length of the spring or type of wire until desired movement is achieved.

Backlit With Love

iot-valentine-14.jpg
iot-valentine-12.jpg

I chose to illuminate the board behind my paper heart by hot gluing a small LED sequin to the back of the motor, but you can put your LED wherever you like, or omit it entirely.

Battery Powered

iot-valentine-15.jpg
iot-valentine-17.jpg

During prototyping, I powered my breadboard circuits through the USB cable I was using to program them. To move to a more final design, I wanted to add lipoly battery power/recharging so that the valentines could be moved about the house and handled without having to be plugged in 100% of the time. On the Feather Huzzah, the power connection must be moved to the BAT pin, if it wasn't there already. On the Huzzah breakout, power connects to the pin labeled VBat, and an additional charging board is required for lipoly batteries (connect BAT to + and GND to -).

This design is not meant to have an on/off switch, but rather to be plugged in most of the time and perched on your desk or wall. If you want to be able to toggle power to the device, add a switched USB cable to your Feather Huzzah board, or add a switch between GND and EN pins to power down the wifi board. If you're using the Huzzah breakout board, you could interrupt one of your power supply leads with a tactile on/off switch.

In Its Final Form

iot-valentine-19.jpg
iot-valentine-18.jpg

Begin soldering your final circuit on a perma-proto board. If using the Huzzah breakout, double check the programming headers don't make contact with the conductive pads on the circuit board.

With Felt Buttons

iot-valentine-20.jpg
iot-valentine-21.jpg
iot-valentine-22.jpg

I've had these felt pushbuttons for several years and never found a good use for them, until now! I had used a felting needle and wool roving to encase momentary pushbuttons in fuzzy needlefelted fiber. Whatever buttons you use, solder them to your circuit board at a comfortable spacing.

Based on Your Own Working Prototype

iot-valentine-23.jpg
iot-valentine-24.jpg

As I mentioned in the Supplies step, I highly recommend duplicating a working solderless breadboard prototype when creating projects like this. You can verify your wire connections against both the circuit diagram and your working breadboard, which will decrease your likely hood of making a mistake. As I soldered up the circuit, I very carefully tucked components close to one another to save space.

To make the valentine easier to assemble, I used screw terminal blocks for power connections, which will come through the back of the shadowbox. If you used a Feather Huzzah board, you'll simply pass the battery wire through and plug it into the board's JST port.

Shaping Up

iot-valentine-25.jpg
iot-valentine-26.jpg
iot-valentine-27.jpg

Do a dry fit to see and mark how your circuit board will fit in the frame. Use a hot glue gun to make standoffs at the corners, to elevate your circuit a bit. This brings the buttons closer to the front of the shadowbox and also provides room for the wires passing to power, motor, and LED.

Use your awl to create another hole, this time behind where your circuit board will go. Pass the power and ground wires, and the wires for the motor and LED.

Into a Shadowbox

iot-valentine-29.jpg
iot-valentine-28.jpg
iot-valentine-30.jpg

I also used terminal blocks to connect the motor and LED, but soldering to the board would have worked fine too. I mounted the lipoly charging board and battery to the backing plate and assembled the shadowbox.

The device both sends and receives commands from the buttons, so you can test it easily by just pressing the buttons-- the heart will buzz and light up when it receives the commands from the internet.

Triggered by IFTTT

Screen Shot 2017-02-01 at 2.54.28 PM.png
Screen Shot 2017-02-01 at 2.49.17 PM.png

To trigger your valentine from your phone, or to automate your valentine based on your social media activity, physical location, and many more actions, set up an account on IFTTT, an API gateway service. You can put together a simple recipe that contributes commands to your Adafruit IO feed that controls the valentine.

Android/iOS button widget: Create a new applet and pick "Button widget" as the trigger. Pick Adafruit as the output, and send the number 1 or 2 to the "command" feed on Adafruit IO. After saving the applet, add a new IFTTT widget to your mobile device's home screen. I made two widgets, one for each button on the valentine.

Or Another Remote

iot-valentine-38.gif
iot-valentine-34.jpg
iot-valentine-31.jpg
iot-valentine-32.jpg
iot-valentine-33.jpg

I built two electrically-identical circuits to act as two-way valentine communicators. The second device I built has a more compact, remote-like design. I harvested an old RadioShack project box and installed an illuminated pushbutton, whose LED serves as sequin does in the shadowbox version. The paper heart stands at the end of a single piece of solid core wire, and I cut a hole in the side of the enclosure for the USB cable to plug in.

For My Valentine

iot-valentine-35.jpg
iot-valentine-36.jpg

I'd like to dedicate this project to my partner Smokey, for whom the step titles form an attempt at a poem.

I hope you glean something for your own IoT projects and I look forward to your feedback in the comments (about anything but the poem)!

If you like this project, you may be interested in the other IoT projects in the series: