Light Probe – Coming Attractions

I did some extensive re-working of things over the last few days, which is to be expected on something this early into development.  I’m kind of forming what I want this to be as I go, which is considered terrible development practice but eh, fuck it. Also uploaded the latest build if anyone would like to download and take it for a spin. Here’s the link:  Light Probe (Zipped Exe)

Latest screenshot of the Light Probe App

So I tweaked the UI quite a bit. Removed some extraneous junk, added things I will actually use. The sensor progress bars now have numerical value boxes as well. I added some (not yet functional) buttons for things like semi-automatic calibration, loading and saving of calibration config files, rescanning for COM ports, and manual override of servo control.

Going forward I’m going to be working on finishing the fully automated operation of the unit, and then starting to tackle the manual operation and calibration. I feel the calibration will be vitally important now that I’ve been playing with the hardware for a few weeks.  It’s fairly obvious that the sensors and servo’s are NOT all created equal, as I can now predict which sensors will read higher or lower given identical readings, and which servo will go further one way or another given identical commands.

This has lead me to consider how I would even calibrate everything.  For the sensors, I’m thinking I will need two things: a light source to act as a control. I’m thinking very bright LED with a rubber seal around it to isolate the sensor from ambient light. Turn the LED off, take a measurement, the value read then becomes zero. Turn the LED on, take a measurement, the value read then becomes 100. I might just build out a mock-up modal window for this purpose later today if I get some free time… Should be quick and easy.

For servo calibration there are really three things to consider. The actual values of 0 degrees, 90 degrees, and 180 degrees. (or -90, 0, and 90 as I prefer to refer to them as.)  I’ve noticed that when I tell the servos to go to these positions, they are invariable off a few degrees.  While this shouldn’t technically matter for fully automatic operation, it just bugs me because I’m obsessive.  If the servo is facing 90 degrees, IT SHOULD SAY 90 DEGREES DAMMIT.  So to tune them I’m looking at the following process:  Tell servo to go to -90. Use tuning buttons to adjust it until it’s actually at -90. Press some sort of “commit” button, and rinse, lather, repeat for 0 and 90.  Once the calibration is done, what is sent to the servo’s is what they will actually do.

Once I have the calibration routines set for everything, it would be nice to not have to do this each time I boot the damn thing. So this logically leads to something like a configuration file.  This then runs into an instant problem.  This device is supposed to be able to run independently of the C# program. So the config file needs to be stored locally. This will probably be as easy as throwing an SD-Card shield on the Arduino and storing it there.  I will probably make some sort of serial load/save functions for this file to avoid having to pull the SD-Card to tweak it. Would also be nice to just be able to save the files to the PC over the serial line.

I’ve got some grand plans for my little toy. Now all I need is about a month with nothing to do to flesh it all out and actually build the boom, mounts, etc.

Light Probe – Update

Spent a good chunk of this weekend tinkering. Got the Arduino IDE for Visual Studio plugin up and running. (and mostly functional), though I still can’t get it to actually upload to the Arduino. Still, it beats running one IDE for Arduino and another for C#! Plus I wrapped the Arduino Code, Fritzing file, and C# code all into one Solution and got it on Github.  The servos are mostly reacting as expected finally.  Still some tuning required, but we’re making progress. Some highlights from this weekend include:

  • Servo’s move different amounts based on how much variance there is between the sensors. Bigger difference between sensors, bigger movement. Then as the sensors get closer together the distance moved each time decreases.  Eventually, I’ll map this to a parabolic function or something similar, but for now it’s all about KISS. I’ll eventually probably also eventually adjust the delay in a similar fashion to allow the servo to complete it’s moves before the next cycle.
  • Cleaning up! While it’s not sexy and doesn’t really bring any new functionality, I did some (desperately needed) housekeeping on the Arduino code.  Just the basics… combining redundant code into functions, commenting things, etc.
  • Consolidating into a real version control system! I had to learn how to use Github at some point. May as well be now…

Goals for this week:

  • Build the prototyle hardware. Probably going to mock it up in cardboard before I hit the shop for real.
  • Get manual calibration of the sensors working
  • Get manual calibration of the servo limits working

That’s all for tonight. You can check out the code and schematics at the Github page.


Light Probe – A Research Project

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:

    1. Read all the sensors
    2. If the left and right sensors are reading equal strength make no lateral adjustments, otherwise move toward the stronger signal.
    3. Same concept for vertical sensors.
    4. 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