Solar MPPT Charger and Lighting Controller

User avatar
Location: Philippines
Posts: 198
Joined: Sat Apr 23, 2016 10:32 pm

Solar MPPT Charger and Lighting Controller

Wed Feb 15, 2017 5:24 pm

This MPPT charger/light controller will work with 12V or 24V solar panels to charge a 12V or 24V lead-acid or lithium iron phosphate battery. You can then use the battery to run 12V DC lighting or a 12V/24V 230VAC inverter to run lighting or other loads.
solar charger.jpg
Contruction List
1 double-sided PCB, available from the EPE PCB Service, coded 16101161, 141 × 112mm
1 diecast box 171 × 121 × 55mm
1 6-way PC-mount screw terminal block (CON1)
1 3-way PC-mount screw terminal block, 5.08mm pin spacing (CON2)
3 2-way PC mount screw terminals 5.08mm pin spacing (CON2,CON3)
1 powdered-iron toroid 28 × 14 × 11mm
1 SPST PC mount tactile membrane switch with 3.5 or 4.3mm actuator (S1)
1 10kΩ NTC thermistor
1 LDR with 10kΩ light resistance,
1MΩ dark resistance
2 IP68 cable glands for 8mm cable
1 IP68 cable gland for 6.5mm cable
1 DIL18 IC socket
2 M205 PC mount fuse clips
1 10A M205 fast blow fuse (F1)
1 TO-220 U shaped heatsink, 19 × 19 × 10mm
1 M3 × 10mm machine screw
4 TO-220 silicone insulation washers
4 TO-220 insulating bushes
4 M3 × 12mm machine screws
5 M3 nuts
2 3-way pin headers with 2.54mm pin spacings (JP1,JP2)
2 jumper shunts for pin headers
2 100mm cable ties
1 3m length of 0.5mm enamelled copper wire

1 50mm length of 0.7mm tinned copper wire (for PIR, see text)
4 PC stakes

1 PIC16F88-I/P microcontrollerm programmed with 1610116A. hex (IC1).
1 LM358 dual op amp (IC2)
1 4N28 optocoupler (OPTO1)
1 TL499A regulator (REG1)
1 SUP53P06-20 P channel MOSFET (Q1)
1 BC337 NPN transistor (Q2)
1 TIP31C NPN transistor (Q3)
1 IRF1405N N-channel MOSFET (Q4)
1 2N7000 N-channel MOSFET (Q5)
2 MBR20100CT fast dual diode (D1,D2)
1 1N4148 diode (D3)
2 30V 1W zener diodes (ZD1,ZD2)
1 18V 1W zener diode (ZD3)
1 12V 1W zener diode (ZD4) (for 12V PIR, see text)
1 3mm high intensity LED (LED1)

2 2200μF 25V low-ESR PC electrolytic (12V version)
2 470μF 63V low-ESR electrolytic
(24V version)
1 100μF 16V
1 10μF 35V
6 100nF MKT polyester
2 100nF X2 class metallised
2 10nF MKT polyester
1 1nF MKT polyester
1 470pF ceramic

(0.25W, 1%)
1 100kΩ (R1) – see text
2 100kΩ
1 68kΩ
1 47kΩ (24V version)
1 51k (24V version)
2 22kΩ (12V version)
2 10kΩ
1 8.2kΩ
2 4.7kΩ
2 2.2kΩ
1 1.5kΩ
1 1.2kΩ (use for 24V supply with 12V PIR see text)
1 1kΩ (24V version)
1 1kΩ 1W
1 1kΩ
2 470Ω
1 330Ω
1 270Ω (for 12V PIR, see text)
2 100Ω
1 100Ω (12V version)
3 10Ω
1 0.01Ω 3W resistor

2 10kΩ mini horizontal trimpots (103) (VR3,VR4)
2 20kΩ mini horizontal trimpots (203) (VR1,VR2)
1 500kΩ mini horizontal trimpot (504) (VR5)

1 12V or 24V SLA or LiFePO4 battery
1 12V (up to 120W) or 24V (up to 220W) solar panel array
12V lamps suitable for 14.4V use
1 12V PIR
10A cable, battery clips, shielded cable, heatshrink tubing.

This unit gives you the choice of running a 12V solar panel up to 120W, or a 24V panel up to 220W. It can switch lights on at dusk and off at dawn. By including a PIR (passive infrared) detector, you can also have lights switch on with movement detection and off with the timer. You can also manually switch the lights on or off at any time. The unit incorporates ‘maximum power point tracking’ (MPPT) to maximise the output from the solar panel, regardless of the solar intensity, and it provides three-stage charging for SLA (sealed lead-acid) batteries or two-stage charging for LiFePO4 batteries. Cell equalisers will be required if using a This MPPT charger/light controller will work with 12V or 24V solar panels to charge a 12V or 24V lead-acid or lithium iron phosphate battery. You can then use the battery to run 12V DC lighting or a 12V/24V 230VAC inverter to run lighting or other loads. LiFePO4 battery; more about this later. Whether you intend operating with a 12V or 24V system, you are not limited to 12V DC lighting. The battery can be used with a 12V or 24V/230VAC inverter of up 600W or more (depending on the size of your battery) to run 230VAC LED downlights, laptop computers, TV sets, power tools and so on. Mind you, while the unit can work with a solar panel rated up to 120W at 12V, or 220W up 24V, you can use a smaller panel if that is all you require.

For use in garden lighting, the light sensor allows the lights to switch on at dusk and they can remain lit for a preset period of up to eight hours, as set by the timer. Alternatively, you may wish to have the lights lit for the entire night and to switch off automatically at sunrise, provided there is sufficient battery charge (and capacity). For security or pathway lighting, the lights can be set to switch on after dusk, but only when someone approaches the area. In this case, a PIR movement detector switches on the lights, while the timer switches off the lights after a predetermined period, typically about one to two minutes. Periods extending up to the full 8-hour timer limit are available if you need more time.

The actual total wattage of the lights that you can use does depend on the application. With its internal MOSFET switching, it will supply a load drawing up to 10A from a 12V or 24V battery. You will get the best efficiency using LED lighting or 12V fluorescent lamps rather than using standard or halogen filament lamps. Alternatively, the controller can switch a heavy-duty relay to drive a 12V or 24V inverter, as noted above, and it will protect the battery by switching off to prevent over-discharge, since it includes low battery detection, with a cut-off below 11V. This is most important for lead-acid or lithium iron phosphate batteries. Standby current drain of the Solar Lighting Controller is quite low at 2.2mA, but this increases to around 12mA if a PIR detector is used.

The cut-off voltage for bulk charge and the float voltage are reduced for temperatures above 20°C, in line with the battery manufacturers’ charging specifications. Typically, this is 19mV per °C for a 12V battery. So at 30°C, the voltages are reduced by 190mV, ie, 14.2V and 13.3V respectively. The ambient temperature is measured using an NTC (negative temperature coefficient) thermistor which should be located close to the battery or preferably, attached to the case of the battery for more accurate temperature sensing. Charging will not occur if the thermistor is shorted or not connected. The two-stage charging used for LiFePO4 batteries is shown in Fig.3 and consists of bulk and absorption stages. In fact, the bulk and absorption stages are exactly the same as for lead-acid batteries, but there is no subsequent float charge mode. We based these modes on information to be found at and similar websites.

Note that it is important that a cell balancer is used when charging.

User avatar
Location: Philippines
Posts: 198
Joined: Sat Apr 23, 2016 10:32 pm

Re: Solar MPPT Charger and Lighting Controller

Wed Feb 15, 2017 5:48 pm

Charge indication
An LED indicator shows the charging stage. It is on continuously for the bulk charge mode; flashes on for 0.5s and off for 0.5s for the absorption mode, and flashes on for one second and off for one second during float mode. If you have a battery that has been discharged below 10.5V, it will be charged with short bursts of current until it reaches 10.5V, whereupon bulk charging will begin. This initial charging will be indicated by a short flash of the charge LED every four seconds.

Circuit details
The full circuit for the Solar Lighting Controller is shown in Fig.6 and is based around a PIC16F88 microcontroller (IC1). This monitors the solar panel voltage and current signals from IC2, a PIR sensor (if used), switch S1, a light-dependent resistor (LDR) and an NTC thermistor, and controls the lighting using MOSFET Q4. A 12V supply is provided for the PIR sensor at CON2 via resistor R2 from the 12V battery supply. Many PIR sensors can be operated from a 9-16V supply, and in these cases R2 can be a wire link and zener diode ZD4 omitted. If the PIR sensor requires a fixed 12V supply, then R2 should be 270Ω and zener diode ZD4 is included. For 24V operation, R2 should be 1.2kΩ. A pushbutton switch (S1) is monitored by IC1’s RB1 input, normally held high at 5V with a 100kΩ pullup resistor. Pressing the switch pulls the RB1 input low. S1 is included for test purposes, but an external on/off (pushbutton) switch can be connected as well, using two of CON2’s terminals. The 100nF capacitor at RB1 prevents interference from causing false switching when long leads are used to an external switch. Ambient light is monitored using a light-dependent resistor (LDR) at the AN5 analogue input of IC1. The LDR forms a voltage divider with a seriesconnected 100kΩ resistor and trimpot VR5, all across the 5V supply. In normal daylight, the LDR is a low resistance (about 10kΩ) but this rises to over 1MΩ in darkness. Therefore, the voltage at the AN5 input will be inversely proportional to the ambient light. If the voltage across LDR1 is below 2.5V, IC1 determines it is daylight; above 2.5V it reads it as dark.

This measurement is made when MOSFET Q5 is switched on, tying the lower end of the LDR close to 0V. VR5 allows threshold adjustment of the LDR sensitivity.

For charging, we use the switchmode step-down circuit MOSFET Q1 is an P-channel type that switches on with a gate voltage that is negative with respect to its source. The voltage at Q1’s source (from the solar panel and diode D1) can range up to about 22V when the solar panel is not delivering current. D1 is a twin-diode package, which has the advantage that both diodes are closely matched for forward voltage, since they are both on the same silicon die. This means that they will share current equally when they are connected in parallel, to give a total rating of 20A. MOSFET Q1 is controlled by NPN transistor Q3 that’s driven by the PWM output at pin 9 of ICI via a 100Ω resistor. Q3’s emitter is connected to ground via another 100Ω resistor. With about 5V at Q3’s base, the emitter is at about 4.3V and so there is 43mA through its collector. When Q3 is on, MOSFET Q1’s gate is pulled negative with respect to its source via diode D3 and the 10Ω resistor, thus switching Q1 on. Q1’s gate is protected from voltages in excess of 18V (which could damage it) by zener diode ZD3. Q3’s emitter resistor is set at 100Ω so that ZD3’s current is limited to 43mA. Whenever Q3 is on, NPN transistor Q2 is off since the base is one diode drop below the emitter, due to D3 being forward biased. Conversely, when IC1 switches Q3 off, Q2’s base is pulled to Q1’s source voltage via a 1kΩ resistor. This switches Q2 on, pulling Q1’s gate to its source and thus switching it off. Q1 is switched on and off by IC1 at 31.24kHz.

Voltage/temperature monitoring
The battery voltage is monitored at lC1’s AN2 input via optocoupler OPTO1 and a resistive divider comprising a 22kΩ resistor and 20kΩ trimpot VR2. This divider is adjusted using VR2 so that the voltage appearing at AN2 is actually 0.3125 times the battery voltage. The reason for this is so that the 5V limit of analogue input AN2 is not exceeded. For example, a 15V battery voltage will be converted to just 4.69V. We’ll cover this in the setting-up procedure later.

The resistive divider is not directly connected to the battery but via the transistor within optocoupler OPTO1 and this connects the battery voltage to the divider whenever the LED within OPTO1 is on. The collector-emitter voltage of the transistor has a minimal effect on the battery voltage measurement, as it is only around 200μV. The divided voltage is converted to a digital value by IC1. The optocoupler’s LED is driven from the 5V supply through a 470Ω resistor to 0V when MOSFET Q5 is switched on. The NTC thermistor forms a voltage divider with a 10kΩ resistor across the supply when Q5 is switched on. IC1’s AN6 input monitors this voltage and converts it to a value in degrees Celsius. At the same time, IC1’s AN1 input monitors the setting of trimpot VR3. This trimpot is effectively connected across the 5V supply when Q5 is switched on. The AN1 input voltage is converted to a mV/°C value and this can range from 0mV/°C when VR3 is set to 0V to 50mV/°C when VR3 isset for 5V.
User avatar
Location: Philippines
Posts: 198
Joined: Sat Apr 23, 2016 10:32 pm

Re: Solar MPPT Charger and Lighting Controller

Wed Feb 15, 2017 5:52 pm

Power saving
As mentioned, MOSFET Q5 connects trimpots VR3 and VR4, the LDR and the NTC to 0V and also powers the optocoupler LED. Q5 is powered on with a 5V signal from the RB5 output of IC1. The MOSFET then momentarily connects these sensors to 0V so that microcontroller IC1 can measure the values. When Q5 is off, these trimpots, sensors and battery divider are disconnected from the supply to reduce battery drain.

One problem with using Q5 to make the 0V connection for the trimpots, battery and sensors is that these sampled voltages cannot be easily measured with a multimeter. This is because a multimeter will not capture the voltage when Q5 switches on momentarily. And we do need to measure some of these voltages for setting up. For example, we need to be able to set VR2 so that the battery divider is correct and we need to measure the timer and mV/°C values as set with VR4 and VR3. So in order to make these measurements, Q5 is switched on whenever S1 is pressed. Other power saving techniques include driving the charge LED (LED1) from the solar panel instead of the battery. The only time this LED will light using battery power is if the thermistor is open or short circuit. In these cases, the LED flashes at a low duty cycle, again conserving power.

Op amp lC2 is also powered from the solar panel, because we only want to measure the solar panel voltage and current when solar power is available. Therefore, IC2 is fed via a 100Ω seriesresistor for a 12V panel and a 1kΩ resistor in the case of a 24V panel. Zener diode ZD2 limits the voltage to 30V. Diode D1 prevents the battery from powering IC2 via Q1’s internal diode and L1. The solar panel voltage is monitored using a 22kΩ and 4.7kΩ voltage divider, while a 100nF capacitor filters any transient voltages or noise that could be induced through long leads from the panel. IC2a is connected as a unity-gain buffer and its output is applied to the AN3 input of IC1. As noted previously, current from the solar panel is measured by the voltage developed across a 0.01Ω shunt resistor. This is around 70mV for a current of 7A. The voltage developed across the shunt is negative and this is inverted and amplified by IC2b, which has a gain of –45. Therefore, lC2b’s output will be around 315mV per 1A of current from the solar panel. This output is applied to the AN4 input of IC1 via a 2.2kΩ current-limiting resistor.

Note that the actual calibration of voltage and current is not particularly important. The software within IC1 multiplies the voltage and current readings obtained at the AN3 and AN4 inputs to find where the maximum power point is for the solar panel This calculation is not after any particular value, but just the maximum in a series of power calculations. It does this calculation periodically (once every 20 seconds) and varies the on/off duty cycle of MOSFET Q1 to find the duty cycle that provides the maximum power from the solar panels. Power for the remainder of the Solar Lighting Controller circuit comes from the 12V battery via REG1, a TL499A regulator. This is a low quiescent current type that can run as a linear step-down regulator and as a switchmode step-up regulator. We have used it as a 12V to 5V linear regulator, with the output voltage trimmed using VR1 to as close to 5V as possible. This then calibrates the analogue-to-digital conversion within IC1, ensuring correct charging voltages for the battery.

Protection against reverse polarity connection of both the 12V battery and solar panel are included. If the solar panel is connected with reverse polarity, IC2 is protected because ZD2 will conduct in its forward direction, preventing more than 0.6V reverse voltage from being applied across its pin 4 and pin 8 supply rails. D1 prevents reverse voltage from the solar panel being applied to the remainder of the circuit. Finally, should the battery be connected back to front, D2 will conduct via inductor L1 and the fuse will blow, breaking the connection.

Return to “ELECTRICAL”