Arduino/Pi Robot


30 posts   Page 1 of 2   1, 2
by Mikeyl » Wed Aug 01, 2012 2:04 pm
Some very quick photos of my Pi/Arduino robot. AT the moment it will wonder around avoiding objects and you can get a robot's view through a streaming webcam sent from the Pi.

Image

Image

Image

Image

It uses the following:

Magician Robot Chassis
Arduino Uno
Arduino Motor Shield
HC-SR01 ultrasonic sensor
Raspberry Pi (in Punnet case held on by elastic band!)
Logitech C200 webcam (bought for 99p on ebay)
Edimax wifi dongle

The power to the arduino is from a battery pack

The power to the pi is from a Tecknet iep387

The next stage is to connect the Pi and Arduino together using GPIO as serial to let you control the robot from a webpage. After that I am planning on adapting the Julius speech recognition to drive the robot.

This is the first piece of electronics I've built... :lol:

Mike
Last edited by Mikeyl on Wed Aug 01, 2012 2:12 pm, edited 1 time in total.
Posts: 23
Joined: Wed Jun 20, 2012 11:15 am
by calebzulawski » Wed Aug 01, 2012 2:08 pm
Very cool :D

I'm working on a very similar project (using almost the same components!), except my robot has 4 wheels :lol:

I'm curious, what's the benefit of using the Arduino motor shield? I always had the motors plugged right into the arduino.... If it's just about voltage, I think I'll use some transistors, but i dunno if that's good enough!
Posts: 46
Joined: Tue Jan 31, 2012 6:00 am
by Justwondering321 » Wed Aug 01, 2012 2:15 pm
The only thing the pi is doing is power the webcam right??? Seems a bit of a waste. No offense though... I love it!!!!
Posts: 58
Joined: Mon Jul 16, 2012 6:39 am
by calebzulawski » Wed Aug 01, 2012 2:23 pm
Justwondering321 wrote:The only thing the pi is doing is power the webcam right??? Seems a bit of a waste. No offense though... I love it!!!!


I'm not sure about mikeyl's robot, but I'm using the arduino to stream the webcam over wifi, as well as do the pathfinding for the arduino
Posts: 46
Joined: Tue Jan 31, 2012 6:00 am
by Mikeyl » Wed Aug 01, 2012 2:29 pm
Hi

I'm using the Motor Shield because (after reading around) it seemed the easiest way to control two motors, vary power and direction.

The Pi powers the webcam, runs motion and streams the webcam image across the network so you can look at it on another machine.

At the moment...

Once the Pi and Arduino are connected then I want to try mapping a route through a room using the Ultrasonic sensor and eventually the webcam image. This is just a starting project to get a testbed up and running...

cheers

Mike
Posts: 23
Joined: Wed Jun 20, 2012 11:15 am
by calebzulawski » Wed Aug 01, 2012 2:31 pm
How are you streaming the webcam? Are you using wifi?
Posts: 46
Joined: Tue Jan 31, 2012 6:00 am
by Ravenous » Wed Aug 01, 2012 2:54 pm
Mikeyl wrote:This is the first piece of electronics I've built... :lol:

Fantastic - by the way this forum needs a "We are not worthy" smiley!

That chassis looks seriously overloaded :shock:
Posts: 1233
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK
by Mikeyl » Wed Aug 01, 2012 2:56 pm
calebzulawski wrote:How are you streaming the webcam? Are you using wifi?


Yes, Edimax wifi dongle

Mike
Posts: 23
Joined: Wed Jun 20, 2012 11:15 am
by Mikeyl » Wed Aug 01, 2012 2:57 pm
Ravenous wrote:
Mikeyl wrote:This is the first piece of electronics I've built... :lol:

Fantastic - by the way this forum needs a "We are not worthy" smiley!

That chassis looks seriously overloaded :shock:


Its not the fastest robot in the world... 8-)

But the chassis was only £10.00 including the motors.

Cost to build the whole thing was about £100

Mike
Posts: 23
Joined: Wed Jun 20, 2012 11:15 am
by calebzulawski » Wed Aug 01, 2012 3:08 pm
Mikeyl wrote:
calebzulawski wrote:How are you streaming the webcam? Are you using wifi?


Yes, Edimax wifi dongle

Mike

Wow, you don't even need a powered hub for that? I'm using an Asus USB-N10... working on a li-po powered hub :|
Posts: 46
Joined: Tue Jan 31, 2012 6:00 am
by exartemarte » Wed Aug 01, 2012 3:19 pm
calebzulawski wrote:I'm curious, what's the benefit of using the Arduino motor shield? I always had the motors plugged right into the arduino.... If it's just about voltage, I think I'll use some transistors, but i dunno if that's good enough!

A microcontroller will not normally deliver enough current to drive motors, unless they're very tiny. Arduino output ports are limited to a few tens of milliamps: the motors on the Magician chassis that Mikeyl has used have a stated stall current of approximately 1 Amp. You can build your own motor control circuit using transistors, and that is quite easy if all you want is to turn the motors on and off, but if you want bidirectional control you will end up building something like an h-bridge anyway and it might be quicker and easier to use a chip such as an L293D or a n L298N. For Mikeyl's chassis I would choose L298N, which I believe is available on an Arduino extension board ("shield", if you must...).
User avatar
Posts: 307
Joined: Sat Mar 03, 2012 3:51 pm
Location: Middle England
by calebzulawski » Wed Aug 01, 2012 3:22 pm
exartemarte wrote:
calebzulawski wrote:I'm curious, what's the benefit of using the Arduino motor shield? I always had the motors plugged right into the arduino.... If it's just about voltage, I think I'll use some transistors, but i dunno if that's good enough!

A microcontroller will not normally deliver enough current to drive motors, unless they're very tiny. Arduino output ports are limited to a few tens of milliamps: the motors on the Magician chassis that Mikeyl has used have a stated stall current of approximately 1 Amp. You can build your own motor control circuit using transistors, and that is quite easy if all you want is to turn the motors on and off, but if you want bidirectional control you will end up building something like an h-bridge anyway and it might be quicker and easier to use a chip such as an L293D or a n L298N. For Mikeyl's chassis I would choose L298N, which I believe is available on an Arduino extension board ("shield", if you must...).

I'm using servos, so I don't need to mess with polarity or anything like that to change speed and direction, since the servos are PWM. Could I just use transistors to boost the PWM output of the arduino to 6V and supply more current?
Posts: 46
Joined: Tue Jan 31, 2012 6:00 am
by exartemarte » Wed Aug 01, 2012 3:27 pm
Mikeyl wrote:This is the first piece of electronics I've built... :lol:

I'm impressed - there's a lot of satisfaction in having a go and putting together something that works.

