Enter Your Holiday Project to win a 3D Printer Prize + a STEAM Kit to Give or a $100 Shopping Cart + a Shopping Cart to Give! | Project14 Home | |
Monthly Themes | ||
Monthly Theme Poll |
A demo video for the IoT Ornament Texter. It worked out pretty well. I think this would make a cool gift for some family members.
Background:
Holiday time!
Heartwarming is central to the season. I made a surprise message receiving system that will definitely bring a smile to your face.
I’ve been thinking about this idea for years and years. I never got around to it. But this year, the spirit was in the air… I absolutely had to make it real.
The concept:
I like the idea of sending a message to a friend/loved one’s “holiday tree.” I have noticed that almost every holiday comes will a barrage of texts to my phone. Happy this, merry that, so old-school. Send a text to a tree… now you got something.
The concept is simple. You setup your Raspberry Pi somewhere special to you. I put it by a little Xmas tree in my example. The Pi checks for messages every so often. When a new on comes in, it displays it on the screen and starts “twinkling” LED lights you place around it. The lights are to let you know a new message has come in. Read it, and press a button to clear the screen. The LEDs turn off… and it waits for the next message.
The project by sections:
The hardest part is if you plan to make a harness out of the LED grid like I did. It’s more tedious than anything. A perfect activity to do while watching holiday movies. My system only has 16 LEDs, so consider that while making the harness. How far apart do you want them?
- Test that harness, if you build one. I made the mistake of wrapping it on the tree before testing. I built this all on a breadboard first, and that one had an issue. I assumed my harness would also have issues. But… I didn’t have any errors, luckily.
Every SMALL Raspberry Pi screen really limits the ability to use the Pi. So, you might want to do all the Raspberry Pi’s setup using a standard screen and switch to the mini-screen at the end. There are a few command-lines you have to do first.
- Test the system on the regular screen first too. It will still work properly. You may even prefer the look, depending on how you want to set up the holiday messenger. If it works without issue, then setup the mini-screen. Then test again!
When you do wrap a tree or setup the LEDs however, consider this: most LEDs have a narrow beam angle. You may want to point the LEDs’ beams toward where an observer may be. Alternatively, find some LEDs with wide-angle. Search for “wide angle polka dot LEDs,” those would be great.
BOM:
1x Small screen
1x button
16x LEDs (Red or any color of your choice)
Schematic and design:
A note about the four 330 ohm resistors on the rows – if you use a lower resistance, the LEDs will be much brighter, but you run the risk of damaging the Pi. Any higher resistance and the LEDs dim significantly.
Code:
I decided to go with Gmail as the Tree’s account. So, I used Gmail's IMAP SSL server to collect messages in the program. In the code, change the account info to match the account you make.
Be sure to enable Gmail's IMAP control for that account. And, allow 3rd party programs in the account too. Typically, these are already active in a new account but do check it out to be sure.
Write in the Pi’s command line or via SSH. This will allow the leds.c program to run:
chmod 755 leds
Want to know more about this, go read a bit about chmod after this link.
- treetexter.py is the main program. I had a lot of plans for this program, but time was limited. So, you’ll notice a lot of commented out lines. I will revisit this project sometime soon and pick it up from there.
- leds.c is what controls the LEDs, ultimately. Feel free to edit this to change the LEDs’ behavior.
Finally, the background.png file is what the test will display on, and what you see on the Pi’s screen. In retrospect, I didn’t make it look very festive. So, feel free to change it.
How to add autostart to this program so it load immediately after the Pi boots:
Edit the file /home/pi/.config/lxsession/LXDE-pi/autostart
sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
remove line @xscreensaver -no-splash
Add these lines to bottom:
cd /home/pi
@python treetexter.py
Save the file. The next time you boot it up, it will start immediately.
Other uses of the system:
- An email messenger alert system. Perhaps you have a special account that doesn’t get many messages.
- Secret alert system.
Oddities and observations:
- Using the small screen was tough.
- Loading the queue with messages was an issue. I found that if I turned off the Pi and back on, I would have to cycle through the messages again. Not that big of a deal.
- I had to bend the GPIO pins to the side to use them along with the mini-screen. Plus I had to cut part of the case away because of it. I wasn't too happy about this.
If I had more money/time:
- E-INK screen for the Raspberry Pi is a must! I wanted to use that, but I ran out of time.
- Alternatively, turn the screen off until a new message comes in. I tried that a few times in the code with no success.
- Process and display pictures and video messages as well.
- Increasing the number of lights, and put it all on a separate power circuit instead of driving directly from the Pi itself. Imagine 300 lights on this. Or every light on your tree is controlled by the Pi. Now I’m talking!!! (NEXT YEAR, for sure!)
Cabe