Let's Make Robots!


I snatched up a RaspPi version B last week when Adafruit had them in stock for a few minutes. It got here today and I barely had time to find a power supply adapter for it before bed. I started reading up though, and only then did I learn that there is only one PWM capable GPIO. There are workarounds of course-like an ATTiny or the PCA9685 on I2C, but that's hardly satisfying when you were raised on a steady diet of Arduino. Also, you can't use the PWM pin and the built in audio at the same time. Still, for $35 US, it's a single board Linux machine.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Check out what sarfata is doing here with the DMA controller on the RPi: http://www.tbideas.com/blog/2013/02/controling-a-high-power-rgb-led-with-a-raspberry-pi/

One source file, a simple compile, and up to 8 channels (or more?) of PWM entirely independent of the CPU and its task scheduler.  This might be just the ticket for controlling your servos with no jitter and no need for realtime kernel extensions.

Hi Max,

Geeze I turn my back a few months and you are doing all the fun stuff...LOL.

I remember thinking the RaspyPi would make a great computer for a robot, but it is quite a step up from the PICAXE 28X1 I am playing with now.

I am looking much forward to seeing what you can do with this.

I dug out Ajax (my first robot) last Saturday and got his arms moving up and down, so hopefully I can get back to this game now.


 Thanks for the update and good luck,



We've missed you, Hal!  We've also apparently turned into a daycare in the meantime.  Anyway, I haven't even gotten the Debian "Wheezy" distro on the machine yet and I'm discovering limitations that p1ss me off, but coming up with ways around them.  Anyhoo, glad to see you.

I've heard about a couple of projects that use this approach.  To me it's kind of like taking a ride in a perfectly functional roadster which is chained into a flatbed truck (lorry.)  You could just drive the flatbed if you want to get somewhere, or you could just take the roadster if you don't need all the power of the truck.  Insisting on both is a little ostentatious and maybe wasteful.  Not to criticize anyone taking this route-just commenting on how it strikes me.

It sounds like I better start designing an I/O shield for a Rasberry that's cheaper than an Arduino.

...and then you should write the libraries for it!  I'll have you do as much of my work for me as I can! ;-)  (Short of actually sending you my Pi, let me know how I can help-if you're serious that is.  Which you should be.  Look at the market for these, and now they're becoming available!)

Ok, as I don't have a Pi, the first thing I need to know is what I/O option would be the easiest or best to implement? For example I2C is relatively easy from a hardware stand point and the newer I2C chips can handle a transfer rate better than 1MHz. Is I2C easy to implement with Linux?

USB is another possibility but I am concerned about drivers.

Please throw some ideas into the melting pot while I do a little research or my own and convince the company to buy me a Pi.


The raspberri pi foundation have released their own expansion board already. Its a little heavyweight for some applications though. It seems to be able to do god damn everything. The onboard uC is preloaded with the arduino bootloader though.

http://www.raspberrypi.org/archives/1734 pi is on the right and dwarfed by the board.

Links to the user manuals are also contained there.


Another link:



I think you might find some good info there that can carry across to your board. The only thing to be aware of is that the GPIO layout I think is slightly different on the revision 2 boards, not 100% certain on whether its just which ports are broken out from the CPU or whether its an actual rearrangement of the GPIO pin ordering though. I2C or serial are probably the best ways to integrate expansion boards.



The standard library used on most pi's for GPIO is wiringpi. Its originally a C library although has bindings for most other languages included in a default rasbian installation (default pi operating system). There are other GPIO libraries but they mostly rely on reading to and writing from a file which is slow. Wiringpi I believe uses direct hardware access (and as a result root permission on installation I believe) so should be much much faster. The textfile used for GPIO state is accessible from all languages if you wish to handle reading and writing to/from it yourself though so languages that don't yet have wiringpi available can still use GPIO.



Adafruits distro is built off of rasbian however I think targetting rasbian (from the software side of things anyway) is probably the best bet as its probably the most commonly used distro now. Assuming it works on rasbian then it should work fine on adafruits distro anyway.


Hope thats all of some use to you. I don't own a pi although did help 2 different friends getting theirs running and helped one of them make a little game in python. Otherwise I would have probably been able to offer assistance with making a python module for your board.

Look at the LadyAda "Wheezy" distribution tutorial.  It has (what I assume are) the best set of GPIO support additions.  As far as which I/O option to use, I would say I2C first and SPI second-you probably don't want to tie up any more USB ports than you have to.  Also, I think the "shield" mentality is probably something good to stick with for robot makers.  The problem is only one pin in the GPIO supports PWM and you can't use it at the same time as the built-in audio-thus my relegating it to the ATTiny44 via I2C for the time being (I should say my plans to do so-I talk a big game but I don't even have the system up and running yet.)

As to function, I'm not sure-perhaps an integrated motor controller/stepper/servo "shield" (others are calling them PiPlates, I'd prefer ice cream scoops on top of my raspberry pi) or maybe a translator shield to make Arduino shields work on a Pi as far as Pin functions go.  You're good with SMT so that wouldn't be out of the realm of possibility.

I'm sure I'll think of more.  Should this move to another thread to get more input?

I've been using an Arduino to drive the servos on my Rasp-Pi robot prototype... it's another $30, but I had one lying around already, so why not?