Stay connected with people you care about, whether they are downstairs or across the world!
Llumin features a light system that communicates with WiFi through the touch of a button. It utilizes the MSP432 and CC3100 to monitor light control and talk to the cloud.
This is a project you can build and easily adapt yourself to connect people by connecting devices.
Llumin was inspired by a family I know. They are a household with three young kids, two of which are going through the painful period of growth spurts and leg cramps. To get to their parents' room when they wake up in the middle of the night, they have to go downstairs, through the living room (and possibly trip over a pile of Legos in the dark), and then jump into mom and dad's bed. This can be a pretty undesirable journey especially when you are uncomfortably woken up by your body trying to extend itself. Sometimes so much so, that they will sit on top of the stairs and make noises or cry until they are fetched by their drowsy, just woken up parent.
What if there was a simple notifying system to help them stay connected?
With Llumin, the people you care about are only a touch away. Llumin comes in two modes: Peer-to-Peer and Child-to-Parent.
Peer-to-Peer
Turning one lamp on will turn on its companion lamp from the Internet. A phone notification is sent also in case the owner is away from their lamp. This system works bidirectionally: turning Peer 1 on/off turns on/off Peer 2, turning Peer 2 on/off turns on/off Peer 1.
Use cases are only limited by your imagination.
- Use Llumin to communicate throughout your house to different members of your family.
- Llumin can be easily adapted to work with a variety of lamps which could be more appropriate in a business environment. For example, remote project teams could use lamps as an easy visual cue that the other team was ready to start a teleconference.
- As a WiFi connected device, keep in touch with friends from across the world. Simply press your light to let your loved ones that you're thinking of them. They can do the same!
Child-to-Parent
Rude awakenings in the middle of night by your precious little one a common problem for you? For you parents out there, Llumin can peacefully alert you through a phone notification that your child needs you. This also can calm him/her down because they know that you're a push of a button away. If they've settled down by themselves, they can also notify you that they don't need you to come anymore by turning the light off. This allows parents the option of waiting a bit before they have to leave their cozy bed to tend to their child.
This system works well for multiple users/children. When a child lamp is activated, a notification is sent to the parent's phone identifying which lamp sent the alert.
Llumin is the perfect bedroom accessory for any kiddos with infrequent nightmares, leg cramps, monster scares, thirsty throats, etc.
Again, the possibilities are endless.
- Perhaps you have an elderly relative. Modify this system for a brighter light that they could use daily. See when they wake up and go to sleep; any abnormal behaviors could signal that something might be wrong. Or a phone call the next day, "Hey Mom, I saw you were up late last night, is everything ok?" would be greatly appreciated.
- Even very young kids can stay connected with a traveling parent through Llumin. Because only an internet connection is needed, a parent away from home can still feel like they are connected to their child.
HARDWARE
For this project I used two of these lights from IKEA, which from henceforth will be referred to as hamsters. They are battery-powered; the little cord you see in the back is a charger for the battery (stick it up its butt to charge the light).
You can use any light, but it may be easier to use a battery-powered one. If you use one that is AC-powered, you'll have to use a relay to switch power and that's a whole different tutorial (but it's not too hard, promise).
Llumin intercepts the the button signal from the light and controls it through the microcontroller (MCU). Then we connect it to WiFi but that's later. Keep reading!
After you've bought your lights, take off the silicon skin from the hamster. You'll get a plastic shell that holds the switch, battery, and LEDs inside. Gently open the plastic shell and remove the circuitry.
The white wires connect the button to the LEDs. Cut both of them and gently strip away the plastic to get to the wire. These lines tell the board to switch state. We're going to put the microcontroller in this pathway so we can control when the light turns on and off.
Below shows what our breadboard is going to look like. Wire it up like the picture. I chose pin 40 for the button to MCU connection and pin 6 for the LED to MCU connection. I used the 3.3V source from the MCU.
Using the DigitalInputPullup (File > Examples > Digital > DigitalInputPullup) code on Energia, you can modify it slightly so that you can turn on/off your LED from your button switch. This is just to make sure that your circuitry is correct so that in the end, you know that your hamster can light up in response to the button.
Good? Good. The wires on the lamp ended up fraying/ breaking on me, so I replaced the white wires with stronger connections (red wires) with soldering help from a friend at the lab.
Place your circuitry back into the hamster shell and have the wires run from the bottom. Label the wires (I used the blue tape you see below) to make sure you know which wires are which -- switch or LED -- then pop on the hamster skin back onto the plastic shell.
Connect your breadboard back up with the hamstersv2.0. I found a couple of paper box cupcake holders at Michaels to house the electronics and had my wired hamsters perch on top so it'd look nicer.
SOFTWARE
The code you just used to turn on your button? Yeah that's just half of the project (we're almost done)! The next step is to connect the hamsters to WiFi. That part is conveniently supplied by Energia's MQTTBasicWifi code (Files > Examples > PubSubClient > MQTTBasicWifi).
First things first, refer to these bomb-diggity tutorials to get an overview of how MQTT works. Don't get bogged down in the details. Just understand the relationship and importance of the broker, publisher, subscriber, and topics.
To modify MQTTBasicWifi for this project, I changed what would control when the system would publish to the broker, as explained in the comments. I only wanted to publish when the hamster was turned on in both Peer-to-Peer and Child-to-Parent situations. For Peer-to-Peer, I had to adjust when the hamster would turn on in response to a message received through its subscription.
For your adoption of the project, there are a few things you may want to edit from my code:
- char ssid[] = "YOUR NETWORK NAME HERE";
- char password[] = "YOUR PASSWORD HERE";
The Node-Red from IBM Bluemix makes it easy to connect lamps to a MQTT broker and to each other. You can find my flows here. Please do not edit the boxes! Create your own account and copy and past my flows onto your flow. Edit the messages you want to send and rename the blocks as you would like. To get notifications, download the Boxcar app and get the API key that comes from your app. Copy and paste this into the first orange function box that will open up to ask for your "API-KEY".
Node-Red creates a space for these devices to talk to each other through our broker, MQTT. This way our hamster, publisher or subscriber, can talk to each other or to the phone.
All the code is provided at the bottom of this project page. Download the code for the situation you want to use Llumin for (Peer-to-Peer or Child-to-Parent), change your network WiFi settings, upload the code onto the MCU. Then unplug your MCU from your computer and connect it to the USB adapter so that now you can power the MCU through the wall. Because this is a battery-powered system, the LEDs are powered by the battery; the MCU is powered through the wall.
WOOHOO!By golly, I think we're done! Now it's your turn to use them and connect with your friends. Happy hacking!
NEXT STEPSHere are some enhancements for future iterations of Llumin:
Easy WiFi Configuration
There is a process called SmartConfig which allows you to replace your WiFi SSID and password code with a "smartConfig" function in Energia so that every time you go to a new location with a different SSID and password, you don't have to load on new code to the MCU (no more hard-coding your WiFi credentials). Download the app from the app store (search for SmartConfig) and when your code gets to the "smartConfig" function in Energia, it will wait for WiFi credentials which you can send from the phone app. The phone and MCU must be connected on the same network. Additionally, there is an example on Energia (File > Examples > WiFi > SmartConfig) so this functionality should be easy to implement.
Power Management
Currently, the MCU and LED lamp lights are powered separately. The LED lamp is powered by its own batteries which are recharged by DC input to the lamp. The MCU is powered via a USB power adapter. The design could be improved and made portable by powering both the MCU and lamp circuit board by the same rechargeable batteries. This would also give the MCU the ability to control power to the lamp's circuit board.
3D Printed Box
I'd like to 3D print a box for the hamster to rest on where the electronics can be housed so the design looks better (as opposed to a paper box) and prevents curious little hands from disturbing anything that shouldn't be touched. Even better would be to find or design a light so that the MCU and LED system could be housed together within the light!
Mode Switching
The code for Peer-to-Peer and Child-to-Parent are pretty similar, it's just a matter of tweaking the topics that each unit publishes/subscribes to and the messages that are sent to the phone from these actions. I would like to integrate the code together to make it easier for users to connect with each other, out of the box. Perhaps this would look like implementing Bluetooth so that a phone can connect to the children lamps or its own peer lamp and configure, through an app to be made, the messages to be sent/received and the topics published/ subscribed to. That way if we were to make this a viable product, the code would be flashed onto the MCU ready to go, waiting for more information to be entered in by the user through a phone app.
PSA: do not treat real-life hamsters like this. It's not the same.
Comments