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

Key Features:

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

  1. Standby
  2. Ready
  3. Tracking

Standby mode

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.

Ready mode

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

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

 

Hover images for details

Block Diagram

MCU

STM32F030K6

The tracker uses an ST STM32F030K6 microcontroller (ARM Cortex-M0, 32-bit RISC core), with 32KB of flash, and 4KB of RAM, and operates at up to 48MHz. The STM32F030K6 microcontroller operates 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 is supplied with 3V.

GSM module

SIMCom SIM800C
SIMCom SIM800C

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

GPS module

u-blox NEO-6M

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 fallback if the I2C interface does not work (usually the case with Chinese fakes). So, the tracker will work with the 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. More details and design considerations can be found in the Hardware Integration Manual of NEO-6 GPS Modules Series and u-blox 6Receiver Description.

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)

Accelerometer

MMA7660FC

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 sample 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 increase power consumption). The interrupt will wake up 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.

Battery Charger

MCP73832

The Li-Ion battery charging IC is MCP73832, which has a user-programmable charge current and the battery charge rate is set to 450mA. It includes an 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.

Schematic

Parts List

ItemRef.MPNLCSC.comQuantity
1R1, R5, R6, R7, R8, R9, R10, R160805W8J0472T5EC260228
2R2CR0805J80222GC1019701
3R3, R4, R11, R12, R15, R17, R18, R22, R23RC0805JR-0710KLC1000479
4R13RTT0510R0FTPC1039251
5R140805W8J0102T5EC256231
6R19, R20, R21RC0805JR-0722RLC1084063
7C1, C2, C21CL21A475KAQNNNEC17793
8C3, C4CC0805KKX7R8BB105C911862
9C5, C6, C7, C9, C10, C11, C13, C15, C17, C19TCC0805X7R104K500DTC28273210
10C8CC0805KRX7R9BB472C1071531
11C12SS-101M1ASA-0605C3116761
12C16DON’T PLACEDON’T PLACE0
13C180805CG101J500NTC820281
14C200805CG220J500NTC246581
15Q1, Q2DMP2035U-7C1104992
16Q3PUMD13,115C1931711
17U1STM32F030K6T6C468301
18U2MCP1700T-3002E/TTC622441
19U3DON’T PLACEDON’T PLACE0
20U4MCP73832T-2ACI/OTC380661
21U5PESD5V0L5UYC3300931
22U6SIM800C 24MbitC691191
23U7MMA7660FCR1 https://www.aliexpress.com/item/32834701234.html1
24LED1, LED2, LED3, LED4FC-DA1608HRK-620DC842634
25D1BZT52H-B5V1,115C1793751
26L1AISC-0805-R056J-TC1869561
27GPS/GSM Antenna connectorU.FL-R-SMT-1(80)C883742
28SIM1Micro SIM Slothttps://www.aliexpress.com/item/32786308183.html1
29USBmicro USB socket 5pinhttps://www.aliexpress.com/item/32768317385.html1
30P1JST 2PIN CONNECTORhttps://www.aliexpress.com/item/5-SETS-Mini-Micro-JST-2-0-PH-2-Pin-Connector-plug-with-Wires-Cables-120MM/32711927418.html1

Battery Life

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.

Status LEDs

LEDDescriptionStates
LED1Battery charging stateOFF: Battery not charging (no USB power or battery fully charged)
ON: Charging
LED2GSM stateOFF: 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
LED3MCU Operating modeOFF: Standby mode
ON: Ready or tracking mode
LED4GPS stateOFF: GPS is powered off
FAST BLINK: GPS is acquiring a lock
SLOW BLINK: GPS has a lock

SMS Commands

CommandDescription
BEE+STATUSReturns battery voltage - temperature - GSM signal strength - tracking enabled - is tracking - last GPS coordinates -sensitivity level.
BEE+CLEARIf the tracker has been triggered this will clear it and stop tracking until the next trigger.
BEE+TRIGGERManually trigger tracking (will trigger even if disabled with BEE+DISABLE). Tracking will stay enabled until BEE+CLEAR is received.
BEE+ENABLEEnable tracking triggers
BEE+DISABLEDisable tracking triggers.
BEE+NUMBER=0123499988This 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=+441234999888International numbers must start with + then the country code.
BEE+SENSE=1/2/3This is the sensitivity level - 1 high sensitivity - 2 medium sensitivity - 3 low sensitivity.

SMS SENT BY THE TRACKER

SMSFormatExample
Status (BEE+STATUS and automated status)BAT: (batt level)% (batt voltage)mV (low batt thres mV)
TMP: (temperature)C
TRK: (is tracking) ()
SIG: (signal)/31
GPS: (status) (lon,lat - speed KPH - time date)
NUM: (SMS number)
SEN: (Sensitivity Level)
BAT: 90% 4020mV (3650mV)
TMP: 23C
TRK: Y (Y)
SIG: 18/31
GPS: LOCKED (11.12345,8.05234 - 64 KPH - 23:10:09 18-09-21)
NUM: 01234567890
SEN: 1
TrackingTRK: (status: LOCKED | NO LOCK | STOP) https://maps.google.com/maps?q=loc:lon,lat - speed KPH - time dateTRK: (LOCKED) https://maps.google.com/maps?q=loc:11.12345,8.05234 - 64 KPH - 23:10:09 18-09-21
Low BatteryLOW BATTERY: (battery voltage)mV (threshold voltage mV)LOW BATTERY: 3400mV (3650mV)

Programming

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.

3D Render

3D Render of the board on KeyShot 11 Pro

Debugging

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.

Format

(<time>)(<module>)<message>
“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

Enclosure

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

Code

The source code and .hex file are available as a download below. Also, the Eagle design files are available.

Please follow and like us:
Pin Share
Subscribe
Notify of
guest

10 Comments
Inline Feedbacks
View all comments
Haim

Hi, There is no STEP and STL files.. How can e download? thank you

Haim Rodrik

Thank you, I will keep the forum posted with the progress

Last edited 1 year ago by Haim Rodrik
Haim Rodrik

yes why not. I worked last almost 23 years with PIC assembly and a bit C codes. I choose that project because it will be first entry to STM32 world. It will be a big challenge form me. BTW, Are you Greek ? (the name) My family origin is from Ioannina wife family from Thessaloniki

Haim Rodrik

Hi Mixos,

What’s the part number of the SIM card socket ?

Last edited 1 year ago by mixos
Mind

Hi,
Is there any place on the Internet where could i buy this tracker (or at least see the price). Asking as a novice beekeeper, whose first hive was stolen. And is willing to use second hive as a bait for the bad guys.

RELATED PROJECTS

TOP PCB Companies