Working Prototype of Wind-Clik Sensor
Requirements:
Design a new sensor system that can detect wind speeds ranging from 2.2 m/s to 13.4 m/s (5-30mph)
Allows user to easily:
Set the wind speed at which the sprinkler system turns off
Set the wind speed at which the sprinkler system resets
Manually override the sensor
Prevents the sprinkler system from cycling On/Off Ability to Stand Up to a Five-Year Warranty in an Outdoor Environment
Wind Cups and Shaft
Simplistic Wind Cup
Threaded 4-40 Rod and Spacers to secure Magnet
Ball Bearing at base of Shaft
Sleeve Bearing at top of housing to constrain shaft in second locatio
Signal Generator
Use of Magnet coupled to Rotating Shaft
Placed near Copper Coil
Produces AC Signal for Microcontroller
Faraday’s Law: V=N∗∆(BA)/∆t
Optimize Signal with Number of Turns (N), Magnet (B), and Area (A)
Various Magnets range from .5299 to .7187 Teslas
Number of Turns per Coil ≈ 2000
Electronics Design
Wind Cups and Shaft
Signal Generator
Microcontroller Code
'****************************************************************
'* Name : mae156b_ec_3.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2012 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 3/10/2012 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
DEFINE ADC_BITS 10 'number of bits in result
Define ADC_CLOCK 3 'set clock source (3=rc)
DEFINE ADC_SAMPLEUS 50 'Set sampling time in us
comp var GPIO.0 'input pin for the output of the comparator
relay1 var GPIO.5 'output to relay pin
relay2 var GPIO.4 'output to relay pin
a1 VAR word 'var to store data for counts of pulse
a2 VAR word 'var to store data for RPM of environment windspeed
p1 var word 'var to store shutoff pot value
p2 var word 'var to store reset pot value
dummy var word 'var for div32
user1 var word 'shutoff setting in RPM
user2 var word 'reset setting in RPM
init:
ADCON0.7=1 'right justified result (10bit)
TRISIO=%11001111 'Set direction of CH (1=input)
CMCON0=7 'comp off
ANSEL=%00110110 'Set AN0-3 as analog
'VRCON=%10100001 'sets vref on with low range 0000
pause 1000 'pause for 1s
relay1=0 'set output to relay pin1 to 0
relay2=1 'set output to relay pin2 to 1 to turn on sprinklers
pause 2000 'pause for 2s
relay2=0 'set output to realy pin2 to 0 to minimize power consumption
start:
count comp,10000,a1 'count pulses from comparator for 10s
a2=a1*6 'multiply by factor to obtain wind speed in RPM
ADCIN 1,p1 'store ADC Ch1 value to p1 var
dummy=756*p1 'store dummy value for div32
dummy=div32 1000 'div32 operation for dividing 32 bits of data
user1=dummy+4 'add the intercept to obtain shutoff in RPM
if a2>user1 THEN 'if env wind speed is > than shutoff
goto turnoff
ELSE 'otherwise
GOTO turnon
ENDIF
GOTO start
turnoff:
relay1=1 'set relay pin1 to 1
relay2=0 'set relay pin2 to 0 to turn off sprinkler system
pause 2000 'pause for 2s
relay1=0 'set relay pin1 to 0 to minimize power consumption
'sleep 5 'sleep for 5s
check:
count comp,10000,a1 'count pulses from comparator for 10s
a2=a1*6 'multiply by factor to obtain wind speed in RPM
ADCIN 2,p2 'store ADC Ch2 value to p2 var
dummy=756*p2 'store dummy value for div32
dummy=div32 1000 'div32 operation for dividing 32 bits of data
user2=dummy+4 'add the intercept to obtain shutoff in RPM
if a2<user2 THEN 'if env wind speed is > than shutoff
goto turnon
ELSE
GOTO turnoff
ENDIF
GOTO check
turnon:
relay1=0 'set relay pin1 to 0
relay2=1 'set relay pin2 to 1 to turn on sprinkler system
pause 2000 'pause for 2s
relay2=0 'set relay pin2 to 0 to minimize power consumption
'sleep 5 'sleep for 5s
goto start 'goto start
END 'end program