💬 Distance Sensor
-
This thread contains comments for the article "Distance Sensor" posted on MySensors.org.
-
Hi there, i've just got a couple JSN-SR04T distance ultrasonic sensors in the post today. Was excited to sit down and make up my first go at a distance sensor to measure our water tank level, but when i went in to the mysensors master directory to find the example sketch for distance sensor i couldn't find one. So i copied the one from https://www.mysensors.org/build/distance but this is an old version and when i complied it in the Arduino IDE i had an error come up not recognising "NewPing.h". Any pointers where to go from here please??
-
Get this error
C:\Users\Daan\AppData\Local\Temp\Rar$DIa0.647\DistanceSensor\DistanceSensor.ino: In function 'void setup()':
DistanceSensor:53: error: 'getConfig' was not declared in this scope
metric = getConfig().isMetric;
-
-
hi folks, has anyone ever tried/considered to run this sensor on a battery powered node? Does it make sense, what would be a good setup? I want to monitor a remote watertank where it's hard to get power to... Thanks for your expert thoughts on this!
@jjk There should be no problem running it from a battery if you only want to check a few times a day and sleep the node in between, but depending on how often you want it to check the level you may need to also have a small solar panel perhaps.
You might also like to search for some of the other threads on battery powered nodes for info on how to reduce power consumption.
I have just installed an ultrasonic level on my tank last weekend but I have power there for the pump so the node runs all the time.
-
I have a setup with a HC-SR04 connected to an Arduino Pro Mini via a cable of about 5m length As I'm getting inconsistent readings from the sensor, I was wondering if cable length could be an issue - and if so, what a possible workaround could look like. Any thoughts from the experts?
-
I have a setup with a HC-SR04 connected to an Arduino Pro Mini via a cable of about 5m length As I'm getting inconsistent readings from the sensor, I was wondering if cable length could be an issue - and if so, what a possible workaround could look like. Any thoughts from the experts?
-
@jjk There should be no problem running it from a battery if you only want to check a few times a day and sleep the node in between, but depending on how often you want it to check the level you may need to also have a small solar panel perhaps.
You might also like to search for some of the other threads on battery powered nodes for info on how to reduce power consumption.
I have just installed an ultrasonic level on my tank last weekend but I have power there for the pump so the node runs all the time.
@Boots33 I had looked at the exact same scenario as jjk, and although the intended 3.3v rfm69 node is pre-designed for low consumption (Whisper), my problem lay in the ultrasonic (DYP-ME007Y mounted on a tube inserted through the concrete roof) for hourly reports as it is 5v, as is the SR04. They can be triggered by 3.3v but not run. The standby current of a 5v booster proved too much, so resorted to a 3v 33mA latching relay to fire it up. It has all been a design exercise to date, but if my calcs are correct the node should run for a year on 3 alkalines with the US running once every hour triggered by RTC.
-
@mfalkvidd that's a fair question... I tested the sketch and connectivity with dupont cables and my spontaneous answer would be, "yes". However, to be honest, I never really calibrated the distance readings nor did I do a long-term test in the lab setup, so I think the true answer is, " I don't know"...
@zboblamont sounds like you figured it out?! Would you mind providing details on the relay you have used?
-
@mfalkvidd that's a fair question... I tested the sketch and connectivity with dupont cables and my spontaneous answer would be, "yes". However, to be honest, I never really calibrated the distance readings nor did I do a long-term test in the lab setup, so I think the true answer is, " I don't know"...
@zboblamont sounds like you figured it out?! Would you mind providing details on the relay you have used?
@jjk Kemet EC2-3SNU from memory, but I know Omron et al make them also, check on Mouser etc. as it is not heavy current. The point is to ensure it is a latching type, the 33mA consumption from memory is ca 30ms, reverse pin polarity to reset relay, other may have dual coil.
-
@jjk As an afterthought - If large temperature fluctuations are not an issue (air expansion in a tube) and it is not dirty water, you might also consider using differential pressure sensors as these are reasonably easy and can operate directly at 3.3v, inc I2C.
-
@zboblamont thanks for putting more thoughts into this for me!
As I'm just an motivated hobbyist (far from being expert in electronics), I've tried to switch the pro mini to a nano, in a hope that keeps me from dealing with the relay (new to me). My thought was that the 5V it provides should mitigate the issue - looks like it doesn't. So if the readings aren't getting more consistent with the 5V Nano, what else could be the issue? -
@zboblamont thanks for putting more thoughts into this for me!
As I'm just an motivated hobbyist (far from being expert in electronics), I've tried to switch the pro mini to a nano, in a hope that keeps me from dealing with the relay (new to me). My thought was that the 5V it provides should mitigate the issue - looks like it doesn't. So if the readings aren't getting more consistent with the 5V Nano, what else could be the issue?@jjk Hey, no expertise here either, hobbyist also, I am just old school measure thrice cut once. To be clear, I am fixed on a low voltage node so the relay gives the US board a solid and separate 5v, as I read that some of these are power sensitive, and some folks had problems powering them from an Arduino. The US trigger is supposedly ok at 3v, I only need to voltage divide the signal to the Mini. But that is my scenario, low power reliability.
In your situation, I would restore everything to completely original in a test space, use separate supplies and run checks. If the board is faulty the inconsistencies should still be there. If not, introduce each variable methodically to identify the cause.