Skip to content

SheffieldMLtracking/BLETrack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

path

Code for Bluetooth Low Energy bee tracking system.

  • "Transmitter" folder contains the code to be flashed to the BT832X/BM832E transmitter board.
  • "Receiver" folder contains the code to be flashed to the DA14531 chip on-tag and the 'Active Scanner' code for testing & diagnostics.
  • "To Print" folder contains FreeCAD files of the transmitter housing.
  • "Path Inference" folder contains code to process data from tag/dev board
  • Test data stored here

Notes on Programming Transmitter

Transmitter programming:

  • Requires nRF Connect SDK.
  • Create a build for the nrf52dk_nrf52832 and add the included device tree overlay.
  • Connect nrf52dk and BT832X/BM832E to the computer via JLINK (done via micro USB cable). Connect DEBUG OUT on nrf52dk to DEBUG IN on BT832X/BM832E:nrf52dk_programming_example
  • flashthisfirst.c must be flashed to the BT832X/BM832E first - then main.c can be flashed.

NOTE: P0.31 is used for encoder output A, P0.30 for encoder output B and P0.11 for hall effect sensor input.

Receiver programming:

  • Requires Keil uVision and configuration of environment as shown here.
  • To program a receiver tag via flashing code to the OTP memory, follow these instructions. If you need to debug code on a tag, do not flash to the OTP. DA14531 USB Development Kit can be used as a serial wire debug probe to debug code on an external DA14531 chip on the receiver tag using this configuration of SWIO cables and DIP switches.
  • Note: binary for compiled DA14531 is found in Keil/DA14531_OUT/Objects.
  • Note: USB dev kit switches should be configured as shown: da14531_usb

Usage of the System

Setting Up Transmitters

  • Charge transmitters before field trial!
  • Each transmitter is placed onto a tripod across the landscape. The 0 degree point on the tripod (denoted by the small magnet on the base the transmitter sits in) should be pointed north using a compass before placing the transmitter itself upon the tripod. The transmitter should be level with the ground and mounted as high up as possible.
  • As each transmitter is turned on, the time between turning each on should be taken using a stop watch. This time is later used to zero the time readouts in the packets.
  • Using the "Active Scanner" code downloaded to the DA14531 USB Dev Kit, the serial output from the dev kit - which can be accessed using a serial terminal program such as Tera Term - should be used to verify the functionality of the tramsitters. The packets recieved by the active scanner are in the following form and should be assessed to ensure that the transmitter is in fact transmitting and that the motor is reading out ~360 degrees of rotation, resetting at the zero point. If there is an issue, the transmitter may need reprogramming, regarching or the motor encoder may have been knocked out of place. Screenshot from 2024-10-29 13-43-06
  • Each transmitter currently has a range of approximately 100m (further at peak signal strength but not currently used in angle inference algorithm). The area tracked should be covered by at least 2, preferably 3 transmitters.

Using a Receiever Tag

  • A programmed tag should be allowed to drain fully to hardware reset, then be charged and attatched to a bee.
  • Following retrieval, put the tag on charge and apply ground to the interrupt pin to switch the tag into transmit mode.
  • The data of each packet is encoded in the destination addr, in the same form as the transmitted packets except the RSSI of the packet is encoded in the leftmost byte. Using a bluetooth sniffer (reccomended nrf52 BLE sniffer) and Wireshark the transmitted packets can be read. The following filter shows only read packets:

btle.advertising_header.pdu_type == 0x01 && !_ws.expert && btle.advertising_address == 80:ea:ca:70:00:04

Performing Infernece

  • Instructions for performing path inference on data are located in PathInferenceFinalCut.inpyb