RoπLawnMow

Today I did some tests with ultrasonic sensors on the Raspberry Pi using a Python script.
I tested the waterproofed JSN-SR04 as well as the HC- SR04. My findings:
The HC SR-04 is cheaper and more accurate than the slightly more expensive JSN-SR04. This sensor can only measure the shortest distance of 20cm. It doesn't provide any valid if the distance is shorter. The HC SR-04 measures minimum distances to 3 cm very reliably. Both sensors deliver valid values up to a distance of 250cm. However, strong reflections occur in the room, which distorts the measurement results. This would still have to be tested outdoors. A disadvantage is that you need 4 GPIOs for 2 sensors. I haven't found a script that uses only one trigger signal yet.
So if I change the ToFs in Ultrasonics Sensors I will use the HC- SR04. But I see in the moment not a great advantage to the VL530X ToF.
Has anybody a solution on Raspberry Pi for 2 Sensors with only one Trigger Signal?
May be this can be a solution
Code:
 while True:
       GPIO.output(TRIG, True)
       time.sleep(0.00001)
       GPIO.output(TRIG, False)
       while GPIO.input(ECHO_left)==0:
          pulse_start = time.time()
       while GPIO.input(ECHO_left)==1:
          pulse_end = time.time()
       pulse_duration = pulse_end - pulse_start
       distance_left = pulse_duration * 17150
       distance_left = round(distance+1.15, 2)
       GPIO.output(TRIG, True)
       time.sleep(0.00001)
       GPIO.output(TRIG, False)
       while GPIO.input(ECHO_right)==0:
          pulse_start = time.time()
       while GPIO.input(ECHO_right)==1:
          pulse_end = time.time()
       pulse_duration = pulse_end - pulse_start
       distance_right = pulse_duration * 17150
       distance_right = round(distance_right+1.15, 2)
       print("Left: ",distance_left,"cm \t Right: ",distance_right,"cm" )
       time.sleep(0.2)
 
Last edited:
i Have exactly the same result in my side .
HC-SR04 is perfect for short detection, so put it in direct front of mower and read it each 500 ms and normally mower never hit object.
JSN-SR04 are OK between 50 cm and 1.5 meter but no so reliable than HC-SR04 at short distance.

For 1 trigger signal i never test.
Teensy is here to have more free pin and i don't know if MCP23017 is fast enough for sonar use.:ROFLMAO:
 
i Have exactly the same result in my side .
HC-SR04 is perfect for short detection, so put it in direct front of mower and read it each 500 ms and normally mower never hit object.
JSN-SR04 are OK between 50 cm and 1.5 meter but no so reliable than HC-SR04 at short distance.

For 1 trigger signal i never test.
Teensy is here to have more free pin and i don't know if MCP23017 is fast enough for sonar use.:ROFLMAO:
Thanks for sharing your results with me. I thought JSN is a good alternative for the ToF, but unfortunately no.
During the winter months I will rebuild my first Mower with the actual drivers and SW. for that I have to print some parts. In this mower (Project name "Hybrid") I wil use the SR04. And its easy to transfer the distance Data form the teensy together with the perimeter Data via i2C to the pi.
So I will do that in this way. Nice weekend!
 
HC-SR04 is perfect for short detection, so put it in direct front of mower and read it each 500 ms and normally mower never hit object.
What is your experience with bushes, flowers and shrubs?
The reflection is not as good as a smooth surface like a wall or something similar
 
What is your experience with bushes, flowers and shrubs?
They are detected, but not all the time in my test, so not a 100% reliable solution.
I only test detection between 40 and 90 cm with JSN and HC sonar , so certainly sensor at front of mower work better.
Perimeter wire is more secure for flower.
 
They are detected, but not all the time in my test, so not a 100% reliable solution.
Do you have any experience with disruptions on the I2C bus in the ArdoMower projects?
The only reason I would replace the ToFs with SR04 on my Test Mower is to avoid sensor malfunctions
due to I2C interference. Malfunctions very rarely occur. The sensor values usually only freeze
for one sensor. If I restart the script it works propper again. But there is no way to detect that.
Because if its freeze e.g. 200cm you don't know if there is an obstacle or not. If its freeze e.g. 76cm
and he drive forward, and the distance not change, then it make sense to restart the Script.
But I recognized this only at my MINI Test Mower Model

P1230626.JPG
 
Back
Top