By Dr Lucy Rogers | 8 minute read | March 14, 2017
Have you got an object that reminds you of someone when you look at it? Wouldn’t it be nice if they knew you were thinking of them, just with the push of a button? For Easter, I have made an Easter Bunny with a heart that lights up when it receives an “I am thinking of you” message. To return the message, just push its tail.
You can link these to as many bunnies as you like. They use mobile phone SIM cards – so no WiFi set-up is required. Just plug in the bunny and it will work.
The message can be sent as a text from a phone as well as from the bunny itself, but you don’t have to use a phone if you don’t want to. This means it’s great for children, who can send a message to grandparents (for example) without asking an adult for help. It’s also a great alternative to chocolate Easter gifts!
Inside is a Raspberry Pi Zero (the £4 one without WiFi and Bluetooth), a SIM800L module and some electronics to control the voltage input. There’s also a button and a neopixel. I 3D-printed the rabbits.
The total cost of the parts for one bunny was about £25 plus a SIM card. I added £10 of credit onto each SIM.
Each bunny requires:
I discovered the SIM800L is very fussy about the supply voltage – a little bit too high or too low and it powers off. If I were starting again from scratch, I would investigate using a breakout board that had a power regulator already in it – something like the Adafruit Fona or one of the Arduino SIM800L developer modules.
The SIM800L has an onboard LED. If it flashes 7 or 8 times then stops, then repeats, it means there is probably either under-voltage or over voltage. If continually flashes it is looking for a carrier. If it flashes once every three seconds it is connected to a carrier. This is what we are trying to achieve!
Put the SIM card in a phone and make sure it is working and can send and receive texts without requiring a pin number. I used giffgaff sims; you don’t need a data package – you just pay-as-you-go and use SMS texts. Make sure you know the phone number. Next:
With a Pi powered down, and as per the diagram:
The SIM800L onboard LED will flash once every three seconds when it is connected to the carrier. If it flashes continuously, try moving the antenna as far as possible away from any other electronics.
The Node-RED flow for the bunnies is at https://github.com/DrLucyRogers/SMS-Bunny. Insert it as you did for the Neopixel and switch. Remember to change the “Number” change node to the Sim phone number of the bunny you want to send the message to.
The serial UART on the Pi (the GPIO physical pins 8 and 10) are used to send and receive data in the form of AT commands between the Pi and the SIM800L. The baud rate is 115200.
Serial input and output nodes provide the Node-RED links between the Pi and the SIM800L.
The AT commands required to send a text are:
#Check the Pi and SIM800L are at the same baud rate etc. (Where <CR> is carriage return)
AT <CR>
#Set the format to plain text
AT+CMGF=1 <CR>
#Enter the receiving mobile phone / Sim card number
AT+CMGS=”+xxxxxxxxx” <CR>
#Then enter the text, followed by Ctrl+Z
Some text in here
<Ctrl+z>
Ctrl+z can’t be done in a Node-RED change node, so I used a function node.
The SIM800L sends various bits of data to the Pi. This is filtered and when the SIM800L receives a text it triggers the Neopixel (Red).
The button sends a text and triggers the Neopixel (Blue).
A “clear all texts” message is sent to the SIM800L to prevent memory shortage problems.
If the SIM800L does not flash red once every three seconds it is not connected to the carrier. Click the bottom inject node, which sends the DTR pin low on the SIM800L. This should wake up the SIM800L if it was in sleep mode. Caution – clicking it again will probably send the SIM800L to sleep again.
A terminal emulation program such as picocom can be used to debug the SIM800L and the AT commands.
The bunny has a hole in the tail for a button switch, and an exit hole for the 5V supply to the Pi. The STL file for the bunny and button is available at https://github.com/DrLucyRogers/SMS-Bunny. They took about 4 hours to print on an Ultimaker using white PLA. It is probably worth making the bunnies a little larger, as I found it fiddly to insert the Pi and the power supply.
The bunny I used was adapted from Henning S’s Thingiverse model.
Note – take care where you insert the Neopixel – you could turn your cute Easter Bunny into something a bit more sinister.
This project could be adapted for other uses – Valentine’s hearts to let your loved one know you are thinking of them, visual alerts for where phones are not allowed, or a button in your car to let people know you are on your way. I’ll be interested to see your creations …
With thanks to:
Dave Conway-Jones, IBM, for help with various Node-RED issues.
James Macfarlane, Airborne Engineering Limited for help with the voltage regulator.
Andrew Armstrong for help with the SIM800L and its idiosyncrasies.