Unexpected behavior with Ultrasonic Sensor[SOLVED]


#1

I’ve put my new GoPiGo2 starter kit together and put the servo and the ultrasonic sensor through their paces.The servo seems to be working fine, although I’ll have to get used to enabling/disabling it (and I should recenter it).

I’m afraid I think the ultrasonic sensor is broken, though. After toying with it a bit and getting odd readings, I checked in the forums and found a few threads on the matter. I ended up running grove_distance_sensor.py in the following configurations (adjusting the source code to use the correct pin each time).

  • On battery power (gpg reports 10.39 V) on the analog port (labeled A1)
  • On battery power (gpg reports 10.36 V) on the digital port (labeled D11)
  • Powering the Raspberry Pi via micro-usb (battery disconnected) on the analog port
  • Powering the Raspberry Pi via micro-usb (battery disconnected) on the digital port.

During each run I held a large thick book directly in front of the sensor, and slowly moved it back and forth. In each configuration, the values from the sensor seemed reasonably accurate, but only up to 8cm or so. Then, no matter how much farther I moved the book, the values would almost never veer away from 7, until I got closer than around 7 or 8 cm.

Before the test I made sure to run DI software update. I updated both Raspberry for Robots and the GoPiGo firmware, being careful to remove the motor leads ( and the other sensor leads) before I started the GPG to perform the update.

gpg reports the firmware at 1.6


#2

Hi @tjhart,

Sorry to hear its not working for you. Can you post a few pictures of your setup, also can you follow this guide, generate a test log and upload it with your reply.

-Shoban


#3

Done, but it looks like I don’t have permissions to upload data.


#4

I think I just gave you the appropriate rights to upload. Try again?


#5

Log file and pictures attached. Produced exactly as requested.

Note that I broke an encoder during the initial construction. I received a replacement tonight and will fix that tomorrow. The log file reflects the missing encoder.

Also, I read through the source code as an opportunity to learn. While executing individual processes, I ran across an interesting discrepancy:

~/Desktop/GoPiGo/Troubleshooting/i2c_test1.sh produced different results when executed by itself. I’ve included that log as well.

After some tinkering, it seems like a timing issue:

$ sudo ./avrdude_test.sh; sleep 0.05s; sudo ./i2c_test1.sh 

produces the same output that i2c_test1.sh does when run standalone. Not sure if that’s related to the issue at hand.

log.txt (7.2 KB)
i2c_test1-standalone-log.txt (696 Bytes)


#6

@tjhart,
I am really sorry, looks like we missed this one.

It really looks like you received a broken sensor. Thanks a lot for testing it out and I’m really sorry for the frustration.
I think you have already reached out to us directly from the website and we’ll send you a replacement ASAP.

Again, I’m really sorry to hear about this; we’ll make it right immediately.
-Karan


#7

@karan

I thought I’d check in. I haven’t received a shipping notice or a replacement part. Is it on the way?


#8

Hi @tjhart,
Sorry for the delay. I’ll check this with our logistics team and get back to you about the status of the replacement.


#9

@karan @cleoqc @Shoban
The replacement sensor came last night. At first it wouldn’t read distances greater than about 60cm or so. After a bit of searching I found a related thread saying it needed 9V to work correctly. After plugging it up to the battery pack instead of micro-usb, it looks like everything is working as expected.


#10

yeah!!! And thanks for letting us know!

I wish you many happy distance detections now :slight_smile:
Cleo


#11

This topic was automatically closed after 24 hours. New replies are no longer allowed.