Warnings

 

Keeping yourself and others safe when designing and making electronic projects

Read this information - it could save your life!

Electrical safety when creating DIY electronic projects

Danger electricity signMains voltage electricity is extremely dangerous. There is a significant risk of death through electrocution if mains voltage electricity is allowed to pass through the body. There can also be a risk of fire and explosion if electricity is not cabled and fused correctly. Therefore precautions must be taken when using mains electricity or similar.

There is a lot that can go wrong with electricity with potentially dire consequences. Some of these are obvious - NEVER use your finger to test for the presence of a mains voltage! - but others may not be such as heat-sinks that are connected to the high voltage connector of a triac. Read this page in full and ensure you think about all the aspects when designing your next circuit. If in any doubt seek out the advise of a qualified person.

Lead Acid Battery safety when creating DIY electronic Projects

Image result for lead acid battery warnings

Solar Online UPS

 

This article describes an Uninterrupted Power Supply that I have designed and built over course of one year.

 

My objectives for this UPS where:

 

Most UPS units are either Offline/Standby or Online.

 

In an offline unit the load runs off commercial AC and the batteries are kept charged by a battery charger. In an outage the UPS switches the load onto an inverter which feeds off batteries. When AC power is restored the load is switched off the inverter and back onto the commercial AC. The batteries are recharged. In this setup AC power is interrupted twice.

 

In an online unit the load runs off an inverter which feeds off the batteries which are kept charged by rectifiers. There is no AC power interruption.

 

The following diagram illustrates the main components of the UPS:

  1. Controllers.
  2. Input – rectifiers, solar panels, wind generator.
  3. Storage – batteries.
  4. Output – inverters.

 

 

 

Basic Operation

 

The inverters feed off the battery bank and provide 110V AC power to my house.

 

The battery bank is charged using rectifiers, solar panels and wind generators.

 

When the commercial power fails the inverters continue to feed off the battery bank until they are run down or power is restored. Any wind or solar power is utilized during the outage. When power is restored the batteries are recharged.

 

A small generator can be added to keep the rectifiers going on extended outages.

 


The image bellows shows my UPS as it at the time of this article.

 


Main Components

 

1. Controllers

 

There are two controllers – a charge controller and a system controller.

 

Charge Controller

 

The charge controller uses a PICAXE-28x 2 module purchased from https://solarbotics.com/product/28486/

 

This PICAXE-28X2 module contains a surface-mount 28X2(AXE201) chip, voltage regulator, download socket, and reset switch in a convenient 28 pin (0.6") format.

 

The Charge Controller is the heart of the system and its function is to keep the battery bank charged to 13.2V using rectifiers, solar panels and wind generators.

 

I mounted this module on a small circuit board as shown below.

 

To power the unit I used a few diodes wired in series to drop the voltage from the battery bank to around 7 volts. You can see the diodes in the yellow shrink wrap connected to a switch. There are also connections to a resistor divider to measure the battery bank voltage, a small 5 volt power supply to monitor commercial power outage and seven relays used to control the rectifiers, solar panels and wind generator.

 

The source code for the charge controller:

           

'Charge Controller for Solar Online UPS

'(c) 2015 - 2017 Larry Slavik

'laslavik.com

 

'Notes:

'converters refer to rectifiers

'

 

'define status values

symbol statusokvolt = 0

symbol statuslowvolt = 1

symbol statushighvolt = 2

symbol statusmaxvolt = 3

 

'define max converter count

symbol maxconvertercount = 8 'max converter states

 

'define pause times

symbol longpausetime = 400                 '1000 = 1 seconds

symbol shortpausetime = 200

 

'define output pins

symbol RelaySolar = 0

symbol Relay1 = 1

symbol Relay2 = 2

symbol Relay3 = 3

symbol Relay4 = 4

symbol Relay5 = 5

symbol Relay6 = 6

 

symbol RelaySpare = 7

 

symbol led = c.1

 

'define input pins

symbol pinhydro = pinc.0

 

'define adc pins

symbol readbattvolt = 0

 

'define temp storage

symbol readbattvoltstorage = w0          'b0,1

symbol avgbatteryvoltage = w1 'b2,3

 

'symbol calibadcsave = b4                    'b4,5

 

symbol floatvoltage = w3                      'b6,7

let floatvoltage = 350                            '13.2 volts

 

symbol maxvoltage = 385                     '15 volts

 

symbol convertercounter = b8   'b8,b9

 

symbol floatlow = w5                           'b10,11

let floatlow = floatvoltage - 15

 

symbol floathigh = w6               'b12,13

let floathigh = floatvoltage + 3  

 

symbol hydrostatus = b14                     'b14,15

symbol prevhydrostatus = b15

 

init:

 

            output c.1,c.2,c.3,c.4,c.5,c.6,c.7

            input c.0

 

            let convertercounter = 1

           

            prevhydrostatus = hydrostatus

           

main:   

           

            'average 3 readings

            avgbatteryvoltage = 0

           

            readadc10 readbattvolt,readbattvoltstorage

            avgbatteryvoltage = avgbatteryvoltage + readbattvoltstorage

           

            readadc10 readbattvolt,readbattvoltstorage

            avgbatteryvoltage = avgbatteryvoltage + readbattvoltstorage

           

            readadc10 readbattvolt,readbattvoltstorage

            avgbatteryvoltage = avgbatteryvoltage + readbattvoltstorage     

                       

            readbattvoltstorage = avgbatteryvoltage / 3

           

            'check hydro status

            let hydrostatus = pinhydro

           

            if hydrostatus <> prevhydrostatus then 

                        'send info

                        sertxd("h",#hydrostatus,13,10)

                        pause 10

                       

                        prevhydrostatus = hydrostatus

            end if

           

            if hydrostatus = 0 then   'hydro is on                  

                        'check for low or high float voltage

                        if readbattvoltstorage > maxvoltage then

                                    convertercounter = 1

                        else if readbattvoltstorage < floatlow then

                                    'increase volts

                                    convertercounter = convertercounter + 1

                                   

                                    if convertercounter > maxconvertercount then

                                                convertercounter = maxconvertercount                                                 

                                    end if

                        else if readbattvoltstorage > floathigh then

                                    'decrease volts

                                    convertercounter = convertercounter - 1

                                   

                                    if convertercounter < 1 then

                                                convertercounter = 1

                                    end if

                        else if readbattvoltstorage > floatlow and readbattvoltstorage < floathigh  then

                                    'do nothing

                        endif    

            else      'hydro is off, use solar only

                        'check for low or high float voltage

                        if readbattvoltstorage > maxvoltage then

                                    convertercounter = 1    'all converters off

                        else if readbattvoltstorage < floatlow then

                                    'increase volts

                                    convertercounter = 2    'just use solar

                        else if readbattvoltstorage > floathigh then

                                    'decrease volts

                                    convertercounter = 1    'all converters off

                        else if readbattvoltstorage > floatlow and readbattvoltstorage < floathigh  then

                                    'do nothing

                        endif    

            end if

                       

 

            'manage solar and converters

            select case convertercounter

                        case 1

                                    low RelaySolar

                                    low relay1

                                    low Relay2

                                    low Relay3

                                    low Relay4

                                    low Relay5

                                    low Relay6

                                                                       

                        case 2

                       

                                    high RelaySolar

                                    low Relay1

                                    low Relay2                  

                                    low Relay3

                                    low Relay4

                                    low Relay5

                                    low Relay6

                       

                        case 3

                       

                                    high RelaySolar                        

                                    high Relay1

                                    low Relay2

                                    low Relay3      

                                    low Relay4

                                    low Relay5

                                    low Relay6

                       

                        case 4

                                    high RelaySolar

                                    high Relay1

                                    high Relay2

                                    low Relay3

                                    low Relay4

                                    low Relay5

                                    low Relay6

                       

                        case 5

                                    high RelaySolar

                                    high Relay1

                                    high Relay2

                                    high Relay3

                                    low Relay4

                                    low Relay5

                                    low Relay6

                       

                        case 6

                                    high RelaySolar

                                    high Relay1

                                    high Relay2

                                    high Relay3

                                    high Relay4

                                    low Relay5

                                    low Relay6

                       

                        case 7

                                    high RelaySolar

                                    high Relay1

                                    high Relay2

                                    high Relay3

                                    high Relay4

                                    high Relay5

                                    low Relay6      

           

                        case 8

                                    high RelaySolar

                                    high Relay1

                                    high Relay2

                                    high Relay3

                                    high Relay4

                                    high Relay5

                                    high Relay6                                                                              

                                   

                        else

           

            end select                    

           

            'send info to PC

            sertxd("c",#convertercounter,13,10)

            pause 10

           

           

           

            'flash red led

            if hydrostatus =0 then

                        'hydro is on

                        toggle led

                        pause longpausetime

            else

                        'hydro is off

                        toggle led

                        pause shortpausetime

                        toggle led

                        pause shortpausetime

            end if

                       

            goto main        

 

System Controller

           

The system controller shown below is used to measure the wind and solar amperage and control other parts of the UPS. It uses a PICAXE-28 Project Board from https://solarbotics.com/product/28510/

 

I built a relay board which holds four relays. These are used to control a cooling fan and a master commercial AC cutoff switch.

 


The source code for the system controller:

 

'System Controller for Solar Online UPS

'(c) 2016 - 2017 Larry Slavik

'laslavik.com

 

symbol adcthermistorvalue = w0

symbol adcthermisteraverage = w1

 

symbol adcsolaramperage = w2

symbol adcsolaramperageaverage = w3

 

symbol adcvoltagevalue = w4

symbol adcvoltageaverage = w5

 

symbol ChargerACCutoffStatus = w6

let ChargerACCutoffStatus = 0

 

symbol GarageTemp = w7

 

'ADC pins

symbol pinVoltage = 0  ‘bank voltage

symbol pinThermister = 1

symbol pinSolarAmperage = 2

symbol pinWindGenVolts = 3

 

'input pins

symbol pinGarageTemp = 0

 

'Output pins

symbol pinfanrelay  = 0

symbol pinChargerACCutoff = 2

 

'Parameters

symbol fanonvalue = 500

symbol fanoffvalue = 480

 

init:

            ‘reset AC cutoff switch

            low pinChargerACCutoff         

            ChargerACCutoffStatus = 0

           

 

main:

 

            adcthermisteraverage = 0

           

‘average 3 readings

            readadc10 pinThermister, adcthermistorvalue

            adcthermisteraverage = adcthermisteraverage + adcthermistorvalue

           

            readadc10 pinThermister, adcthermistorvalue

            adcthermisteraverage = adcthermisteraverage + adcthermistorvalue

           

            readadc10 pinThermister, adcthermistorvalue

            adcthermisteraverage = adcthermisteraverage + adcthermistorvalue

           

            adcthermistorvalue = adcthermisteraverage / 3

           

            if adcthermistorvalue > fanonvalue then

                        high pinfanrelay

                        sertxd("f1",13,10)

                        pause 10

            else if adcthermistorvalue < fanoffvalue then

                        low pinfanrelay

                        sertxd("f0",13,10)

                        pause 10

            end if   

           

'send to PC                 

            sertxd("t",#adcthermistorvalue,13,10)

            pause 10

           

            'read wind generator volts

            adcvoltageaverage = 0

           

            readadc10 pinWindGenVolts, adcvoltagevalue

            adcvoltageaverage = adcvoltageaverage + adcvoltagevalue

           

            readadc10 pinWindGenVolts, adcvoltagevalue

            adcvoltageaverage = adcvoltageaverage + adcvoltagevalue

           

            readadc10 pinWindGenVolts, adcvoltagevalue

            adcvoltageaverage = adcvoltageaverage + adcvoltagevalue

           

            adcvoltagevalue = adcvoltageaverage / 3

           

            sertxd("g",#adcvoltagevalue,13,10)

            pause 10

                       

            'read battery bank voltage

            adcvoltageaverage = 0

           

            readadc10 pinvoltage, adcvoltagevalue

            adcvoltageaverage = adcvoltageaverage + adcvoltagevalue

           

            readadc10 pinvoltage, adcvoltagevalue

            adcvoltageaverage = adcvoltageaverage + adcvoltagevalue

           

            readadc10 pinvoltage, adcvoltagevalue

            adcvoltageaverage = adcvoltageaverage + adcvoltagevalue

           

            adcvoltagevalue = adcvoltageaverage / 3

           

            sertxd("v",#adcvoltagevalue,13,10)

            pause 10

           

            'check for overcharging

            if adcvoltagevalue > 390 then                ‘> 15V

                        ‘to reset, press the reset button on the charger controller

                        high pinChargerACCutoff

           

                        if ChargerACCutoffStatus = 0 then

                                    ChargerACCutoffStatus = 1

                                    ‘update PC

                                    sertxd("a",#ChargerACCutoffStatus,13,10)      

                                    pause 10                     

                        end if               

            end if

           

            'read temp

            'readtemp12 pinGarageTemp, GarageTemp

           

           

            'read solar amperage

            adcsolaramperageaverage = 0

           

            readadc10 pinSolarAmperage, adcsolaramperage

            adcsolaramperageaverage = adcsolaramperageaverage + adcsolaramperage

           

            readadc10 pinSolarAmperage, adcsolaramperage

            adcsolaramperageaverage = adcsolaramperageaverage + adcsolaramperage

           

            readadc10 pinSolarAmperage, adcsolaramperage

            adcsolaramperageaverage = adcsolaramperageaverage + adcsolaramperage

           

            adcsolaramperage = adcsolaramperageaverage / 3

           

'send to PC

            sertxd("c",#adcsolaramperage,13,10)   

            pause 10

           

            'flash LED

            toggle 1           

           

            goto main

           


A small 5V 1A converter powers all the electronics.

 


Both controllers are wired to a laptop using USB PICAXE Programming Cables. I have developed a Visual Basic program which takes input from the two controllers and visualizes the UPS operation on a laptop and stores data in a SQL server.

 

 

 

2. Inputs

 

Rectifiers

 

There are six rectifiers currently wired into the UPS. These units were built for the most part from salvaged battery chargers, microwave ovens and small UPS’s.

 

The transformers for three of the unit were made by rewinding the transformers from microwave ovens. These MOTS convert 110V AC to 2KV AC for the magnetron. I just cut out the secondary winding with a hacksaw and rewound the secondary with about 12 to 15 turns of 10 gauge wire until I measured 12 volts AC on the secondary. A little super glue on the secondary winding help quiet the 60 Hz hum.

 


You can see the modification in the next photo.

 

 

A 50 amp bridge rectifier is mounted on the underside of a heat sink. Cooling fans, capacitors and a 30 amp fuse complete the rectifier. I have three of these each putting out 20 – 25 amps.

 

Three more rectifiers produce 10 amps each giving me a total of 90 amps at 18 volts or approximately 1600 watts of rectified power. Right now my UPS load is 325 watts. This load consists of my desktop computer, two 23” monitors, router, modem, sound system and a security camera.

 


The rectifiers are controlled with a relay board shown below. The relays were salvaged from discarded equipment and I used silicon to glue them to a wood strip. The contacts have a minimum rating of 115V, 15A, AC. So far none of the contacts have welded shut from switching the transformers on the rectifiers.

 

 

Each relay is controlled by a mosfet. PicAxe micros operate on 5 volts and the relays are 12 volts necessitating the mosfet devices. The mosfets came from discarded inverters and small UPS’s. The gate lead of each mosfet is connected to an output port on the PicAxe.

 


I modified a six outlet power bar so that the relays controll the hot side of each outlet. The six rectifiers are plugged into the six outlets.

 

 

The rectifiers are isolated from each other by diodes. This is necessary in case one of the rectifiers fail. It also isolates the capacitors and leds on each rectifier.

 


This is my first attempt at a diode isolator. I sandwich seven 30A button diodes between an aluminum heat sink and a terminal board. The diode connections were not reliable and I scraped it.

 

 


Next I constructed and isolator using 50A bridge rectifiers. The heat sink was not adequate so I added a large cooling fan. I added a thermistor to the heat sink, wired it and the fan to the system controller. This worked great until Microsoft did an upgrade on my laptop. The reset hung the system controller causing the cooling fan to not function. One of the bridge rectifiers overheated and was destroyed.

 

 

 

Finally I settled on a diode array from a 150A truck alternator. A small cooling fan which I wired directly to the 12V bus keeps everything nice a cool. One unit will handle 3 rectifiers. A second unit is needed for the other 3 rectifiers.

 

 

 

Solar Panels

 

So far I have three 100 watt solar panels.

 

Two are a Coleman 100W Crystalline Solar Panel, 2-pk from Canadian Tire and one is a Sonali 12 volt Off Grid Panel from http://solardirectcanada.com

 

These panels are each rated for 18.5V and 5.5A. I have them mounted on my south facing roof.

 

12V/6V Sonali Off-grid 100W Panel

 

 

 

 

The panels are wired to a black distribution board seen below. Panels are individually fused at 10A and isolated with a 20A button diode.

 

 

 

This board is then wired down to a relay which is controlled by the charge controller.

 

These panels were installed a few months ago and I have recorded 15A on a clear day.

 


Wind Generator

 

For my wind generator I purchased a DC-540 Low Wind Permanent Magnet Alternator from http://www.windbluepower.com. This unit has both DC and AC outputs on it. I use the DC output.

 

 


I designed a mount and a friend of mine welded it for me. It is made from 1inch square tubing and rotates on 1 inch OD tubing using 1inch steel collars.

 

 

It is mounted on my garage roof. I rigged up a pulley system so I could raise the generator without trying to use a ladder on the roof. I made the 3 blade rotor using PVC water pipe and 1 inch flat steel stock to mount the blades. The hub is ½ inch plywood with thin sheet steel on each side for added strength.

 

I also made a five blade rotor but I need to add more rigging to the mount. The hub is ¼ inch stainless steel and the whole thing is heavy. It needs to be lightened.

 

 

The output is wired down to the same distribution board as the solar panels and is controlled by the same relay as the solar panels.

 

 

So far performance has been very disappointing. I initially had this mounted on a seven foot pole in my back yard and connected to two deep cycle batteries with no charge controller. I monitored the battery voltage with a PC and a PicAxe interface. I recorded 14 volts or better but only when the wind was as least 20 mph.

 

In the spring I moved it up onto my roof but by then the leaves were out and I am surrounded by trees. The thing did not generate much power until December when the trees were bare. During a three day, gusty wind period I barley got an amp out of the generator.

 

I put the generator on my drill press and at 540 rpm I got 45V on an open circuit. With a 5 ohm load I got 15V and 4.5A. When I connected it to my UPS the RPM dropped in half and I measured 14.5V and 1.2A. My little drill press motor almost overheated.

 

My friend has a better wind generator setup than I do and even with a MPPT controller his power generation is disappointing.

 

I have decided not to spend any more time or money on wind power and instead concentrate on solar power.

 

3.  Storage

 

Batteries

 

Right now I have four, Group 27, 100AH deep cycle batteries connected.

 

Using the basic formula:

Battery Capacity (Ah) / Device Consumption (A) * 0.7

 

I estimate approx. 18 hrs run time on the batteries.

 

4. Output

 

Inverters

 

I have two inverters. One is a 1KW recovered from a Canadian Tire Power Box and the other is a 400W I bought many years ago from Canadian Tire. The 1K unit powers my load and the 400W has two 100W light bulbs that I use for testing the system. Both have modifier sine wave output.

 

Miscellaneous Stuff

 

These are circuits added to the UPS.

 

One morning I found my batteries at 16V and the rectifiers where madly turning off and on. My 1KW inverter was shut down and the number one rectifier was too hot to touch.

I discovered that the relay contacts for the number one rectifier had welded shut. The original relays were out of a car and the contacts could not handle switching an inductive load.

 

I change the relay and added two circuits to prevent this from happening again.

 

Load Transfer Circuit

 

The first one shown below will transfer the load from the 1K inverter onto commercial AC if the inverter fails. This can happen if the supply voltage exceeds 15V or the batteries run down or the inverter just fails. The two black 12v relays are power by a simple 12V power supply which is plugged into one of the outlets on the 1KW inverter. If the inverter fails, the 12V power supply stops and the relays release transferring the load onto commercial AC.

 

These relays need to be replaced with ones that have a faster switch over time.

 

 


Emergency AC Cut-off Switch

 

The second is an emergency AC cut-off switch show below. It’s a power bar with a 12V relay mounted inside. This relay is controlled by the system controller. If the battery voltage exceeds 15V the controller will turn off this power bar. The power bar for the rectifiers is plugged into this power bar.

 

A small 12V power supply is also plugged into the cut-off switch. This power supply controls a 12V relay which is wired to alert both controllers when commercial AC has failed.

 

 


Final Thoughts

 

I need to move this outside in its own enclosure. My foyer is on the other side of the wall that the UPS is mounted on and the noise echoes through.

 

My garage installation limits my access to the hydro I need for the rectifiers and the additional output circuits I need to run as I expand the UPS.

 

Future improvements are: