Making a robot that can see. Arduino + Raspberry Pi

Hi all!
I am working on a project and since I am not much proficient with Arduino and Raspberry Pi I thought I would take guidance...

I have to make an obstacle avoiding robot can can run in a lane(about 3 meters wide, with 9" cones on each side), turn as the path turns, avoids collision with other robots moving in the same vicinity, and is triggered by a traffic light.

Now I plan to use a Raspberry Pi for the image processing part and find out when the light turns green, the RPi then sends appropriate commands to the Arduino (Uno or Mega 2560 R3, I have trouble deciding which one to use), the Arduino will have the HC-SR04 Ultrasonic sensor(2 on either sides and one on front) which will tell it to maintain uniform distance from both sides, and from any robots that might be ahead of it.

That's my plan. Its just a theory right now, looks simple ain't it? But I got some questions-
Q1. Shall I use the Arduino Uno or the Mega 2560 R3?
Q2. What is the best motor shield to use?(And where to find it?)
Q3. Will Arduino and Raspberry Pi be able to communicate with each other?
Q4. Is this entire theory or plan going to work the way I want it to?
Q5. What procedure you all recommend for the image processing? I have to detect a traffic light(red and green).

I would seriously appreciate any improvements to the idea, as well as any and all help.

Thank you!
-YaddyVirus

YaddyVirus:
Q1. Shall I use the Arduino Uno or the Mega 2560 R3?
Depends on how many I/O pins you need and the size of the code
Q2. What is the best motor shield to use?(And where to find it?)
Depends on the size of the robot, weight, speed and motors
Q3. Will Arduino and Raspberry Pi be able to communicate with each other?
Yes, of course
Q4. Is this entire theory or plan going to work the way I want it to?
That depends on your skills, ability to learn and motivation.

Great project! Spend plenty of time on Google, looking up and studying other people's projects. Join a team and plan on a long term but very rewarding effort.

Id use the adafruit motor shield v3, very good! And the Uno is going to be enough for the sensors and the wheels, mega is overkill.

Why use the Pi?. The Yun provides enough processing power on the Linux side combined with an AVR process on the "Arduino" side. Don't be fooled by the slower processing speed!. The Yun does not waste a lot of its power on graphics.

Why use an Arduino?. The Pi has GPIO pins.

Check on those ultrasonic sensors! do why have the range? Could they see a row of cones?

Mark

The Yun does not waste a lot of its power on graphics.

Nether does the Raspberry Pi, it has a separate graphics processor.

While the plan looks good it is going to be a lot more complex to implement than you think at the moment.

jremington:
Great project! Spend plenty of time on Google, looking up and studying other people's projects. Join a team and plan on a long term but very rewarding effort.

Well thanks a lot for the reply. As for the motivation part, I am passionate about coding, I am the highest level member of my school's robotics lab, and as I am making this robot for participating in an overseas event, failure is not an option. I have to do it and I will.
I'm gonna have to work alone though... :P.
One more question that I forgot to type... How do I do the actual image processing? Is there some algorithm for that?

Thank you
-YaddyVirus

mart256:
Id use the adafruit motor shield v3, very good! And the Uno is going to be enough for the sensors and the wheels, mega is overkill.

Thanks but there is a problem, It isn't available on Amazon and Adafrruit shipping is risky and slow (Since they are a US based company and I'm in India.) I don't want to sit waiting for the parts to arrive as my event comes closer. I want as much time as I can get for experimenting and testing.
This is a shield I found that could be shipped to me. But looks like its some old version of Adafruit motor shield, can you please review it?

About the Uno I have to use 3 sensors simultaneously as well as control the speed of the motors and take commands from the Pi. DO you think the Uno will stand?

So can you please point out where to buy it? Or suggest some alternative?

Thank you
-YaddyVirus

Grumpy_Mike:
While the plan looks good it is going to be a lot more complex to implement than you think at the moment.

I guessed that, but complexity isn't going to be a problem, I like challenges. Just wanted to make sure that my plan is correct before I actually start working on it.

Thank you
-YaddyVirus

holmes4:
Why use the Pi?. The Yun provides enough processing power on the Linux side combined with an AVR process on the "Arduino" side. Don't be fooled by the slower processing speed!. The Yun does not waste a lot of its power on graphics.

Why use an Arduino?. The Pi has GPIO pins.

Check on those ultrasonic sensors! do why have the range? Could they see a row of cones?

Mark

Umm Then what do I use?

BTW the sensors have a 2-400 cm range(that should be enough I guess). Since the cones are 9" in height I think that it should be able to see them.

Since the cones are 9" in height I think that it should be able to see them.

The problem with cones and ultrasound is that their shape will tend to reflect the sound away from the receiver. You may not "see" them until you're about to bump into them.

YaddyVirus:
How do I do the actual image processing?

You can't do that on an Arduino so you need to ask in another Forum. It is a complex business but I'm sure it has been done many many times.

...R

YaddyVirus:
I guessed that, but complexity isn't going to be a problem, I like challenges. Just wanted to make sure that my plan is correct before I actually start working on it.

This is a problem that is foxing many post doctorate research fellows. It is not something you can do with enthusiasm alone. It is the image processing bit that will push you beyond your current limits.
The best you can do is to use openCV which is a collection of grown up image processing algorithms, you can run it on the Raspberry Pi but complex as it is it is not very good and you will still have to work out how to put these together do achieve what you want.

Mind you you might have a modern attitude to success which involves constantly downgrading your definition until it matches what you can actually do.

AWOL:
The problem with cones and ultrasound is that their shape will tend to reflect the sound away from the receiver. You may not "see" them until you're about to bump into them.

That's something I overlooked. Thanks a lot!

Grumpy_Mike:
This is a problem that is foxing many post doctorate research fellows. It is not something you can do with enthusiasm alone. It is the image processing bit that will push you beyond your current limits.
The best you can do is to use openCV which is a collection of grown up image processing algorithms, you can run it on the Raspberry Pi but complex as it is it is not very good and you will still have to work out how to put these together do achieve what you want.

Mind you you might have a modern attitude to success which involves constantly downgrading your definition until it matches what you can actually do.

I completely agree, thanks a lot for your suggestions. I am certain that the image processing bit will be tough, but I'll do it. And with folks like you helping, it might not be as hard as that!

Thank you
-YaddyVirus

OK so forget about the robot bit and first get a Raspberry Pi, and download openCV, then play about with some images and get a feel for what you have to do.

It is very processor intensive so get a model 3 Pi if you can, a model 2 Pi might work at a push but the original model 1 Pi is way under powered for the task.

I wouldnt use Yun for this task, I dont know if 64mb ram and 400 mhz is going to be enough for real time image processing, nor do I know if yun supports openCV.

Given that I said :-

the original model 1 Pi is way under powered for the task.

And that processor runs at 800 MHz then 400MHz is a non starter. Also given that it has no video output the Yun is totally out of the frame for this.

Grumpy_Mike:
OK so forget about the robot bit and first get a Raspberry Pi, and download openCV, then play about with some images and get a feel for what you have to do.

It is very processor intensive so get a model 3 Pi if you can, a model 2 Pi might work at a push but the original model 1 Pi is way under powered for the task.

On it bud. Can you please check out this link and make sure that I am buying the right version? There is huge confusion regarding this stuff back here in India...
http://www.amazon.in/Raspberry-Pi-64-bit-quad-core-Cortex/dp/B01CEG24WO?tag=googinhydr18418-21&tag=googinkenshoo-21&ascsubtag=82a30893-4776-415c-a522-89ce3ef3a26d#productDetails

Now this seems to be the final of my problems... I can't buy the board as of now, I cannot afford it. My school's paying for the project and I haven't received the money yet, so is there a way to run openCV on my laptop? I mean I could play around and come up with the final algorithm and when I get my hands on the board, get it up and running and remove any bugs if they exist...

Again thanks for sticking out with me, its the help of people like you which motivates outsourced people like me to attempt such projects. But as it is said-
"Don't undertake a project unless it is manifestly important and nearly impossible" - Edwin Land
:wink:

Thank you
-YaddyVirus

Yes you can use openCV on any platform. That Pi looks right it is the Pi 3 just launched last week.

Take a look at the pixycam

(any one know which processor is used, the project is open source)

Mark