I recently purchased a grove collision sensor from seeed and don’t seem to be observing expected behavior while using it with my GrovePi+.
I have attached my GrovePi+ to my GoPiGo2 and want to detect when the robot crashes or bumps into something but all I get back from the sensor are a stream of 0’s and 255 very rarely and randomly (does not actually correspond with a collision event).
I’m running the sample code and would appreciate any assistance. Thank you.
Can you post the code that you are using and a screenshot of the output that your getting. Also send us a test log and few pictures of your setup with the sensors. You can follow this guide to generate the test log.
This is the code I’m using (straight from the grovepi python software directory).
# Connect the Grove Collision Sensor to digital port D2
collision_sensor = 2
log.txt (5.8 KB)
After much troubleshooting I think I might know what the problem is, but I’m not sure how to fix it.
On the previous iteration of this Grove sensor (version .9b) there were 4 leads/connections GND, VCC, SIG1, and NC. On the sensor that I received (version 2.1) there are also 4 leads/connections, but they are different. The newer version has GND, VCC, SIG1,and SIG2.
I point this out because I when I tested the sensor with my Arduino nano I only connected GND, VCC, and SIG1 and it worked perfectly fine. But when I reconnected the sensor to the digital port of the GrovePi/GoPiGo and updated the firmware with the same code from the Arduino it no longer worked.
Could it be the the digital port of the GrovePi/GoPiGo is reading SIG2 which may or may not be connected instead of SIG1? If so how can I correct this?
Upon looking at the eagle files of the sensor, Pin SIG2 is nothing much to worry about . It is equivalent to a no connection as the Jumper P1 on the sensor is not connected. Hence you should be able to use this sensor on GrovePi as usual.
Can you do the following and reply back to us
Follow this guide and post a test log, make sure you are running the latest Firmware 1.2.7 on GrovePi. If you aren’t running the latest, then update your firmware by running this script.
Please do a software update by clicking on the DI_update icon on the Desktop as we have updated the software recently.
Remove or comment the
time.sleep(.5) which is inside the try block of your code as it may delay the response.
Also can you tell us how the output looks like on the Arduino Nano that you have tried.
Thank you for your patience,
Thanks @Shoban after performing the firmware and software updates the collision sensor now works!
This topic was automatically closed after 24 hours. New replies are no longer allowed.