Category Archives: hellocomputer

How we got BG to tweet!

System Overview

Hi All, as promised we prepared a new post with all the juicy details of what was used to have BG send tweets all over the world. Originally when HelloComputer came to us for help, we had grand plans of creating new designs and circuit boards. Unfortunately the timelines would not allow for such a system (at least not for the original pilot). We then decided to use as much off the shelf components as possible. Great products such as the Arduino and the variety of shields available makes prototyping systems like this a lot easier. This system has some much more potential to be developed and expanded and it’s definitely something we are planning to continuously work on.


The concept behind BG the tweeting badger is basically that we added infra red motion sensors to BG’s enclosure at various places. As the sensors detect his movement it sends the data through to a base station which in turn sends it through to a server. The server handles the conversion from sensor triggers to tweets being sent. While we could tweet directly from the base station we wanted a system that could be managed easily in terms of keeping the tweet database up to date and making sure that BG doesn’t become a twitter spammer.

Wireless Sensors

We tried to keep the wireless sensors as simple as possible. The main concern was that power usage since BG doesn’t have any electrical sockets in his enclosure (He is more of a reader, so he doesn’t watch TV).


Because you are planning on using electronics combined with little bits and bobs, you need to make sure that BG can’t get to it. Worst case scenario if he did manage to get his hands on it, it should be rugged enough that he can’t get inside the enclosure of the sensor and chew on any of the internal bits. The safety of BG always needed to come first.

We ended up going with a ABS molded enclosure with a clear lid. The enclosure is IP65 rated (We don’t want any rain to spoil the fun).

ENCL-11-3T (1)

The wireless sensors were attached to various places in his enclosure. One of the challenges was that since BG is a pretty good climber, so we couldn’t just attached the enclosure to the side. The solution was to attach it to the poles with an aluminium arm that kept the sensor out of reach from BG. In other places, for example his bedroom, we could mount the sensors directly against the wall as long as it wasn’t within close range of any of his play shelves.



The hardware used in the sensors consist of three parts, mainly the infrared sensor, a wireless radio and a battery pack. The wireless radio is by default in sleep mode (to keep power usage low). When the infrared motion sensor detects movement it triggers a digital input on the wireless radio, which in turns wakes up and sends the signal to the base station.

For the wireless radio we used a XBee radio. These are nifty little radios which can be setup very easily, but they are slightly expensive.


The following was set up on the XBee radio’s:

– Change the communication to API mode
– Configure the DI (digital input)
– Configure the sleep mode

Base Station

The base station is a big part of the project, since without it, the sensors would be useless. We also needed something smarter so we decided to go with an Arduino, easy enough to program and with the shields available it would be minimal hardware development. The base station has three main functions. It receives the trigger information from the sensors and handles the connection to the server. Again there was no power or IT infrastructure within close range of his enclosure, so we had to make it a solar powered solution.

BG Tech

Since we were using wireless sensors we could place the base station outside of the enclosure but still very close to maintain connectivity. We used a similar enclosure with the clear lid, but slightly bigger to keep all the bits together. Originally the base station was mounted on top of BG’s enclosure, but 5 minutes after it was mounted he managed to climb all the way to top and loosen the nuts and bolts that kept it attached. We promptly moved it to the top of the porcupine enclosure next door (they don’t climb that well).


The hardware used for the base station consist of an Arduino, a GSM shield and a XBee shield. Other bits include the solar panel, a battery pack and the solar battery charger (The lipo rider pro is awesome and so easy to use!).


The software for the base station was designed as a basic state machine. Depending on the current state it will either listen to the sensors, check the GSM connection or send through data to the server.

The GSM shield makes it very easy to send through data to a server. Once the initial connection is created, you can access perform simple HTTP POST and GET actions with the built in AT commands. Just remember to keep on the lookout for connection state changes so that you can reconnect the GPRS data connection if it’s not running.


The XBee side of things are simplified by using this XBee library. The main reason for using the XBee shield is that the wireless radio’s run on 3.3V and you need to do level shifting to connect it to the 5V Arduino. The XBee shield handles all of that.


The Arduino IDE makes it very simple to upload a program to the Arduino. The only thing to keep in mind is that keeping the shield plugged in while trying programming the Arduino does not work.

Planned Upgrades

The system is currently running very nicely, but there is lots of room for improvements. At the moment the wireless sensors are rather dumb. They currently only receive the actual trigger and we would also like to add current battery levels in the reports. Most of the stuff is also mostly being kept together in the enclosures using duct tape and double sided tape. While it does make for a neat hack it doesn’t exactly look professional.


Now that the project is up and running we are going to take out time to design some proper electronics with new pcb’s and hardware. Another reason for wanting to upgrade the electronics is that prototyping equipment like XBee shields and Arduino boards aren’t really designed with low power applications in mind. Custom PCB’s designed strictly for the application could deliver anything from a 100% – 250% increase in battery life, as well as better management of the wireless sensors.

And finally we are in the process of designing some inserts for the enclosures that would keep everything in the right place and will make it more presentable. These inserts are currently being design in OpenSCAD and will be 3d printed on our in-house 3d printer.


Thanks to HelloComputer for getting us to do this project with them. It’s been lots of fun and we’re looking forward to more projects.

Have any questions? Want to stay updated about future BinarySpace projects? Check out our Facebook page, or join our mailing list :)

The World’s First LIVE Tweeting Badger

Not too long ago HelloComputer requested help on a new project that they were working on to get more exposure for the Johannesburg Zoo. When we saw the request, Sebastian Schocke and I (Tom Van den Bon) jumped on it. It sounded like an awesome project and we wanted to be part of it. Today we are proud to announce that the system went live and the Zoo has their own social media representation called BG. BG is the world’s first LIVE tweeting badger :)

Obviously we didn’t just hand BG a smartphone and trained him to use it (although that should maybe be a future project!), but rather we turned his home into a more hi-tech home. This consisted of outfitting his enclosure with Infra-Red sensors that would detect him performing various activities such as playing on his Jungle Gym or when he has retired to his room.

BG Tech

We will go into more detailed posts about the hardware and software used in future posts, but the basic concept consists of wireless sensors using PIR sensors and xbee wireless modules which communicate with a base station.The base station consist of a xbee/arduino and gsm engine.


When a sensor gets triggered it will send through a notification to the base station which will in turn send it through to a server which handles sending of tweets based on the data. This effectively turns BG into a Twitterer 😉


Why not follow his twitter feed @zootweetslive (#tweetingbadger) and keep up to date with his movements and happenings at the zoo.