Browsed by
Author: Kirk

A little help needed for the upkeep on the Mad Scientist Hut site.

A little help needed for the upkeep on the Mad Scientist Hut site.

Since most people use ad blockers:

I hope the information contained in the blog has been or is helpful to many people.  As I approach retirement I will not be able to fund the web server fees soon. Since I will be retiring soon I plan on starting to work on the blog section once again with many exciting projects, I have been absent on the blog since the corporation I currently work for owns everything you do including in your off time, they consider my home time work as their intellectual property….. If you could help with any donation amount (even as small 1$)  this will help keep the site up and running. See link below:

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

We Just Preordered a Glowforge Laser Cutter for $1995.00, 50% of the List Price

We Just Preordered a Glowforge Laser Cutter for $1995.00, 50% of the List Price

We just purchased a Glowforge laser cutter for 50% off of the list price as part of a preorder discount that will run for 30 days from Sept 24th

Use this link for another $100.00 off of your order, we also get $100.00 off if you buy one using this link!

We have been in the market for a decent laser cutter for some time now. The low cost option was to get something from China for about 1K with software that leaves so much to be desired  and hardware that is very questionable or you could spend 10K or more  on a US made laser cutter with some descent software and hardware.

See this great video:

Well here is what sold me on the Glowforge laser cutter:

  • US made laser cutter
  • Pre-order price is 50% off
  • The laser uses two cameras for alignment of the material, it takes a picture of the material on the laser bed, then lets you move the design on the material by just dragging it on the screen.
  • Any software updates are free forever
  • Cuts: wood, fabric, leather, acrylic, chocolate, delrin, rubber, etc…
  • Can cut from both sides using second high magnification camera to align the back die of the cut, which means you may be able to cut 1/2inch plywood.
  • You can draw on the material and it will trace your drawing using the laser (this was a major selling feature for me)
  • The laser automatically focuses up to 0.5 inches over the surface of the material as it is cutting ( also a major selling feature for me)
  • The work area is 12″x20″, this is a very usable size for me.
  • 40Watt zero mode (high quality, small spot size) CO2 Laser
  • sealed optics (no cleaning of optics)
  • no external cooling system
  • no external compressor required


Arduino 16 bit DAC: INL, DNL, Gain and Offset.

Arduino 16 bit DAC: INL, DNL, Gain and Offset.

Following on with step 1c from the article: Making a high resolution ADC from an Arduino Mini Pro

Well since the PWM output is only capable of 61069 steps, it really is not 16 bits, as 16 bit resolution would allow for 65535 discrete steps so I will call it a 15+ bit DAC.

Now that we actually have the DAC working, it is time to verify how well it works.  Here is a look at some of the data from the first unit I tested but first a quick description of how the data was taken for this: I set up the PWM to take a step approximately every 1.2 seconds. I programmed the PWM to start from zero then when it reached 61069 it would start back down again. The PWM output was fed through the 4th order RC filter. To take the DC value I used an 18bit measure system (over +/-10V) that was programmed to average a about 16,000 measurements every 950mS from the filter output.  We ended up with a total of 72064 data points over the 61069 output steps. Since I did not fully synchronize the data measured with every step taken the actual INL and DNL are approximate. The measured values I came up with for this Arduino Mini Pro board:

LSB = ~ 0.000076V (76uV)

INL= ~ 0.00225V (2.25mV)

DNL= ~ 0.0015V (1.5mV)

Min Measurement = 0.00313686V

Maximum Measurement = 4.64705V

Gain error = 0.928782628 ( Hmm.. this seems to explain the step response we were seeing on the scope capture in the filter article, when I was expecting a 409mV step and was seeing about 374mV on the scope)

Offset error =   0.00313686V

The DNL is really bad news. Why? Because it means effectively we are losing a little more than 4 bits of resolution. It is like this: From step to step there can be an error of 1.5mV so there is no point in looking for anything smaller than 1.5mV then for the full scale range of 4.647V divided by 1.5mV gives us about 3100 discrete values which is a little more than 11 bits of resolution. I really need to see if this is an inherent problem with the PWM generator design or if it is just an issue with this one device. So I will end up running this test again on another one or two more devices.

Below are graphs of the actual data for the first device, and also a copy of the raw data if you are interested in looking it over.

Here is a copy of the raw data, you will need office 2010 to open this since it has more than 65,535 rows of data




This is a graph of the measured data:

Arduino DAC Graphed output
Arduino DAC Graphed output











So our 15+ bit DAC seems to work pretty well.


To calculate INL We took the end points of the data and subtracted a linear line from the actual data taken and ended up with a worst case measurement of about 0.00225V or approximately an error of 0.5% of the expected programmed output.

Here is what the INL graph looks like:

Arduino DAC INL
Arduino DAC INL











To calculate  DNL  We just took every data point and subtracted the previous measurement and graphed the result. This resulted in about a 0.0015V error from measurement to measurement, really this is a pseudo DNL, this would work much better with a synchronized step to measurement.

Here is a look at the DNL graph:

Arduino DAC DNL
Arduino DAC DNL











So if you are wondering why is the DNL getting wider, lets examine the output a little closer.

Here is the output for several steps around 0.5V, looks pretty decent….












Here is the output for several steps around 2.5V, starting to see a real monotonicity issue here. I am going to take a guess that this part has some divider issue that is occurring on every forth step (it is the 3rd bit in the clock divider that may be does not do what is expected)












Here is the output for several steps around 4.5V and here it is getting close to the maximum output and where the worst case DNL was happening.