I haven't tried a webcam with the Pi as yet: was it reasonably straightforward?
User avatar
Posts: 307
Joined: Sat Mar 03, 2012 3:51 pm
Location: Middle England
by Mikeyl » Wed Aug 01, 2012 3:45 pm
exartemarte wrote:[
I haven't tried a webcam with the Pi as yet: was it reasonably straightforward?


Yes, pretty easy. I had a problem initially but eventually managed to work out that I wasn't supplying enough power to the Pi. Once I switched to using my Ipad power supply (which is 2.1A) then the camera came up as video1 and I was able to get motion up and running.

It took a while to work out the settings for the camera (brightness,etc) but now it runs pretty well.

It's been a learning curve as its about 25 years since I did any Xenix/Unix...

The portable supply I am using will drive an Ipad so I was sure it could cope with the Pi/webcam and wifi.

Mike
Posts: 23
Joined: Wed Jun 20, 2012 11:15 am
by calebzulawski » Wed Aug 01, 2012 3:53 pm
Mikeyl wrote:
exartemarte wrote:[
I haven't tried a webcam with the Pi as yet: was it reasonably straightforward?


Yes, pretty easy. I had a problem initially but eventually managed to work out that I wasn't supplying enough power to the Pi. Once I switched to using my Ipad power supply (which is 2.1A) then the camera came up as video1 and I was able to get motion up and running.

It took a while to work out the settings for the camera (brightness,etc) but now it runs pretty well.

It's been a learning curve as its about 25 years since I did any Xenix/Unix...

The portable supply I am using will drive an Ipad so I was sure it could cope with the Pi/webcam and wifi.

Mike


How much does the supply hold (mAh)? And do you know how long it lasts driving everything?
Posts: 46
Joined: Tue Jan 31, 2012 6:00 am
by Mikeyl » Wed Aug 01, 2012 3:54 pm
calebzulawski wrote:
Mikeyl wrote:
exartemarte wrote:[
The portable supply I am using will drive an Ipad so I was sure it could cope with the Pi/webcam and wifi.

Mike


How much does the supply hold (mAh)? And do you know how long it lasts driving everything?


It is a 7000mah supply - I haven't done any tests to see how long it will run the pi for yet. But it is supposed to be able to drive an Ipad for 3-4 hours.

Mike
Posts: 23
Joined: Wed Jun 20, 2012 11:15 am
by exartemarte » Wed Aug 01, 2012 9:01 pm
calebzulawski wrote:
exartemarte wrote:
calebzulawski wrote:I'm curious, what's the benefit of using the Arduino motor shield? I always had the motors plugged right into the arduino.... If it's just about voltage, I think I'll use some transistors, but i dunno if that's good enough!

A microcontroller will not normally deliver enough current to drive motors, unless they're very tiny. Arduino output ports are limited to a few tens of milliamps: the motors on the Magician chassis that Mikeyl has used have a stated stall current of approximately 1 Amp. You can build your own motor control circuit using transistors, and that is quite easy if all you want is to turn the motors on and off, but if you want bidirectional control you will end up building something like an h-bridge anyway and it might be quicker and easier to use a chip such as an L293D or a n L298N. For Mikeyl's chassis I would choose L298N, which I believe is available on an Arduino extension board ("shield", if you must...).

I'm using servos, so I don't need to mess with polarity or anything like that to change speed and direction, since the servos are PWM. Could I just use transistors to boost the PWM output of the arduino to 6V and supply more current?

I don't have a lot of experience with servos, although I have used them - it might help if you have a look at page 19 of this manual. The code example won't help much, since it's for a Picaxe, but the description and the diagram apply equally to an Arduino or the Pi.

This may also help to clarify the issues:

RC-type servos generally have three connections:

Black. This must be connected to the common ground/0v. (Common, that is, to the servo, the Arduino, the Pi and the power supply / battery.

Red. This is where the servo gets its power from and it should be connected to the positive side of the (4.5-6v) supply. You should not connect this line to the 5v output on either the Arduino or the Pi - these boards have on-board voltage regulators which cannot supply the current the servo will need.

White or yellow. This is the signal input: it will be connected to an output port on the Arduino or the Pi. Power is not an issue with this connection - it draws very little current. The 5v signal from an Arduino output port will control the servo quite satisfactorily. I don't know whether the 3.3v signal level from the Pi will be adequate to control the servo - my guess is that it will, but I haven't tried it.

Some people would argue that the servos should have their own, separate battery, since they generate a lot of electrical noise. I can only say that in my limited experience that hasn't been a problem.

I hope some of this helps.
User avatar
Posts: 307
Joined: Sat Mar 03, 2012 3:51 pm
Location: Middle England
by exartemarte » Wed Aug 01, 2012 9:13 pm
Mikeyl wrote:
exartemarte wrote:[
I haven't tried a webcam with the Pi as yet: was it reasonably straightforward?


Yes, pretty easy. I had a problem initially but eventually managed to work out that I wasn't supplying enough power to the Pi. Once I switched to using my Ipad power supply (which is 2.1A) then the camera came up as video1 and I was able to get motion up and running.

It took a while to work out the settings for the camera (brightness,etc) but now it runs pretty well.

It's been a learning curve as its about 25 years since I did any Xenix/Unix...

The portable supply I am using will drive an Ipad so I was sure it could cope with the Pi/webcam and wifi.

Mike

Thanks - I have a couple of disused webcams lying around so I might give that a whirl when I get bored with my robot arm. Given the problems that I and others have had with usb wifi dongles I imagined that getting a usb webcam to work might be difficult verging on the impossible.
User avatar
Posts: 307
Joined: Sat Mar 03, 2012 3:51 pm
Location: Middle England
by Mikeyl » Thu Aug 02, 2012 2:49 pm
exartemarte wrote:Thanks - I have a couple of disused webcams lying around so I might give that a whirl when I get bored with my robot arm. Given the problems that I and others have had with usb wifi dongles I imagined that getting a usb webcam to work might be difficult verging on the impossible.


The robot arm is cool... I did look into the USB one from Maplin but decided to go with a wandering robot first.

I am tempted to try to create a chess-playing robot arm at some point.

Mike
Posts: 23
Joined: Wed Jun 20, 2012 11:15 am
by 6677 » Sat Aug 04, 2012 2:07 pm
calebzulawski wrote:I'm curious, what's the benefit of using the Arduino motor shield? I always had the motors plugged right into the arduino.... If it's just about voltage, I think I'll use some transistors, but i dunno if that's good enough!

Motors plugged right into arduino IO pins is a VERY bad idea, the current draw of even a small pager motor when stalling is high enough to fry the arduino.
A motorshield usually has some sort of motor driver chip on it capable of much higher voltages and currents. With transistors all your really doing is making a very basic motor driver. L293D is a common motor driver chip used on arduino motor shields I think, nothing says you have to use a shield but it might be tidier than just having a chip soldered to some wires and hanging off your bot.
Posts: 372
Joined: Wed Mar 14, 2012 9:23 pm
by calebzulawski » Tue Aug 07, 2012 8:18 pm
6677 wrote:
calebzulawski wrote:I'm curious, what's the benefit of using the Arduino motor shield? I always had the motors plugged right into the arduino.... If it's just about voltage, I think I'll use some transistors, but i dunno if that's good enough!

Motors plugged right into arduino IO pins is a VERY bad idea, the current draw of even a small pager motor when stalling is high enough to fry the arduino.
A motorshield usually has some sort of motor driver chip on it capable of much higher voltages and currents. With transistors all your really doing is making a very basic motor driver. L293D is a common motor driver chip used on arduino motor shields I think, nothing says you have to use a shield but it might be tidier than just having a chip soldered to some wires and hanging off your bot.

I was actually using servos, so the power and ground was supplied directly from the UBEC connected to my battery. Only the PWM was connected to the Arduino
Posts: 46
Joined: Tue Jan 31, 2012 6:00 am
by JoBu » Wed Aug 08, 2012 12:40 pm
This is really nice! Keep us updated with your future work.
I'm interested in everything that concerns the R-Pi and Arduino together to get some ideas for my current Arduino based robot so if you have any other good reads please post em!
Posts: 3
Joined: Mon Feb 20, 2012 8:31 am
by wakaru44 » Sun Sep 02, 2012 1:10 pm
Hi!

I'm doing more or less the same, with almost the same hardware. It was fun to find this thread.

Instead of buying a chip, i made the H-bridge myself in a protoboard (which is huge :( )
For the body i used plastic "tupperware"'s from the kitchen :D

I use PWM to control the motor's speed. I don't know if that is good or not (I would like to read your opinion on this)

My plans are similar ,play with SLAM and voice recognition. I already have Julian installed on the RPi, but i still don't have any kind of "range finder".
Posts: 1
Joined: Sun Sep 02, 2012 12:50 pm
by raspberryk » Mon Sep 10, 2012 12:07 am
Instead of using the Arduino motor shield, what if you were to use an RC car?

small_IMG_1521.jpg
small_IMG_1521.jpg (26.98 KiB) Viewed 13872 times


I am considering trying to wire up my Raspberry Pi with an RC car (the dual track type), but the twist is, I want to control the remote control, and not the car itself. My logic is, the board and wiring are already taken care of, why re-invent the wheel? I just do not know how to "make the connection" between the GPIO on the Raspberry Pi and the remote's switches that drive the car.

If anyone has any ideas, I'd be interested in hearing about them: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=16832
Posts: 4
Joined: Sun Sep 09, 2012 2:32 am
by shanester » Wed Dec 04, 2013 9:40 am
Have a look at the pi-cars website- a very good tutorial for using the pi to control an RC car. It was the second thing I did with my pi.
For testing I use SimpleSi's Scratch GPIO to test omit the output and let my boys (were 4&6) have a play with it.

I'm also looking to build a R-Pi / Arduino robot. I have cheated (a lot) and got the Initio from 4Tronix (a 40th Birthday pressie) which is pretty good value. Next to integrate the R-Pi for SLAM.
Anyone have this up and running already?

Cheers.

Shane
Posts: 12
Joined: Tue Sep 10, 2013 8:03 pm