Garden Solar Light Logger.

This Web page captures some working notes about the use of a microchip PIC 16F676 to analyse and measure the effectiveness of the garden solar light.

| INTRO | SPEC | PHOTOS | CIRCUIT | NOTES | PINOUTS | GRAPHS 20/01/06 |
BLOG | MEASUREMENT BLOG | CALCULATOR AND BLOG FORM | Another CALCULATOR
| Blog converted to CSV output for plotting | Blog converted and plotted with SVG - use firefox | SC001_multiChip.asm | SC001_multiChip.lst |

A simple logger using a 16F676

I purchased two of those solar powered lights.

They worked quite well in the summer, but in the autumn, they never seemed to be on for very long. I was quite disappointed.

How long is the LED on for? Is the battery big enough, or is the solar panel too small?

I wanted to measure how long the battery was being charged for and the how long the LED is on for.



image


Could I use a PIC with A/D and a serial EEPROM to measure how long the LED was on , how long the battery was being charged, and see if the design was optimised.

I traced the circuit of the solar light, and using a couple of cheap alarm clocks as timers I could measure the Charging duration and the on time.

The alarm clocks are the Quartz mechanical types, I used a transistor to turn on the battery, and therefore I could measure the on time for up to 12 hours.

Reset the time to 12:00 when you leave, come back within 12 hours and see what the time is now and you have a cheap timer!

You have to use a mechanical clock, not an LCD one, as the the LCD ones reset when you remove the power. You can buy dummy AA batteries from Maplin, which makes connecting to the clock much easier.

To measure the charge time with an alarm clock, I replaced the series diode from the Solar cell to the battery with a transistor Base Emitter.

I then used the transistor to turn on the battery to the clock.

Even in February, I was getting 9 hours of charge, Using another clock, I could measure how long the LED was on for. I connected the Clock across the LED, as when it is on, The clock is on. However, this did not work very well as the clock takes power in pulses every second, and the solar garden light circuits uses a Schmitt trigger to keep the light on.

The next thing was to use a PIC with some A/D converters and a serial EEPROM, and log the voltages around the circuit.

The serial EEPROM was too difficult to achieve, so I used a counter approach.

I had an array of counters, which were incremented depending upon what was happening. Every tick, the values were output in hex as serial and could be logged using hyper-terminal, captured and processed.

The counters were:

; count, time, solar cell, bright, dim ,





You could leave it for the day, and come in when it was dark, save the counts, and the time you read them and reset the counts for the next day.



The cycle for the day is:



1)It is dark and the Garden light's Battery is exhusted.

Reset the counters, as nothing really is happening

2)Dawn and the battery starts to charge.

3) Dusk and the solar cell voltage falls below the battery voltage, and stops charging the battery

4) Dusk and the LED comes on bright

5) Dark and the battery is almost exhusted that the LED goes dim.



In the winter I could reset the counters before I went to bed, in the summer, the LED was still on, and dawn was too early to get up for.





Outline Requirements for logger

Currently I have a simple logger SR003_multichip.


This uses a single 16F676. It uses the simple serial code from http://www.dougrice.plus.com/hp/LCD1300/index.html


It also uses TMR1 to tick the chip.


My first logger simply measured the voltages around the Solar Garden light, and incremented counters depending if the voltages suggested that the battery was being charged, the LED was on, was bright or was dim.


These were continually reported to an rs232 terminal.


When reseting the chip, write down the time, leave it for about 24 hours and record the counts and actual time.


I wrote a simple web page to process the counts. You entered the start and stop times and it calculated the times and voltages.


Pin Allocation for logger with EEPROM

image
Illustration 1: PIC 16F676 pins





 

image
Illustration 2: EEprom



 


image



Requirements

; v6 = Vsolar,



; V5 = Vbattery

; V4 = VtopOfLED

Function

Pin

Comment

Vsolar

9,RC1/AN5

Used to measure the solar cell volatage,

Clammped to Diode and Vbattery.

Vbattery

12, RA1,AN1,VREF

Set this to Vref to get max range of AtoD when measuring the voltage across the LED resistor.

Used to measure Battery voltage

VtopOfLED

10, RC0/AN4

Used to measure LED current, so brightness.

Feedback LED

8, RC2/AN6

Used to Indicate a status.

Serial TX/RX

13, RA0/AN0/CIN+/ICSPDAT as SR003multichip uses this.
( Move to 7, RC3/AN7 to free up comparator )

Use 4K7 resistor for half duplex serial .

Possible use on change interupt.

EEPROM SCL

5, RC5

I2C clock

EEPROM SDA

6, RC4

I2C data

Log Tick from external Clock

4, RA3

On ve edge store the Counts into the EEPROM

and zero the Counts.

Input only

32kHz Crystal

2, RA5/T1CKI/OSC1/CLKIN

Not used yet

32kHz Crystal

3, RA4/T1G/AN3/OSC2/

0

Battery

1,

VDD VDD Power — Positive supply

GND

14

VSS VSS Power — Ground reference


ICSPDAT TTL CMOS Serial Programming Data I/O

13,RA0/AN0/CIN+/ICSPDAT

RA0/AN0/CIN+/ICSPDAT RA0 TTL CMOS Bi-directional I/O w/ programmable pull-up and

Interrupt-on-change

AN0 AN — A/D Channel 0 input

CIN+ AN Comparator input

ICSPDAT TTL CMOS Serial Programming Data I/O

ICSPCLK ST — Serial Programming Clock

12,RA1/AN1/CIN-/VREF/ICSPCLK

RA1/AN1/CIN-/VREF/

ICSPCLK

RA1 TTL CMOS Bi-directional I/O w/ programmable pull-up and

Interrupt-on-change

AN1 AN — A/D Channel 1 input

CIN- AN — Comparator input

VREF AN — External Voltage reference

ICSPCLK ST — Serial Programming Clock



image
Illustration 3: Essential circuit of the Solar Garden Light




 

Webcam pictures

Webcam pictures

image


image


image


The Circuit for the logger is:


The Circuit for the logger



This circuit was used for the experiment in 2006

image

On 29/09/2008, it was found that the performance of the AtoD is much worse if the RS232 is connected to PA0. The voltage on PA0 is -0.65 volts and this makes the AtoD convert very sensitive to series resistence on the AN4,AN5,AN6 inputs.

NOTE: ONLY WHEN RS232 IS CONNECTED TO PA0, AND PA0 is -0.65 V

The resistor in series with the AtoD converter affects the measured ADRES value.
different resistors are inserted between Vdd and the AtoD pin Vref++ is set to Vdd. Vdd ---+--------------------->Vdd +--[resistor]--------->AtoD resistor ADRES dADRES/dkR dR/dADRES 0 1006 1000 992 -14 -71.43 2000 976 -16 -62.5 3000 964 -12 -83.33 4700 941 -13.53 -73.91 5600 929 -13.33 -75 7500 907 -11.58 -86.36 8200 895 -17.14 -58.33 9100 885 -11.11 -90

If the RS232 circuit is moved to RC5, which is not an ANx pin, the AtoD convert works much better. When measuring the Value goes to 0x3FF when he pin is connected to Vref via a 10k resisitor.

image

Made up on vero board




The circuit of the garden light

image


 

 


Notes


The Logger runs off an un regulated battery. The solar cell charges two NiCa cells, so the voltages are clamped to the NiCa cell voltages.


To provide a more stable voltage, a blue LED is used as a voltage reference as well as an indication of sampling.


The LED is turned on during the measurements, and provides a reference of about 3.25 volts. Pick an LED with a high forward voltage. It needs to be higher than the volatages to be measured.



The Pinouts


TABLE 1-1: PIC16F630/676 PINOUT DESCRIPTION

image


Graphs of samples on 20th Jan 2006

The serial ouput was captured throughout the day and some of the samples plotted

The PIC's output was captured with a terminal program, pasted into a web page text area. The web page converted the HEX to decimal and converted the values to voltages. This output was pasted into microsoft works 4.5, and the graphs pasted into IFANView and saved as GIFs.

image
The next graph is more spaced out, but looses the time reference.
image

The battery never got enough charge. At twilight, the battery was discharged by the 1K5 resistor R6 in the diagram above. The LED never came on!

In the middle of the day, the solar panel was angled at about 45 degrees to the Sun, which was adjusted late afternoon.

The next graph is the year's counts plotted. Remember, that the logger increments the count every 15 seconds if the measured voltage matches the condition.

image

Quite frankly its a bit of a dissapointment. The on time of the light was very poor. I was surprised how long the SolarCell is charging. However, the currrent is very small.

AtoD EQUATION 7-1: ACQUISITION TIME Calculator.

EQUATION 7-1: ACQUISITION TIME
TACQ = Amplifier Settling Time + Hold Capacitor Charging Time + Temperature Coefficient
     = TAMP + TC + TCOFF
     = 2us + TC + [(Temperature -25C)(0.05u/C)]
Tc   = CHOLD (RIC + RSS + RS) ln(1/2047)
     = -120pF (1k. + 7k. + 10k.) ln(0.0004885)    // ln( 1/2047 ) = -7.62413058566128952912456837248005
     = 16.47us
Tacq = 2us + 16.47us + [(50C -25C)(0.05u/C)
     = 19.72us

Note 
1: The reference voltage (VREF) has no effect on the equation, since it cancels itself out.
2: The charge holding capacitor (CHOLD) is not discharged after each conversion.
3: The maximum recommended impedance for analog sources is 10 k.. This is required to meet the pin
leakage specification.
us Tc = -120pF * ( kOhm Ric, kOhm Rss, kOhm Rs, ) * ln( 1/2047 )
us Taqu, = 2us + Tc + ( C Temp - 25C) *0.05
re-calculate TC and Tacq

Solar Light Calculator.

Paste values from PIC SR003MultiChip.asm

Sample time: Vref:

PIC output:

01FA,0000,0000,0000,0000,,/,4640,1F00,,t,181B,0400,,,31C,3D4,3D8,D58,*

0047,0000,0000,0000,0000,/t,093508,0100,011C,011B,033A,//s,FFE4,l,0001,,*

0047,0000,0000,0000,0000,/t,093508,0100,011C,011B,033A,//s,FFE4,l,0001,,*
004D,0000,0000,0000,0000,/t,093502,0112,011C,011C,033B,//s,FFF6,l,0000,,*

018B,00F8,0000,0000,0000,/t,091F0E,0193,011B,0117,033B,//s,0078,l,0004,,*
018C,00F9,0000,0000,0000,/t,091F0D,0191,0116,011A,033B,//s,007B,l,FFFC,,*
018D,00FA,0000,0000,0000,/t,091F0C,018F,0118,0119,033B,//s,0077,l,FFFF,,*
018E,00FB,0000,0000,0000,/t,091F0B,018F,0118,0118,033A,//s,0077,l,0000,,*
// 
1680,0400,0000,0000,0000,/t,12240F,01DA,012E,012A,034A,//s,00AC,l,0004,,*
1681,0401,0000,0000,0000,/t,12240E,01DB,012D,012A,034A,//s,00AE,l,0003,,*
1682,0402,0000,0000,0000,/t,12240D,01DE,012D,012B,034A,//s,00B1,l,0002,,*

recalc if values edited

Working Notes and BLOG update form

Paste the normal serial line from the PIC, or use th d; command to get the stored counts. You currently need to selct the counts and paste to replace the counts in the normal output.

:name
:email
:Type of comment
:PIC Output
Please enter any comments:-


 

User notes and thoughts

Last Entry first

Measurement Log

Last Entry first


image