Unfortunately the metalwork has still not arrived due to a shipping error by the supplier and that has left me with nothing other to do than start writing code. Very often initial coding attempts reveal problems in the hardware design and so it proves to be in this case. It is basically an iterative affair.
One such case is the current sensor. The standard device for this job is the ACS712 hall effect sensor which comes in various ratings - for this purpose I have selected the 20A version. It runs off a 5V Vcc supply and, rather annoyingly for this sort of application, is designed to measure current flows in either direction. It does this by setting the output at a nominal Vcc/2 for 0A. positive excursions from this baseline are current flow in one direction, negative excursions the opposite direction.1A of current flow is represented by 100mV change in output. 20A, which is the absolute maximum the amplifier should ever take, 16A or so being more commonplace, therefore represents a 2V excursion or (Vcc/2) + 2 = 4.5V. This is a problem, because the Teensy is a 3.3V device.
The simplest solution is a 5:3.3 potential divider, which can be realised with a 4k7 and a 9k1 resistor. This reduces the 0A voltage to 1.67V and 3.3V represents 24.44A at a conversion ratio of 1A = 66.7mV. Although the 3.3V maximum input should never be exceeded in normal operation it makes sense to protect it with a 3V3 zener diode.
Similar considerations apply to the 50V monitor which is fed via a 20:1 potential divider and again the input to the Teensy is protected with a 3V3 zener diode. At full power the VSWR outputs from the amplifier can reach around 5.5V so here a 2:1 potential divider is implemented.
Next I turned my attention to the fan control logic. The Teensy doesn't have any analogue output pins, instead using pulse width modulation (PWM) to vary the average output voltage. All well and good but fans don't much care for 3 kHz square wave power supplies, so some fairly aggressive smoothing is required. Fortunately this is easily achieved once you know that you need to do it. a 47uF electrolytic on the base of the driver transistor works well with the series resistor to reduce the ripple to about 100mV. The fans are now much happier!All of this has resulted in significant change to the circuitry and, of course, the resulting PCB layout. I think I am getting close to the finished design and it may be time to think about getting the first PCBs produced. I can hold off for another week or two because hopefully some time soon the metalwork will turn up and I can get on with that aspect of the project.
I've also put some effort into screen layout design for the control head. This is as much art as it is engineering, in that we want the finished article to look professional and pleasing to the eye, while also being functional, with good ergonomics. Inevitably there will be multiple iterations but, of course, this is just software, so it is easily changed, unlike committing to a circuit and having the PCB produced.
Anyway the image shows where I am at in my thought processes so far. This is the main "operating" screen. There is a startup screen and a maintenance screen with diagnostic information... yet to be designed.
No comments:
Post a Comment