After many (many!) attempts and learning’s.

Everything from PCB design via software, PCB manufacture via toner transfer and ensuring your board is soldered correctly has had to be designed, re-engineered and put into practice on almost a production line state of mind.

Finally the initial board is ready to rock!

Completed BeeSafe Board, Version 1

Completed BeeSafe Board, Version 1

This board features, 5 LED’s; 4 of which are configurable. 3 Temperature Sensors, input for a switch and an I2C based accelerometer. *NB* The board above only has 1 of the three temperature sensors attached as at time of writing the other two sensors were in the post.

This board connects into a Raspberry Pi via the large 26 Pin header in the top left. Connected to the Pi is a USB GPS and USB 3G Data stick. *NB* the Pi’s on board USB ports aren’t able to provide enough power to support the 3G Data stick so an additional hub or secondary PCB will have to be provided should 3G be needed (Which I suspect it will!).

In total the BeeSafe project has the following sensors and communication gateways:

Circuit Temperature BeeSafe Board
Brood Temperature BeeSafe Board
External Environmental Temperature BeeSafe Board
XYZ Accelerometer BeeSafe Board
5 x Status LED’s BeeSafe Board
Switch Sensor BeeSafe Board
GPS Raspberry Pi
3G Data Modem Raspberry Pi
Ethernet Connection Raspberry Pi

With the hardware now complete (for the moment!); my attention has turned to the software to power BeeSafe. This is comprised of two parts: Software localised on the device and software hosted in the cloud to collect, store and interpret all the data.

A lot of people have asked why I chose to use the Raspberry Pi to power this device, a micro-controller such as Arduino would have been more than capable of reading temperature sensors, XYZ data, parsing GPS data and submitting it all via a comm’s device to the cloud. But the Pi stands out as a standalone computer. It’s capable of hosting its on database, serve pages and data to other computers and networks. An Arduino works in a single hive, but a Pi could work with many.

An Example; quite often bee hives are clustered together and are known as apiaries. If each beehive had a 1-2-1 connection to the internet that would mean each hive would require a 3G stick, its own sim card and data plan. Quickly the costs of keeping an apiary online would rack up.

Using a Raspberry Pi you could create a star network, one device could become a host. Using a USB WiFi stick to create a local WiFi access point (like your WiFi at home, one hub serves many users with an internet connection). This could keep costs and maintenance down as each apiary would only need one connection to the internet.

Additionally, if there is no cell signal, a Raspberry Pi could be used as a localised storage option for all the data collected. While this means you would loose some of the advantages of monitoring your Bee Hive remotely, the data is still invaluable and could be downloaded at a later point.

The next steps for BeeSafe include a start up program that will scan the hardware and configure everything into appropriate sections. For the moment I am doing this manually using a mix of python scrips to test the internet connection, GPS data, LED’s, temperature and XYZ position.

My ultimate goal is to produce a initial start up script that will on boot, self-test the LED’s, check for internet connection, scan for temperature sensors, check for the presence of an Accelerometer and then store all this data within an XML file to be used by the default BeeSafe program.

An example of the XML configuration file is below:

<?xml version=”1.0″?>
<BeeSafe>
<BeeSafeDeviceID></BeeSafeDeviceID> #Unique Serial Number used to identify the BeeSafe
<RedLED><RedLED> #GPIO Pin number for Red LED
<AmberLED></AmberLED> #GPIO Pin number for AmberLED
<GreenLED0></GreenLED0> #GPIO Pin number for First Green LED
<GreenLED1></GreenLED1> #GPIO Pin number for Second GreenLED
<BoardTemp></BoardTemp> #Identifier for Board Temp Sensor
<BroodTemp></BroodTemp> #Identifier for BroodTemp Sensor
<EnvironmentTemp></EnvironmentTemp> #Identifier for External Temp Sensor
<MagSwitch></MagSwitch> #GPIO Pin number for Magnetic Switch
<XYZ></XYZ> #Identifier for I2C Accelerometer
</BeeSafe>


The BeeSafe Device ID is used to track and log the data submitted by a BeeSafe device, my initial thoughts were that I could use the serial number from the Raspberry Pi attached, but this quickly led to issues as should a user wish to swap out the Pi for another one, the serial number would change and the data would be lost. Additionally I did not want to tie a BeeSafe device to a specific email address as should an individual user have more than one BeeSafe active, managing each device this way could prove to be problematic.

So whats the solution?
A BeeSafe’s Device ID will be generated on demand from the cloud, as a new device comes online and communicates with the cloud for the first time, it will be assigned a device ID which will be saved to the XML config file. While this ID will not be dependent on the PI it is connected to, the Pi’s serial number will be submitted so that should the worst occur and the SD card with the config file be lost, if the same Pi attempts to reconnect to the cloud, as a new user, it will be assigned the same device ID.

From a human perspective; one user can be in control of many BeeSafe devices.
Should the worst occur and the user need to be contacted, if more than one device has an alert status (such as a whole apiary) the user would be alerted once rather than receiving multiple alerts for a cluster of hives suffering the same issue. For example, if a cluster of BeeHives have collapsed, a single alert would be sent out stating that X number of hives currently need attention, rather than bombarding the user with an alert for each individual hive.

Continuing again with my Raspberry Pi adventures and further developing my ‘BeeSafe’ project. One of the components I need to integrate is GPS module that would allow me to track the BeeHive / box should someone decide to move it.. To this end I purchased a few GPS units from ebay. This guide should get you up to speed on how to access GPS data via your Raspberry Pi / linux setup.

USB GPS with magnetic base

USB GPS with magnetic base

Plug the USB GPS into the pi, you should be able to see it detected in

sudo lsusb

Mine came up as: Bus 001 Device 004: ID 1546:01a6 U-Blox AG

Using:

dmesg | grep -i usb

I worked out that my USB GPS was paired to ttyACM0

At this point you can test your GPS device is functional and sending data by:

sudo cat /dev/ttyACM0

The next thing we need to do is pipe the GPS feed into GPSD (the gps demon) for it to interpret the data and hopefully give us something useful to use later.

sudo gpsd /dev/ttyACM0 -n -F /var/run/gpsd.sock

this command connects the output of ttyACM0 to the gpsd socket

NB: I had to ensure that the -n flag was present in this command, as trying without the flag resulted in a time out.

You should now be able to test the GPS using

cgps -s

Which will bring up a small window showing the GPS data.

Things to note; If you have any problems and cgps always displays ‘NO FIX’ under status and then aborts after a few seconds, you may need to restart the gpsd service you may have to kill and reboot the gps demon by typing

sudo killall gpsd

and then

sudo gpsd /dev/ttyACM0 -n -F /var/run/gpsd.sock

 

which will restart the gpsd service and pick up the new settings.

Now you should be able to use the GPS data for whatever your project needs; in my case I want to build a GPS fence so that if my beehive is detected leaving a known area (such as a field) then it will alert me and provide me with a GPS co-ordinate feed.

I used the Lady Ada guide on how to setup GPS devices to help me; the link is:

http://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi/setting-everything-up

Following on from my previous post (see post), concerning the unboxing of an Android based Mini GPS tracker, I’ve finally cracked how it works and what you need to do, the below is a review and how-to on my successes with the device so far;

For starters the Tracker is tiny:

Operation is relatively simple; I’m using a prepaid SIM card which you simply slot into the SIM card slot, once fully inserted the Tracker activates and a red light illuminates for about 10 seconds.

Initially my tracker did nothing, I spent the morning trying to see if it was a SIM card fault, the number not being activated or the tracker itself. Eventually I came to the conclusion that all things network related were fine and began to lose confidence in the Tracker.

THEN: It sprung into life. Out of no-where the tracker started responding to SMS commands and if I were to ring the device it would answer and I could hear the surrounding – very interesting.

Points to note:

‘GPS’ & ‘DW’ commands appear to do the same thing, but not what I was expecting.

I was expecting a raw output of GPS Lat and Long Co-ordinates from the Tracker, something in a raw easy to use format would have been nice… but alas I was presented with this:

