sky99
Posts: 6
Joined: Wed Nov 07, 2012 4:12 pm

Starting robotics with raspberry pi?

Wed Nov 07, 2012 4:48 pm

Hello everyone!
I'm finishing my thesis in AI, and can handle programming. However, i don't know how to control motors, servomotors and such things. I am interested in doing so, and furthermore, with some of my students (i do some teaching in programming and AI) we want to start some kind of "hacker lab", meaning that we'll be experimenting stuff, and trying to craft devices, and interact with the real world rather than just doing regular programming.

When we discussed about raspberry pi, we all got really enthusiastic. So now, one of my students want to control a RC car with a raspberry pi. My own project is to use servomotors to make a motorized camera, and a third one already ordered his own raspberry pi for goals that i don't know yet.

Tu put it short, we need to be able to control motors and servomotors from the raspberry pi, using the IO ports. I have seen some methods to control a small servomotor directly from the Rpi, but i read that i can't be used for larger servos, and it's limited to only one. So we need help not for the programming part, but the hardware part :

-How can we make a motor/servromotor driver that can be controlled from the Rpi?
-What kind of hardware should we buy in order to realize this, and experiment?
-Could you provide online ressources for beginners for the electronics required for controlling such devices?

I want to stress that we need simple designs, because it has a learning purpose : the goal is to be able to understand the basics, so that each student can adapt it to his/her goals, and is capable of explaining to other students.

We are located in Guadeloupe, a small island in French west Indies, where it is difficult to obtain hardware, so we will be ordering on the internet the electronic parts (probably on RS component when ordering the Rpis).

If some people could also recommend pieces of hardware that are not directly useful for this current task, but has educational interest, and could be used for learning purposes, i'm open to suggestions!
In advance, thanks to all! :)

AforAlex
Posts: 85
Joined: Thu May 31, 2012 7:56 pm

Re: Starting robotics with raspberry pi?

Wed Nov 07, 2012 11:09 pm

I think one option might be to look at something like the piface board, but if you want to do something a bit more simple then you could do something like I've done here : http://thingswatihavedonewithmyraspberr ... th-my.html negatives are that it uses up a lot of your GPIO's so not brilliant if you want to drive more than just 2 DC motors, but its reasonably simple and is quite responsive, haven't quite gotten my head around the pwm stuff yet tho :-(

sky99
Posts: 6
Joined: Wed Nov 07, 2012 4:12 pm

Re: Starting robotics with raspberry pi?

Wed Nov 07, 2012 11:22 pm

AforAlex wrote:I think one option might be to look at something like the piface board, but if you want to do something a bit more simple then you could do something like I've done here : http://thingswatihavedonewithmyraspberr ... th-my.html negatives are that it uses up a lot of your GPIO's so not brilliant if you want to drive more than just 2 DC motors, but its reasonably simple and is quite responsive, haven't quite gotten my head around the pwm stuff yet tho :-(
Thanks for your reply!
This is really interesting, i think your link will be really interesting for the motor control part. We will be able to have a mobile raspberry pi, which will enable us to perform simple robot movement algorithms.

I also read a lot about Arduino, and i have seen that the cost of arduino uno boards is quite low. I was wondering how easily one could interface such a board with a raspberry pi to control motors, servomotors and such things... Is it interesting to use it in combination of the raspberry pi, or is it redundant?

flyinghappy
Posts: 115
Joined: Mon Nov 05, 2012 5:31 pm

Re: Starting robotics with raspberry pi?

Wed Nov 07, 2012 11:24 pm

This guy got a roomba going with a pi. Not exactly what you are doing, but still has 2 servo motors and such with it.

http://www.raspberrypi.org/archives/tag/roomba
Pi with ArchLinux running a minidlna/samba home server

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Starting robotics with raspberry pi?

Thu Nov 08, 2012 1:32 pm

Maybe have a look at:
http://www.raspberrypi.org/phpBB3/viewt ... 37&t=16973

and the other Skutter threads.

Also the segway style balancing robot::
http://www.raspberrypi.org/phpBB3/viewt ... =37&t=5254

