' Solar Pump controller ver 4 ' For Aug. 2004 Silicon Chip Picaxe-08 application ' via Robert => robertg@ansonic.com.au 'pins: '2 = out to motor transistor '1 = input to read voltages '3 = input to check for daylight symbol volts_11 = b0 symbol volts_12 = b1 symbol volts_13 = b2 symbol volts_14 = b3 symbol sleep_time = b4 symbol read_volts = b5 symbol motor_count = b6 symbol counter = b7 symbol short_sleep = b8 symbol medium_sleep = b9 symbol long_sleep = b10 symbol day_status = b11 volts_11 = 90 'from experimentation volts_12 = 96 volts_13 = 105 volts_14 = 110 short_sleep = 80 'approx 3 minutes medium_sleep = 130 long_sleep = 255 motor_count = 30 'start wait 3 sleep_time = short_sleep main: debug b0 ' use debug to check voltage at B4 (90 = 11 volts, 96 = 12, 107 = 13) if pin3 = 1 then goto day night: day_status = 0 'usefull for debugging goto sleeper goto main day: day_status = 1 'usefull for debugging readadc 1,read_volts if read_volts > volts_14 then goto v_high_volt if read_volts > volts_13 then goto high_volt if read_volts > volts_12 then goto medium_volt if read_volts > volts_11 then goto low_volt if read_volts <= volts_11 then goto sleeper low_volt: sleep_time = long_sleep goto spin medium_volt: sleep_time = medium_sleep goto spin high_volt: sleep_time = short_sleep goto spin v_high_volt: if sleep_time <3 then goto keep_same sleep_time = sleep_time/2 goto spin keep_same: sleep_time = 2 'goto spin spin: pwm 2,200,125 'kick starts motor for counter = 0 to motor_count pwm 2,100,125 next counter sleeper: sleep sleep_time goto main