A normal compass just points north (boring). Lets make something smarter, that points to any required place.
Story
Our general compass just points towards north. I decided to make a smart compass, that will point to the nearest place selected using keypad.
Usage -
Set HyperIMU app on android phone to send UDP packets to the PI. Select orientation and GPS values in packet settings.
Attach the phone to the device, such that, the Phone points towards the tip of the needle. The Pi uses the orientation sensors inside the phone to determine its orientation. This values are streamed to the PI using HyperIMU.
Now run the container -> instructions to run the docker container
Now press the button on keypad for desired nearest location.
The buttons correspond to different places ->
1 - Automobile Service
2 - Hospital
3 - Police Station
A - Petrol Pump
4 - Mall
5 - Pizza
6 - Bank
B - Post Office
7 - Stadium
8 - Railway Station
C - Airport
* - Hotel
0 - Restaurant
# - School
D - Reset
For the needle to return to 0 degree mark, press the Reset button.
Working -
The Pi continously scans the keypad, for a button press. Once a button is pressed, using Google Maps API nearest corresponding location place coordinates and name are fetched.
Next, the Pi calculates the Bearing angle using the coordinates fetched and the device coordinates received from HyperIMU stream. Then according to the device orientation, the final angle is calculated. This final angle is fed to stepper driver and the needle moves.
After the needle points to the right direction, the needle gets locked in that direction. To return back to 0 degree mark, press Reset.
For all code & software details visit the Code repository at -> https://github.com/YashIndane/smartcompass
Comments