i found a bug with the sensor SRF04 (ultrasonic).
you must modify the code for the grovepi (grove_pi_v1_2_7.ino) :
//Ultrasonic Read
else if(cmd[0]==7)
{
pin=cmd[1];
pinMode(pin, OUTPUT);
pinMode(pin+1,INPUT);
digitalWrite(pin, LOW);
delayMicroseconds(2);
digitalWrite(pin, HIGH);
delayMicroseconds(5);
digitalWrite(pin,LOW);
dur = pulseIn(pin+1,HIGH);
RangeCm = dur/29/2;
b[1]=RangeCm/256;
b[2]=RangeCm%256;
Hi @stephane.roque,
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?
Thank you!
Read the Datasheet SRF04:
http://inside.mines.edu/~coulston/courses/EENG383/lab/lab06/SRF04.pdf
https://www.robot-electronics.co.uk/htm/srf04tech.htm
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:
http://wiki.seeed.cc/Grove-Ultrasonic_Ranger/
the bug is present, but you can use an oscilloscope and capture the signals (i verify with an oscilloscope the problem).
Hi @stephane.roque,
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.
-Shoban
Perhaps but the SRF04 is the most commun not the ultrasonic seeedstudio.
https://www.technobotsonline.com/srf04-ultrasonic-range-finder.html
https://www.superdroidrobots.com/shop/item.aspx/devantech-srf04-ultrasonic-ranger/82/
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:
http://wiki.seeed.cc/Grove-Ultrasonic_Ranger/
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
Hi @stephane.roque,
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.
-Shoban