Silicon ChipA Solar-Powered Lighting System - May 2010 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Saving energy is not the issue
  4. Feature: Slash Your Factory/Office Lighting Bill by Leo Simpson
  5. Feature: A Look At The TDA7377 Quad 12V Amplifier IC by Nicholas Vinen
  6. Project: A Solar-Powered Lighting System by John Clarke
  7. Project: Build A Compact 12V 20W Stereo Amplifier by Nicholas Vinen
  8. Project: Low-Power Car/Bike USB Charger by Nicholas Vinen
  9. Project: Digital Audio Signal Generator, Pt.3 by Nicholas VInen
  10. Review: Tektronix DMM4050 6½-Digit Multimeter by Nicholas Vinen
  11. Book Store
  12. Vintage Radio: How AGC works and why it’s necessary by Rodney Champness
  13. Advertising Index
  14. Outer Back Cover

This is only a preview of the May 2010 issue of Silicon Chip.

You can view 29 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 "A Solar-Powered Lighting System":
  • Solar-powered Lighting System PCB [16105101] (AUD $10.00)
  • PIC16F88-I/P programmed for the Solar Powered Lighting Controller [1610510A.HEX] (Programmed Microcontroller, AUD $15.00)
  • PIC16F88 firmware and source code for the Solar Powered Lighting Controller [0610510A.HEX] (Software, Free)
  • Solar-Powered Lighting System PCB pattern (PDF download) [16105101] (Free)
Articles in this series:
  • A Solar-Powered Lighting System (May 2010)
  • A Solar-Powered Lighting System (May 2010)
  • A Solar-Powered Lighting System, Pt.2 (June 2010)
  • A Solar-Powered Lighting System, Pt.2 (June 2010)
Items relevant to "Build A Compact 12V 20W Stereo Amplifier":
  • Compact 12V 20W Stereo Amplifier PCB [01104101] (AUD $7.50)
  • Compact 12V 20W Stereo Amplifier PCB pattern (PDF download) [01104101] (Free)
  • Compact 12V 20W Stereo Amplifier front panel artwork (PDF download) (Free)
Items relevant to "Low-Power Car/Bike USB Charger":
  • Low-Power Car/Bike USB Charger PCB [14105101] (AUD $5.00)
  • Low-Power Car/Bike USB Charger PCB pattern (PDF download) [14105101] (Free)
  • Low Power Car/Bike USB Charger front panel artwork (PDF download) (Free)
Items relevant to "Digital Audio Signal Generator, Pt.3":
  • Digital Audio Signal Generator main PCB (to suit Jaycar case - 04203101] (AUD $10.00)
  • Digital Audio Signal Generator main PCB (to suit Altronics case - 04203103] (AUD $10.00)
  • Digital Audio Signal Generator control PCB [04203102] (AUD $7.50)
  • dsPIC33FJ64GP802-I/SP programmed for the Digital Audio Signal Generator [0420310C.HEX] (Programmed Microcontroller, AUD $25.00)
  • dsPIC33 firmware and source code for the S/PDIF Digital Audio Signal Generator [0420310C.HEX] (Software, Free)
  • S/PDIF Digital Audio Signal Generator main PCB pattern for Jaycar case (PDF download) [04203101] (Free)
  • S/PDIF Digital Audio Signal Generator main PCB pattern for Altronics case (PDF download) [04203103] (Free)
  • S/PDIF Digital Audio Signal Generator display/control PCB pattern (PDF download) [04203102] (Free)
  • S/PDIF Digital Audio Signal Generator front panel label artwork (PDF download) (Panel Artwork, Free)
  • S/PDIF Digital Audio Signal Generator top panel label artwork for Jaycar case (PDF download) (Panel Artwork, Free)
  • S/PDIF Digital Audio Signal Generator top panel label artwork for Altronics case (PDF download) (Panel Artwork, Free)
