Saturday, April 30, 2016

Off-grid Electric Arc Furnace

I found this on the King of Random youtube channel. It is very interesting and has lots of uses. This particular version uses two microwave oven transformers on 240 VAC. This outputs about 20 to 40 volts at about 40 to 80 amps.

But, instead of using transformers and wall power, what if you used two reclaimed car batteries wired in series? And, what if you charged them with solar? This would make for a great off-the-grid metal furnace. And, with car batteries and bigger electrodes, you could have a much bigger furnace.

Sunday, January 17, 2016

Battery Desulfator - Capacitive Voltage Divider

A few years ago, I posted this video showing my first crude battery desulfator.

This works like a champ, but I wanted to point out there is a few ways to make this safer. The one in the video had no protection and it put out up to 170 volts pulsed DC at 1.1 amps. This one MUST be connected to a battery when you turned the power on.

I wanted to make it safer and limit the voltage to about 55 volts. This is done without a transformer and uses just run-type capacitors. You could also use a transformer, but, hey...this is just interesting. Besides, you can swap out capacitors to get different currents. Also, a transformer isn't constant-current like this circuit.

Update - the fuse should be on the hot side.

The top capacitor basically controls the amperage. This one would be 1.1 amps at 120 VAC at 60hz. The bottom controls the voltage. If the bottom capacitor is rated the same as the top, then the output will be cut in half. In this case, there is 120 VAC coming in and the output will be one-third of the input, or 40 volts AC. Actual DC is 1.4 times the AC value, so the full-wave bridge's output will be 56 VDC pulsed at 120 times per second.

Here is a real-world example. Let's say you have lots of 25 MFD run-type capacitors that you picked up from the local HVAC shop. You could use 5 of them as shown below. This gives you one fifth the input voltage that goes to the rectifier.  If you start with 120 VAC, this gives 24 VAC to the rectifier. Multiply that times 1.4 and you get 33.6 VDC. This example could charge any lead-acid battery up to and including 24 volts with no problem. It would do it at 1.1 amps.
Update - the fuse should be on the hot side.

IMPORTANT: This is not a smart charger. It will keep trying to charge a battery and it is like the terminator, it will not give up. You have to monitor the battery voltage and fluid levels. You don't want to overcharge or dry out the cells. OR, you could use an Arduino to monitor the voltage for you and switch this circuit off with a relay.

Sunday, January 10, 2016

Arduino: Micro Processing Renewable Energy - Part 4 - Control the BIG stuff!

Control the Big Stuff

I have always been amazed that a little fragile computer chip, that could easily fry from static electricity, could control a massive 400 amp solenoid to activate a dump load for a massive wind turbine. I'm just as impressed when that little processor switches on five 60 watt light bulbs.

In this fourth and final installment, I'll be discussing how to pull this kind of thing off. Before you know it, you'll be controlling the big stuff.


The Arduino can only handle a maximum of 40 mA of current on its output. This would work for a small relay, well, except for the fact that the Arduino's output is only a maximum of 5 volts. And, I really hate to push the Arduino like that. It just generates a bunch of heat and is more likely to overheat with time. I love electronic circuits that run cool and efficiently. You know, those circuits that are reliable, not those circuits that fail after 2 days of use.

So, what we need is a way to take a 5 volt signal from the Arduino and input it into something that has a large resistance/impedance. That way, very little current is drawn from the Arduino and it continues to run cool. The trick is transistors.


There are many types of transistors, but I will just talk about 2 here; the bipolar junction transistor (BJT) and the MOSFET. And, just to keep it even simpler, I'll only refer to the NPN type of BJT and the N-channel MOSFET.

Basically, a transistor is just a switch. If you apply a small current or voltage (depending on which type) to the gate/base, it allows current to flow between the other two connectors.



The BJT of this size can switch about 500-600 mA of current max, but I wouldn't recommend that because it will get very hot. If you can keep it to about 150 mA or less then that would be perfect. A typical relay that this could drive would draw about 70-120 mA, which is perfect for this transistor. The circuit might look something like this.

To limit the current coming out of the Arduino into the base of the transistor, I used a 1k resistor. Since 5 volts divided by 0.005 amps equals 1,000, I used a 1k resistor.  The transistor will turn on using just a 1 or 2 mA or so. Even at 5 mA on the base, that should still switch at least 150 mA through the junction.

