I’ve decided to finally build the self-tuning Wi-Fi antenna I’ve been dreaming about for a few years now. I figured it would make sense to start with something a tad easier, but with transferable skills and code. Hence I’m building an arm that orients itself toward light. It will accomplish this with 4 photoresistors and some math. (I may eventually trim it back to 3 photoresistors). They’re broken down into Upper Left, Upper Right, Lower Left, and Lower Right. Basically the code flow goes like this:
- Read all the sensors
- If the left and right sensors are reading equal strength make no lateral adjustments, otherwise move toward the stronger signal.
- Same concept for vertical sensors.
- Rinse lather repeat until everything is reading the same values and you are (hopefully) oriented towards the light source.
To go with this hardware, I’m writing a UI in WPF/XAML (because I know it, don’t judge me!) It’s fun, and quick to set up. So far it’s giving me live readouts of the sensor values. This is accomplished using a simple set of fixed length values passed via Serial. I’m currently primarily using USB cable, but I do have a bluetooth module ready to go once I get things polished up a bit.
For now the code is UGLY!!!! I know this. Don’t care. Will refactor is later as I get things working. For now it’s all about getting things to actually function.
Details and source code can be found on Github at https://github.com/pyrrh1c/Light-Probe.