Show Posts
Pages: [1] 2 3 ... 35
1  Using Arduino / Sensors / Re: Help interfacing with this ultrasonic sensor - DYP-ME007Y on: June 02, 2014, 04:42:16 pm
TX surely wont work with NewPing library.

Correct.  Also, using NewPing is typically much easier to get the sensor working than doing all the pin high/low/pulsein stuff.  NewPing takes care of that for you, and does so in a more direct way.

2  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: June 02, 2014, 04:39:14 pm
I did some reading on SR-06 and I found out it does the corrections on the sensor itself... So yea, your lib does support that:)

I think that's what I said, or at least I meant to say that.

3  Using Arduino / Sensors / Re: PIR sensor always HIGH on: June 02, 2014, 12:29:24 pm
I only used a connector because I didn't have a  female-male wire. I measured and there isn't any shorts between the pins.
I'll measure again tonight just to be sure.

The wiring order I used is GROUND, SIGNAL, POWER (black, blue, red) when you look at the back of the sensor and the pins are on the bottom.


Do you have a solderless breadboard?  That would be a better way to start to make sure you don't have somthing buggered up.

4  Using Arduino / Sensors / Re: Ultrasonic sensor HC-SR04/SR06 to measure water level on: June 02, 2014, 09:37:29 am

I just got SR04 sensor and is working flawlessly with your library...

ping_mediana is working nice and my results are about 1cm off scale, but that I can fix with software calibration.

As far as my sketch goes, I will be checking my water level every minute or so, since it will also be used for alerting in case something goes wrong and water starts to spill out of the tank...

During water change it will be running non-stop, but that will take 30min every week, no more....


Are you measuring from the front or the back of the sensor?  The sensor itself is about 1cm in length.  If there's a distance issue, it's with where you start the measurement.  Also, NewPing rounds to the closest cm.  So 10.5 would round to 11.  Therefore, it can easily appear to be 1cm off once you factor in where you start your measurement and up to 1/2 cm rounding.

5  Using Arduino / Sensors / Re: PIR sensor always HIGH on: June 02, 2014, 09:32:02 am
Thanks for the answer.

My sensor looked a lot like the one in the tutorial so I just wired it up like there.  I don't use any interface.. it's plugged straight into arduino.
Also, this is the only way I've  wired it. In my pics I have
Red = 5V
Black = GND
Blue = Ouput

For your experience, what other wiring should I test?

You're using jumper wires soldered to a connector which is then plugged into the PIR sensor.  That can be a potential problem and one cannot see how things are attached due to it.  You could have a short in that connector.  Instead, just use a solderless breadboard and jumper wires.  Also, the order on the PIR sensors are opposite on 50% of them.  Some are GROUND, SIGNAL, POWER, and others are POWER, SIGNAL, GROUND.  I've never seen one that was POWER, GROUND, SIGNAL as you list.

Basically, throw away everything you have between the sensor and the Arduino.  Plug the PIR sensor directly into a breadboard, and use jumper wires to wire up each pin.  Then, detail the pin ORDER and the SIDE you're looking at on the sensor.  I fear you have it wired wrong or there's a short as it is now.  Which is why things are not working correctly for you.

6  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: June 02, 2014, 09:21:30 am
Does NewPing library supports temperature compensation with SRF06 sensor?
Can it automatically read temperature and use it in it's calculation?

lp, Matej

The sensor does not output the temperature.  It simply reads the temp and adjusts the output based on the temp.  So yes, NewPing works along with the thermostat and is used in the calculations.

7  Using Arduino / Sensors / Re: VEX Ultrasonic Range finder + Arduino UNO on: June 02, 2014, 08:24:47 am
Hi all,
I read some other forums on how to get the vex range finder to work with the arduino uno. I am having some troubles though. The only numbers i have been able to get are 5 digit numbers in the 30,000 range. This is the code I used that supposedly worked for someone else but gives me these funky numbers that dont even correspond to how close an object is to the range finder.

First, use the NewPing library instead of rolling your own, you're project will work so much better.

Secondly, did you notice that it's not displaying "Duration:  " either?  You probabaly really mean for that line to read:

Serial.print("Duration:  ");

But, it's not showing "Duration:" in your output.  In other words, this has nothing to do with your sensor.  You can't even get your sketch to output "Duration:" to the serial port.  Notice in your sketch where you open the serial port, you specify 9600 baud.  My guess, is that you've set a different baud rate in the Arduino IDE.

Basically, your sketch is set to 9600 baud and your computer program (Arduino IDE) is set to some other speed.  So, the data is garbage.  My guess is if you make both the baud rates the same, it will at least show "Duration:".  Then and ONLY then can you start diagnosing a possible problem with your sensor or the sketch.

8  Using Arduino / Sensors / Re: PIR sensor always HIGH on: June 02, 2014, 08:16:42 am

I'm trying to connect a PIR sensor to my Arduino Uno board. The sensor was purchased from amazon and looks a lot like HC-SR501 (uses a BIS0001 chip).
I followed this tutorial   including the source code there.

The problem is I always have the input pin on HIGH. I tried adjusting the sensitivity but with no luck. I attached a picture of my setup.

The weird thing is, I think somehow the sensor works without the + and GND pins plugged in (just the output pin).  Sometimes it behaves weird, but most of the times it detects my palm.

PIR sensors are pinned two different ways (totally opposite).  I can't tell by your pictures if you have it pinned correctly.  Also, there's an added complexity because you added an interface.  Instead, plug the sensor into a solderless breadboard and wire it up that way.  This will remove a possible reason why it's not working.

I've spent countless hours working with PIR sensors.  They're VERY simple and work very well.  That's why I believe the problem has to do with how you're connecting it.  Or, it's possible you have a dead sensor (maybe from wiring it wrong at some point).  I have dozens of these sensors and have used them on all kinds of projects.  I've never had a dead one or one that failed.

9  Using Arduino / Sensors / Re: Ultrasonic sensor HC-SR04/SR06 to measure water level on: June 02, 2014, 07:36:45 am
I will be using it to measure water level in a fish tank. I will measure water level, so I will know when to add water that evaporated and to know when to stop/start pumping when changing water.

The only problem I see, can be that the surface of the water is wavy and that will affect measurements... But then again, that's way I will use ping_median.

How long does it take to make a measurement?
One second?
Half second?

lp, Matej
ping_median() sends out a ping every 29 ms.  Because the surface isn't still, and the water lever doesn't change quickly, I would suggest doing many iterations to get the median.  Let's say 15 iterations.  Even at 15 iterations, it will take less than a half second.  One ping at a short distance may only take 5ms.  The only reason it would take almost a half second is because it's doing it so many times and waiting for echos to dissipate.  You may even want to do 30 or more iterations for even more stable results.

I would imagine your sketch doing a measurement a couple times a day at most and put the Arduino to sleep between sensor readings.  There's no reason to be sending high-frequency sound into your tank which your fish could sense.  You wouldn't want to be possibly aggravating your fish by a constant high-frequency speaker blaring all the time.  Sounds a bit like torture.

You may also want to consider a float switch (think the ballcock in your toilet tank).  Maybe a little low-tech, but it should work well.

10  Using Arduino / Sensors / Re: Ultrasonic sensor HC-SR04/SR06 to measure water level on: May 29, 2014, 04:18:29 pm

Is anyone using HC-SR04 or  HC-SR06 for measuring water level?
How accurate is it?
Are you using temperature compensation?
I'm planing on using it from 5-30cm. Is it accurate in that area?

Thanks, Matej

Lots of people use the HC-SR04 or HC-SR06 to measure water.  They work quite well for that.   I would suggest using my NewPing library for faster/better results.  Also, when doing so, use the ping_median() method that will do multiple pings and give you the median value.  As most water measurement projects don't need to be fast, you can have the ping_median() do many iterations to give you a much more accurate reading and still do readings many times even a second.

Are you doing something like a sump pump logger/alarm?

11  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: May 29, 2014, 04:12:46 pm

I noticed SR06 sensor has a temperature sensor on the board as well, which can be used for temperature compensation.
Are those measurements more accurate?
How much more? Let's say I have a sensor without temperature compensation and I set my code to 20°, but ambient temperature is 30°C. How big of a deviation would I see?


The formula for the speed of sound is:  m/s = 331.3 + (0.606 x C°)

So, at 20°, the speed of sound is 343.42 m/s and at 30° it's 349.48.

Towards the extreme edge of the sensor range, lets say you get a ping time of 29,000 ms.  That would give you:

29,000 ms / 10,000  x 343.42 m/s / 2 = 497.96 cm
29,000 ms / 10,000  x 349.48 m/s / 2 = 506.75 cm

So, temperature does make a difference, in this example, almost 9cm.  Likewise, at 100cm, the difference would still be about 1.75 cm, so still sizable.

With this said, it's typically not an issue.  Because for normal uses, the sensor is not being used to measure an exact distance, but instead to see if something is approaching or too close relative to a previous ping.  However, if you're using the sensor to measure an exact distance (say a water level) and you must get very precise distance results over a long period of time at various temperatures, then using a thermostat and doing the above calculation would be very important.  All depends on your need.  NewPing is designed to work easily with the built-in ping_cm() method, or you can roll your own with ping().

12  Using Arduino / Sensors / Re: HC-SR04: tests on accuracy, precision and resolution of ultrasonic measurement on: May 28, 2014, 03:22:38 pm
Thanks a lot, Tim - I promise that I'll never ever write again that a sketch is "pretty simple"...
The typo in the sound speed expression is quite probably the cause of the large absolute errors that I "observed".
Regarding the room temperature, I checked it and was 23-24ºC - as you mention, not a big difference, but if I added the possibility I should have made use of it...
And I will look at the possible numerical errors related to using too many floats!
Hope to have it all done by this weekend!

I expect you will see very little difference.  But, a few slight inaccuracies could add up to a *slight* measurable difference.  Not dividing by 10,000 till the ping alone will fix the numerical errors (as shown in my previous post).  Converting everything over to not using floats will make things just run faster and use less program space, it won't make much of a numerical error difference.

Anxious to see if there's a measurable difference...

13  Using Arduino / Sensors / Re: HC-SR04: tests on accuracy, precision and resolution of ultrasonic measurement on: May 28, 2014, 08:20:48 am
Having spent a lot of time on this myself, I would suggest the following...

First, your calculation of the speed of sound is incorrect and you probably shouldn't be dividing by 10,000 for your speed of sound variable.  The reason is that float is only accurate to 6-7 decimal digits of precision and by dividing by 10,000 you're putting a lot of undue zeros in your variable (thus possibly reducing accuracy).  Instead, use the following:

soundSpeed = 331.3 + (0.606 * tempAir); //  m/s

Then, for your actual distance calculation:

distance[j] = duration / 20000.0 * soundSpeed; // converts the time into a distance (cm)

I would also suggest making the last line:

return(pulseIn(pinO, HIGH, 35000));

So it doesn't wait for a full second if no "pong" is heard (also prevents echo's generating false results).

Further, I question your generic "20.0" for the temperature.  While minimal, an exact reading should be taken for accurate results.

Personally, I would also rework the code so it doesn't use any floats.  This would reduce the compiled code size, speed up the program, and therefore increase accuracy.  It would be quite easy to do and still give you the same precision of results.  However, I'd doubt it would make any measurable difference so it would probably be a useless exercise, it's just how I would do it for accuracy's sake (and I avoid floats at all cost).

14  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: May 28, 2014, 07:27:05 am
here's the video of the Intervention I did with my installation in Copacabana
and you can see the sensor working at its best

I could tell the dog's ego was inflated due to your project.

15  Using Arduino / Sensors / Re: Help interfacing with this ultrasonic sensor - DYP-ME007Y on: May 27, 2014, 10:33:05 am
@teckel - did you ever confirm this sensor works with NewPing?

Would need the sensor to confirm myself.  Others have got it working.

Pages: [1] 2 3 ... 35