Connecting the Sharp Distance Sensor to the m3pi

The place to discuss the Pololu 3pi, m3pi, and Zumo robots and share your code.

Connecting the Sharp Distance Sensor to the m3pi

Postby Urielnam » Wed Nov 23, 2011 7:05 am

Heya,
I've started working with my batch of 6 m3pi's and oh are they awesome.
But, I'd like to connect a sharp short distance sensor on to the mbed.
I actually have no idea where I need to plug all three of his cables. I tried extrapolating according to the 3pi wall follower but if I understand correctly connecting the sensor to the PC5 will disable my line following sensors.
So, can anyone give me a short tutorial as to where exactly I need to connect the sensor's cables?

Thank you very much,
Uriel.
Urielnam
 
Posts: 3
Joined: Thu Jul 28, 2011 3:31 am

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby ryantm » Tue Nov 29, 2011 11:00 am

Hello, Uriel.

Are you talking about the Sharp Distance Sensors (SDSs) with analog outputs that Pololu sells? For the rest of this post, I am assuming you are.

On the m3pi, connecting the distance sensor to the 3pi directly will require modifying the 3pi's software because it does not have a command to take and relay analog readings to the mbed. You would have to write that software yourself. The easier and probably more performant way to connect the distance sensor is directly to the mbed. If you prefer modifying the 3pi serial slave program, let me know and I can help you with that.

On the m3pi the analog inputs (pin 15 through pin 20) are used as LED outputs, so you will have to modify the m3pi to disconnect the LED circuit from the mbed. A description of the LEDs is in the m3pi user's guide. Desoldering the 470 ohm resistor (the resistors that are connected to the m3pi via the red traces in the picture below would be a good way to disconnect the circuit. Save the resistor in case you want to restore the LED circuit! Also, in general, desoldering is harder than soldering so make sure you know how to desolder things before attempting it.
Image

After you've modified your m3pi, here are the connections I recommend:

1. SDS GND to m3pi GND
2. SDS Vcc to m3pi VCC
3. SDS Vo to the mbed analog input you disconnected the LED circuit from

Then you would use the mbed AnalogIn library to read the sensor.

- Ryan
User avatar
ryantm
Pololu Employee
 
Posts: 1268
Joined: Mon May 19, 2008 1:00 pm
Location: Las Vegas, NV

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby RoboCookie » Mon Dec 05, 2011 2:38 pm

Hello Ryan and Uriel
I have both 3pi and m3pi and would like to mount my two GP2Y0D805 seniors with carrier boards to one of the robots if possible. I’m not sure with one? So that the robot can detect objects when they are running the maze program. Say on the left front and right front of the robots
Thanks Gary
RoboCookie
 
Posts: 5
Joined: Fri Aug 19, 2011 1:59 pm

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby Ben » Mon Dec 05, 2011 4:42 pm

Hi Gary.

I'm not sure what you're asking as the only question in your post seems to really just be a statement with a question mark on the end. Is there something specific you are confused about?

- Ben
User avatar
Ben
Pololu Employee
 
Posts: 3454
Joined: Mon Aug 28, 2006 1:05 pm
Location: Las Vegas, NV

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby RoboCookie » Mon Dec 05, 2011 6:32 pm

Hello Ben
Sorry.
3pi is robot that I would like to hookup the sensors to. I found most of the info on your website except for how to setup code in the maze program.
Thanks Gary
RoboCookie
 
Posts: 5
Joined: Fri Aug 19, 2011 1:59 pm

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby Ben » Mon Dec 05, 2011 11:18 pm

You still haven't actually asked any questions. The maze example code we provide is intended for use with a line maze and uses the 3pi's reflectance sensors. If you want to instead run in a walled maze using distance sensors, you will need to make substantial changes to the sample code, and while we can give you feedback on your attempts, we cannot provide this code for you. If you are just trying to detect obstacles while exploring a line maze, you need to better explain what you are trying to do and ask specific questions about what you're stuck on if you want some help.

- Ben
User avatar
Ben
Pololu Employee
 
Posts: 3454
Joined: Mon Aug 28, 2006 1:05 pm
Location: Las Vegas, NV

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby RoboCookie » Tue Dec 06, 2011 9:10 am

Hello Ben
Again my apologies
What I needed was to fine out the physical layout on 3pi for the two seniors, I did after taking a hard look at the forum, so that problem is done. And yes I’m trying to detect obstacles then exploring a line maze. This is for a larger robot that I’m building to work in a warehouse moving stuff from point A to point B and avoiding People along the way. I build small at first then go Big.
Thanks
Gary
RoboCookie
 
Posts: 5
Joined: Fri Aug 19, 2011 1:59 pm

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby royrporter » Sat Dec 17, 2011 12:05 pm

Can anyone share some code for the sharp sensors?
I am a novice so modifying / adding to code is my present skill level.
Anyone know of ANY available AVR Studio code (C++) available for a basic obstacle avoidance using two sensors on PC5 and ADC6?
royrporter@live.com
royrporter
 
