No results with an ultra sound sensor
-
Hello,
I need to connect an ultrasonic sensor (picture below) but I can't read the returns from the probeI have done :
m950 j0 c "io8.out" q10000 ; (the sound needs an implusion of 10u)
The result is "Pin io8.out, active: true"
But when I do "m950 j0" the result is always null....I don't understand why.
Could you help me ?
PS: I know that the ultra sound sensors are not precise but in my project I don't need precision of height
Thanks in advance
-
-
@fcwilt How can I check?
-
Well it seems you have used io8.out to trigger the sensor but where have you connected the output signal from the sensor to the Duet?
And you have io8.out configured as an input - is that allowed?
Frederick
-
@fcwilt said in No results with an ultra sound sensor:
Well you have used io8.out to trigger the sensor but where have you connected the output signal from the sensor to the Duet?
Yes, I have connected the following items:
- 5V
- GND
- Trigger in out
- Echo in in
-
@fcwilt And normally I configure the Out with m950 j0 c "io8.out" q10000 and I read the result with "m950 j0"...
I think so -
@fmeleard said in No results with an ultra sound sensor:
@fcwilt And normally I configure the Out with m950 j0 c "io8.out" q10000 and I read the result with "m950 j0"...
I think soAccording to the M950 docs J is used for input pins and P or S for servo output pins.
Is the output of the device a digital signal (on/off) or an analog signal (varying voltage)?
Perhaps you should look at M558 and try treating the device as a probe.
Frederick
-
@fmeleard said in No results with an ultra sound sensor:
PS: I know that the ultra sound sensors are not precise but in my project I don't need precision of height
What exactly are you using it for? Endstop? Probe? Trigger?
-
@phaedrux Hello,
I need some kind of Z probe.My machine needs to do actions on variable terrain (from dirt). So I use an sensor ultrasonic to identify the height of the ground to trigger a DC motor.
My machine needs to work outdoors, so I don't use IR or Laser because of light disturbances, and I don't need to be accurate to the millimeter, but overall to the centimeter on the Z axis, so the sensor ultrasonic is fine.
My Need is:
- You position yourself in X and Y (precisely)
- You analyze the height of the ground -> Z (max analysis about 90 cm)
- Go down Z (analysis of the height - the dimension of your current tool which can be variable depending on the current tool)
- Engage the tool once it is in place
- When it's done, you move Z back to the zero point of 0 (since there is vibration, I have to make sure Z hasn't 'moved' too much)
- After your zero point, you go back to the tool change tray
- You start the same process again with a tool that probably has a different height
I think it's a Z probe set up in a special way, I think
-
@fmeleard please provide a link to the data for the sensor.
-
@dc42 Here are a couple of links to data sheets and info for that sensor.
https://www.electroschematics.com/wp-content/uploads/2013/07/HC-SR04-datasheet-version-2.pdf
https://www.sparkfun.com/products/15569
@fmeleard I don't think that sensor will be much good for you application. I use a couple of them in my home automation coupled to ESP 32 modules. One senses the salt level in my water softener and I have an automation set up to send a notification to my 'phone when it gets low. However I have to filter the readings and take an average because typical variations between subsequent readings are between 14 and 20 cm. The other application I tried was as a presence detector to sense when I was sitting in my office chair and turn lights on/off accordingly (in conjunction with PIR motion and lux level sensors). For this application, I don't really care what the actual distance is but even so, I'm unable to reliably discriminate between a couple of cms and 10 cms so I've given up trying to use it.
-
@deckingman thanks for the link.
@fmeleard that sensor needs a 10us pulse to trigger it, and then the length of the output pulse needs to be measured. The 10us pulse could be generated by a PWM-capable output pin, however RRF is not set up to measure the length of the input pulse. So I think your best bet would be to use an Arduino Nano or similar to drive that sensor with the 120us pulses and measure the pulse width, and set an output pin high if the pulse returned by the sensor is shorter than a specified width.
-
@dc42 @deckingman Thanks for your feedback
Concerning the analysis, with my Raspberry, I get a pretty accurate analysis (a few millimeters)...In this case, if I understand correctly, the simplest thing would be to analyze the distance with the Raspberry, and to send the displacement via my python program in Gcode...
This is a possibility.
Otherwise, for my need of height analysis (outdoors for a max distance of about 90 cm) without need of accuracy higher than a millimeter, would you have a tip for a probe more adapted to the Duet3?
Francis