Advice on a remote buzzer alarm

If doesn't fit into any other category ....
Post Reply
Zim
Posts: 281
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 257 times
Been thanked: 128 times

Advice on a remote buzzer alarm

Post by Zim »

I have a pump monitor which I would like to ring a buzzer at a remote location. I had hoped that ESP-NOW would allow me to do so.
Can anyone see why this would not work? Is it possible to use UDP (if not ESP-NOW) from one ESP8266 to ESP8266 while one is connected to WIFI?

Thanks
Zim

remote.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Nighthawk
Posts: 7
Joined: Fri Feb 19, 2021 5:23 pm
Has thanked: 20 times
Been thanked: 2 times

Re: Advice on a remote buzzer alarm

Post by Nighthawk »

Hi Zim,
I believe what you want to do should work OK.
I have two modules talking to each other via ESP-NOW at the same time they are connected to my local wifi.

Receiver module...

Code: [Local Link Removed for Guests]

option.mac "60:01:94:1E:EF:77"   'assign a new mac address, will cause router to assign a new IP
onEspNowMsg espMSG
gosub WebPage ' draw the webpage
espnow.begin
wait

espMSG:
Code here to act on incomming esp-now data
return
Sender module...

Code: [Local Link Removed for Guests]

Cap_MAC$ = "60:01:94:1E:EF:77"  'mac address of far end receiver
espnow.begin
espnow.add_peer Cap_MAC$    ' set the address of the receiver
onEspNowError status   ' set the place where jump in case of TX error
gosub WebPage
wait

sendMessage:
espnow.write msg$   ' send the message to other module
return
notice in my sample code I have chosen to change the mac address of the receiving module.
If you change the mac address of a module this will cause your home router to issue a NEW IP address to that module which will likely be a different IP than it is initially assigned before running the code where the mac is changed.

I am only sending messages one way via espnow but I'm pretty sure you can use it bi-directionally.

Changing the mac address allows you to drop the code into various test modules and not have to change the mac address where the sender is sending its message to. EspNow uses mac addresses as the identifier.

This code is just partial from my system so if you need working code post back for more help.

cheers
dwight
Zim
Posts: 281
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 257 times
Been thanked: 128 times

Re: Advice on a remote buzzer alarm

Post by Zim »

Thanks a ton dwight
I will give it a go!

Zim
Post Reply