Practical Arduino Quench Control - Part 3
The next step was to hook my Arduino Quench program to a real power level control switch. Seems easy, but once again I hit some interesting potholes along the way.
The Sea & Sea TTL converter housing came with 3 rotating controls:
- Left - A, B, C, D
- Right - A, B, C, D
- Power Level - OFF, Manual, 1, 2, 3, ..., 12
Each of these controls was a multi position rotating switch. Turns out they were all just potentiometers. The OFF setting on the Power Level control was not actually a mechanical off switch. It was just the lowest (or highest) setting on a potentiometer. This made wiring the controls simple. 3 connections needed per control: +5, ground and an analog input connected to the center tap of the pot. For now, I was only interested in the Power Level control. I would read the analog value and use software to interpret what the various switch position settings meant.
A potentiometer is just a variable resistor and they burn energy. Precious energy when you are powering the circuit via a battery. I did not want my pots hooked directly to the battery power. The solution was easy - power them via a digital output pin. I only needed to provide power to the pot any time I wanted to take a reading. Assert a digital output pin just prior to taking a reading and then let it float afterwards. I was worried about getting stable readings but it worked like a charm first time out. I was able to assert the digital output, read the analog input and obtain stable consistent readings. As long as I did not change the switch setting...
The pot featured a set of mechanical detents that corresponded to the different power level settings marked on the exterior of the housing. Rotating up gave a series of consistent values. Rotating down gave a different set of consistent values. Depending upon the direction of rotation a specific power setting gave a different value. Likely due to back lash in the mechanism. Time to deal with the real world. I had to make my code a little more sophisticated and map a range of pot values to each power setting.
Next up was making my Quench program responsive to Power Level control changes. BUT: I wanted to read the pot as few times as possible in order to conserve battery power From my radio communication background I knew vaguely remembered that most humans generally could not perceive changes faster than about 250ms. In other words a 250ms delay appears instantaneous to the majority of people. So there was no need to attempt to read the Power Level control setting every cycle of the Arduino control loop. Reading the potentiometer once every 100ms to 200ms should be often enough to track changes in the control.
I added some logic to flash the red LED on the converter each time the Power Level setting changed. Some experimentation showed that reading the pot every 200ms was fast enough. The LED appeared to flash instantly after I changed the Power Level setting.
I now felt I had the basics under control. Time to add a camera and some real strobes.