Silicon ChipSolar MPPT Charger & Lighting Controller, Pt.1 - February 2016 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: A defibrillator could save your life or that of your friend
  4. Feature: Defibrillators Save Lives by Ross Tester
  5. Project: Micromite LCD BackPack With Touch-Screen Display by Geoff Graham
  6. Project: Solar MPPT Charger & Lighting Controller, Pt.1 by John Clarke
  7. Product Showcase
  8. Subscriptions
  9. Project: Raspberry Pi Temperature/Humidity/Pressure Monitor, Pt.2 by Greg Swain
  10. Feature: Crowd Funding: Kickstarter & “The Joey” by Steve OBrien & David Meiklejohn
  11. Project: Valve Stereo Preamplifier For HiFi Systems, Pt.2 by Nicholas Vinen
  12. Review: Keithley’s 2460 Sourcemeter by Jim Rowe
  13. Vintage Radio: The 1948 Healing L502E 5-valve radio by Associate Professor Graham Parslow
  14. PartShop
  15. Notes & Errata
  16. Market Centre
  17. Advertising Index
  18. Outer Back Cover

This is only a preview of the February 2016 issue of Silicon Chip.

You can view 39 of the 96 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Micromite LCD BackPack With Touch-Screen Display":
  • Micromite LCD BackPack PCB [2.8-inch version) [07102122] (AUD $5.00)
  • Micromite LCD BackPack PCB [2.4-inch version) [07102121] (AUD $1.50)
  • PIC32MX170F256B-50I/SP programmed for the Micromite Mk2 plus capacitor (Programmed Microcontroller, AUD $15.00)
  • 2.8-inch TFT Touchscreen LCD module with SD card socket (Component, AUD $25.00)
  • MCP1700 3.3V LDO (TO-92) (Component, AUD $2.00)
  • CP2102-based USB/TTL serial converter with 5-pin header and 30cm jumper cable (Component, AUD $5.00)
  • Micromite LCD BackPack V1 complete kit (Component, AUD $65.00)
  • Matte/Gloss Black UB3 Lid for 2.8-inch Micromite LCD BackPack (PCB, AUD $5.00)
  • Clear UB3 Lid for 2.8-inch Micromite LCD BackPack (PCB, AUD $5.00)
  • Gloss Black UB3 Lid for 2.8-inch Micromite LCD BackPack (PCB, AUD $4.00)
  • Firmware (HEX) file and documents for the Micromite Mk.2 and Micromite Plus (Software, Free)
  • Micromite LCD BackPack PCB patterns (PDF download) [07102121/2] (Free)
  • Micromite LCD BackPack/Ultrasonic sensor lid cutting diagrams (download) (Panel Artwork, Free)
Items relevant to "Solar MPPT Charger & Lighting Controller, Pt.1":
  • Solar MPPT Charger & Lighting Controller PCB [16101161] (AUD $15.00)
  • PIC16F88-E/P programmed for the Solar MPPT Charger & Lighting Controller [1610116A.HEX] (Programmed Microcontroller, AUD $15.00)
  • Firmware (ASM and HEX) files for the Solar MPPT Charger & Lighting Controller [1610116A.HEX] (Software, Free)
  • Solar MPPT Charger & Lighting Controller PCB pattern (PDF download) [16101161] (Free)
Articles in this series:
  • Solar MPPT Charger & Lighting Controller, Pt.1 (February 2016)
  • Solar MPPT Charger & Lighting Controller, Pt.1 (February 2016)
  • Solar MPPT Charger & Lighting Controller, Pt.2 (March 2016)
  • Solar MPPT Charger & Lighting Controller, Pt.2 (March 2016)
Items relevant to "Raspberry Pi Temperature/Humidity/Pressure Monitor, Pt.2":
  • Script for Raspberry Pi Temperature/Humidity/Pressure Monitor Pt.2 (Software, Free)
Articles in this series:
  • Raspberry Pi Temperature/Humidity/Pressure Monitor Pt.1 (January 2016)
  • Raspberry Pi Temperature/Humidity/Pressure Monitor Pt.1 (January 2016)
  • Raspberry Pi Temperature/Humidity/Pressure Monitor, Pt.2 (February 2016)
  • Raspberry Pi Temperature/Humidity/Pressure Monitor, Pt.2 (February 2016)
  • 1-Wire Digital Temperature Sensor For The Raspberry Pi (March 2016)
  • 1-Wire Digital Temperature Sensor For The Raspberry Pi (March 2016)
Items relevant to "Valve Stereo Preamplifier For HiFi Systems, Pt.2":
  • Stereo Valve Preamplifier PCB [01101161] (AUD $15.00)
  • STFU13N65M2 650V logic-level Mosfet (Component, AUD $10.00)
  • Red & White PCB-mounting RCA sockets (Component, AUD $4.00)
  • Dual gang 50kΩ 16mm logarithmic taper potentiometer with spline tooth shaft (Component, AUD $5.00)
  • Hard-to-get parts for Stereo Valve Preamplifier (Component, AUD $30.00)
  • Hifi Stereo Valve Preamplifier clear acrylic case pieces (PCB, AUD $20.00)
  • Stereo Valve Preamplifier PCB pattern (PDF download) [01101161] (Free)
  • Laser cutting artwork and drilling diagram for the Hifi Stereo Valve Preamplifier (PDF download) (Panel Artwork, Free)
Articles in this series:
  • Valve Stereo Preamplifier For HiFi Systems (January 2016)
  • Valve Stereo Preamplifier For HiFi Systems (January 2016)
  • Valve Stereo Preamplifier For HiFi Systems, Pt.2 (February 2016)
  • Valve Stereo Preamplifier For HiFi Systems, Pt.2 (February 2016)

Purchase a printed copy of this issue for $10.00.