You might also want to search around, I have definitely seen threads in the past about:
- controlling servos (via pulses, as they contain their own driver circuit)
- building your own H-bridge to run motors (Morphy hacked his own in one of the skutter threads)
- just buy standard H-bridge chips like the L293 or L298 or similar
- running a small motor in one direction only using something like ULN chips (ULN2803 or 2003 or something) or Darlington transistors.

A good place to start (I've mentioned this a few times) is this manual (for a completely different product) with lots of basic electronic circuits for relays and small motors:
http://www.picaxe.com/docs/picaxe_manual3.pdf

I think the raspi only does 3.3V logic outputs, not 5V. You can make level shifters out of mosfet transistors to match between the two if necessary - those are mentined in various threads somewhere too.

Bear in mind I don't own a raspi yet (I'm waiting for the lower power model A) so I haven't connected the raspi to a single one of the things I've mentioned above, and haven't yet studied any of the software options for the GPIO connector, etc.

Oh I nearly forgot, also go to the News page and read through quickly for at least 5-10 pages. There are lots of hardware/robotics/interfacing projects that have been mentioned on there.

Good luck! You could spend days researching all this before even beginning to decide what you need to buy/build...

Rodney Wertz
Posts: 24
Joined: Sun Jun 03, 2012 12:22 am
Location: Wolfforth, Texas

Re: Starting robotics with raspberry pi?

Fri Nov 09, 2012 1:53 am

If you don't already have it you might look at "Robot Builder's Bonanza" by Gordon McComb. It has quite a lot about how to control DC motors. It has step by step procedures for modifying RC servos to work with PWM. I have begun to experiment with this using ServoBlaster on the RPI. It works very nicely on the workbench. I have yet to turn it on its wheels and crash it into a wall. Old legos dug out of the bottom of the toy box are great for prototyping the chassis.

Rodney Wertz
Posts: 24
Joined: Sun Jun 03, 2012 12:22 am
Location: Wolfforth, Texas

Re: Starting robotics with raspberry pi?

Fri Nov 09, 2012 7:02 pm

I should have said modify the servo for continous rotation.

ToddFerrante
Posts: 19
Joined: Sun Sep 30, 2012 8:00 pm

Re: Starting robotics with raspberry pi?

Sun Nov 11, 2012 12:55 pm

Off the shelf, the Raspberry Pi can control up to 8 RC style servos (or motor drivers) using PWM control.
This thread tells how: http://www.raspberrypi.org/phpBB3/viewt ... lit=servos

For something like a camera pan/tilt, use position control servos. For driving motors, use the motor drivers used for RC cars (bi-directional) or airplanes (one direction).

If you want to do more motors than that, use the adafruit servo driver board: http://adafruit.com/products/815

Todd F.

catmaker
Posts: 50
Joined: Thu May 24, 2012 8:32 am

Re: Starting robotics with raspberry pi?

Wed Nov 14, 2012 6:33 am

Up to 4 common RC servos may be attached, powered, and controlled directly by Raspy Juice, again [sic] with minimal wiring jungle.
See topic http://www.raspberrypi.org/phpBB3/viewt ... 59&t=14654

tenochtitlanuk
Posts: 156
Joined: Fri Jul 06, 2012 8:51 pm
Location: Taunton, Somerset, UK
Contact: Website

Re: Starting robotics with raspberry pi?

Wed Nov 14, 2012 10:03 am

I thoroughly recommend the https://www.sparkfun.com/products/10025 Eibotboard. It plugs on your USB connector on the Pi, but appears as a serial port. You send it simple serial commands from a terminal or the language of your choice. It has two stepper motor drivers on board; servo outputs; and digital in/out.
Best of all, the vector drawing program 'Inkscape' runs on a Pi ( though takes ages to load) and has extensions that run an Eibotboard direct. You draw a shape, and an x-y plotter run by two steppers draws your shape. If instead one motor rotates a spherical object, you get a 3D polar plot, ie it wraps the drawing round the sphere.
Image - Image
The Piface board here is not being used.
While RC servos will turn to approximately the correct position, steppers ( unless over loaded & stalled) will ALWAYS turn the exact angle requested. I get all my steppers from old scanners & printers, and have old mains-adaptors to run power to motors. I only bought the EiBotBoard. And rather than always use eggs, I write to old lightbulbs, which wipe clean!

Return to “Automation, sensing and robotics”