Zumo obstacle avoidance Sharp IR sensor

Hi guys,
I have a project with the pololu zumo robot and Sharp IR sensor, that i want to make the robot avoide abstacles .
could you please help me , cause i don’t know where to sold the Sharp IR sensor and to implement the arduino code thanks

Hello.

We have two different output types for the Sharp distance sensors: analog voltage and digital. Also, we have two versions of the Zumo robot: the Zumo Robot for Arduino and the Zumo 32U4. Which Sharp distance sensor and Zumo robot do you have?

- Amanda

Hello dear,
In the images, here is the zumo robot and IR sensor i have.

Could you please tell me how can link or soldering the sensor to my zumo robot, and please there is a code example for the obstacle avoidance.

Thaank you,

xs

Hello.

It looks like you have the Zumo Robot for Arduino and the Sharp GP2Y0A51SK0F Analog Distance Sensor 2-15cm. If that is the case, you will probably want a 3-Pin Female JST ZH-Style Cable (30cm) for Sharp GP2Y0A51 Distance Sensors if you do not already have it. From there you could connect the wires to the Zumo via soldering: Vcc (red wire) to 5 V, ground (black wire) to ground, and the output (white wire) to an available analog pin. You can find the available analog pins on the Zumo from the table under the “Arduino pin assignment table” section in the Zumo Shield for Arduino User’s Guide. The analog pins are brought out in the front expansion area and along the sides of the Arduino headers on the Zumo, so you have multiple options where you want to connect the wires.

As for code examples, we do not have an example for the Zumo for obstacle avoidance, but you can try writing something simple like moving the Zumo forward, reading the distance sensor and checking that it is above a threshold value equivalent to the distance you want, and adjust the motors’ speed accordingly. You might find it helpful to look at the graph showing the output voltage versus distance to object on the distance sensor’s product page next to the “Linearizing the output” section.

- Amanda