Robotics

Hack a bunny for Easter: A Dr Lucy Rogers maker project

Share this post:

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:

Instructions to get started

  1. Set up the Pi with the preliminary software
  2. Connect the Neopixel and switch to the Pi and test using Node-RED
  3. Set up the voltage regulator electronics and the SIM800L module
  4. Connect the Pi to the SIM800L and voltage regulator
  5. Program the Pi using Node-RED
  6. 3D Print the bunny and button

Step 1: Set up the Pi with the preliminary software

  1. Use the newest Jessie image from https://www.raspberrypi.org/downloads.
  2. Connect Pi to WiFi.
  3. 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.
  4. Update and upgrade the software at https://www.raspberrypi.org/documentation/raspbian/updating.md
  5. 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.)
  6. Install the software for a Pimoroni Unicorn HAT.
  7. Run Node-RED to get a Node-RED directory (on command line type: node-red.)
  8. Open the Node-RED user directory – this is typically ~/.node-red
  9. Install the neopixel node by typing: npm install node-red-node-pi-neopixel
  10. Auto start node-red every time the Pi boots by typing: sudo systemctl enable nodered.service
  11. Edit the file /boot/config.txt and , if required, change the line from enable_uart=0 to enable_uart=1
  12. Reboot the Pi.

Step 2: Connect the Neopixel and switch to the Pi, and test using Node-RED

  1. With the Pi disconnected from a power supply, connect 5V, Ground and Physical Pin 12 to a Neopixel 5V in, Ground and Data in.
  2. From the Pi, connect Ground and Physical Pin 22 to the switch.
  3. 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”]]}]
  4. Click the inject nodes in the flow and make sure your neopixel responds with the correct colour.
  5. 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:

Voltage regulator diagram

Step 4: Connect the Pi to the SIM800L and voltage regulator

With a Pi powered down, and as per the diagram:

Raspberry Pi Zero

  • 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.

3D-printed bunny

Bunny 5

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

Bunny with light-up heart

Note – take care where you insert the Neopixel – you could turn your cute Easter Bunny into something a bit more sinister.

Red head bunny

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.

More Robotics stories
By Matthew Mikell on June 12, 2018

S.A.V.E. from IoT: Trust and tracking from a new IoT Blockchain Service

Today’s the day you can make IoT do the work for you, rather than the other way around. You’ve been demanding more value from thousands of devices and the sea of sensor data. You asked, we delivered. Today, IBM is announcing the IBM IoT Blockchain Service; the add-on to IBM IoT Connection Services. But it’s […]

Continue reading

By John McDonald on June 4, 2018

Back to the Future, Part 2: The data-driven economy

In part 1 of my article, I shared with you a vision of our world from the vantage point of systems and automation. In part 2 of the series, I will explore how we as individuals and organizations can really take advantage of the new data-driven economy. Don’t get left behind: ensure your organization has […]

Continue reading

By John McDonald on May 31, 2018

Back to the Future, Part 1: Autonomous Vehicles

What does a future of autonomous vehicles look like? In Part 1, Back to the Future: Autonomous Vehicles, John McDonald, CEO at ClearObject, shares a vision of a world where intelligent systems and automation are the norm. Are you ready for the biggest one-time leap in human productivity – ever? First, some facts. The average […]

Continue reading