i found a bug with the sensor SRF04 (ultrasonic).
you must modify the code for the grovepi (grove_pi_v1_2_7.ino) :
dur = pulseIn(pin+1,HIGH);
RangeCm = dur/29/2;
I noticed the modifications you’ve brought, but in order to test it, can you tell me more details in how the bug is behaving?
Read the Datasheet SRF04:
This module use 4 pins:
1 pin : GND
1 pin : VCC
1 pin: Trigger (input for this module so output on grovepi)
1 pin : Echo (output for this module so input on grovepi)
it’s impossible to use the same pin on grovepi for the signals Trigger and output.
i modify your firmware and after my modification, SRF04 works fine.
the problem, on this url:
the bug is present, but you can use an oscilloscope and capture the signals (i verify with an oscilloscope the problem).
Are you using the Grove Ultrasonic ranger sensor, the one from seeed? The sensor from seeed has only 3 useful pins(VDD, GND and SIG) and the other 4th pin has no connections. We will be happy to have our firmware improved, if you have a way to make your improvements work with Seeed Ultrasonic sensor.
Perhaps but the SRF04 is the most commun not the ultrasonic seeedstudio.
you find very easy an SRF04 but if you want to use a seeedstudio, you must buy on the url seeedstudio. Else you have a good luck to use a real SRF04.
I buy many SRF04 on many dealer and all my SRF04 works with 4 pins and not 3 pins.
i think many people have a problem with the sensor because, they don’t use the seeedstudio ultrasonic.
I will buy a seeedstudio ultrasonic for my test.
And also, on seeedstudio, they have an error:
see the schematics with SRF04, they use D8 and D9 for the signals and VCC and GND !!!
perhaps make 2 commands for the ultrasonic sensor: 1pin and 2pins
I agree with you that SR04, is quite common in the market. The Ultrasonic ranger that we sell from our website here is identical to the one, that is sold from Seeed. We sell this sensor because it is easier to handle three pins than four with GrovePi. As you have mentioned in another post, where if you have 4 functional pins then two ultrasonic sensors cannot be used on the adjacent Ports of GrovePi. To ease that out we wanted to have only 3 functional pins.
People with queries on the forums mostly buy the sensors from us and we check it out through their pictures. We are coming up with our own sensor to measure distance which will be even more accurate than what is there now. Definitely thanks a lot for sharing the links related to SR04 as it will be helpful to others on the forums.