The Software
Let’s identify what the software does:
1.
Spins the backdrop to match the current heading of the digital compass.
2.
A wave animation spreads across the screen, making a clicking sound as it appears.
3.
On a predefined event a new contact is added to the display at a random distance and bearing from the centre and
starts moving closer to the centre at a random speed.
4.
When the wave animation reaches the position of one of the contacts, a bleeping sound is made and a blip fades in
and out at the position of the contact. The bleep is only made when the wave reaches the first contact, the pitch
of the beep depends on how close the contact is to the centre.
5.
Display the range to the nearest contact at the bottom of the screen.
At this point, you should have Pi Zero with an attatched display, compass and audio board. To get the motion tracker
software running there are a couple of packages we need to install first.
sudo apt-get install python-pygame, python-smbus
Download the program plus image and sound files here and copy them to yourt Pi. I put mine in the following folder:
\home\Pi\PiTracker
To run the program type:
sudo python \home\pi\PiTracker\motiontrackerv3.3.py
To add a blip to the screen, you will need to add a button with pins connected to GND and GPIO 14
Note: If the screen rotation isn’t working properly, it is likely that the calibration settings are off as the code is set to use
the calibration from my compass and they will probably differ from yours.
Edit the program files and locate the following lines
x_offset = 8
y_offset = -43
Amend these values to match the calibration values for your own compass (You can find the calibration values by
following instructions from here)