Not being able to read the Chinese I don’t know what it says but a quick copy and paste of the characters into Google Translate reveals ‘View image URL’ so now we know that the device is using some kind of 3rd party mechanism to present the users with a picture of a map centered around the GPS co-ordinates.

It would have been nice to have raw GPS data, particularly as the URL your forwarded too doesn’t seem to work and auto directs to another web server which isn’t currently working.  Given that this device is (hopefully) Android based their might be an option to reprogram the tracker? –don’t hold your breath.

A quick few Google searches reveal a few others are having the same issues – both with the web server as well as the lack of any kind of good quality support from the sellers. Below is a link to a seller who appears to be communicating:

http://club.dx.com/forums/forums.dx/threadid.1261336

A few months back I ordered from a ‘Made in China’ website a small GPS / GSM tracking device, the device sounded pretty interesting – tho not in a stalkerish way!

Devices like this have been speculated about for many years and indeed used by various governments of the world for years. But more recently companies and individuals have taken to using the devices.

From a data perspective devices like this can serve a greater good. The tracking of a elderly loved one serves a useful purpose and backed up by SOS buttons its very easy to see benefit from something like this.

I had previously investigated building something like this in the past as an experiment so I was intrigued to see what an official product did and looked like. Plus being only $15USD inc. shipping it didnt break the bank.

Boxed:

Its clear to see how small the tracker is:

Technologically it features an ARM A8 Processor (hence the name Mini A8) which is one of the chipsets being produced in the millions out in China. This processor is able to run Googles ‘Android’ operating system so being able to program and interact with the tracker should be quite easy..

The instructions on the other hand are a different matter… While the Chinese are very good at many things, technical translation is not one of them.

eg “before using the new machine should be filled with electricity, in order to achieve the best effort”

So this is a ‘rough’ Chinglish to English translation guide on how to operate the A8 Mini Tracker

Mini A8 Android GPS / GSM Tracker English Users Guide.

This product uses the latest technology produced from Taiwan. Small yet mighty, It features a long battery life, simple easy to use, stable operation and easy installation.

While the device has a range of uses, the top uses are: Monitoring and support of elderly / cared for individuals, vehicle and logistics tracking as well as individual location tracking.

Powering ON: The device is powered on, once a SIM card has been inserted into the SIM tray. Turning the device over (Android face down) slide the cover back to reveal the SIM tray.

Once a SIM card has been inserted the system will begin its boot process. You will see a light illuminate for approximately 10 seconds. Once this light has been extinguished replace the cover.

Environmental Monitoring:  You can use the tracker’s onboard Mic to listen to the surrounding environment. To do this simply dial the number connected to the SIM you inserted, the tracker should answer and after approximately 5 seconds you should be able to hear up to approximately 10 meters from the tracker.

Sound Controlled Call Back: One advantage of the A8 that It can ring you when when noise around the device exceeds 45 DB. To configure this, ring from the phone you wish to the A8 to call you, once connected to the tracker wait 3 seconds and then hang up.

This feature can be turned off by sending an SMS text of ‘0000’ to the phone number of the A8. You can also turn this feature back on again by sending an SMS of ‘1111’ to the A8’s number.

GPS Positioning: In CAPITALS send an SMS message of either ‘DW’ or ‘GPS’ to the A8′. After a few minutes the A8 will respond with the GPS co-ordinates.

SOS Emergency Call: From the phone you wish to receive SOS calls from. Send in CAPITALS an SMS with the words ‘SOS’. After 3 seconds press the SOS button on the A8 to test this functionality. The indicator should flash and the phone should ring.

The Mini A8 GPS/ GSM Tracker operates at frequencies of: GSM 850/900/1800/1900MHz

Notices:

Before initial use, please ensure you fully charge the device, A 5.0V Power supply has been supplied however any 5.0VDC power source will work.

If your not able to interact with the A8 Device try removing the SIM card, reinserting and recharging before next use.

and finally my favourite quote of the manual:

“this product is forbidden for illegal purposes, Otherwise your peril.”