I also wanted to limit the current to the 12 volt relay from the battery. I picked 80 ohms to limit the current to 150 mA. The 80 ohm resistor isn't standard, so you can use a 81 ohm at 5% tolerance. Also, keep in mind that at 150 mA, the resistor would be dissipating 1.8 watts. You would have to use a 5 watt power resistor. The better option would be to use a fuse, maybe a 250 mA rated fuse.


Note that the MOSFET can be used the same way the BJT is used. The gate on the MOSFET has a high impedance so the 1k resistor isn't technically needed. But, I like to keep it just in case, mainly to protect the Arduino if something is not connected right, or the transistor shorts out internally after a failure.

I also placed a diode across the relay coils. When the relay turns off, the magnetic field collapses and a high voltage reverse pulse is released. The diode will absorb that pulse to protect the transistor.

But, you may want to just use the MOSFETS as a relay and skip the whole "moving parts" idea. Typical MOSFETS can handle 10 to 80 amps or so. They need to have good heat sinks attached for heat dissipation. You can parallel as many as practical. If you had a MOSFET that could handle 30 amps, then using 10 in parallel could handle 300 amps. You get the picture.

Small 5 volt relays

There is another option that should be mentioned here. A small 5 volt relay is available that can connect to the Arduino. If you use these, make sure they have (or you use) a freewheeling diode and optocoupler to protect the Arduino.

This particular example can be cycled 100,000 times and switches 10 amps at up to 250 VAC. The optocoupler ensures that the Arduino is protected. It basically connects the Arduino to the relay via light. It uses an LED that activates a photo-transistor, all inside a small chip. It also ensures that only a few milliamps will be drawn from the Arduino output .

I would not recommend paralleling relay boards, though. When they activate, they don't turn on at exactly the same speed. This means that one may turn on a few micro seconds before the rest. That one set of electrical contacts will be temporarily carrying the entire load. Let's say that you have a 100 amp load and you are using 10 relays each capable of 10 amp switching. Then, for those few initial micro seconds, one relay is carrying 100 amps. This will start to burn out the contacts, or worse, weld the contacts closed. That would be very bad for a dump load controller. It would drain your batteries and kill them. And we don't harm batteries here...not here...ever.

Sunday, January 3, 2016

Arduino: Micro Processing Renewable Energy - Part 3 - Measuring RPMs

Measuring RPMs

Let´s face it, sometimes we just need to know how fast something is spinning. Sure, we can eyeball it to some extent, up to a few hundred RPMs, but after that it becomes a little bit hairy. And, even then, it isn´t very accurate. The Arduino is perfect for quick and easy projects like this, when you just need to do some quick tests.

Measuring RPMs is basically just counting pulses per revolution over a given time frame and extrapolating out to one minute. But, what pulses and how do we do it? There are many ways I can think of, but two very common methods are used; hall effect sensors and optical (photo interrupters). So, let´s dive right in.

Hall Effect Sensor

A hall effect sensor works on changes in magnetic fields. Basically, if you have a magnet attached to the rotating object that you want to measure, every time it passes the hall sensor, a voltage is created on the output. The Arduino can detect the change and count it as a pulse. If you get 50 pulses per second, for example, that equates to 3,000 RPMs.

You can use a circuit board like this one and it will work fine. You could also use the hall sensor directly, as shown below. The 10k resistor is a pull-up resistor to keep the normal out put state high or close to 5 volts in this case. When the hall sensor is triggered, the output goes down.

Something to keep in mind is balance. Putting one magnet on a high speed rotating device might make it out of balance. You could consider putting two magnets on the rotor across from each other to balance it. Opposite poles could be pointing out to make the changes in poles more distinct and to give better accuracy.

Optical Photo Interrupter

This one is like it sounds, you are interrupting a beam of light. Typically, these use a rotary encoder disc which are discs with slots cut out.

The optical sensor sits straddled over the disk. A built-in diode shines a light while a photo-transistor senses that light. An On or Off signal is then generated for the Arduino.

Image courtesy of

Be aware that you don´t need a disc with this many slots cut in it, especially when measuring high RPMs. For low RPMs, the example above would be perfect and very accurate. But for higher RPMs, something like this would be much better.

Notice that you will get 3 pulses each revolution with the above example. But, you can deduce direction with it as well. If it is spinning clockwise, for example, you´ll get three pulses followed by a short pause. If it is spinning counter-clockwise, you would get a pause followed by three pulses.

Monday, December 28, 2015

Arduino: Micro Processing Renewable Energy - Part 2 - Measuring Current

Measuring Current

