While most solar engines activate at a certain voltage (type 1 SE) some activate based on elapsed time (type 2 SE). This new solar engine circuit is a type 3 SE... Which means it triggers based on whether the voltage on the storage capacitor is rising or stable (fully charged). If the solar cell is nominally outputting 4 volts in the noon sun it might only put out 3 volts in the evening either way the capacitor can only charge up to the voltage being output by the solar panel. This means that with a type 1 SE and a 3.5 volt trigger you will only charge up to the trigger level in strong lighting, But with a type 3 SE you can trigger in a greater range of light levels.
Enter the SBSE v1 (Smart Beam Solar Engine). This circuit samples the voltage in regular intervals and saves the result, comparing it to the previous reading. If the voltage has not risen since the last reading, then it knows it's topped off and not going to be charging much more, so it sends it's enable low signal to other circuitry to signal that it's time to go. There is also a variable voltage trigger. If the capacitor is only charging to 2.5 volts and you know your motors wont activate without at least 3 volts, you set the trigger level such that it will not activate unless there is enough voltage, and then only if the voltage on the storage capacitor has stopped rising.
How it works:
When the voltage on the storage cap reaches the minimum required voltage of the Picaxe 08m2, it turns on, sets the clock frequency of the picaxe to 31k to conserve power, and starts testing the voltage. It does this by making the cathode of the diode @ pin c.0 (TestVin) output low, allowing the voltage to pass through the 10k pullup and diode. Then the Picaxe samples the voltage drop across the diode with the pin c.1 (Vin) and when it is done it then sets pin c.0 high again (to save power the diode is only seeing voltage when testing). The ADC of the picaxe is set to return a value between 0 (Gnd) and 255 (Vcc). By measuring the voltage drop of the diode as shown, you return a value that changes depending on the voltage of the storage cap.
Example:
The cap has stored 3.5 volts = 255
The voltage drop of the diode is .7 volts (for a 1n914 signal diode)
So 255 / 3.5 = 73
73 * .7 = 51
So when our ADC reading drops to 51 or lower we are above 3.5 volts. The TriggerLevel has been met (if set at 51) and now the Picaxe starts saving test results to compare to new readings.
By varying the TriggerLevel we can therefore set the minimum voltage required for activation.
Now we have a small cap for storage maybe 3300uf, we want to set the TestFreq to a low setting to test the voltage frequently. This small cap charges fast so we need to test often to know when the voltage tops off. If you are using a super cap, you will want to adjust your TestFreq to sample the voltage less often. The reason being that it takes more time to charge a super cap so you want to sample slower to give it the required time to charge. Adjustment is required to allow for the size of the solar cell and size of capacitor.
Finally there is a MaxOnTime variable that sets how long you want to run the motor. This is useful for robots with a large super capacitor that you want to run in bursts, not completely draining the capacitor in each cycle. For my application I needed the turbot to move its arms a certain max amount at a time before stopping and re evaluating where the light is coming from.
Other notes:
If you want to drive a motor directly (for a photopopper or symet, etc...) use a transistor and series resistor from the enable pin c.4 (DumpPWR). If using an NPN transistor change the code to set the initial state of DumpPWR to low and the active state to high. Also change the 100k pullup resistor to a pulldown resistor. As is below though, the signal is an enable low.
Use the nap reference so set the timing. See the chart below. While 'napping' the Picaxe is in a very low power sleep mode to conserve power.
Thoughts for improvements:
For a further improvement in efficiency, pulling pin c.3 low with a resistor, and also pulling c.2 low and setting it to an output would cut the amount of current consumed by the picaxe.
One might use the unused ADC on pin c.2 to set the value of the TriggerLevel or TestFreq variables using a potentiometer wired as a voltage divider, thereby allowing 'tweaking' of the settings without re-programming the chip.
The circuit and program:
' _ _
' ___| |__ ___ ___ /\ /\/ |
' / __| '_ \/ __|/ _ \ \ \ / /| |
' \__ \ |_) \__ \ __/ \ V /_| | James White
' |___/_.__/|___/\___| \_/(_)_| 9/20/13
'
' SMART BEAM SOLAR ENGINE TYPE 3
'
' Schematic:
' SMART BEAM SOLAR ENGINE TYPE 3
' SERIAL OUT
' <-----------------------------------------------+
' GROUND |
' <-------------------------------------------+ |
' SERIAL IN | |
' >-------------------------------+ | |
' ENABLE ____ | ____ | |
' <---------------+ +---(____)---+---(____)--+ |
' | | 22k 10k | |
' Vcc _|__|_ .----+--+----. | |
' <----+--------/ | | \--[|Vcc '--' Gnd|]----+ |
' | | | | PICAXE | |
' | | +----[|C.5 C.0|]--------+--|<|--+
' | ____ | | 08M2 | 1N914 |
' +--(____)--+-------[|C.4 C.1|]----------------+
' | 100k | | |
' | NC [|C.3 C.2|] NC |
' | `------------' |
' | ____ |
' +-----------------------(____)---------------------+
' 10k
|=== Nap Reference ===
| value time
| 0 = 18ms
| 1 = 32ms
| 3 = 72ms
| 4 = 144ms
| 5 = 288ms
| 6 = 576ms
| 7 = 1.1s
| 8 = 2.3s
| 9 = 4s
| 10 = 8s
| 11 = 16s
| 12 = 32s
| 13 = 64s
| 14 = 128s
' ====== Constants ======
symbol TestVin = c.0 ' connect to cathode of diode
symbol Vin = c.1 ' connect to anode of diode and to 10k pullup resistor
symbol DumpPWR = c.4 ' enable low output
' ====== Variables ======
symbol TriggerLevel = b0 ' min voltage to dump power (set @ 45 for 3v trigger)
symbol TestResults = b1 ' results from voltage test
symbol PreviousTest = b2 ' previous test results to compare to most recent test
symbol TestFreq = b3 ' how long to wait in between checking the voltage
symbol MaxOnTime = b4 ' maximum amount of time to dump power in one go
' ====== Directives ======
#picaxe 08m2
#no_data
#no_end
' =============================== Begin Program ===============================
setfreq k31 ' set clock speed to lowest setting to conserve power
high DumpPWR ' this pin has a 10k pullup
high TestVin ' we want this pin high until time to sample the voltage
let TriggerLevel = 45 ' min voltage at which the SE will trigger
let PreviousTest = 255 ' start with a zero volt reading
let TestFreq = 8 ' this number decides how long to wait between samples
let MaxOnTime = 9 ' maximum amount of time to dump power
test:
nap TestFreq
low TestVin
readadc Vin, TestResults
high TestVin
if TestResults >= TriggerLevel then goto test
if TestResults < PreviousTest then goto save
goto enable
save:
let PreviousTest = TestResults
goto test
enable:
low DumpPWR
nap MaxOnTime
reset