Survival Beacon – Prototype 1
Waypoints – Bearing – GPS – RF Auditory Locator – Non-Volatile Memory – Power Efficient
Neo-6M GPS Module
This module is responsible for accurately finding the device’s location using trilateration as well as providing serial communication to the main MCU (microcontroller unit).
Data received from this device is stored in an array before it is stripped for the essential information which is then processed to produce a decimal coordinate which represents a location on the earths surface.
What does the device do?
The device as a whole combines mathematics, physics and computer science to calculate the bearing from the devices location to a specified place such as your base-camp preventing you from getting lost.
POWERED BY THE ATMEGA328P
OVER 23 CODE ITTERATIONS
PROGRAMMED ENTIRELY IN C++
INTERGRATED INSTRUCTION MANUAL
The Code
The code for this project was one of the hardest things I’ve worked on to date. After GCSE Computer Science Paper 2 (OCR J277 2023) I felt like a bad coder since I’m normally pretty good in computer science exams but I came out feeling terrible. As a result I decided to push myself to develop my capabilities.
(I even used comments… wow)
A brief overview of how the code works:
The GPS sends us a string of data over software serial. We scan the string to see if it beings with “$GPGLL” which tells us it has location data. We then figure out the length of the string to see if we have enough data to work with, assuming we do we take sections of data from the main string and use the atof() function (ascii to float) to convert the string to usable floats.
These usable floats are then stored as temporary variables and if we have any coordinates saved in EEPROM (electrically erasable programable read only memory, say that 10 times fast) we use an equation to calculate the bearing of the EEPROM coordinates from the coordinates we just assigned to variables.
Why use EEPROM to store data?
EEPROM, unlike RAM, is non-volatile and therefore we can cut power to the microprocessor without losing our last saved location. This feature allows us to set a waypoint at “base-camp” go on a long hike and then turn on the device which will give us directions back to base-camp (it saves battery).
Saving to EEPROM on Arduinos is really easy using a library. Firstly we must convert out floats into 4 binary bytes because each address in EEPROM can only hold 1 byte of data. To do this we use a union and then save our bytes using the EEPROM.put() function.
Some other cool features:
Not all of these features made it into prototype 1 since I had a deadline (a camping trip with friends) but they should still be appreciated.
- Auditory Locator (flashed and beeps on radio command) – Installed
- EEPROM Power Saving – Installed
- Automatic Bearing Calculation – Installed
- Fall Detection – Underdeveloped
- Memory Game (to pass time) – Underdeveloped
- Panic Mode – Underdeveloped
- Digital Compass – Working however not installed due to electromagnetic interference inside device casing.
Email: [email protected]
What I’ve learnt from this project:
- atoi() Function
- atof() Function
- Null Characters
- Unions
- I2C vs SPI
- EEPROM
- Function Pointers
- Arc Minutes
- Trilateration
- How to write neat code