JamesWhite
New Member
After toasting my last 1381 voltage trigger for a 'miller' solar engine, I decided I wanted to try a new design. I decided to use a 08m2 to sample the storage capacitor's voltage and dump power (provide an enable low all systems go signal) to my other circuitry. It triggers only if the voltage is over a pre-set level and only if the voltage has not risen between samples, thus allowing triggering based on solar cell output, not just the trigger voltage. In BEAM lingo it's a Type 3 SE.
Here is my blog w/ more info:
http://geppettosworkbench.blogspot.com/2013/09/sbse-v1-new-picaxe-08m2-based-solar.html
-James
Here is my blog w/ more info:
http://geppettosworkbench.blogspot.com/2013/09/sbse-v1-new-picaxe-08m2-based-solar.html
-James
Code:
' _ _
' ___| |__ ___ ___ /\ /\/ |
' / __| '_ \/ __|/ _ \ \ \ / /| |
' \__ \ |_) \__ \ __/ \ V /_| | James White
' |___/_.__/|___/\___| \_/(_)_| 9/20/13
'
' SMART BEAM SOLAR ENGINE TYPE 3
' SERIAL OUT
' <-----------------------------------------------+ |=== Nap Reference ===
' GROUND | | value time
' <-------------------------------------------+ | | 0 = 18ms
' SERIAL IN | | | 1 = 32ms
' >-------------------------------+ | | | 3 = 72ms
' ENABLE ____ | ____ | | | 4 = 144ms
' <---------------+ +---(____)---+---(____)--+ | | 5 = 288ms
' | | 22k 10k | | | 6 = 576ms
' Vcc _|__|_ .----+--+----. | | | 7 = 1.1s
' <----+--------/ | | \--[|Vcc '--' Gnd|]----+ | | 8 = 2.3s
' | | | | PICAXE | | | 9 = 4s
' | | +----[|C.5 C.0|]--------+--|<|--+ | 10 = 8s
' | ____ | | 08M2 | 1N914 | | 11 = 16s
' +--(____)--+-------[|C.4 C.1|]----------------+ | 12 = 32s
' | 100k | | | | 13 = 64s
' | NC [|C.3 C.2|] NC | | 14 = 128s
' | `------------' |
' | ____ |
' +-----------------------(____)---------------------+
' 10k
'
'
' ====== 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 its 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 ' this number decides min voltage at which the SE will trigger, increase to lower and decrease to raise trigger voltage
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
Last edited: