I’v spent hours searching, researching, and debugging why I’m not getting expected readings from the analog inputs from ssc32u. I am powering the logic for the board from the USB Port, and powering servos using a 6V nimh battery. Servos are powered and move nicely when sent proper commands. However, I cannot get any readings from the PING))) ultrasonic sensor (other than apparently 0v). The PING is connected to I have connected to the analog port A. I have checked to ensure the connection is correct, with ground, power, and signal.
I am controlling the SSC32U from python using pyserial. I’ve tried doing this from the python shell and in scripts, but in general the command I’m using to try and read from the SSC32u is as follows:
[blockquote]ser.write("VA \r\n\<cr>")
value = (ser.read())
print(ord(value))[/blockquote]
I have tried putting objects in front of the sensor at various ranges.
The PING LEDs do not appear to blink or light in any way, so I’m not even sure the sensors are getting powered, even though I have checked the pins are connected properly.
Is there any information I can refer to, or is there anyone who might know something I’m missing to get a proper range value from the sensor?
We assume this means you have the SSC-32U connect by USB to a computer and a 6 V DC NiMH battery pack connected to VS1? Please note that the USB port does not power anything except the USB interface chip itself (for safety reasons). Therefore, the board’s logic circuit is powered by the on-board regulator. This receives power from the VS1 input through a special circuit.
We assume by “PING” you mean something like the RB-Plx-73? If so, that would explain the issue you are having.
The PING-type sonar is a digital sensor that requires a bi-directional digital pin to work. It is started by sending an initial pulse to the SIG pin and then stopping output and instead reading from the same pin for the return pulse (the length of the pulse is proportional to the distance). You can read more about it here. Therefore, you cannot use such a sensor directly with an SSC-32U since it cannot do pulse length measurements of digital signals. See below for solutions.
You can read more in the other documents available on the product page under “Useful Links”. You can find this here.
The reading of analog values is as you do in your example (quite straight forward). You may still want to have a look at the example available here. It has a few comments that are worth reading concerning using the analog inputs of the SSC-32U (and useful links to documentation).[/blockquote]
See explanation above. The device is most likely never told to read a distance (SIG connect to an analog-in pin) and therefore never activates.
See the details above concerning PING-type sensors.
The two most obvious solutions are:
Use an ultrasonic sensor that returns distance as an analog voltage proportional to the distance measured instead of one that uses a digital pulse. You can find some options here. Ex: RB-Max-03.
Use a small microcontroller to convert the pulse into an analog signal and connect that new output to the analog pin of the SSC-32U. You can create that output using a PWM signal and make it go through a low-pass filter to remove noise.