Projects

Replacing the BigTrak Electronics

Last updated: Jan. 28, 2012, 5 p.m.

Not a lot to see, this is a cheap PCB with an epoxy coated silicon-on-board processor.

Underneath the Original BigTrak PCB: Not a lot to see, this is a cheap PCB with an epoxy coated silicon-on-board processor.

Internally the BigTrak is a fairly typical modern toy, the circuit board in it with an epoxy covered ASIC in the middle looks like the main circuit board in any cheap radio controlled car. The motor driver H-bridges are built out of discreet transistors, but as the motors only draw about 25mA running current the transistors are nothing remarkable. Quite possibly the most expensive part is the 0.1" header that the keypad plugs into.


Probably the most expensive part is the 0.1" header, a pair of discrete H-bridges and a voltage regulator is all that you can see here.

BigTrak PCB: Probably the most expensive part is the 0.1" header, a pair of discrete H-bridges and a voltage regulator is all that you can see here.

I first looked at emulating the keypad with the BeagleBone to allow it to work exactly as the original toy did but via a web page. There were two problems with this, the first is that it was very inflexible, you couldn't just make it drive forward or respond like a radio controlled toy if you wanted to, the second was the real show stopper; the key scan algorithm was very complex. I'd expected something much simpler, along the lines of power each column one at a time and look at the rows. In fact it turns out it uses four inputs to monitor the columns and sends pulses along the rows after an initial press has been detected. Emulating this would have been very complex and would have only produced a limited functionality so I abandoned the idea.

A full replacement of the on-board circuitry was the new plan. Having looked at the motors with a multi-meter I found that the running current is around 25mA per motor and logging the surge current the multi-meter registered a max of 50mA. This is really tiny and any old switching transistors would do to drive the motors. For simplicity and size I chose to use a dual H-bridge IC, there are a few of these about but the L293D chip from TI has the advantages of containing dual power supply inputs (one for logic one for motor drive), two enable lines and internal protection diodes. Since the BeagleBone GPIO is all 3.3V I wanted to run all the logic at 3.3V to avoid accidentally damaging the BeagleBone, so I checked the input high level voltage on the L293 datasheet and found it's about 2.4V even though the logic supply has to be 5V or more. This is low enough to work with 3.3V CMOS logic so the chip looked ideal. Check out my H-bridge tutorial for more details about how they work and the features of different chips. The only passives I added to the motor driver chip were a pair of 0.1μF capacitors on the two supply lines. Wherever you have digitally switching ICs it's a good idea to put a bit of local decoupling to keep your power supply fairly clean. I used the three AA batteries from the original BigTrak to power just the motors in my modified design. It helps keep the system noise low to have a separate motor supply, and those three AA cells wouldn't be any good for powering the BeagleBone for very long. The connection of the two ground references (the motor and the logic ground) is done in one place with a nice solid bit of wire, this helps keep the noise down and avoids loops which can pick up lots of noise from the motors.

Circuit diagram of the opto-encoder to logic signal converter.

The other essential part of the BigTrak electronics that needed replacing were the two wheel encoders. These look like a couple of LEDs stuck around the gearbox. I took some measurements before I took the controls out and noted the voltage across the LED. This was only present when the motor was running so the control chip obviously turns off the LED when it isn't needed to save on battery. The voltage drop was only about 1.2V, next I put a multimeter in milli-amp range between the control board and the LED and noted the current was about 8mA. I didn't bother controlling the LEDs so I could turn them off and just wired them across the 5V rail. From the values I measured a 470Ω resistor was spot on. These are infra-red LEDs and you need to be a bit careful when driving them continuously that you don't over drive them as I've burnt some out in the past and it can take ages to find the problem as you can't see anything when they are working! The output side of the encoder had a very small amplitude square wave on it when the motors were turning. There are a couple of ways to turn this into a logic level signal, one is to use a comparator IC like an LM311 which provides a pull-down only output when one input goes below the level on the other input pin, so you can put a pull-up to any voltage you like on the output and set one input with a trim-pot to the "trigger-level". A much smaller circuit out of common parts though is a simple transistor switch. If you pull the photodiode high with a resistor (say 10k) then connect this to the base of an NPN transistor the transistor will be on when the photodiode isn't conducting (i.e. base pulled high) and off when the phtodiode is conducting (i.e. base pulled low. Add a pull-up resistor to the collector of your NPN transistor and you get a logic-level square wave output that should easily trigger an interrupt input on a microcontroller.

The power supply, motor driver and opto encoder transistors all crammed into the chassis.

Internal Circuits: The power supply, motor driver and opto encoder transistors all crammed into the chassis.

The final part of the circuitry included inside the BigTrak body was a switch mode power supply based on the LM2576 regulator chip. A standard linear regulator (e.g. 7805 or LD1086) essentially works by dropping the unwanted excess voltage across a resistor, this means power is lost as heat. For example if you have a 9V battery pack (six AA alkaline cells for example) and you regulate down to 5V you are dropping 4V in the regulator. If you draw a 1.5A current at 5V you will be needing 1.5A at 9V and wasting 6W (4 * 1.5) of power as heat. This is not only a lot of heat to deal with but also a lot of battery power going to waste. Using a switch mode power supply the desired voltage is achieved using PWM and an output smoothing filter so very little voltage is dropped in the regulator. There are some losses in practical systems but you can expect 80% efficiency in a well optimised system. So looking at the previous example where we need 1.5A at 5V, we would only need to draw about 1A from the 9V supply. Power out = power in * 0.8 so power in = (5V * 1.5A) / 0.8 = 9.375W and I = P/V so I = 9.375/9 = 1.0A. This isn't really an optimised implementation, I used a huge and over-rated inductor, while that improves efficiency it isn't very cost effective or space effective either. The main thing is it works pretty well and in tests it was stable down to a battery pack voltage of about 6.5V unloaded which is pretty impressive for normal AA cells. The LM2576 regulator is a 5 pin TO220 package so it doesn't really fit on stripboard well. I managed to carefully bend the legs outwards so it spans 5 rows which is simpler to wire up than the traditional staggered approach with a dog-leg in every other pin.

Downloads

Schematic

(st.com) LM2576 datasheet

(ti.com) L293D datasheet

Bill of materials bom.csv This is basically my basket exported from Farnell (UK)dummy, prices are in GBP and it comes to less than £20 ex VAT. Note this doesn't include the BeagleBone or ChipKit, and you'll need some bits of wire and a bit of stripboard to hook it all up.

Section:
Projects
Tags:
electronics,
robotics,
H-Bridge,
Toy hack,
power supply

Comments

Posting comments is not currently possible. If you want to discuss this article you can reach me on twitter or via email.


Contact

Email: nathan@nathandumont.com

Twitter: @hairymnstr

Links