![]() |
Forum Index : Microcontroller and PC projects : Gas Stove burner left on - reminder
Author | Message | ||||
MikeO Senior Member ![]() Joined: 11/09/2011 Location: AustraliaPosts: 275 |
We have all left the gas stove burner on at some time . Go on admit it! Here is a fun project with a serious use. A "Gas Stove burner left on" reminder, bit of a mouth full I know. The circuit is simple ,a uMite with 1 push button , 1 NTC sensor , 1 Piezo speaker and a couple of LEDs. The circuit is mounted somewhere above the stove so it can measure the local temperature. The uMite reads the NTC sensor every 15 seconds and in between it goes to sleep to save the battery. It constantly adjusts and stores the ambient temperature. What it is looking for is a large change in temperature, a degree or so in the sample period . When it senses this change it goes into alarm mode and the piezo sounds which you acknowledge by pressing the button. The UMite continues to monitor the temperature and if 30 minutes passes and the stove is still on, the alarm will sound again, pressing the button will set a further 30 min period but if you have walked away and forgotten the burner hopefully it will bring you back to turn it off! If you have turned off the stove the uMite will detect the drop in temperature back to the ambient and reset the alarm. You can also reset the alarm by pressing the button during a wakeup period (every 15sec). ' *******************************
' ***** Stove Sensor ***** ' ******************************* ' Filename: mm2stovexx.bas ' Date: Dec 2015 ' File Version: ' Written by: M.Ogden ' Function: uMite Stove left on sensor ' ' ' Last Revision: ' Target MM2 ' ******************************* ' Option Explicit Option Default Integer Option autorun On Cpu 48 dim Level,newLevel,resultLevel,prealarmlevel dim alarm, ack,increase,alarmtime dim pin.temp=7 dim pin.redled=22 dim pin.yellowled=18 dim pin.button=16 dim pin.beep=27 dim pin.battV=6 dim pin.pwm=2 Const adcFactor=0.0032258 dim threslevel=2 'setup i/o setpin pin.temp, ain setpin pin.redled, dout setpin pin.yellowled, dout setpin pin.battv, ain setpin pin.button, din, PULLUP level=Cint(Pin(7)/adcfactor) 'read sensor to establish ambient level do adctempSensor 'If we get back here there has been a Temperature change if Alarm = 1 and Increase =0 then 'temperature has dropped reset the Alarm AlarmReset goto buttonclear elseif Increase =1 and alarm =0 then 'new alarm alarm=1 'set alarm acknowledgeAlarm: soundAlarm pause 1000 if pin(pin.button)=1 then goto acknowledgealarm ack=1 goto buttonclear end if buttonclear: if pin(pin.button)=0 then goto buttonclear pause 1000 loop sub adctempSensor local x Do cpu sleep 15 pin(pin.yellowled)=1 pause 50 pin(pin.yellowled)=0 'pulse pin.yellowled, 50 newlevel=0 for x=1 to 20 newlevel=newlevel + Cint(Pin(7)/adcfactor) next x newlevel=newlevel/20 'read sensor If newlevel>level Then 'establish new base level 'Temperature decrease resultLevel=newLevel-level increase=0 Else 'Temperature increase resultLevel=level-newLevel increase=1 End If if alarm =0 then prealarmlevel=level ' freeze level when in alarm level=newlevel Print "PreAlarmLevel:" + str$(prealarmlevel) print "New Level / swing " + str$(level) + " / " + str$(resultlevel) If pin(pin.button)=0 then alarmreset 'during debug change this command to END 'check if pre alarm tems have been reached if so rsset alarm conditions if alarm=1 and level=>prealarmlevel then alarmreset if alarm=1 then pin(pin.redled)=1 pause 100 pin(pin.redled)=0 alarmtime=alarmtime+1 print "Alarmtime" + str$(Alarmtime) if alarmtime>120 then repeatalarm end if checkbattery Loop Until resultlevel>threslevel 'trigger when exceeding base level by threshold value end sub sub checkbattery local dcv as float dcv=pin(pin.battv) print "Battery Level:" + str$(dcv) if dcv <= 2.3 then sound (100,2) end if end sub sub alarmReset print "Alarm Reset" alarm=0:ack=0:alarmtime=0 sound (10,20) end sub sub repeatalarm print "Repeat Alarm" alarmtime=0 acknowledgeAlarm: soundAlarm pause 100 if pin(pin.button)=1 then goto acknowledgealarm end sub sub soundalarm sound (100,10) pause 200 sound (100,10) pause 200 sound (100,10) pause 200 end sub sub sound(note,duration) pwm pin.pwm,39*note,50 pause 10*duration pwm pin.pwm,stop end sub Codenquilts |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
Nice project Mike. Have you had enough time to see how long this will operate on battery power? |
||||
MikeO Senior Member ![]() Joined: 11/09/2011 Location: AustraliaPosts: 275 |
According to my trusty phone app around 80 days. Mike Codenquilts |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |