
Hack a bunny for Easter: A Dr Lucy Rogers maker project
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.
No supervision required
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.
Ingredients
Each bunny requires:
- Pi Zero, £4
- 5V 2.5 Amp power supply, £8
- Sim800L module, about £4 on eBay
- Single Neopixel, about £1 each in a pack of 5
- 3A low dropout voltage regulator, £2
- 2 off 100μF electrolytic capacitor, £1 (these have to be low ESR capacitors – see the data sheet for the low dropout voltage regulator for details)
- 3D-printed bunny and button
- Other electronics: £5 including, veroboard, button switch, resistor (2K7 ohm), resistor (1k2 ohm)
- SIM card – from GiffGaff with £10 credit
Instructions to get started
- Set up the Pi with the preliminary software
- Connect the Neopixel and switch to the Pi and test using Node-RED
- Set up the voltage regulator electronics and the SIM800L module
- Connect the Pi to the SIM800L and voltage regulator
- Program the Pi using Node-RED
- 3D Print the bunny and button
Step 1: Set up the Pi with the preliminary software
- Use the newest Jessie image from https://www.raspberrypi.org/downloads.
- Connect Pi to WiFi.
- In the raspi-config, disable the serial interface. If you wish to log on from a different computer on the network, enable the ssh interface.
- Update and upgrade the software at https://www.raspberrypi.org/documentation/raspbian/updating.md
- Upgrade nodejs and nodered by running the bash command given on: http://nodered.org/docs/hardware/raspberrypi. (This can take about 40 mins on a Pi Zero.)
- Install the software for a Pimoroni Unicorn HAT.
- Run Node-RED to get a Node-RED directory (on command line type: node-red.)
- Open the Node-RED user directory – this is typically ~/.node-red
- Install the neopixel node by typing: npm install node-red-node-pi-neopixel
- Auto start node-red every time the Pi boots by typing: sudo systemctl enable nodered.service
- Edit the file /boot/config.txt and , if required, change the line from enable_uart=0 to enable_uart=1
- Reboot the Pi.
Step 2: Connect the Neopixel and switch to the Pi, and test using Node-RED
- With the Pi disconnected from a power supply, connect 5V, Ground and Physical Pin 12 to a Neopixel 5V in, Ground and Data in.
- From the Pi, connect Ground and Physical Pin 22 to the switch.
- Power up the Pi, open Node-RED and copy and insert this flow: (Click on the NodeRED menu (the hamburger icon), then Import, Clipboard, paste the flow, and click OK.) [{“id”:”a28c6b31.f542″,”type”:”inject”,”z”:”b8782fdb.51836″,”name”:””,”topic”:””,”payload”:”red”,”payloadType”:”str”,”repeat”:””,”crontab”:””,”once”:false,”x”:130,”y”:160,”wires”:[[“5ce76db7.85832c”]]},{“id”:”5c000f1b.59b36″,”type”:”inject”,”z”:”b8782fdb.51836″,”name”:””,”topic”:””,”payload”:”blue”,”payloadType”:”str”,”repeat”:””,”crontab”:””,”once”:false,”x”:130,”y”:120,”wires”:[[“5ce76db7.85832c”]]},{“id”:”e835983f.f4b17″,”type”:”inject”,”z”:”b8782fdb.51836″,”name”:””,”topic”:””,”payload”:”green”,”payloadType”:”str”,”repeat”:””,”crontab”:””,”once”:false,”x”:130,”y”:80,”wires”:[[“5ce76db7.85832c”]]},{“id”:”ce63ad55.d83c6″,”type”:”inject”,”z”:”b8782fdb.51836″,”name”:””,”topic”:””,”payload”:”black”,”payloadType”:”str”,”repeat”:””,”crontab”:””,”once”:false,”x”:126.35714721679688,”y”:201,”wires”:[[“5ce76db7.85832c”]]},{“id”:”71d3acce.cb302c”,”type”:”debug”,”z”:”b8782fdb.51836″,”name”:””,”active”:true,”console”:”false”,”complete”:”false”,”x”:490,”y”:260,”wires”:[]},{“id”:”bb3fd04d.232a9″,”type”:”rpi-gpio in”,”z”:”b8782fdb.51836″,”name”:”Push Button Switch”,”pin”:”22″,”intype”:”up”,”debounce”:”50″,”read”:false,”x”:130,”y”:260,”wires”:[[“2aa0c210.c1f4d6”]]},{“id”:”5ce76db7.85832c”,”type”:”rpi-neopixels”,”z”:”b8782fdb.51836″,”name”:””,”pixels”:”1″,”bgnd”:””,”fgnd”:””,”wipe”:”40″,”mode”:”pcent”,”rgb”:”rgb”,”x”:350,”y”:140,”wires”:[]},{“id”:”2aa0c210.c1f4d6″,”type”:”rbe”,”z”:”b8782fdb.51836″,”name”:””,”func”:”rbe”,”gap”:””,”start”:””,”inout”:”out”,”x”:310,”y”:260,”wires”:[[“71d3acce.cb302c”]]}]
- Click the inject nodes in the flow and make sure your neopixel responds with the correct colour.
- Click the physical switch and make sure the debug node shows the changes from “1” to “0” etc.
Step 3: Set up the voltage regulator electronics and the SIM800L module
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:
- Insert SIM into SIM800L
- Solder the antenna onto the NET pin of the SIM800L (Sim800Antenna.jpg)
- Connect VCC and RST together
- Solder approx. 20cm long wires to the SIM800L pins DTR, VCC, RXD, TXD and GND and leave the other ends loose
- Using veroboard or similar, wire this voltage regulator circuit:
Step 4: Connect the Pi to the SIM800L and voltage regulator
With a Pi powered down, and as per the diagram:
- Connect the GND and 5V of the Pi to the voltage regulator circuit
- Connect the voltage regulator circuit output and GND to the SIM800L
- Connect the remaining SIM800L wires to the Pi (RXD, TXD and DTR)
- Power up the Pi
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.
Step 5: Program the Pi using Node-RED
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.
Additional items in the flow
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.
Troubleshooting
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.
Step 6: 3D print the bunny and button
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.
Step 7: Assembly
- Push the antenna up the bunny’s neck, and use Velcro to secure the SIM800L to the top of the bunny’s back
- Use hot melt glue to stick the neopixel to the “heart” of the bunny
- Use hot melt glue to attach the switch to the bunny tail
- Use hot melt glue to attach the voltage regulator to the back of the Pi
- The Pi then just about fits inside the bunny
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 …
Acknowledgements
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.