Ultrasonic sensor question

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
msev
Normal user
Posts: 33
Joined: 13 Feb 2016, 18:24

Ultrasonic sensor question

#1 Post by msev » 10 Mar 2016, 23:06

For the HC-SR04 ultrasonic sensor - would it be possible to make an option in the code, that the ESP would send a MQTT message 1 if object besides the sensor was present (for example car in a garage) and 0 if the object wasn't present.

So basically send MQTT message 1 (or something else) if object is present and 0 if object is not present within the range of the sensor.

chrille
Normal user
Posts: 88
Joined: 26 Aug 2015, 15:11
Location: Horsens, Denmark

Re: Ultrasonic sensor question

#2 Post by chrille » 11 Mar 2016, 08:38

msev wrote:For the HC-SR04 ultrasonic sensor - would it be possible to make an option in the code, that the ESP would send a MQTT message 1 if object besides the sensor was present (for example car in a garage) and 0 if the object wasn't present.

So basically send MQTT message 1 (or something else) if object is present and 0 if object is not present within the range of the sensor.
This is really a job for an external application, like nodered or mqttwarn. If you use some kind of home automation system, it might also be able to it, but it's trivial to implement in mqttwarn, and it's only a matter of time, before you need to other things with your MQTT messages

- Jan
Jan Chrillesen, Denmark

msev
Normal user
Posts: 33
Joined: 13 Feb 2016, 18:24

Re: Ultrasonic sensor question

#3 Post by msev » 11 Mar 2016, 10:11

Well dunno, I think it could be used that way too...It could be an option, since probably the main use case of an ultrasonic sensor would be detection of an object infront of it :).

But I would still like to know how you would do it in mqttwarn, it looks interesting :), can you explain a bit more on the specifics. Also do you use any dashboard for your sensors, if so which one?

Martinus

Re: Ultrasonic sensor question

#4 Post by Martinus » 11 Mar 2016, 12:43

msev wrote:For the HC-SR04 ultrasonic sensor - would it be possible to make an option in the code, that the ESP would send a MQTT message 1 if object besides the sensor was present (for example car in a garage) and 0 if the object wasn't present.

So basically send MQTT message 1 (or something else) if object is present and 0 if object is not present within the range of the sensor.
I think that it should already work this way if you select "state" mode in the settings and enter some threshold. Check the wiki page settings.

msev
Normal user
Posts: 33
Joined: 13 Feb 2016, 18:24

Re: Ultrasonic sensor question

#5 Post by msev » 11 Mar 2016, 23:10

Awesome, gonna try that...By the looks of the wiki it should work :)

Post Reply

Who is online

Users browsing this forum: No registered users and 52 guests