Pt.1: By JOHN CLARKE Solar MPPT Charger & Lighting Controller 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 to drive other loads. S OLAR PANELS are becoming cheaper all the time, so now you can build a low-cost system to power lighting and other loads around your home, your boat or caravan or for a home that’s not connected to the grid. 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 30  Silicon Chip it provides 3-stage charging for SLA (sealed lead-acid) batteries or 2-stage charging for LiFePO4 batteries. Cell equalisers will be required if using a 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. A big advantage of using a 230VAC inverter is that you will have a much larger choice of lights than if you are confined to a 12V DC system. Fig.1 shows the arrangement of our Solar Lighting Controller and depicts the solar panel, battery and the 12V lighting or 230VAC inverter. Additional inputs to the controller include a light sensor to monitor the ambient light, a PIR detector and a timer. 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 siliconchip.com.au 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 depends 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. Multi-stage charging As mentioned above, the Controller provides 3-stage charging for leadacid batteries or a 2-stage charge for LiFePO4 batteries. Fig.2 shows the 3-stage charging with bulk, absorption SOLAR PANEL 12V 120W OR 24V 220W 12V LIGHTING OR 230VAC INVERTER TEMPERATURE SENSING (NTC1) SOLAR CHARGER CONTROLLER LIGHT SENSING (LDR1) 12V/24V BATTERY Fig.1: block diagram of the lighting system. It uses a a solar panel, a 12V/24V battery and the MPPT Charge Controller to drive either 12V lighting or a 230VAC inverter and can be switched using various sensors. PIR DETECTOR TIMER (VR4) ON/OFF SWITCH and float modes. Bulk charge is applied when the battery voltage drops below 12.7V and feeds maximum power from the solar panel until the battery voltage reaches cut-off at 14.4V <at> 20°C. Next is the absorption phase where the battery is maintained at the cut-off voltage of 14.4V for one hour, to ensure full charge. After that, the battery is maintained on float charge at 13.5V. The cut-off voltage for bulk charge and the float voltage is reduced for temperatures above 20°C, in accordance 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 that 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. CUTOFF BATTERY VOLTAGE BATTERY VOLTAGE FLOAT VOLTAGE BULK ABSORPTION BULK FLOAT TIME TIME CHARGE CURRENT CHARGE CURRENT TIME Fig.2: 3-stageFIG.2: charging is used for lead-acid batteries, startTHREE-STAGE CHARGING ing with an initial bulk charge. When the battery reaches the cut-off voltage, the absorption stage takes over to fully charge it. The float stage then maintains the charge. siliconchip.com.au ABSORPTION TIME Fig.3: 2-stageFIG.3: charging is used CHARGING for LiFePO4 batteries and TWO-STAGE consists of bulk and absorption stages. These stages are exactly the same as for lead-acid batteries but there is no subsequent float charge mode. February 2016  31 SOLAR PANEL POWER CURVE SIMULATION (120W PANEL) 24V OPEN CIRCUIT VOLTAGE (Voc = 21.8) 22V VOLTAGE DROP WITH CURRENT SLOPE 20V OUTPUT VOLTAGE 18V Fig.4: the current/ voltage curve for a typical 120W solar panel. MAXIMUM POWER POINT 17.8V 16V CURRENT LIMIT THRESHOLD 14V 12V CURRENT LIMIT SLOPE 10V 8V 6V 4V 0V 6.74A 2V 0 0.8 1.6 2.4 3.2 4.0 4.8 5.6 6.4 SHORT CIRCUIT CURRENT (Isc = 7.14A) 7.2 8.0 OUTPUT CURRENT (AMPS) The 2-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 www.powerstream.com/LLLF.htm and similar websites. Note that it is important that a cell balancer is used when charging LiFePO4 batteries. We intend publishing a suitable cell balancer in our March 2016 issue. Charge indication A 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. MPPT operation Fig.4 shows the output of a typical 12V solar panel. It will deliver maximum current when the output is shorted and maximum voltage when 32  Silicon Chip the output is open-circuit (ie, no load). So the maximum short circuit current might be around 7.2A and the maximum voltage can be anywhere between 21.8V and 22.5V, or maybe a little more. However, the maximum power output for a nominal 12V 120W panel will be between those extremes, at a load current of 6.74A and a voltage of 17.8V (or very close to those figures). When we consider the power delivered to the battery, the story becomes more interesting. If we were to connect the 120W solar panel directly to the battery, the charge current would be about 6.9A at 12V (ie, 82.8W) and about 6.8A at 14.4V (ie, 97.9W). Both these values are far less than the 120W available from the solar panel when its voltage is at 17.8V. Ideally, the solar panel should be operated at peak efficiency, to deliver maximum power. And that is where the Maximum Power Point Tracking (MPPT) aspect of the controller comes into play. It’s essentially a switchmode step-down power converter, which increases the available power from the solar panel to the battery with minimal power loss. At the same time, it provides the required 2-stage or 3-stage charging to the battery. Fig.5 shows how this takes place. When Mosfet Q1 is closed, current from the solar panel flows through paralleled dual diode D1 and this is fil- tered with two 2200µF capacitors. The current (i1) flows through inductor L1 into the battery. The inductor charges (ie, current rises to its maximum value) and after a short period, Q1 is switched off and the stored charge in L1 maintains current flow (i2) via paralleled dual diode D2. The ratio of the on to off period (duty cycle) for Q1 is controlled so that the solar panel delivers the maximum available power. The solar panel is not required to supply the peak current into the inductor as this is drawn from the 2200µF capacitors. Incidentally, these capacitors are low ESR (effective series resistance) types, suited to the switching frequency of 31.24kHz. The voltage from the solar panel is monitored by op amp lC2a while the current is monitored by measuring the voltage across a 0.01Ω shunt resistor. This voltage is multiplied by -45 in op amp lC2b which also acts as a low pass filter. Both op amps feed their signals to microcontroller IC1 and this controls the whole circuit operation. 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Ω pull-up 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 analog input of IC1. The LDR siliconchip.com.au Q1 D1 A K A K L1 FUSE i1 F1 λ 12V/24V SOLAR PANEL VOLTAGE DIVIDER + 2x 2200 µF 25V K K A A D2 i2 Q2, Q3 12V/24V BATTERY IC2a BUFFER PWM V 0.01Ω 3W IC2b I AN3 IC1 MICROCONTROLLER BATTERY VOLTAGE AN4 LOW-PASS FILTER (GAIN = –45) Fig.5: block diagram of the switchmode step-down MPPT Charge Controller. The ratio of the on-to-off period (duty cycle) for Mosfet Q1 (shown here as a switch) is controlled by IC1 which acts in response to the solar panel’s current and output voltage. This ensures that the solar panel delivers the maximum available power to the 12V or 24V battery. 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. Link Options There are three options available for turning on the lighting: (1) only at night; (2) only in daylight; and (3) both day and night. The position of link JP1 selects the first two options, while the third option operates with the link in the night position but with the LDR left out of circuit. The lamp can also be switched on using pushbutton switch S1 (internal or external), provided the ambient light level is correct according to the selection made with JP1. When JP2 is in the PIR position, the lamp can also be switched on when the PIR detects movement; again dependent on ambient light, according to the JP1 selection. If JP2 is set to the LDR position, the PIR does not switch on the lamp and the lamp is switched on at the change of ambient light, day to siliconchip.com.au Features & Specifications Main Features • • • • • • • 12V or 24V operation 120W/220W solar panel rating 120W/600W lighting Lamps on with movement, on/off switch or with ambient light changes 3-stage charging for SLA batteries 2-stage charging for LiFEPO4 batteries Switchmode charger operation with maximum power ponting tracking (MPPT) Specifications • • • • • • Lamp driver: up to 10A • • Open or short circuit thermistor LED warning • • Bulk charge initiation when battery drops below 12.7V • Charger: charging starts when solar panel output is >12V Lamp Timer: 2s to 8 hours Lamp switch on: PIR sensor or LDR light level sensor Low battery cut-off voltage: 11V Quiescent current: 2.2mA Charge compensation: adjustable from 0 to 50mV per °C, reducing charge voltage above 20°C and increasing below 20°C. No increase below 0°C. (SLA only) (For LiFePO4 set at 0mV per °C) Low battery charge LED indication: at less than 10.5V charging via a 6.25% duty cycle charge burst (Charge indicator flashes 260ms each 4.2s) Charge LED indicator: bulk charge = continuously lit; absorption = flashing 0.5s on, 0.5s off; float = 1s on, 1s off February 2016  33 Table 1: Lamp Operation Options JP1 JP2 Lamp On Lamp Off Day to night transition, with S1 or timer time-out Night to day transition, with S1 or timer time-out Day position LDR position Night position LDR position Night to day transition. With S1 during day Day to night transition. With S1 during night Night position LDR position and with the LDR disconnected from CON3 S1 during day or night Timer time-out or S1 Day position PIR position Night position PIR position Day to night transition, with S1 or timer time-out Night to day transition, with S1 or timer time-out Night position PIR position and with the LDR disconnected from CON3 PIR movement detection or with S1 during the day only PIR movement detection or with S1 during the night only PIR movement detection or with S1 during the day or night night or night to day (again, dependent upon JP1) – see Table 1. Timer Thelampcanalsobeswitchedoffusing either a timer or the ambient light level. The various options are summarised in Table 1. The lamp ON period is adjustable using trimpot VR4, connected between +5V and the drain of Q5. When Q5 is switched on, the trimpot is effectively connected across the 5V supply. The wiper voltage is monitored at the AN0 input of IC1. We’ll cover the procedure for adjusting VR4 later. Lamp driver The lamp or lamps are powered on using Mosfet Q4. This is switched on with gate voltage from the RB0 output of IC1. Q4 is an IRF1405 and this can be driven using a low-voltage gate signal such as the 5V from IC1. The expected voltage drop between drain and source is around 0.12V when conducting 10A. A small heatsink ensures that this Mosfet runs relatively cool. Note that if an inverter is to be controlled, Q4 is used to switch a heavy-duty relay. Charging For charging, we use the switchmode step-down circuit previously described in Fig.5. Mosfet Q1 is a 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 34  Silicon Chip 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. While ever 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 analog 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. Timer time-out or with S1 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 is set for 5V. 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 siliconchip.com.au siliconchip.com.au February 2016  35 A K S1 10k ZD4 12V 100nF 8.2k 5 4 IC2b 100nF SEE TEXT (1.2k) 1 1W ZD2 30V 7 +12V IC2: LM358 470pF IC2a R2 270Ω 6 68k 2 3 8 A K A2 100nF R1 100k 2.2k 2.2k 35V 10 µF E A K Q3 TIP31C 100Ω C D3 1k 1W DAY 100k NIGHT PIR LDR JP1 +5V SOLAR PANEL CURRENT MONITOR SOLAR PANEL VOLTAGE MONITOR 100Ω B 63V (24V) 2 x 470 µF 25V (12V) 2 x 2200 µF SOLAR CHARGE/LIGHTING CONTROLLER GND SIGNAL + 3W 0.01Ω 1.5k 12V 120W OR 24V 220W SOLAR PANEL 100nF 100Ω (1k) K JP2 1k B RB1 RB2 RA6 RA7 A RA2/AN2 K K 5 Vss RB0 RB4 RB5 RB6 TP2 470Ω S 2N7000 G 11 12 17 18 13 D RA0/AN0 RA1/AN1 RB7/AN6 1 6 +5V 100 µF TP1 TPGND D 10 10Ω 100nF G IC1 PIC16F88 PIC1 6F8 8 AN4/RA4 AN3/RA3 PWM/RB3 ZD1 – ZD4 A Vdd 14 1W S ZD3 18V MCLR/RA5 100nF A K D3: 1N4148 7 8 15 16 3 2 9 4 E Q2 BC337 C Q1 SUP53P06-20 TP3 E 10nF B C BC337 VR3 10k 10Ω LED1 REF REG1 TL499A 5 +5V A1 4 K A2 7 10Ω 100k D1, D2 VR5 500k VR4 10k VR2 20k SW IN K λ A K C G S D 2 1 E TIP31C 470Ω B 1nF 4 5 3 6 SERIES 1 IN 100nF X2 SW REG IN2 SW CUR GND CTRL PGND OUT 100nF X2 22k (51k) +5V 2 8 D2 MBR20100CT 4.7k A2 10nF K λ A VR1 20k TP4 A1 K L1: 5 µH (12V) 10 µH (24) C Q5 2N7000 10k G OPTO1 4N28 +12V 1W ZD1 30V 330Ω +12V G K A LED D S + D LDR NTC – LAMP CON3 Q4 IRF1405N Q1, Q4 S D CON1 F CON1 E CON1 D 12V (24V) BATTERY CON1 C F1 10A Fig.6: the full circuit for the 12V/24V Solar Lighting Controller is based on 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 a NTC thermistor. The resulting PWM (pulse width modulation) output on pin 9 of IC1 then drives power Mosfet Q1 via transistors Q3 & Q2 to control the charge current for the battery, while Q4 controls the lighting. SC 20 1 6 λ + CON2 TO EXT SWITCH TO PIR SENSOR CON1 B CON1 A 4.7k 22k (47k) A1 D1 MBR20100CT Parts List: Solar MPPT Charger/Lighting Controller 1 double-sided PCB, code 16101161, 141 x 112mm 1 diecast box 171 x 121 x 55mm (Jaycar HB5046) 1 6-way PC-mount screw terminal block (Altronics P2106) (CON1) 1 3-way PC-mount screw termin­ al block, 5.08mm pin spacing (CON2) 3 2-way PC mount screw terminals 5.08mm pin spacing (CON2,CON3) 1 powdered-iron toroid 28 x 14 x 11mm (Jaycar LO-1244) 1 SPST PC mount tactile membrane switch with 3.5 or 4.3mm actuator (S1) (Altronics S1120, Jaycar SP0602) 1 10kΩ NTC thermistor (Altronics R4290, Jaycar RN3440 or equivalent) 1 LDR with 10kΩ light resistance, 1MΩ dark resistance (Altronics Z1621, Jaycar RD3480 or equivalent) 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 x 19 x 10mm 1 M3 x 10mm machinescrew 4 TO-220 silicone insulation washers 4 TO-220 insulating bushes 4 M3 x 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 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 while ever S1 is pressed. Other power saving techniques include driving the charge LED (LED1) from the solar panel instead of the bat- tery. 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Ω series resistor 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 36  Silicon Chip Semiconductors 1 PIC16F88-I/P microcontroller 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) Capacitors 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 Polypropylene 2 10nF MKT polyester 1 1nF MKT polyester 1 470pF ceramic Resistors (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 (Jaycar RR3420) Trimpots 2 10kΩ mini horizontal trimpots (103) (VR3,VR4) 2 20kΩ mini horizontal trimpots (203) (VR1,VR2) 1 500kΩ mini horizontal trimpot (504) (VR5) Miscellaneous 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 (eg, Altronics S5314A) 10A cable, battery clips, shielded cable, heatshrink tubing 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 siliconchip.com.au Building the Solar Charger & Lighting Controller is easy, with all parts mounted on a single PCB. This is housed in a diecast metal case which provides the necessary heatsinking. The full assembly details are in Pt2 next month. 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 stepdown 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 analog 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. Next month, we’ll cover full constructional details and set-up proceSC dure. Are Your S ILICON C HIP Issues Getting Dog-Eared? Are your SILICON CHIP copies getting damaged or dog-eared just lying around in a cupboard or on a shelf? REAL VALUE AT $16.95 * PLUS P & P Keep them safe, secure & always available with these handy binders Order now from www.siliconchip.com.au/Shop/4 or call (02) 9939 3295 and quote your credit card number. *See website for overseas prices. siliconchip.com.au February 2016  37