Posts: 3
Joined: Wed Dec 07, 2011 7:06 am

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby donde » Sun Dec 18, 2011 12:04 am

Stand by. I have 1 Sharp distance sensor that works fine on my m3pi. I'll get back to you.
donde

OK, I'm back. Hope this helps...donde

I have the Sharp 10 cm sensor, that is GP2YOD810ZOF.
VCC, 5 volts comes from the 3pi battery supply, ground from common ground of m3pi.
I use pin 12 of the MBED for digital in.
First of all the 3pi is set up as Slave.

Here is some code for the PID line-follower

m3pi m3pi; // engage 3pi slave This is before main()

DigitalIn dist_sen(p12); // Distance sensor pin This is before main()

dist_sen.mode(PullUp); // This is after main()

Below is a 2nd while() after the first one, and the end of program

while(on) {

if(dist_sen) // Distance sensor pin high This if statement and break; does the sensor work. The rest is my stuff.
break;
else // spin 180 if obstruction
m3pi.stop();
wait(0.2);
m3pi.left(0.8);
wait(0.2);
break;
}
}
m3pi.stop(); // stops when atfull()
if (on == 0) {
all_stop = 1; // full shutdown
wait(0.25);
all_stop = 0;
}
}
donde
 
Posts: 84
Joined: Sat Nov 29, 2008 3:54 pm

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby ngoldin » Thu May 16, 2013 6:01 am

Hi,

Sorry for the thread necromancy, but this is unclear to me. I have a Sharp Digital Sensor (GP2Y0D805Z0F) and want to connect it. Ryan said mbed's VCC, but the mbed has different Voltages (VIN, VOUT, VU), and there is the VCC from the 3pi. So the VCC from the 3pi is the correct one? And can I use any position labeled VCC on the 3pi base for that (like the convenient row of three VCCs in the front...)?

Is there a list of the free pins of the mbed somewhere? There's always the schematic diagram, but that is a bit unpractical.

Thanks,
Niko
ngoldin
 
Posts: 2
Joined: Fri May 10, 2013 6:15 am

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby JeremyT » Thu May 16, 2013 3:03 pm

Hello.

That Sharp digital distance sensor has an operating voltage of 5V, so you could connect it to VCC on the 3pi, which is 5V. The mbed runs on 3.3V logic but is 5V tolerant, so you should be able to connect the output of the Sharp digital sensor directly to it. The m3pi schematic diagram is the easiest way to see which IO pins are available (why does using that seem impractical to you?). The mbed pins without net labels are completely free.

- Jeremy
User avatar
JeremyT
Pololu Employee
 
Posts: 639
Joined: Fri Dec 14, 2012 5:59 pm
Location: North Las Vegas, NV

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby ngoldin » Fri May 17, 2013 4:03 am

Thanks!

Well a chart of unused pins would be quicker, as the pins in the schematic are not ordered. Maybe I'm just lazy...
ngoldin
 
Posts: 2
Joined: Fri May 10, 2013 6:15 am

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby Ben » Fri May 17, 2013 9:56 am

Hello.

One benefit to using the schematic is that it makes it easy to see how the used pins are used and determine if they can be appropriated for some other purpose in your design. The pins with no net labels are completely free, but some of the other pins are conditionally free (e.g. the COM_TX, COM_RX, and COM_nRST pins if no Wixel or XBee module is present), and some pins can be used for multiple things (e.g. the LED control pins can be used as general-purpose digital outputs). I agree that this could be conveyed nicely (and, in some ways, more conveniently) with a table, but I think the schematic does a decent and, ultimately, more thorough job.

- Ben
User avatar
Ben
Pololu Employee
 
Posts: 3454
Joined: Mon Aug 28, 2006 1:05 pm
Location: Las Vegas, NV

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby amannta09 » Wed Jul 17, 2013 3:58 pm

3pi robot I can not connect using the proximity sensor. when I use my proximity sensor and solder to connect, the light sensor and serves only one sensor alone, the other input port is not working, please help how should I fix it?

:-( :-( :-( :-( :-(
amannta09
 
Posts: 1
Joined: Wed Jul 17, 2013 3:51 pm

Re: Connecting the Sharp Distance Sensor to the m3pi

Postby Derrill » Thu Jul 18, 2013 1:28 pm

Hi.

I am having difficulty understanding your problem. Could you please provide a more detailed description of the issue and your setup (e.g. what sensor you are using, pictures of your setup, and a connection diagram)?

-Derrill
User avatar
Derrill
Pololu Employee
 
Posts: 438
Joined: Thu Jan 10, 2013 12:47 pm
Location: Las Vegas, NV

Next

Return to 3pi, m3pi, and Zumo Robots

Who is online

Users browsing this forum: No registered users and 3 guests