Most power supplies these days have overcurrent protection, but for those of us too poor for anything besides a Mastech & who were left with an ancient, unused 3DR BEC after the world migrated to DJI, there is hope.  Instead of hacking the Mastech to detect its current limiting LED, it was decided to make a standalone fuse which was fully programmable from a serial terminal. Merely plug the fuse into a USB port & it provides its own console interface. It requires 5V from the serial dongle. The load & power for the load are on a separate circuit from the fuse.

It was the 1st programming of an 8 bit PIC in C, with the official MPLAB. It was also the 1st use of a C program on a point to point soldered, through hole chip. All those years of assembly language with the free gputils & nedit weren't worth it. MPLAB on even a Mac is lightyears faster. It has all the navigation & autocompletion functions of other IDE's. It has handy displays of memory usage. The compilation & flashing is automatic. The crippled features of the commercial compiler don't matter. Many commercial products are made with unpaid versions of the compiler.

The fuse program used 80% of the PIC's 4k of ROM & 20% of its 256 bytes of RAM, but probably a lot more of its stack. It needed a few 32 bit operations to handle current & time conversions. It needed routines for persistent settings & a menu interface. It wasn't a huge amount bigger than an assembly language program.

The original idea was to have just a bag of analog comparators & RC timers. After LTSpice proved that to be very complex, it moved to a microcontroller with LEDs & a pot to set the fuse limit. There would be a table of pot voltages corresponding to current limits. When the parameters grew to a variable time delay & 2 limits, the design changed to a pure serial terminal interface implemented entirely on the microcontroller. Despite the need to be near a computer & to open a 2nd serial terminal, it's the most flexible interface.

The trick with the fuse was allowing a programmable delay. Current exceeding the limit can run long enough to power a motor movement before it blows the fuse, a very useful feature when developing motor controller firmware.  A 2nd limit is a hard limit that instantly blows the fuse. All the commercial power supplies have only a hard limit which instantly blows the fuse. Although the software has a limit to the limit of 15A, the Mastech only goes to 10.7A, so there was no way to test it. The fuse was only tested up to a 10A limit.

The maximum current detectable by the fuse is limited by the LM324's saturation voltage. The 3DR current sensor has a very low output voltage for current below 15A, so the fuse needs an LM324 to boost the 3DR's output. It was predicted to saturate at 15.4A. If the fuse is set to 15A, the LM324 may saturate below that & never blow. The fuse MOSFET may also overheat over 10A & fail closed. It gets smoking hot at 10A.

Another problem is the 3DR current sensor uses the load power to power its own op-amp. If the load voltage drops below 2V, the 3DR current sensor reports nonsense current values. Fortunately, the nonsense current values escape towards 8A as the load voltage drops, so the fuse blows for any load below 2V, as long as the limit current is below 8A.
The source code:

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones