How to burn two bridges with one spark

Posted on July 25, 2013


The burned-out power bridge had been rebuilt, the joystick buttons had been repaired, the software had been tuned, the Trike was running and the moon was shining upon a black velvet sky. Why oh why did I insist on ironing out the last electrical bug?

Ever since the beginning of this project the I²C communication bus has been pestering us. Well, it’s not its own fault, it was designed to work between integrated circuits on the same board, centimetres apart. It was clearly not designed for medium-length transmission lines like we have here. But we are makers and hackers, we tend to misuse stuff, that’s part of the fun. 😉 Besides, the market-available power bridges only had I²C interface.

The problem at hand was that the 5.0V voltage that feeds the microcontroller in the MD03 power bridges jumps up and down every time the Trike pilot asks for full motoring/braking currents. This doesn’t happen on the Raspberry Pi end of the cable, even though it’s this end that provides that power. So it must be a bridge problem.

Every time there is visible wandering of this voltage, the microcontrollers will reset resulting in a motor “hiccup”. These hiccups are especially bad when the Trike is stopped and the battery is fully charged… we just never get it running unless we’re extra-gentle with the joystick.

But first, let me show you the circuit diagram of the Difftrike Proof-of-Concept as it currently stands (click to see full size):


Current state of the DiffTrike’s circuitry, slightly simplified on the “Main Relay” area. “SCL” is digital Clock, “SDA” is digital Data.

Notice that there is no ground (0.0V) connection to the digital bus side of the bridges. This is because the MD03 boards already have that connection inside them and I’m trying to avoid ground loops. Notice also the very large 6600µF capacitors present inside each bridge. They originally were 2200, but I added another 4400 to make real sure that the MD03 boards have all the spiking power they need and to avoid EMI noise from the power cables.

Having such large capacitors requires that a pre-charge resistor exists around the main switch, so that the capacitors charge slowly when we connect the battery. Otherwise when we turn on the main switch the capacitors draw a large instantaneous current that degrades them and the switch.

Regarding the 5.0V up-and-down problem, the “down” part was easy to solve, I added a couple of capacitors to the 5.0V bus on each bridge. But the “up” part became a bigger problem. So, at NJay’s suggestion and with a couple of LM7805 chips he provided me, I proceeded to isolate the 5.0V power supply of the bridges from the 5.0V supply of the Raspberry Pi and the I²C level-shifter. This would hopefully avoid strange currents flowing through the digital bus. Or maybe not. 🙂


My LM7805 hack on the MD03, piggy-back style.

It was all going very well in testing, so I went along and plugged in the MD03 modified with a LM7805. I plugged in the digital connector first because it’s easier that way. And after all, it’ just a couple of data wires, right? no power connections there. Here’s the schematics showing what I had in front of me (click for full picture):


“It’s ok, the batteries are disconnected and I’m only going to connect one wire”…

I had one MD03 fully connected on the Trike, and its capacitor bank was fully charged (and as usual, I had forgotten about this). I had another MD03 in my hand, and its capacitors where fully discharged. And the batteries where disconnected, so no power supply except for the caps. The green wire is the next connection I made: the positive power lead of the MD03.

TZAPPP!! you just lost 2 power bridges. Go back to the soldering lab and replace the microcontroller in each bridge, please. I tested the MD03 boards after that, the microcontroller cores work but the bus ports don’t. So they’re useless to me this way. And they warm up considerably, showing that there are fused short-circuits inside the chips.

So, how does this happen?… how can a capacitor discharge through just one wire?!… I had no ground connections anywhere, how the heck did the current find a way from one bridge to the other??

Well, there’s only one possible answer (click to see):


Don’t you know that Nature always finds a way? 🙂

The damned I²C digital lines, when the microcontroller is turned off, seem to be connected to the board ground plane (or probably they become connected when you force 24V upon a 5V chip). That’s where the current flowed through: the I/O pins of the micros. Both of them. Burned.

Ok, that’s another two weeks waiting around for a shipment of PIC16F872 chips, and another one or two weeks to carefully and patiently repair both bridges. So the Trike won’t run for another month. At least. 😦

Lessons learned:

  1. Always connect negative leads first;
  2. Always discharge ALL capacitors in circuit before disconnecting or connecting anything;
  3. I²C is not an inter-board bus (duh).

Next steps:

  1. Install a discharging resistor in the main circuit to guarantee the main caps lose their charge on switch-off;
  2. Repair power bridges (ugh…again);
  3. Electrically isolate the I²C bus lines between the RasPi and the MD03 boards (ideally).

Number 2 is going to be a pain, but number 3 is downright complicated. Oh well, just another day in homebrew R&D. 😉

Just remember: “if you’re not having fun, you’re doing it wrong.”