A microprocessor can't really measure current directly. It can only read voltage. There are many ways to create a voltage that can relate to a current. The most basic being a shunt. A shunt is just a known resistor that is used in the circuit to be measured. When the voltage drop across the resistor is measured, Ohm's Law can be used to solve for current.

V = I x R
I = V/R
V = Voltage
I = Current
R = Resistance

For instance, if you have a 1 ohm resistor in a circuit, and you measure a voltage across the resistor of 3.7 volts, then the current flowing through that resistor is 3.7 amps (3.7 volts / 1 ohm). That resistor would be pretty hot, though. Since power is equal to the current squared times the resistance, that resistor would be emitting 13.69 watts. A typical resistor that you would see on a small circuit board can only hand a quarter watt, so nearly 14 watts would blow a hole through it and shoot flames out its sides. Not a pretty picture.

Burning resistor as seen on
A more appropriate resistor would be like this 25 watt one.

But, that seems like a lot of wasted heat just to check the current. And the resistor actually limits the current slightly. What if we used a resistor with much less resistance? How about a 0.001 ohm? Then, every milivolt we detect across the resistor would equal one amp of current. For wasted heat, that would be great, only 14 mW instead of 14 watts. Wow, 1/1,000th of the original wasted heat.

There would be a problem though. The Arduino only reads 0 to 5 volts and it does it in 1,023 discreet steps. The lowest value it can detect after zero would be 4.9 milivolts or 0.0049 volts. You could only detect 0 amps, 4.9 amps, 9.8 amps, etc. Not a great solution. There are a few ways to compensate for this though; oversampling, op amp, hall effect, or use a different resistor at 0.01 ohm.


There are many scholarly articles written on oversampling, so I won't go into excessive detail here. I'll just cover the basics. In the above example using a 0.001 ohm resistor, we can only detect a change of 4.9 amp increments. This is because we are reading the voltage at a 10-bit resolution. But what if we somehow (magically?) used 14-bit resolution? That would be 16, 383 steps, each step to 5 volts would be equal to 0.0003 volts or 0.3 mV per step.

We can do that through oversampling. We just take multiple samples and average them to come up with a new, more accurate value. For instance, take a light in your house, that either turns on or off. That is 1-bit resolution. If you flick the light off and on and record those readings, you can then average 4 readings to get 2-bit resolution. Values would include 0, 0.33, 0.66, and 1.0. Another way to express that is OFF, 33%, 66%, and ON.

The rule of thumb is to accumulate 4^n 10-bit samples, where n is the desired extra number of bits in the resolution. For example, to get 14-bit resolution, that is 4 more than 10, so 4 to the 4th power would be 256 samples taken, then divide the result by 256. To get 16-bit resolution, take 4 to the 6th power (4,096) samples and divide by 4,096.

This approach works only because there is almost always some RF or electrical noise in the system to make minor variations occur while taking the samples. More info can be found at

Op Amp

Op Amp, or operational amplifier, is an electronic chip that takes an input and amplifies the output a number of times. In the above example of using a 0.001 ohm shunt resistor to measure current, we could just amplify the voltage reading to get something more appropriate to the Arduino. If, for example, 30 amps is the max current we expected, we could make that equal 5 volts to the Arduino input pin. The voltage drop across the resistor would be 30mV. So, we would have to set the Op Amp to amplify the output by 167 times.

Hall Effect

Many times you can buy a hall effect current measuring device that will measure AC and DC current in either direction. This one will measure 30 amps. There is a trick to make this 30 amp version measure much more. For instance, to double its capacity, just place a jumper wire across the terminals to shunt half of the current. You may have to experiment with the thickness and length of wire to use as the bypass, and you would also have to adjust a variable in your Arduino program to get the accuracy where it should be.


The simple solution to the initial problem is to use a 0.01 ohm resistor instead of a 0.001 ohm resistor. Instead of 1 mV being equal to 1 amp, 10 mV equals 1 amp. Since the Arduino can normally read in 5 mV increments, this would be good enough to measure current in half amp increments. At 3.7 amps, that would be 37 mV. The Arduino could only see 35 mV or 40 mV, so the resolution wouldn't quite be there. Your program would just have to report it as 3.5 amps.

Which solution to use?

Well, they all have their place depending on the scenario. I've used all of the above. One of my favorites is to mix the hall effect with oversampling. Then I add a shunt around the hall effect to up my current capacity. This gives me the best of all worlds, 14-bit accuracy with over 100 amps of measurement on a 30 amp hall sensor budget.