I have finally begun the design and implementation of a new controller for my two prop pitch motor rotators. The "legacy" controller is home brew by a previous owner. It is ugly and has problems, and the "temporary" outboard op-amp circuit and meter are especially unsightly. The time has come to eliminate it from my desktop.
The plan is for the power supplies to be placed out of sight under the operating desk, and operated from a lightweight and ergonomic controller on the desktop. The controller will be software based using an Arduino. There are several components:
- Two 24 VDC power supplies, with switching for the AC and the clockwise and counterclockwise direction wires; I have two power supplies but I want to rehouse them in a new enclosure
- Digital display of rotator direction using op amp circuits driven by the existing direction pots on the towers
- Manual activation via push buttons, and eventually supplemented by software controls
- Software limits and provision for greater than 360° rotation
- Fault detection and protection
There are commercial products that will do the job. However, as anyone that has followed this blog knows, I like to do it myself. Yes, it is less expensive to home brew, but I like the satisfaction of building what I can. This is not a particularly complex project so it is well within my abilities. There is ample learning to be done along the way, which is a major theme of this blog.
There will be further articles as the project progresses. In this one I will focus on one design challenge: protecting the Arduino processor from high and low voltage applied to its GPIO pins. The 741 op-amp circuits will employ ±15 VDC supplies and the microprocessor is acutely sensitive to out of bound voltages. Mistakes can happen during construction and during periodic adjustment of the op amp circuits and I want to reduce the risk of bricking microprocessors.
The maximum allowed range of voltages applied to the GPIO pins of a 5 VDC microprocessor is approximately -0.5 to +5.5 volts, whether for digital or analogue input. The range is narrower for a 3.3 VDC microprocessor, so you must confirm which you are using and choose a different value for D2, a Zener diode, in the following circuit.
One of my recent projects is to learn KiCad to develop custom PCBs. I have a long road ahead so I may resort to my usual use of protoboards for expedience in this project -- my time is limited. Its only purpose here is to draw the schematic of the protection circuit.
The purposes of the circuit include:
- Block negative voltage: D1 provides reverse polarity protection from negative voltages
- Limit the positive voltage: R1 and D2 (5.1 volt Zener diode) act as a regulator to keep the voltage well below 5.5 volts
The potentiometer in the test circuit is used to vary the source voltage from the 9 volt battery over its range from 0 to ~9.5 volts. The battery is reversed to test negative voltage protection. R2 emulates the high impedance of an analog GPIO pin of the Arduino. There are test points to measure the source voltage (A) the voltage drop across D1 (B), and the voltage presented to the GPIO pin (C).
The objectives of the test:
- Verify blocking of negative voltages and that positive voltages never exceed 5 volts
- Linearity of the circuit
- Voltage range for best linearity
- Component selection for best linearity
A push down protoboard was used for the test circuit. It is easy to substitute components. An inexpensive digital multimeter is used to measure voltage at the test points and to confirm resistor values. Readout precision is 0.01 volt ±0.01 count error. Multimeter accuracy is unknown.
Populating the other half of the protoboard is a circuit for testing the use of an LCD display with the Arduino Uno. It will be used for the controller software and display. I'll leave that component of the controller for another article, but I will mention that connecting and using the LCD display was far easier than I anticipated. I was even able to quickly construct the custom characters that I'll need.
I varied the source voltage from 0.5 to 5.5 volts in 0.5 volt steps with the potentiometer. I measured and plotted the voltage at test points A, B and C. Lower voltages are cut off by the silicon junction of D1 and higher voltages are rolled off by D2. The linear range, if it exists, must lie between those extremes. I repeated the test with R1 values of 220 Ω and 1000 Ω. A higher R2 may be desirable to limit current and heat dissipation during over-voltage conditions. The B curves are identical (as expected) so the yellow curve is hidden beneath the blue one.
The test went so well that I saw no need to substitute components for D1 and D2. Negative (reverse battery) voltage read 0.00 volts at all test points at all potentiometer settings up to the limit of the new 9 volt battery (9.7 VDC) the voltage at test point C never exceeded 4.9 VDC. There is a wide linear operating range for positive voltages. Although this is what I expected it is better to be certain. Those straight lines on data sheets can deviate depending on circuit design.
The linear range is from 1.0 to 5.0 volts (A), within ±0.02 volts at test points B and C. Linearity is critical for tracking the linear direction pot, assuming linearity of the op amp circuit. Non-linearity, had it been present, can be remedied by an improved hardware design, software compensation based on the circuit's operating curve, or by restricting the voltage to a narrower range where it is found to be linear.
In my application the target voltage range will be 1.5 to 4.5 volts, representing directions from 0° to 360°. I leave a small amount of the linear range at both ends to exploit the lack of mechanical limits on the prop pitch motor to extend clockwise and counter-clockwise rotation past 180° (due south) by a small amount. The rotation loops can accommodate at least 20° of additional range in each direction.
Although the choice of R1 did not affect linearity in this test, the value still matters. As mentioned earlier, a higher value serves to limit the current when the source voltage is high. However, a higher value reduces the usable resolution due to voltage division with the load (GPIO pin). Notice the slopes of the red and green lines. I did not measure the current through R1 and D2 during the test.
For the source voltage range of 1.5 to 4.5 volts, the corresponding range presented to the GPIO pin (C) is 2.8 volts when R1 is 220 Ω and 2.66 volts when 1000 Ω. Thus the centre (north) positions are 2.9 and 2.83 volts, respectively.
The Arduino has a 10 bit ADC with 1024 values from 0 to 5 volts. We're using a little more than half that, say, 60%. The direction readout is therefore approximately 360 ÷ 600 = 0.7°. The difference may not be so pronounced when connected to an actual GPIO since the input resistance is typically higher than the 10 kΩ used for testing.
While not a concern for HF yagis, a higher resolution may be desirable for VHF/UHF antennas, but only if the resolution of the direction pot is better than the software resolution. High resolution can be useful for monitoring any antenna system rocking in the wind and to ascertain whether the rotator is moving in the moments after power is applied.
Too simple?
After reading this article you might wonder whether the circuit and its characterization are too simple to require exposition. Simplicity is in the eye of the beholder. For those that live and breathe electronic circuit design, this article might elicit nothing more than a shrug.
But I'm a ham, not an electrical engineer, although I do know software design. Understanding simple circuits like this is well worth the effort. Walking through the process is likely to be of use to other hams like me. It might even inspire experimentation and home brewing, and that's always a good thing in our technical hobby.
Next steps
The next step is to connect the circuit to the Arduino. The software to convert the voltage to a direction and display it isn't complicated. The op amp circuit to convert the direction pot resistance to the Arduino ADC will be designed to centre its output on the protection circuit's linear range.
It will be slightly different from the prototype I am currently using since a meter reads current and the ADC reads voltage. The op amp circuit will be adjustable so that no software correction will be needed to derive the correct direction.
No comments:
Post a Comment
All comments are moderated, and should appear within one day of submission.