Stranger Lights

2017

Stranger Lights

Source Code

Here I combined my Arduino hardware skills with an Android app geo-location experiment to create a geo-fence-activated lightswitch. I.e. when I walk outside the house, my phone tracks the location and turns off the lights, and vice-versa!

Done as part of an interview project for PubNub

The primary component is the Android App running on a GPS-enabled device. With 750ms updates, it publishes the user's lat/lon coordinates to PubNub. This location data is then received by a python script, which checks the Vincenty distance of the user's location against that of predefined lights. If the user is within a threshold boundary, the script sends information of the light and required state to an Arduino Uno connected over serial. The Arduino is connected via USB to the device running the python script (my laptop in this case), and controls relays for each corresponding light directly.

Upon activation of the lights, the python script publishes their state to another channel over PubNub. This data is received by the Android app, which visually displays the state of the lights at the bottom.

© 2023 Yury Zhuk