Freezer alarm with buzzer!

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Naesstrom
Normal user
Posts: 21
Joined: 02 Jun 2017, 21:02

Freezer alarm with buzzer!

#1 Post by Naesstrom » 24 Oct 2018, 20:24

This might be a stupid question but I'm building a freezer alarm with a wemos d1 mini and a buzzer shield, I'm getting the temp from 2 ds18b20's... I've never written a rule before but after some reading I've come up with the following

Code: Select all

on temp#Temperature do 
  if [temp#Temperature] > -15 // temp warmer then -15ºC
    tone,14,1000,700
  endif
endon
Havn't tried it yet but will it loop? And how can I add a pause so the sound is beeping and not just a continous tone?

User avatar
grovkillen
Core team member
Posts: 3268
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Freezer alarm with buzzer!

#2 Post by grovkillen » 24 Oct 2018, 20:30

Rtttl is another command but it will block the loop during the playing. But to stop it after a while you need to use timer and possibly dummy devices to store the state (creating a kind of hysteresis).
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Naesstrom
Normal user
Posts: 21
Joined: 02 Jun 2017, 21:02

Re: Freezer alarm with buzzer!

#3 Post by Naesstrom » 24 Oct 2018, 21:26

grovkillen wrote:
24 Oct 2018, 20:30
Rtttl is another command but it will block the loop during the playing. But to stop it after a while you need to use timer and possibly dummy devices to store the state (creating a kind of hysteresis).
Yeah I was thinking of making it play the imperial march but since it's going to be at my office I wasn't sure how the other teachers would react :D

I was looking at the tutorial rules and was thinking about this one

Code: Select all

 //start the warning signal when we receive a start_warning event:
 On start_warning do 
   timerSet,1,2
 endon
 
 //stop the warning signal when we receive a stop_warning event:
 On stop_warning do
   timerSet,1,0
 endon
 
 //create an actual warning signal, every time timer 1 expires:
 On Rules#Timer=1 do 
   //repeat after 2 seconds 
   timerSet,1,2

   //produce a short 1000hz beep via a piezo element on pin 14
   tone,14,1000,700
 
 endon
is that a better way, and then create a rule that sends a

Code: Select all

cmd=event,start_warning
when the temperature is -15 or warmer and a

Code: Select all

cmd=event,stop_warning
when the temperature is colder then -15?

Naesstrom
Normal user
Posts: 21
Joined: 02 Jun 2017, 21:02

Re: Freezer alarm with buzzer!

#4 Post by Naesstrom » 24 Oct 2018, 21:39

Actually I tried my first try of the code and it worked super... set it to this:

Code: Select all

on FRYS#Temperature do 
  if [FRYS#Temperature] > 30 // temp warmer then -15ºC
    tone,14,1000,700
  endif
endon
And when warming it up over 30 it starts beeping and when it cools down it stops! Just as I wanted it! :D hmm... maybe I should do something more fun like a rtttl :D

Can I add another rule in the same set for the fridge?

User avatar
grovkillen
Core team member
Posts: 3268
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Freezer alarm with buzzer!

#5 Post by grovkillen » 24 Oct 2018, 22:47

Yeah it shouldn't be a problem.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests