Saturday, September 26, 2015

RC car build and trouble with motor driving

Sometime in the early 90s I bought a Taiyo Fast Traxx Pick-up RC car. The special thing about it was, that instead of wheels it had two rubber tracks. It served me well, until one day about 20 years ago the electronics crapped out. I never threw it out in hopes of repairing the electronics some day.
Turns out the electronics were basically all custom parts, or at least with custom markings. I didn't want to start figuring all that out, so I decided to build new electronics from scratch. Basically I just needed two H-bridge motor controllers and a radio receiver.

The motors were running quite poorly after all the years in storage, so I cleaned them by running them in a bath of CRC 5-56. It turned out that the motor had quite low armature resistance (around 0.5 ohms), i.e. they would pull huge currents if stalled (in the order of 20 amperes from the original 9.6V supply). This was surprising as the original controller was just on-off and to handle the stall current the switching device would have needed to have a very low on state resistance.

As the only H-bridge drivers I had in my junk box were L298s, I decided to use one of those. I planned to limit the current to acceptable levels just by limiting the pulse width of the enable signal. Also, the L298 has high saturation voltage in the switching transistors, which also helps to limit the current.

For the receiver, I wanted to use one of my "receiver v3" boards. Those were designed to drive standard servo motors at 50Hz frequency and between 1 and 2 milliseconds pulse widths. This application would need much higher frequency and also higher duty cycles. Due to the way the receiver board was designed, the duty cycle would always be limited to at most 50% when driving two channels, but that was enough for this application and wasn't a problem. The frequency could also be increased easily to 1kHz.

After building everything on a proto board I did the first test. The motors didn't turn. The L298 just couldn't drive the motors. The IC just got really hot even with a large piece of aluminum acting as a heat sink. So back to the drawing board it was...

Figure 1. L298 based dual H-bridge driver, which was a complete failure. Receiver is not in the picture, but it would mount upside down in the black female pin headers.

I decided to go simple with the build. Just a single N channel MOSFET switching the current and perhaps to do the reverse later using a relay. I had some FDD16AN08A0 FETs laying around in my parts bin and wanted to use those, but 3.3V gate-source voltage isn't enough for those. The highest current capability FETs I had that could be driven with 3.3V were CEG8205. They are TSSOP-8 packaged, which makes them really awkward to use on a proto board, so I didn't go with that and instead used two Si2302s in parallel.

First test with the motors goes well, when powered from my lab supply. The motors turn, but not very fast as the lab supply doesn't provide much current. Happy with the way everything is working, I test it out with a battery. Now the motors are running much faster and the whole thing seems like a winner. Then, all of a sudden, flames and smoke. I quickly disconnect the battery. The transistors have gone up in smoke (this incident also took out the processor, the radio module and the 3.3V regulator on the receiver board). I find this odd, as the two Si2302s in parallel were supposed to be able to handle 5A of current.

Figure 2. Burn marks on the phenolic board after the transistors caught fire.

I went back to the CEG8205s, so I bodged them on some SO-8 to DIP breakout boards I had, and soldered those on the proto board. With both channels in parallel they should be good to 9A. Testing on the lab supply again, I slowly turn up the power on the controller and the motors start slowly turning. Then suddenly one of the FETs starts to smoke. It took some time for me to understand how a 2A limited power supply was able to destroy a 9A rated MOSFET, but I think what happened was that when the current limit of the power supply kicked in, the output voltage dropped suddenly. This in turn reduced the gate-source drive voltage of the FET, which then wasn't enough to achieve a low channel resistance. The 2A current through the channel was then enough to destroy it. After this incident, I increased the brownout threshold of the processor to 2.7V, which should still be high enough for an acceptable channel resistance.

After all this and more (for instance playing around with the drive frequency and measuring waveforms), I still couldn't get the thing to work. It would work for a while and then a FET would die. I then got fed up and added a 74HC04 to level shift the drive waveform to 5V and switched to the much larger FDD16AN08A0 FETs. Even still, the FETs would get so hot that the solder would start to melt! I couldn't believe it. This is when I realized that although the average current through the channel was limited to 2A by the power supply, the maximum current could be much higher. This could result in a much higher average power dissipated in the device than what would be inferred from the average current. I was working under the assumption that the motor had significant inductance, and due to it the current would remain approximately constant (or at least not shoot to insane values) during the switching period. I had experimented with rising the switching frequency up to 8kHz, but didn't have any luck with that, so the inductance had to be really small (in fact my poor man's LCR meter measured it at less than 10uH).

I found some high current 100uH inductors in my parts bin and put those in series with the motors and everything just started to work! Motors run faster, FETs run cool. I even tested with the L298 driver board I first made and it is now capable of getting the motors running (however they give too little torque and don't run very fast, so I still can't use that).

Figure 3. The RC car assembly with FPV gear.

Figure 4. Close up on the quality of workmanship. I didn't bother redoing the board after replacing the CEG8205s with the FDD16AN08A0s. I just bodged them onto the breakout boards.

Figure 5. Close up on the 100uH load inductors. Secured down with hot glue.

Thursday, September 17, 2015

Bluetooth modification for Ferrograph Aurora 63

Some time ago I got a Ferrograph Aurora 63 LED display. Its a 16x135 matrix of dual color (red/green) LEDs. It has the custom XDF firmware installed, which allows it to be controlled using the well documented Alpha Sign protocol. The commands are given to the display through either RS422 or RS232.

Figure 1. The panel displaying a message on my work bench.

As RS232 serial ports are quite rare today, I decided to modify the display to use Bluetooth instead. The display uses a MAX232 level shifter for the RS232 communication. That is, to shift the levels between the higher voltage RS232 levels and the TTL compatible logic levels which the processor of the display (Z180) uses. My idea was to make a Bluetooth module, which would act as a drop-in replacement for the MAX232 chip.

I have some HC-05 Bluetooth serial adapters on breakout boards (ZS-040) from eBay, which I planned to use for this project. These modules use 3.3V CMOS logic levels. The output from one of these can be directly fed into the TTL compatible input of the Z180 and it will function properly. However, the input pin on the Bluetooth adapter is not 5V tolerant, and the output from the Z180 would damage it. I used a simple resistor divider (12kohm:22kohm) to bring the voltage down from 5V to 3.3V.

Figure 2. The resulting module. I used horrible phenolic paper prototype board.

Figure 3. Module installed in place of the MAX232 chip. It is difficult to open the thing up for a better photo, sorry.
I was worried that the aluminum chassis of the display would block the radio signals, but this thing works all the way from the other side of the house. Now to just mount it on the wall and write some software to display useful information on it :-).

Update 2020/05/17

Some people have asked for the schematic for my MAX232 replacing module. I didn't publish it here originally, as I didn't have one. The thing was just improvised at the time. I've since drawn the schematic, so here it is.


Tuesday, September 8, 2015

Lab power supply repair

I have four Mc voice/Mc power NG1620-BL power supply units. These are the absolute cheapest lab supplies I've found with adjustable voltage and current (I bought mine from thiecom.de). They are not very high power with their 0-15 V and 0-2 A range, but they fit most of my needs. Also, as they are floating supplies I connect them up in series and parallel when needed.

Left running for several days, one morning I noticed one of them showed 9V on the meter when it should have been around 5V. First I suspected a meter fault, but I confirmed that the output voltage was indeed 9V. Good thing the device it was powering had its own regulator, so the supply didn't take anything with it. I've had the main filter capacitor fail in one of the other units, so I suspected it had gone bad in this one too. I replaced it, but the problem persisted.

The unit supplies 9V even when the voltage is adjusted all the way down. If the current limit is increased, the voltage increases also, independent of the voltage pot. Voltage rises to over 20V if the current limit is adjusted all the way up. There doesn't seem to be any obvious sign of damage anywhere, so I need to check things more carefully.

I couldn't find a schematic online so I decided to trace it out myself. I might not really need one for this fix, but I've wanted to have the schematic even before anything got broken. I first took photos of the top and bottom side of the PCB and then planned to superimpose them into the same image to see both the components and their connections. Luckily the PCB is one sided, as this helps a lot while tracing the circuit.

Figure 1. Top side of the PCB.
Figure 2. Bottom side of the PCB.

Figure 3. Top side image overlaid on the bottom side image.

The overlay turned out quite good. I didn't go out of my way to align everything. I just corrected for the perspective of the board in the photos and scaled the resulting images to the same size, and placed them on top of each other (of course mirroring the bottom side image). This was done using GIMP.

The board isn't the best construction quality, though it could be much worse. The soldering quality is quite good apart from some of the components having quite long leads (the burnt flux residue is from replacing the filter cap as I didn't clean the board before I took the photos). My main problem with the unit is however the dubious mains insulation. They have shrink wrap tube around the connections, but it has been applied sloppily and the connections are exposed in many places. The main chassis is properly earth grounded, but I'm not confident that the cover shell makes good contact as the parts are painted. Furthermore, the chassis has ventilation holes, which could easily pass a loose wire end inside in a messy workbench environment... I'll need to do something about this.

Figure 4. Raw traced schematic.
Figure 4 shows the schematic I traced out. I might still arrange it in a better way and re-draw this in Eagle. An important notice is that GND and the positive output terminal T+ are connected. The main electronics power supply thus always follows the output voltage and produces +12 and V- around that rail. The negative output terminal is basically what gets controlled.

The main voltage loop seems to be run by the LM741 (N1) and current limit is done using a single channel from the LM324 (N2). One extra channel from the LM324 is used to switch the secondary winding for the main power stage. Two channels of the LM324 (N2) are unconnected. There is something weird connected to the offset compensation pins of the LM741 (N1). Perhaps that motivates the use of an additional opamp instead of just using one extra channel from the LM324 (N2).

Before any probing around, I insulated all exposed mains wiring with hot glue. After that I started by checking the reference voltage, which was spot on. Then I checked the +12V rail, which again was spot on. Checking the V- rail I saw 25Vpp oscillation at mains frequency. This rail drives two shunt regulators to provide the negative voltages to the opamps, and is thus quite heavily loaded (not because of the opamps that is, but because of shunt regulation). My first guess was that the filter capacitor of that line (C2) might have gone bad. After removing the capacitor, a quick check with my multimeter revealed a significant loss of capacitance. I replaced the capacitor with a similar spec one, though with slightly larger physical size. Power on, and the device had come back to life.

Checking the failed capacitor with my ESR meter I got 6000 nF of capacitance and 18 ohms series resistance. That is significant. I also replaced the two other identical capacitors in the circuit (C1 and C3), although they both read fine on the meter (oddly enough, they were even better than the ones I used to replace them).

I probably wouldn't have needed the schematic for this, but having it at hand really allowed me to search for problems systematically and by publishing it here there is the remote possibility that others might find it useful as well.