Browsed by
Category: MISC

A Simple 24V Li-Ion Battery Low Voltage Disconnect W/ Hysteresis Using Six Parts

A Simple 24V Li-Ion Battery Low Voltage Disconnect W/ Hysteresis Using Six Parts

I was at Lowes the other day and I saw their new 24V Kobalt tools. With a great surprise they sell a low capacity 24V Li-ion 1.5A/Hr battery for $10.00.

Wow! I was hooked I bought a the starter set with the drill and 1/4 inch impact driver with charger and a battery for $119.00 and 3 of the 1.5A/hr batteries.

I am excited about having these low cost Kobalt 24V Li-ion batteries since they will be more useful as power sources for other projects. I quickly designed an adapter on the laser cutter out of acrylic that I could plug into the battery.


Kobalt 24V Battery clip design
Kobalt 24V Battery clip designed in Inkscape

First project to use the battery pack on: A dual USB power outlet and an 800 lumen LED light

I installed a DC-DC boost board to produce the 28V needed for the series LED string and a DC-DC buck to produce the 5V needed for the USB ports.

Great it works, lets test it.

Wow runs for about 3.5 hours with the LEDs running.

Doh it runs the batteries below their critical cutoff point of 15V. Yikes this will destroy the batteries in no time.  (apparently these batteries do not have a low voltage cutoff built into them)

Hmm time for a low voltage cutoff circuit. So here is the simplistic circuit that I came up with: It cuts the battery off at ~18.2V and then with a little hysteresis it will turn back on again at 19.8V I figured this was a good trade off. This is simulated, I am ordering the parts to see how the circuit will perform. I plan on using a TLV431 since it will use less current to function and the PMOS will also be a different part. Edit: I just looked at the datasheet for the TLV431 and it is a low voltage part so a nogo there.

Circuit description:

TLV431 2.5V reference

R1 and R2 form a divider for 2.5V (the switching point of the TL431)

R3 Bias for TL431 and PMOS Gate

R5 creates the hysteresis ( this is so that we do not oscillate when switching the battery off )

R4 is just a simulation load ( this is where your battery powered circuit will be )

M1 is a P-CH MOS FET sized accordingly for the load. ( I like a low rdson value and at least 2x the voltage for the rating so 48V or greater PMOS)

V1 is a simulation voltage source that is programmed to run from 24V @0.0S to 18V@0.5S then back to 24V@1.0S

Red Trace is simulation load current, Green trace is simulation Battery Voltage site copy site copy


I have not had a problem with my faithful Pinzgaur 712AMB since I bought it more than five years ago, but the winter in Colorado has been very harsh for the last several weeks with many negative temperature days and my Pinz has finally failed me. I remembered that the best site on the internet for the Pinzgauer 710 or 712 repair information was made by K. Jürgen Schöpf, but the site has lapsed since he sold his Pinzgauer. I was saddened by the loss of this great information site, so I contacted Jürgen and and he gave me permission to put up a copy of the site. So here it is live once again on the Mad Scientist Hut site:

I will be editing some of the pages when I get some time to remove some of the dead links and to try and make navigation a little easier. If anyone wants to add more info or correct something wrong  please contact me at:




Lessons in measurement error

Lessons in measurement error

I built a tachometer for the milling machine, as a step in giving the cnc controller full spindle control (auto-change with tool change, and sense when it’s stalling.)  The first version uses an arduino and this code:

The sensor is a mouse encoder wheel LED/phototransistor pair, with a turned aluminum disc that has a hole drilled in it, as the encoder itself.

(You may ask why I’m not using an AS5040.  That’s the wrong tool for the job, since it senses position rather than just rotation, and the encoder wheel I just cut fits right on the hollow mill spindle, which provides no easy place to put a magnet.)

Anyway.  The arduino code works fine.  The schematic, however, has a problem: if you wire it up just as this says, the phototransistor output is always at about Vcc: the analog input to the arduino measures between 1017 and 1023 no matter how carefully you block the phototransistor.

But the moment you go to measure the voltage coming off the phototransistor with respect to ground, it works perfectly: any bit of anything blocks the lightbeam and the output goes to a fraction of a volt.

The meter’s input impedance drags down the output and makes it work.  It’s hard to troubleshoot something that works when you’re measuring it, and only doesn’t work when you’re not measuring it.

A 1 megohm resistor between the output and ground makes it work great.

optical tachometer schematic
optical tachometer schematic


Tomorrow I’ll add an LCD rather than having to keep a laptop in there to see the RPM, and a bit later I’ll turn the whole thing into a standalone board on the back of the LCD, but for the moment this will do.


usb sniffing using wireshark

usb sniffing using wireshark

A while back Kirk gave me a webcam that has pan and tilt control. It works well under Windows. But I’m a masochist — and I already have a weather station + insolation + multiple temperature measurement setup for an old linux laptop, and I thought it’d be nice to add a pan&tilt webcam to the mix.
The webcam is a Creative Live! Motion cam. It uses a standard ccd for which drivers are included in the mainline kernel so camorama et al can get video from it natively. But that doesn’t handle motion.
Soooo I fired up wireshark, preparing to copy these guys:
who reverse-engineered the screendump program for an oscilloscope (and found that the scope actually dumps a nice full-color high-resolution screencap that the stock software degrades to a small monochrome picture.)

So I installed XP in virtualbox, installed the cam drivers in XP, and fired up the camera.
Problem 1: no USB. I solved this by running virtualbox as root.
Problem 2: XP crashed the moment I tried to do anything with the camera. I solved this by starting virtualbox as root, and doing the whole XP install from that — just copying over a VM made as a user didn’t do it.
At this point the camera is stable in XP.
Problem 3: wireshark crashed the camera connection. As soon as wireshark came up, the USB stream got broken.
My friend Brian pointed out that other people have had problems with old versions of libpcap, upon which wireshark relies. Turns out even recent versions of Ubuntu and Mint have wireshark packages from 2007.
Independent repositories to the rescue: ppa:jelmer/daily will provide you with (as of right now) wireshark 1.4.2 rather than the stock 0.9 and that has a libpcap that works beautifully.
So now I can drive the video camera around, taking pictures, and logging usb commands. I can look through the packets — ignoring the 64kbyte ones, that are just chatter between the computer and the camera and analyzing the packets that are larger than that — and start figuring out how I can copy them.

That’s as far as I’ve gotten so far, because now I’m learning how to use wireshark’s filters so I can have it show only the differences between sequential packets.