Imagine sending your heart beat to a (remote) flashing display. This is both a tool that can be used to monitor someone's HR (heart rate) with a visual feedback, even remotely, but also a nice Valentine's surprise: honey, I give you my heart! :)
The lamp flashes with a frequency equal to the heart rate sensed by the HR monitor.
The round glass body of the lamp I'm using as enclosure serves the purpose of making it nice, shiny, and so that light is uniformly diffused for a closer product-like result.
The HR is taken from any Bluetooth Low-Energy (BLE) sensor: I used a RF(radiofrequency)/BLE combo chest band that can connect to my phone, but modern bluetooth wrist bands or smartwatches with an optic HR monitor should work as well, as long as they can be paired with non-proprietary applications (i.e. Runtastic, Strava, Google Fit, Apple's Health, etc).
I used the following components, scroll down for the building steps:
1) 1m ws2813 rgb LED strip:
get the non waterproof version, with 60 leds/m. Note you can do this with ws2812 and ws2812b LEDs as well, the light will be exactly the same and these are cheaper. The ws2813 are just more reliable, as they have a redundant data connection, so if you break one LED, the rest of the strip will keep working.
2) an Ikea Fado lamp:
This was 15€, roughly 18$.
4$, or roughly 3.5€
4) one 5v, 2a power supply, soon to be replaced with a 3a one
This was 3.5$. Note that you'll have to reduce the maximum brightness unless you use a power supply with at least 4A
5) some spare dupont cables:
6) a spare DC barrel jack adapter:
7) any BLE enabled HR monitor. I have used a Medisana Bluetooth chest band, found in Lidl for 15€. It looks like this is similar, though more expensive:
If you have a smartwatch with a HR monitor, chances are that will work already!
Step 1: Bring 5v Current Inside the Lamp
Remove the plug at the end of the electric cable from the Fado lamp. This will expose the two cables that you can plug in a barrel adaptor that you'll attach to the power supply. Inside the lamp, place (read: solder) two dupont cables to the positive and negative of the lightbulb holder. Put the other ends of the dupont cable inside the positive and negative of a barrel jack where you'll insert the other cables as in the next step.
Step 2: Wire the Microcontroller and the LED Strip
Take the Wemos D1 mini. It comes with no soldered headers. You can go ahead and solder them, or you can do like me: place the headers from the bottom, and insert the dupont cables from the top. There is enough friction to keep everything in place. With dupont cables, connect the 5v pin of the Wemos to the positive of the barrel jack, and the GND pin of the Wemos to the negative of the barrel jack. Do the same for the LED strip. Then connect the green data cable from the LED strip to pin D2 of the Wemos. Place a capacitor (mine is 1000uf) in the barrel jack, baring in mind the positive and negative pins.
Step 3: Fit the LEDs Into the Lamp
This step requires some manual skills. After securing the Wemos to the side of the lightbulb holder, you need to roll the LED strip in a way that it will stay together, and that it distributes the light. You can use the bi-adhesive behind the strip to do this. I made the first lap by sticking the adhesive to the base of the Fado. Then I started going up. On the top, I inserted a spare long screw I had into the lightbulb holder, so it can hold the top of the LED strip. Insert everything into the glass top and double check that it held all the connections.
Step 4: Program the Microcontroller
In this step, I'm going to assume that you have already the Arduino IDE installed and that you are able to upload a sketch with it. If this isn't your case, this class may help you get started:
Upload the attached file to your Wemos via the Arduino IDE.
Replace these two lines with your appropriate credentials:
const char* ssid = "YOUR_WIFI_HERE"; const char* password = "YOUR_PASS_HERE";
The attached sketch provides two "modes" to the lamp: OFF, and HEART. This sketch can be expanded to do more things.
Step 5: Program the Mobile App
There are tons of ways to implement this step. I chose a rather simple, and portable, approach: a Ionic (Cordova-based) mobile app that can be compiled and installed on either Android or iOS. I have tested it with Android only so far.
In this step, I'm going to assume you have the Ionic framework installed, as well as the latest Android SDK. If this isn't the case for you, you can use this Instructable to help you get started:
After you're up and running with the framework, create a blank Ionic project (step 1 of the Instructable above), then you need to install the BLE plugin:
cordova plugin add cordova-plugin-ble-central
Then you'll need the attached js and html, replacing app.js in www/js and index.html in www folder of your project.
Because of limitations of the uploader, I had to rename index.html into index.html.TXT before uploading. Once you have downloaded it, remove the .TXT at the end first.
In app.js, replace the string:
with the IP address of your lamp (get it from your router, this is router-dependent so I'm going to skip the how-to here).
If you want, you can use this icon in the www/resources folder and tell ionic to build the icons with that file :)
Compile the project and run it on your Android/iOS device. I'm attaching a screenshot of the result on my OnePlus 3.
Step 6: Try It!
Wear your BLE HR monitor. Open your newly installed mobile app.
Click on "scan". For simplicity, the mobile app assumes that the first BLE HR monitor found is the one to connect to. You can change this in the code if you want.
An alert will confirm that you're connected (you can remove the alert from the code if you want), click ok, and enjoy!
At this point the app will start sending data to the lamp when it's available. Keep in mind that the app is not sending the moments in which your heart beats (i.e., it's not synced to your heart). It will only send its rate, but this should be enough for most use cases.
Also, no cheap HR monitor / band / wearable can replace the accuracy of a professional medical device. Though this project is effective, please don't consider it as your only solution if you need to monitor the heart rate in case of a medical condition.
Step 7: Making It a REMOTE HR Display :)
Ok so everything works, you see your heart rate on your glass lamp.
What if you wanted to see your dad's (who lives 2000 km away) heart rate, or you want your girlfriend or boyfriend who lives in a different country to see how your heart beats for her/him? :)
It's actually super simple. You need to adjust two things:
1) the lamp needs to be reachable from the Internet
2) the app needs to connect to an Internet (not local) address.
This is one way to do it. You may find other, more reliable / more secure / more ... , solutions.
For step 1, you need to forward the http incoming traffic from your router to your lamp. This how-to explains it for one particular model of modem, you need to adjust this guide to your own modem:
In particular, you need steps 6 and 7.
For step 2, you need your lamp (or, the public, external, IP address of the modem) known to your app. One way to do it is to setup a dynamic DNS account and create a host for it.
Two popular solutions are:
both offer a free host. If you don't know how to use them, and how to keep them updated from within the microcontroller, this Instructables may help you get started:
Once you have your host set up, let's say: myheart.isdreaming.org, change the line
in app.js above to work with it.