SafeBee – A GPS Tracker for Beehives
This is an original design of a GPS tracker designed on Elab and it is intended to be used as a security device for beehives, but it is not limited to this. It can be used everywhere a motion-activated GPS tracker is needed, like your car, bike, or even your boat. It is a GPS tracker controlled by simple SMS commands and it is designed for reliability, low power consumption, and ease of use. It features a MEMS accelerometer that is used to intelligently detect movement and once triggered it will power on the GPS module and will try to acquire the current coordinates. The location details will be transmitted to the owner’s smartphone via a simple SMS and then follow update the coordinates at predefined intervals.
- Remote management via simple SMS commands
- High reliability – no need to babysit the tracker due to crashes and resets
- Long battery life – over 1-year standby on a single charge (2500mAh battery)
- 3-axis high sensitivity MEMS Accelerometer
- Intelligent Triggering – it will not be triggered by accidental movement
- Selectable Trigger Sensitivity Level
Description of Operation
The tracker has 3 main modes of operation, detailed below:
In standby mode, the GSM and GPS modules are powered down and the microcontroller is in sleep mode, resulting in a current draw of approximately 70uA, mainly by the accelerometer (MMA7660). The accelerometer is used to detect movement caused by a possible thief. If the accelerometer is triggered 1 or 2 or 3 times (depending on the sensitivity level) inside of a 60-second window then the device will enter tracking mode. While in standby mode the tracker will also enter ready mode approximately every 12 hours, triggered by the microcontroller’s internal RTC. This is to check for incoming commands and battery status etc.
The ready mode is entered by the microcontroller’s internal RTC and when the tracker is first powered on. In this mode, the tracker will power up the GSM module and wait for any SMSs to come in and process them. The tracker will stay in ready mode for 5 minutes before returning to standby mode unless an SMS command has instructed the device to enter tracking mode (BEE+TRIGGER).
Tracking mode is entered when manually instructed to by the BEE+TRIGGER command or after the accelerometer triggers (1 or 2 or 3 movements detect depending on sensitivity level) within a 60-second window, from either standby or ready modes. In tracking mode, the tracker will power up both the GSM and GPS modules and begin to send tracking alert SMSs to the number configured by the BEE+NUMBER command. The device will continue to stay in tracking mode until the BEE+CLEAR command is received or while the accelerometer is detecting movement and/or the GPS module has a lock and the speed is greater than 10KPH. If neither of these conditions is met for 6 minutes then the tracker will send a tracking stopped SMS and return to standby mode, or ready mode if the RTC was triggered within the last 5 minutes.
Power up and Battery Status
In ready and tracking modes if the battery voltage falls below the threshold voltage (3650mV default) then a low battery alert SMS will be sent to the number configured by BEE+NUMBER. Approximately every 30 days (60 RTC triggers) an automated status SMS is also sent to the number configured by BEE+NUMBER.
When power is first applied to the device the tracker will be in ready mode and it will check for incoming SMS and then go to sleep. This is the ideal time to configure the tracker with the BEE+NUMBER number. This is the number that tracking messages, monthly status reports, and low battery alerts will be sent to. The phone number is stored in the microcontroller’s FLASH memory and it will be permanently saved, even if battery power is removed. At power-up, the tracker will send a status SMS and also ignore any movement detected by the accelerometer for the first 60 seconds.
The tracker uses an ST STM32F030K6 microcontroller (ARM Cortex-M0, 32-bit RISC core), with 32KB of flash, 4KB of RAM and operating at up to 48MHz. The STM32F030K6 microcontroller operate in the -40 to +85 °C temperature range from a 2.4 to 3.6V power supply. A comprehensive set of power-saving modes allows the design of low-power applications. Currently, the firmware is taking roughly 24KB of flash (with debugging output enabled) and 1.7KB of RAM. The microcontroller is running at 8MHz and supplied with 3V.
The GSM module is a SIMCom SIM800C and uses the UART bus to communicate with the MCU. The GSM module is power-gated with a P-MOSFET, controlled by the MCU, as its own low-power modes are not sufficient for this project. SIM800C supports Quad-band 850/900/1800/1900MHz, it can transmit Voice, SMS and data information with low power consumption. With tiny size of 17.6*15.7*2.3mm, it can smoothly fit into our small board. The module is controlled via AT commands and has a supply voltage range 3.4 ~ 4.4V.
The GPS module is a u-blox NEO-6M and uses the I2C bus to communicate with the MCU. There is also a UART connection to the microcontroller as a fall-back if the I2C interface does not work (usually the case with Chinese fakes). So, the tracker will work with original NEO-6M as well as Chinese fake modules. The microcontroller implements the UART interface in software (via timer interrupts), operating at 9600 baud. The GPS module is power-gated with a P-MOSFET, controlled by the MCU, as its own low-power modes are not sufficient. The NEO-6M is powered in the range of 2.7 – 3.6V and has a size of 12.2 x 16 x 2.4mm.
Supported GPS modules:
- U-blox NEO-5M
- U-blox NEO-6M
- U-blox NEO-7M
- U-blox NEO-M8N
- Various Chinese fakes using AT6558 and similar (if the PCB footprint is the same then it will probably work)
The accelerometer IC is the MMA7660FC and uses the I2C bus to communicate with the MCU. The MMA7660FC is a ±1.5 g 3-Axis Accelerometer with Digital Output (I2C). It is a very low power, low profile capacitive MEMS sensor featuring a low pass filter, compensation for 0g offset and gain errors, and conversion to 6-bit digital values at a user configurable samples per second. In OFF Mode it consumes 0.4 μA, in Standby Mode: 2 μA, in Active mode 47 μA and is powered in the range 2.4 V – 3.6 V. The accelerometer is always active, set up to create an interrupt whenever a shake or orientation change is detected, and is configured with a sampling rate of 8Hz (higher sampling rates improve detection, but also increases power consumption). The interrupt will wakeup the microcontroller, where it will run through the main loop. In this loop it checks the interrupt status, and if set it will clear the interrupt and increment a counter at a maximum of once per second. The counter is reset every minute. If the counter reaches 3 the tracker is activated.
The Li-Ion battery charging IC is MCP73832, which has user-programmable charge current and the battery charge rate is set to 450mA. It includes integrated pass transistor, integrated current sensing, and reverse discharge protection. It is usually recommended to charge Lithium batteries at no more than 0.5C, so the recommended minimum battery capacity to use with the tracker is 900mAh.
With a 2500mAh battery, standby current of 70uA, and waking up every 12 hours for 5 minutes with an estimated average current of 15mA the battery life should be approximately 1.5 years. A poor GSM signal can reduce battery life.
|LED1||Battery charging state||OFF: Battery not charging (no USB power or battery fully charged)
|LED2||GSM state||OFF: GSM is powered off
FAST BLINK: GSM is not connected to a network (usually no signal or no SIM)
SLOW BLINK: GSM is connected to the network
|LED3||MCU Operating mode||OFF: Standby mode
ON: Ready or tracking mode
|LED4||GPS state||OFF: GPS is powered off
FAST BLINK: GPS is acquiring a lock
SLOW BLINK: GPS has a lock
|BEE+STATUS||Returns battery voltage - temperature - GSM signal strength - tracking enabled - is tracking - last GPS coordinates -sensitivity level.|
|BEE+CLEAR||If the tracker has been triggered this will clear it and stop tracking until the next trigger.|
|BEE+TRIGGER||Manually trigger tracking (will trigger even if disabled with BEE+DISABLE). Tracking will stay enabled until BEE+CLEAR is received.|
|BEE+ENABLE||Enable tracking triggers|
|BEE+DISABLE||Disable tracking triggers.|
|BEE+NUMBER=0123499988||This sets the mobile number to send tracking - low battery warning and monthly status SMSs to. Other command replies are sent to the number that the command was sent from.|
|BEE+NUMBER=+441234999888||International numbers must start with + then the country code.|
|BEE+SENSE=1/2/3||This is the sensitivity level - 1 high sensitivity - 2 medium sensitivity - 3 low sensitivity.|
SMS SENT BY THE TRACKER
|Status (BEE+STATUS and automated status)||BAT: (batt level)% (batt voltage)mV (low batt thres mV) |
TRK: (is tracking) (
GPS: (status) (lon,lat - speed KPH - time date)
NUM: (SMS number)
SEN: (Sensitivity Level)
|BAT: 90% 4020mV (3650mV)
TRK: Y (Y)
GPS: LOCKED (11.12345,8.05234 - 64 KPH - 23:10:09 18-09-21)
|Tracking||TRK: (status: LOCKED | NO LOCK | STOP) https://maps.google.com/maps?q=loc:lon,lat - speed KPH - time date||TRK: (LOCKED) https://maps.google.com/maps?q=loc:11.12345,8.05234 - 64 KPH - 23:10:09 18-09-21|
|Low Battery||LOW BATTERY: (battery voltage)mV (threshold voltage mV)||LOW BATTERY: 3400mV (3650mV)|
The device firmware can be programmed via the SWD interface, which is the 4-pin programming header on the PCB marked RST (reset), SWD (SWDIO), SWC (SWCLK) and GND (ground). An ST-LINK/V2 USB adapter is needed to program the device, which is available from ebay, aliexpress, and other places for less than £3.
Debugging data is sent out of the UART interface through the TX pin of the debugging header on the PCB, at 115200 baud. This pin is also shared with the SWD interface (SWC). The RX pin is unused but made available for possible use in the future.
“time” is in milliseconds and only increments while the microcontroller is not in standby mode. “module” is either “DBG” (general messages), “TRK” (tracker), “GSM”, “GPS”, “SMS”, “MGR” (MGR is the SMS manager which controls when queued SMSs are sent, retried etc.)
START SafeBee Tracker http://zakkemble.co.uk FW: 1.0.0 180407 (Built: Apr 7 2018 16:38:32) (1634)(TRK)CONFIG (1636)(TRK)Number: (Type: 129) "0000000000" (1640)(TRK)Track interval: 180 (1643)(TRK)Wake duration: 300 (1647)(TRK)Trig idle: 360 (1649)(TRK)Low batt thres: 3650 (1654)(TRK)TRIG SECS: 1 (1657)(GSM)** ON ** (4000)(GSM)** POWERON ** (4502)(GSM)** CMDDELAY ** (4505)(GSM)CMD DELAY (4507)(GSM)PWR SAVE OFF (5007)(GSM)CMD SEND
A 3D model of the enclosure is designed using Solidworks with overall dimensions of 60 x 20 x 112 mm. The enclosure has two holes, one for the charging micro USB connector and one to fit a mini rocker power switch. The provided design files (download .STEP and .STL files below) can be used to print your own enclosure in your desired color and material. The screws used to secure the enclosure are M3 x 10mm countersunk screws. Design is made by professional engineer janangachandima and you can find his services on the Fiverr page.
3D Enclosure View
The source code and .hex file are available as a download below. Also, the Eagle design files are available.
$18 Welcome Bonus for new registrations Now https://jlcpcb.com