• Upgraded Everyting

    Drew Pilcher03/08/2023 at 22:00 0 comments

    I've made a lot of changes to the system since last post. Here's the system now:

    New Automatic Transfer Switch:

    First, I abandoned building my own automatic transfer switch. I decided I didn't want to worry about designing a part so safety critical. Instead I bought one off the shelf. It turns out they're not very expensive. This one was 28 USD on ebay. It doesn't seem to have a part number...


    I wired it up so that the inverter is the primary source, and the mains is the backup. The system can now power the freezer as much as it's able, and if it runs out of juice the freezer will simply switch over to mains. At some point I would like to be able to set the voltage at which this happens, instead of relying on the cutoff of the BMS or inverter, but so far so good.

    New Battery:

    When I tested running the deep freezer on battery power, I found that it cut out with a lot of power still remaining in the lead acid battery. The inverter would be tripped off, and the battery would still be reading 12V.

    I think what was happening is that due to age or just the battery type, it was sagging a lot under the 500W load that the deep freezer applies on startup.

    I started looking for a second lead acid battery to both increase the capacity, and reduce the droop under load. However I was dismayed to see that not only were suitable batteries hard to come by, their price per kWh is now HIGHER than lithium-ion, despite being worse in every single way.

    Rather than throw good money after bad, I decided to ditch the lead acids all together and switch to lithium ion.

    I bought a box of 100 new and high quality Samsung (INR18650-33G) cells from BatteryHookup for 201 USD.

    Combined, they have 1134wh of energy, and 321A max discharge current at 12V.

    My original lead acid by comparison is only 720wh new. Is rated for 330A (which it certainly could not do for any length of time while maintaining its output voltage), and it costs 345USD new from mouser, maybe as low as 250 if I shopped around. In short its lower capacity, heavier, and more expensive.

    Now, the catch is that I had to assemble the cells into a pack. I'm not going to lie this was pretty time consuming, since I made the pack totally custom. However in the future I think I'll be able to bang out a pack in 3 or 4 hours.

    I decided to go 3S33P. To make it a 12V pack. That's not ideal, because it means a LOT of current is required to get hundreds of watts out of it. However a 12V battery will be compatible with a much larger variety of gear. So basically I went with versatility over efficiency.

    Here's the completed pack with a Daly 3S BMS installed. It has a current limit of 30A continuous 60A burst. This is far less than the batteries are capable of, but its intentional. The interconnects have to withstand that current as well, and designing them to handle 300A would have been prohibitively complicated and expensive. The BMS was 30USD shipped.

    I could write a whole blog post about this battery but honestly it's been done a thousand times so what's the point.


    There is one feature that I would like to call attention to, because I think it's often overlooked. Noticed that I wired the balance plug in such a way that it can be disconnected from the BMS. This is important.

    When you store a lipo battery unused for many years, the BMS can greatly accelerate the self discharge of the battery, eventually leading to damaged cells. I have found that with no BMS, and at a storage charge of 3.75V per cell, lipos age extremely well. I have lipos that have been stored this way for 10 years without maintenance, and they seems as good as new when I put them to use. Try that with some "protected" powertool battery... Therefore, it was important to me that if I ever take this battery out of service, I should be able to store it the same way.

    The connector on the battery is an XT90 (rated for 90A). I use XT60s on my drones and I've found them to be very reliable, easy to connect/disconnect, and not...

    Read more »

  • Detecting mains voltage with an arduino safely

    Drew Pilcher09/04/2022 at 08:00 0 comments

    Right now I'm working on building an "automatic transfer switch". This device will switch the load from my solar system to mains if the inverter shuts down.


    I'll document that in another post, but one problem I had to solve to make it work was to detect the line voltage with an arduino.

    At first it sounds pretty simple right? Reduce the voltage with a resistor divider, then rectify it with a diode and a cap.

    But the issue with this is I have 2 inputs, and for electrical safety I want to switch the hot AND neutral. That means I need some kind of isolation if I want my arduino to be able to monitor both.


    Here's the solution I came up with using parts I had lying around:

    It's an opto-coupler utilizing a phototransistor and a neon lamp instead of a LED. Although the lamp is fairly dim, it produces a good response from the photo-transistor. I used this arrangement with a 680k resistor and a 5V power supply:

    I don't know the photo-transistor part number because it was just something from my junk box, but the lamps were still in the bag; the part number for those is GT-NE6S1325T


    I'm not going to lie, I forgot neon lamps need current limiting resistors (150k for this one), and the lamp exploded instantly the first time I tried it. Luckily, I did have the foresight to put on safety glasses before flicking the switch on a circuit connected to mains. :)


    With the circuit tested, I assembled it like this:


    Then I added the following layers;

    • Heatshrink on the individual wires, especially the mains ones (not pictured)
    • Clear heatshrink over the whole assembly (not pictured)
    • A layer of aluminum foil over that. Both to block ambient light, and reflect light internally:
    • Then a layer of heatshrink with internal adhesive (to add some rigidity):


    I tested the module again after assembly and it works perfectly! I might need some filtering of the output signal if it has a 60Hz flicker, but my multimeter reads it just fine.

  • Proof of Concept

    Drew Pilcher08/17/2022 at 08:32 0 comments

    I started with the following components (prices include shipping):

    2x L02M100N-1 monocrystalline solar panels from ECO-WORTHY. $90 each. Mine have slightly different specs due to being purchased a year apart.

    1x PG-12V55-FR Powersonic 12V 55Ah Sealed Lead Acid Battery. $120 Old but unused from ebay.

    1x Tracer1206AN Epever MPPT Solar Charge Controller. $49 from ebay.

    1x PS-1200JCR Giandel 1200W Sine Wave Inverter. $200 from amazon.

    Basic math:
    The chest freezer draws an average of 40W continuously (tested with a kill-a-watt).

    Dividing by the 90% max efficiency of the inverter gives 45W

    For approx 16 hours a day the system will run on the lead acid batteries. Estimating the efficiency of the batteries is difficult. I believe it varies a lot depending on the range of the battery charge you're using. Lets assume 80%.

    (16h * 45W / 0.8) + (8h * 45W) =  1260Wh per day required from the solar panels

    Assuming and average battery voltage of 13V. 16h * 45W / .80 / 13V = 69 Ah per day from the batteries.

    Each solar panel produces 100W nominally for approximately 4 hours per day (depends on geographic location and climate). That's 400Wh per panel per day.

    The charge controller claims "up to 98% efficiency" which is probably not realistic. Lets call it 90%

    Each panel therefore produces 360Wh per day. So I would need 4 panels.

    Getting started:

    My proof of concept was to simply hook everything up and see if it works. Meaning it can charge the battery and power the freezer at least briefly.

    I decided to located the electronics in the basement instead of near the panels to make the system easier to tinker with.

    I used an extension cord to carry the DC from the solar panels inside. Including an extremely jankey connection under the panels which I need to replace asap.

    Conclusions after testing:

    • The system is able to power the fridge for several hours (I didn't time it exactly). Battery capacity needs to be increased, as expected.
    • The battery charges fully over the course of a day. Although the voltage
      cutoffs don't allow the full nameplate capacity of the battery to be used.
    • I probably need a different charge controller, as my current one can only charge at 10A. That's only ~130W.
    • The 1200W inverter is important. Even though the freezer only draws 40W. I tried running it on a 400W non-sine wave inverter, and it tripped instantly every time the freezer tried to start.
    • I believe I witnessed exactly why they say not to restart a compressor cooler within 3 minutes of powering it off (Apparently it can cause the compressor to try to spin in reverse). Well, when you do that it doesn't make any sound, but the freezer starts drawing 500W! instead of the usual 40. I will need some kind of circuit to prevent this from happening if the inverter trips, or a switchover to mains occurs.
    • I've been manually swapping the freezer between solar and grid power, but it's quite annoying because of the 3 minute wait. I should build the switch over circuit soon.