Articles in this series:
  • Digital Audio Signal Generator, Pt.1 (March 2010)
  • Digital Audio Signal Generator, Pt.1 (March 2010)
  • Digital Audio Signal Generator, Pt.2 (April 2010)
  • Digital Audio Signal Generator, Pt.2 (April 2010)
  • Digital Audio Signal Generator, Pt.3 (May 2010)
  • Digital Audio Signal Generator, Pt.3 (May 2010)
Articles in this series:
  • How AGC works and why it’s necessary (May 2010)
  • How AGC works and why it’s necessary (May 2010)
  • How AGC works and why it’s necessary, Pt.2 (June 2010)
  • How AGC works and why it’s necessary, Pt.2 (June 2010)

Purchase a printed copy of this issue for $10.00.

High efficiency solar lighting system with MPPT and Solar-Powered Lighting System Need lighting away from a power source? Try this one: it’s ideal for your garden, shed or even a camp site. With a 5W solar panel, a 12V SLA battery and a smart controller, it has 3-stage charging for the battery and Maximum Power Point Tracking (MPPT) for the solar panel. Part 1 – By JOHN CLARKE 26  Silicon Chip siliconchip.com.au Features 3-stage charging. . . 1[ 12V SLA battery operation 1[ Ideal for LED lighting 1[ Constant current LED N o, it’s not the old Irish joke about the bloke who invented the solar-powered torch! Solar-powered lighting is ideal where it is impractical or unsafe to install mains-powered lighting. It can be installed just about anywhere and best of all, running costs are zero because it uses energy from the sun. In its simplest form, solar powered lighting comprises a solar panel, a battery and a lamp that can be switched on and off. But you do need to ensure that the battery is not over-charged during the day or over-discharged at night; so you need some sort of charge and discharge controller. Fig.1 shows the arrangement of our Solar Lighting Controller. The solar panel, the battery and the lamps connect to the Controller, allowing full management of charging and lighting. Additional inputs to the Controller include a light sensor to monitor the ambient light, a Passive Infra- Red (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 (subject, of course, to sufficient battery charge). 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 but settable up to the 8-hour timer limit. For shed lighting, you may opt to switch the lights on and off using a remote pushbutton switch. They can remain on until they are switched off again or they can switch automatically after a preset period, or at sunrise. Normally the Controller would be set so that the lights can only come on when it is dark. However, you might want the lights on during day in a shed and this is also possible. Table 1 shows a summary of all the lighting options 12V/5W SOLAR PANEL TEMP SENSING (NTC1) LIGHT SENSING (LDR1) PIR DETECTOR 12V LAMP OR LEDS SOLAR LIGHTING CONTROLLER 12V SLA BATTERY REMOTE SWITCH TIMER Fig.1: this shows the arrangement of our Solar Lighting Controller. The solar panel, SLA battery and the lamps connect to the Controller. Optional inputs to the controller include a light sensor to monitor the ambient light, a PIR detector and a timer. siliconchip.com.au driver option PIR, switch or ambient light turn-on [ Lamp timer included [ 5W solar panel with 3-stage battery charging 1[ 1 1 which are selected using jumper links. We’ll look at these various options later. Types of lighting The Solar Lighting Controller can power 12V compact fluorescent lamps (CFL), halogen lamps and 12V LED lighting. In addition, the Controller can directly drive LEDs using a constant current driver. Best efficiency is obtained with three 1W or 3W white LEDs in series. The actual total wattage of the lights depends on the application. We recommend that the Solar Lighting Controller be used with up to 10W of lighting when the lights are used for a maximum of 2.5 hours each day. Lower wattage lighting can give longer lighting periods. For example, 3W of lighting can be used for around seven hours per day. The restriction on the lighting wattage and usage depends mainly upon the solar panels and their ability to recharge the battery each day. The specified 5W solar panel is ideally suited for recharging a partially discharged 3.3AH battery during the day, assuming at least six hours of winter sunlight is available. Summer time will obviously provide more hours of sunlight for charging but then there will usually be less need to use the lights because of the reduced night period. Lead-acid batteries (including SLAs, despite popular belief to the contrary) will be seriously damaged or rendered inoperative if they are fully discharged and/or left in a discharged state. Hence, we have included low battery detection. Should the battery become discharged below 11V, the lights will switch off. Low standby current Standby current drain of the Solar Lighting Controller is low to conserve battery power and this has been achieved without using special components, apart from the PIR sensor. This sensor is designed for use with battery equipment where current drain is a major consideration, and is available from Altronics (Cat SX5306). We measured current drain on our sample unit at 73A from a 12V supply. This May ay 2010  27 BATTERY VOLTAGE ing will be indicated by a short flash of the charge LED every four seconds. CUTOFF VOLTAGE CUTOFF POINT BULK ABSORPTION FLOAT VOLTAGE FLOAT TIME CHARGE CURRENT TIME Fig.2: this shows the three charge stages. First is the initial bulk charge until the battery reaches the cutoff voltage. Then the absorption stage to fully charge the battery and then the float charge at a lower voltage to maintain charge. rises to 1.3mA with movement detection, due to lighting of the internal detection indicator LED. Overall quiescent current for the Controller is 2.8mA. 3-stage charging The Controller charges the SLA battery from the solar panel in three stages, as shown in Fig.2. First is the “bulk charge”, applied when the battery voltage drops below 12.45V. This charge cycle applies 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 for one hour, to ensure the battery becomes fully charged. After that, the battery is maintained on “float” charge at 13.5V. The cut-off voltage for the 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.21V and 13.31V respectively. Ambient temperature is measured using a NTC (negative temperature coefficient) thermistor located within the Controller. The monitored ambient temperature should be similar to that of the battery, provided it is located in the same area as the Controller. The thermistor can also be located adjacent to the battery, if required for a more accurate temperature measurement of the battery. No charging will occur if the thermistor is shorted or if it is not connected. This feature is useful when the thermistor is remotely located where the wiring could become shorted or broken. A LED indicator flashes momentarily once every two seconds when the thermistor is open circuit and momentarily once every one second when shorted. Charging is also indicated using the same LED indicator. Bulk charge is indicated when the LED is on continuously while it flashes on for 0.5s and 0.5s off for the absorption and one second on, one second off during float. A battery that has been discharged below 10.5V will be charged using short burst of current until it reaches 10.5V whereupon the main charge will begin. This initial charg28  Silicon Chip MPPT & charge optimisation The Controller optimises the available charge from the solar panel. As shown in Fig.3, a typical solar panel provides an output that follows the curve that ranges from maximum current when the output is shorted (ISC) to maximum voltage when the output is open circuit (VOC). For the Altronics N0005 panel featured in this article, ISC is 320mA and VOC is 21.6V. Maximum power is 5.05W at 290mA and 17.4V. When we consider the power delivered to the battery, the story becomes more interesting. If we were to connect the solar panel directly to the battery, the charge current would be about 320mA at 12V (3.84W) and about 300mA at 14.4V (4.32W). Both these values are less than the 5.05W available from the solar panel at 17.4V. The solar panel operates at peak efficiency when it is delivering maximum power. And that is where the Maximum Power Point Tracking (MPPT) aspect of the controller comes into play. It is essentially a switchmode step-down power converter, which couples the available power from the solar panel to the battery with minimal power loss. At the same time, it provides 3-stage charging to the battery. Fig.4. shows how this takes place. Current from the solar panel flows through diode D1 via Q1. When Q1 is on, current (i1) flows through inductor L1 into the 470F capacitor and 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 diode D2. The ratio of the on to off period (duty cycle) for Q1 is controlled so that the solar panel delivers its maximum power. The solar panel is not required to supply the peak current into the inductor as this is drawn from the 470F reservoir capacitor, C1. Similarly, capacitor C2 acts as a reservoir to charge the battery when current is not flowing through the inductor. 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 IC2a while the current is monitored by measuring the voltage across a 0.1Ω resistor. This voltage is multiplied by –50 in op amp IC2b. Both op amps feed their signals I(mA) 290mA Isc = 320mA 300 MAXIMUM POWER 200 100 Voc = 21.6V 0 0 2 4 6 8 10 12 14 16 18 17.4V 20 22 24 V Fig.3: the solar panel provides an output that follows this curve, ranging from maximum current when the output is shorted (Isc) to maximum voltage when the output is open circuit (Voc). For best efficiency it is necessary to operate the solar panel at its maximum power point. siliconchip.com.au Here’s the controller mounted inside its box. It snaps into place on the integral PC board supports. The cable glands on the left side make it fairly water-resistant but this box is definitely not waterproof! to microcontroller IC1 which controls the whole circuit. it cannot provide much current before the voltage drops significantly. Hence, the input loading for this sensor signal is 10MΩ . Note that resistor R2 is not used with the SX5306 PIR sensor. R2 is included if a standard PIR detector is used. Many standard PIR detectors include a relay with normallyclosed contact that opens when movement is detected. With R2 included this provides a pull-up to 5V when the contact opens. A 12V power supply for either type of PIR detector is included. A pushbutton switch (S1) is monitored by the RB1 Circuit details The full circuit for the Solar Lighting Controller is shown in Fig.5 and is based around a PIC16F88 microcontroller, IC1. It monitors IC2, the PIR sensor, switch S1, light dependent resistor LDR1 (for day/night sensing), the NTC thermistor and also controls lamp operation via Mosfet Q4. For PIR operation using the Altronics SX5306 PIR detector, output from the PIR is normally at 0V but when it detects movement, the trigger output goes high to 4.5V. Output impedance of this PIR is high, at about 700kΩ, so A i1 Q1 D1 L1 K FUSE F1 K +  BUFFER SOLAR PANEL A=1 (IC2a) C1 470 F V BUFFER I 0.1 siliconchip.com.au A = –50 (IC2b) MICROCONTROLLER (IC1) D2 A i2 + 12V SLA BATTERY – C2 470 F Fig.4: charging the battery from the solar panel uses a switchmode circuit. Current from the solar panel flows through reversepolarity protection diode D1 via Q1. (D1 also prevents the battery discharging into the solar panel at night via the internal diode in Q1). When Q1 is on, current (i1) flows through inductor L1 into the 470F capacitor and 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 diode D2. May 2010  29 input, normally held high at 5V with a 10kΩ pull-up resistor. Pressing the switch pulls the RB1 input low. S1 is included on the Controller PC board for test purposes but an external on/off (pushbutton) switch can be connected as well. The 100nF capacitor at RB1 prevents interference when long leads are used to an external switch. Ambient light is monitored using the light dependent resistor (LDR1) at the AN5 analog input of IC1. The LDR forms a voltage divider with the series-connected 100kΩ resistor and VR5 connecting to 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 relative 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 Q6 is switched on, tying the lower end of the LDR close to 0V. VR5 allows threshold adjustment of the LDR sensitivity. pendent on ambient light, according to the LK1 selection. If PIR operation is selected with LK2 but the PIR detector is not connected to the circuit, then the lamp can only be switched on with S1. If LK2 is set to the LDR position, the PIR does not switch on the lamp – the lamp is switched on at the change of ambient light, day to night or night to day (again, dependent on LK1). Link Options Lamp driver There are three options available for turning on the LED/ light: (1) only at night, (2) only in daylight or (3) either. The position of link LK1 selects the first two options, while the third option operates with the link in the “night” position but has the LDR left out of circuit. The lamp can be switched on using the pushbutton switch S1 (internal or external), provided the ambient light level is correct according to the selection made with LK1. When link LK2 is in the PIR position, the lamp can also be switched on when the PIR detects movement; again de- Built-in timer The lamp can also be switched off with a timer or ambient light. The various options are summarised in Table 1. The lamp “on” period is adjustable using trimpot VR4, which connects between 5V and the drain of Q6. When Q6 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 to set VR4 later. The Controller includes a constant current lamp driver which can power LEDs or standard 12V incandescent lamps. Current control is important for LEDs because with voltage control, small variations in the supply voltage can result in large changes in the current flow. Mosfet Q4 and its associated components form an active current sink. Q4’s transconductance is varied in response to the voltage developed across R1, which is proportional to the lamp current. IC1’s RB0 output switches on the lamp by applying Specifications Lamp driver................................... Constant current LED drive Lamp current................................. Typically less than 350mA for 1W LEDs or less than 1A for 3W LEDs, or at                2A for 12V halogen and 12V LED lamps Lamp timer.................................... 2s to 8h. See table 3. LED driver..................................... Up to 3 white LEDs in series. 1W or 3W types. Lamp switch on............................. Via ambient light change, PIR sensor and switch Lamp Switch off ........................... Via ambient light change, timer or switch Low battery lamp off voltage........ 11V Quiescent current ......................... 2.8mA Charging voltage........................... 14.4V at 20°C for main bulk charge and absorption cut-off voltage.                Float is 13.5V <at> 20°C Compensation............................... Adjustable from 0 to 50mV per °C, reducing charge voltage above 20°C and                increasing below 20°C. No increase below 0°C. Thermistor warning....................... Open or short circuit (Charge LED flashes 262ms every 2s for open circuit                and 262ms every 1s for short circuit) Low battery charge....................... At less than 10.5V charging via a 6.25% duty cycle charge burst (Charge indicator flashes 260ms each 4.2s) Bulk charge initiation.................... When battery drops below 12.45V or the equivalent of 75% charge Charge LED indicator ................... Bulk charge: Continuously lit.                Absorption: flashing at 0.5s on 0.5s off.                Float: 1s on and 1s off Charger.......................................... Charging can start when solar panel is >12V Charger operation......................... Switch mode power converter at 31.24kHz maintains solar panel operation                at maximum power output. 30  Silicon Chip siliconchip.com.au  + 100nF 0.1  5W 10k 8 100nF 4 IC2b 100k 1nF IC2a 100nF 5 6 2 3 ZD2 30V 1W 7 1 IC2: LM358 A K 10k 100k R2 -SEE TEXT 2.2k 2.2k 10 F 35V LK1 +5V LDR PIR LK2 B 10 DAY E C K A 10k NIGHT Q3 470 F 35V LOW ESR SOLAR LIGHTING CONTROLLER S1 10M +12V 1k 1k 12V/5W SOLAR PANEL 100nF 100 K 4.7k 100nF D3 B 2 9 7 8 15 3 4 1k A K 14 AN2 1 10 LED1 RB4 Vdd G TP1 TP2 K CHARGE A ZD1 18V 1W (mV/°C) +5V 470  100nF A K 5 Vss A AN6 AN0 AN1 RB5 AN5 K 1N5822 RB1 RB2 RA6 AN4 11 12 13 17 18 TP4 TP3 +5V  K A K ZD1,ZD2 A D3: 1N4148 VR4 10k TIMER VR3 10k 10nF +5V 100 F +5V 10 LDR 1 NTC 1 10k 22k G 1nF 470 2 LED1 VR5 500k K A 8 +12V 10nF 100k VR2 20k 4.7k SET 5V VR1 20k 470 F 35V LOW ESR L1 100 H 3A D2 1N5822 IC1 PIC16F88 6 COMPENSATION -I/P RB0 RA7 AN3 PWM MCLR 10 Q2 16 E C D Q1 IRF9540 S Fig.5: the circuit is based around a PIC16F88 microcontroller, IC1. It monitors IC2, the PIR sensor, switch S1, light dependent resistor LDR1 (for day/night sensing), the NTC thermistor and also controls lamp operation via Mosfet Q4. 2010 SC  EXT ON/OFF PIR SENSOR – + 4.7k 22k A D1 1N5822  siliconchip.com.au May 2010  31 IC3 Q5 1k 4 5 5 S G S 2N7000 Q6 2N7000 D D 2  1 4N28 4 IC4 TL499A +12V E C 1 E B C G – G 10nF S D S Q4 IRF540 EXT LDR D COMMON EXT NTC R1 (SEE TEXT) D Q1, Q4 VR6 20k CURRENT ADJUST – Q2,Q3,Q5: BC337 82k B + 12V 12V LAMP SLA OR LEDS BATTERY (SEE TEXT) + FUSE F1 3A Table 1: Lamp Operation PIR (LK1) LDR (LK2) Lamp ON Lamp OFF In Night PIR movement detection or with S1 during night time only Timer timeout, S1 or at dawn In Day PIR movement detection or with S1 during day time only Timer timeout, S1 or at dusk In Night (LDR1 disconnected) PIR movement detection or with S1 during day and night Timer timeout or S1 Out Night Day to night transition or with S1, night only Timer timeout, S1 or automatically at dawn Out Day Night to day transition or with S1, day only Timer timeout, S1 or automatically at dusk Out Night (LDR1 disconnected) S1 during day or night Timer timeout or S1 5V to Q4’s gate, allowing current to flow from its drain to source. If the current through R1 rises enough for the voltage across it to exceed 0.6V, transistor Q5 turns on and reduces Q4’s gate voltage. This reduces the current flow. A steady state arises so that the voltage across R1 is kept at approximately 0.6V. If R1 is 2.2Ω, about 270mA will flow through Q4 and the lamp. VR6, in combination with the 82kΩ resistor, acts as a voltage divider, allowing the current flow to be adjusted upwards. If VR6 is set for maximum resistance than the voltage across R1 will be 0.76V before Q5 turns on, allowing up to 345mA through the lamp. 2.2Ω for R1 is suitable for a lamp consisting of three 1W white LEDs in series. Their combined forward voltage is about 10.5V. With 0.76V across R1, this means that there will be 0.74V across Q4 (its minimum drop is around 0.1V in this case). With this setup, the lamp driver consumes some 0.51W (1.5V x 340mA) and the LEDs consume a total of 3.57W. Thus efficiency is about 87%. If the 270-340mA range is inadequate then R1’s value can be changed. For 3W star LEDs, use 0.68Ω, which results in a range of 0.9-1.1A. For standard 12V lamps, the current regulator serves as short circuit protection – a 0.33Ω resistor allow up to 2A before limiting occurs. Charging For charging, we use the switchmode step-down circuit previously described in Fig.3. Mosfet Q1 is a P-channel type that switches on with a gate voltage that is negative with respect to the source. The voltage at Q1’s source (from the solar panel and diode D1) can range up to about 21V when the solar panel is not delivering current. The gate is pulled negative with respect to the source via transistor Q3, a 10Ω resistor and diode D3. Transistor Q3 is pulse-width-modulated by the RB3 output of IC1 via a 4.7kΩ resistor. 32  Silicon Chip When RB3 goes to 5V, Q3 is switched on and pulls the gate of Q1 low. The Mosfet is therefore switched on. Transistor Q2 is held off due to its base being held lower than the emitter via the forward-biased diode D3. The 10Ω resistor at the collector of Q3 limits initial zener diode current through ZD1 in the event that the gate voltage exceeds 18V. This zener protects the gate from breakdown with excess gate voltage. With extreme over voltage, transistor Q3 will come out of saturation, preventing little more than about 20mA current through the 18V zener diode. When the output of RB3 is taken to 0V, transistor Q3 switches off and the base of Q2 is pulled to the Q1 source voltage via a 10kΩ resistor. Transistor Q2 switches on and pulls the gate of Q1 to the source and so switches off Q1. The switch-on and switch-off action for Q1 as controlled by the RB3 output of IC1 is at 31.24kHz. Battery voltage is monitored at IC1’s AN2 input via optocoupler IC3 and a resistive divider comprising a 22kΩ resistor and 20kΩ trimpot, VR2. This divider, or more properly the trimpot, is adjusted to 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 procedure in the setup later. The resistive divider is not directly connected to the battery but via the transistor within optocoupler IC3, which connects the battery voltage to the divider whenever the LED within IC3 is on. The voltage between the collector and emitter 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 the IC’s firmware. The optocoupler LED is driven from the 5V supply through a 470Ω resistor and to 0V when Mosfet Q6 is switched on. The thermistor (NTC1) forms a voltage divider with a 10kΩ resistor across the supply when Q6 is switched on. The AN6 input to IC1 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, which is also effectively connected across the 5V supply when Q6 is switched on. The AN6 and AN1 inputs are converted to a mV/°C value, which can range from 0mV/°C when VR3 is set to 0V to 50mV/°C when VR3 is set for 5V. Power saving As we just mentioned, Mosfet Q6 connects trimpotsVR3 and VR4, the LDR and the NTC to 0V and also powers the optocoupler LED. Q6 is powered on with a 5V signal from the RB5 output of IC1. The Mosfet then momentarily connects these sensors to 0V so the IC1 microcontroller can measure the values. When Q6 is off, these trimpots, sensors and battery divider are disconnected from the supply to conserve the power drain from the battery. One problem with using Q6 to make the 0V connection for the trimpots, battery and sensors is that these sampled voltages cannot be measured easily with a multimeter. This is because a multimeter will not be fast enough to capture the voltage as Q6 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 siliconchip.com.au Parts List – Solar Powered Lighting Controller 1 PC board coded 16105101, 133 x 86mm 1 UB1 box 157 x 95 x 53mm 4 3-way PC mount screw terminals 5.08mm pin spacing (CON1,CON2) 1 2-way PC mount screw terminals 5.08mm pin spacing (CON1) 1 100H 3A Choke (Altronics L6522, Jaycar LF1272 or equivalent) 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 or Jaycar RD3480 or equivalent) 4 IP68 cable glands for 6mm cable 2 4.8mm female spade crimp connectors 1 DIP18 IC socket 2 M205 PC mount fuse clips 1 3A M205 fast blow fuse 1 TO-220 U shaped heatsink 19 x 19 x 10mm 1 M3 x 10mm screw, nut and washer 2 PC stakes (TP1,TP2) 1 2-way pin header with 2.54mm pin spacing (TP3,TP4) 2 3-way pin headers with 2.54mm pin spacings (LK1, LK2) 2 jumper shunts for pin headers 1 100mm cable tie 1 100mm length of 0.7mm tinned copper wire or 4 0Ω links Semiconductors 1 PIC16F88-I/P microcontroller programmed with 1610510A.hex (IC1) 1 LM358 dual op amp (IC2) 1 4N28 optocoupler (IC3) 1 TL499A regulator (IC4) 1 IRF9540 P-channel Mosfet (Q1) 3 BC337 NPN transistors (Q2,Q3,Q5) 1 2N7000 N-channel Mosfet (Q6) 1 IRF540 N-channel Mosfet (Q4) 2 1N5822 3A Schottky diodes (D1,D2) 1 1N4148 switching diode (D3) 1 18V 1W zener diode (ZD1) 1 30V 1W zener diode (ZD2) 1 3mm high intensity red LED (LED1) Additional Parts (as required) Capacitors 2 470F 35V (or 50V) low ESR 1 100F 16V 1 10F 35V 6 100nF MKT polyester 3 10nF MKT polyester 2 1nF MKT polyester Resistors (0.25W 1%) 1 10MΩ 5% 2 100kΩ 4 10kΩ 3 4.7kΩ 2 470Ω 1 100Ω 1 82kΩ 2 2.2kΩ 3 10Ω 1 Altronics low current PIR movement detector (IR-TEC IR-530LC) (Altronics SX5306) or 1 PIR movement detector with NC relay contacts (preferably with 1mA or less standby current – will also need R2, an extra 100kΩ resistor) 2 22kΩ 4 1kΩ Resistors (5W) 1 0.1Ω 1 0.33Ω – 3.3Ω (value selected from Table 1) LEDs 1W white LEDs (Jaycar ZD0424, ZD0426, ZD0508, ZD0510) (Altronics Z0251, Z0252A) 3W white LEDs (Jaycar ZD0532, ZD0534, ZD0442, ZD0-0444) (Altronics Z0258A, 0259A Mini horizontal trimpots (5.08mm pin spacings) 2 10kΩ (103) (VR3,VR4) 3 20kΩ (203) (VR1,VR2,VR6) 1 500kΩ (504) (VR5) LED drivers (see text; Controller has a LED driver built in) Jaycar AA0592, Altronics M3310 for 1-6 LEDs at 1W Jaycar AA0594 for 1-6 LEDs at 3W (Altronics M3320 for 1-3 LEDs at 3W) Miscellaneous 1 12V 3.3AH SLA battery 1 12V 5W solar panel array (Altronics N0005 or N0704, Jaycar ZM9091 or ZM9026 or equivalent) Figure-8 wire, solder, 4-way alarm cable. 12V lamps IP67 3-LED modules (eg Jaycar ZD0490) MR16 lamps (eg Jaycar ZD-0346-ZD0349) 10W Halogen (eg Altronics Z2400) 12V DC LED Globes (eg Altronics X2150) siliconchip.com.au May 2010  33 Internal (above) and external shots of our 3-LED light which is perfect for this controller. You can just see the blurry LEDs through the translucent lid in the photo below. Construction details will follow next month. battery divider is correct and to measure the timer and mV/°C values set with VR4 and VR3. In order make these measurements; Q6 is switched while ever S1 is pressed. Other power saving methods includes how the charge LED (LED1) is driven. It is only used to show charging when there is supply available from the solar panel. Current to drive the LED is therefore provided 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 these indications at a low duty cycle, again conserving power. Op amp IC2 is also powered from the solar panel itself. This arrangement is suitable because we only want to measure the solar panel voltage and its current whenever 34  Silicon Chip the solar panels are generating power. Power for IC2 is derived from the solar panel via a 100Ω series resistor. A 30V zener diode limits transient voltages that could occur in long wiring that connects between the Solar Lighting Controller and the solar panel. Diode D1 prevents the battery from powering IC2 via Q1’s internal diode and L1. Solar panel voltage is monitored using a 22kΩ and 4.7kΩ voltage divider. A 100nF capacitor filters any transient voltages or noise that could be induced through long leads from the solar panel. Voltage is buffered by IC2a and the output is applied to the AN3 input of IC1. The voltage divider ratio allows for measurement of up to about 28V from the solar panel. Should IC2a’s output go above 5V, the 2.2kΩ resistor limits current into IC1. Current through the solar panel is measured by voltage developed across a 0.1Ω resistor. The voltage is only around 30mV with 300mA flowing. Voltage at the negative terminal of the panel does go (slightly) negative with respect to 0V when there is solar panel current flow. This voltage is inverted and amplified by IC2b, which has a gain of -50. Therefore IC2b’s output will be around 1V per 200mA of current flow from the solar panel. This output is applied to the AN4 input of IC1 via a current limiting 2.2kΩ resistor. Note that the actual calibration of voltage and current is not overly important. 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 and 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 is from the 12V SLA battery via a TL499A regulator, IC4, a low quiescent current type that can run as a linear step-down regulator and as a switch mode step-up regulator. We have used it as a 12V to 5V linear regulator, with the output voltage trimmed using VR1. Setting the output to 5V 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 zener diode ZD2 will conduct in its forward direction, preventing more than 0.6V reverse voltage applied across its pin 4 and pin 8 supply rails. Diode D1 prevents reverse voltage being applied to the remainder of the circuit. Should the battery be connected back to front, diode D2 will conduct via inductor L1 and the fuse, F1. The fuse will blow breaking the connection. Construction next month That’s a fair amount to digest in one bite but broken down into functional parts, it’s not that difficult! Next month, we’ll cover full constructional details and even show how we made some LED lights to go with the project. SC siliconchip.com.au