Friday 4 May 2007

How to build a COTS PC Robot - Part 1

This first part will deal with how to fit the physical and electrical parts together to make a pile of hardware that can be called a robot because it can move, not because it will actually be intelligent or autonomous.

At the end of this part, you will have a platform that with the help of part 2 (software / drivers) can be used as an expensive remote controlled 2 wheel car that can report on its sensors, and be in a position to have intelligence and automomy programmed into it. It will be similar in hardware composition to the Whitebox 914, but will have cost you $4000 less. It will of course be missing a beautiful shell and software to make it do anything. ( No disrespect to whitebox – the hardware part of this project was completed before the whitebox, but turns out to be very similar. Their product certainly has a beautiful shell and probably has some good software. If you want a finished system: check them out. )


What makes a robot?
For the purposes of this articles we will say that to be able to be called a robot it must:
1) Be able to move using wheels or legs
2) Be able to sense its surroundings, at least a bit.
3) Be able to respond to its senses and choose a move.

There are many ways to accomplish the above, and a $10 BEAM robot, may in many cases perform the above more reliably and with greater fluidity. This article will assume that you want a full PC as brain, either an existing desktop machine or a small PC that will move with the robot.

Advantages:
1) You can program with familiar languages.
2) You have access to large memory and storage.
3) You can use web cams and other commodity parts.
4) You can have access to wifi and the power of the network.

Disadvantages:
1) Complex system with many parts
2) Slow start up time.
3) Only as reliable as your software.
4) Expensive.

How do you make a PC move and sense?
These days there are many devices that can plug directly into a PC using serial, or USB and give you access to a vast range of actuators and sensors. Popular examples include, Phidgets, the Serializer and I2C devices. This article will concentrate on I2C devices from a UK company called Devantech mainly because it is what I have most experience with. Although I personally think they are a good option by price, performance and ease, many other choices are possible, and your own research many lead you in another direction.

Easy option: the RD01 Drive system from Devantech. £96.91
It contains the I2C controlled MD23 dual 3A motor controller, two gear motors with 360 step encoders, complete with wheels and mounting brackets. You could just about screw these directly into a laptop and you would nearly have a robot. We won’t be following that route.

How do you talk to it?
We will follow two possible routes:
1) The USBI2C adaptor from Devantech. £16.56
Plug one end into a USB port and plug some I2C wires into the other side. Done.
2) The RF04/CM02 from Devantech £79.88
Plug the RF04 into a desktop PC, and plug the CM02 via some I2C wires into your MD23. The RF04 will speak over radio waves to the CM02. This way you can use your desktop PC as the robot’s brain, and avoid you having to buy another computer for the robot. This will be much cheaper, but communication will have more latency and it won’t be as easy to stick a webcam on your robot.

Both of the above will let you speak to I2C devices through a virtual COM port. You simply send a few bytes to the COM port to tell the device to do something, or send another few bytes asking the device to send you something back. Higher level drivers exist which can do all of this low level communication for you and give you access to the devices via a web page or a service based architecture (more details in part 2).

Other sensors:
Once you have established access from your PC to the I2C bus, you can keep on adding sensors and actuators, up to about 122 devices in theory, and even more if you use several USB2I2C adaptors, or I2C bus splitters, but this is plenty already.

SD21 Servo Driver £21.99. This lets you control up to 21 servos, easily enough for a pan-tilt head, a couple of arms, a simple walker, or some other custom mechanisms that you may dream up.

If you are tight on budget and have chosen not to carry the PC brain around with you, you could even use a couple of continuous rotation servos (or hacked servos) as wheels.





PC
Beware, this is a fairly full PC that with added screen and speakers would make a fine home entertainment system. As the software will rely on XP, we have steered away from using compact flash as the hard disk. If you already have a CD drive lying around you could use that while installing the motherboard drivers and XP far enough to get network access, and use terminal services thereafter.

The exact part listing is not important. This list is for a mini-itx system, but an old laptop would be just as good. There are other variants with dual cores, pico-itx, or much lower power consumption – the choice is yours.



Motherboard / CPU: EPIA CN 13000G C7 Mini-ITX Board £109
Ram: 512MB PC4200 DDR2 533 DIMM £45
Hard Disk: 40GB Western Digital Scorpio 2.5" IDE 5400RPM Hard Drive - 8MB Cache £39
Slimline 24x CDROM Drive £25
Netgear 54Mpbs Wireless PCI Card £27
M2-ATX 160W Vehicle DC-DC Power Supply £59
Windows XP Pro £89



Power
This depends on the automomy you require. Obviously the more battery power you have, the longer it will be able to live without recharging, but that power will come at the cost of weight which will slow down your robot. You need 12V for the ATX, but you may also want 6V-7.2V for powering the servos, and 5V for some of the sensors. To avoid having another battery for the servos, we will use two 6V batteries in series, to produce a total of 12V, and we can take 6V from the middle for the servos. In the end, another two batteries and an extra 5V regulator was added to supply sufficient noise-free power to all the sensors.

Chassis
You can build the chassis out of just about anything, with wood and plastic being amoung the easiest. Basically all you need is a platform to put the pc parts on, with a sturdy frame on which to attach the wheels. Later on you may want to attach bumpers and a higher level for more sensors.

The chassis in the pictures was made out of aluminium profiles bought from a hardware store. It can be cut with a metal bladed hacksaw with a bit of patience and the sharp corners rounded off with a file. You will also need a small drill with some metal bits and a vice to hold things in place while sawing or drilling. Many designs are possible.

The pictures show the wheels in the middle which makes it a little easier to turn on the spot, but the castors at front and back could easily make it get stuck on a small edge of carpet. Many commercial designs sensibly use a circular frame and three wheels which is much less likely to get stuck on corners of furniture and can get over bumps without becoming grounded.




All pretty obvious stuff. The chassis and the wiring take a good deal of patience, so hopefully there will be commercially available cheap kits made by someone in the near future.

Is it finished?
No, not really. I need to make some much shorter USB cables to connect the web cam and the USBI2C. I'll be adding a second webcam for some stereo vision tests, and an arm or two to make use of all the spare SD21 channels. The servos go a bit jumpy while the PC starts, so I'll need to add a few capacitors or re-route power a bit. Also the plastic head is not pretty - I'll probably make a prettier metal head when the second cam arrives.

What software is it running?
XP with MSRS and Devantech Drivers

Is is autonomous?
No, not yet. It can be controlled wirelessly via a Joystick and web pages using MSRS and can report on all its sensors. Autonomy is planned: See: Grid SLAM Explorer

Can it actually do anything?
Ha! No, not really. It could push something around, I guess. It does telepresence and could warn me about a fire or intruder, or speak RSS feeds if I really wanted it to. For the moment though I'll be concentrating on mapping then give it an arm or two.

8 comments:

Anonymous said...

Way cool Chris! What are your thoughts on MSRS?

Chris Kilner said...

Hi Alex,

thoughts on MSRS... It can be used to do good things, but is much too hard for novice programmers. Until there is a really good ecosystem of services that can be dragged into action or coordinated by lovely GUIs, then it will miss out on a larger audience.

At its core it has enough powerful features and enough rigour for it to work well as a foundation, especially as multi-processor and network inteligence start to be tapped into. We 'just' need another million programmers devoting their lives to it :)

Anonymous said...

Thanks!

I tried to figure MSRS out about a year or so ago (had a release that Msoft hooked us up with before the official release) but I didn't have a lot of time to devote to it, and found that it required a great deal of time to learn. From what I understand about it, it sounds like it has an great deal of potential though. I'd love to learn more about it, it's just time that prevents me to do so...

I haven't talked to too many people that have had the opportunity to use MSRS since after the official release so, given your experience, I definitely was curious on your thoughts.

BTW, I checked out quite a few of your other posts, great job! I've already added it to MyYahoo page and told a few colleagues of mine about it. It's great to see people who not only understand the benefits behind true PC based robotics, but also know how to apply it:)

Unknown said...

Chris,

Nice work, I can't wait to see where the project goes from here. To help it along, ad to save you the soldering on your short USB cables, I wanted to pass on this little find...

http://www.national-tech.com/specs/10u2-02201bk.htm

Who new 1 foot USB cables would be so useful.

Keep it up and keep posting your results!

-David Smith
www.edgecentric.com/blog

Chris Kilner said...

Hi David,

nice cable and great price too until shipping to my remote european hill is factored in, alas.

I'm currently trying to tie up several paralel projects: devantech drivers update for 1.5 with pid, dead reckoning, multi-sonar pan etc. serializer generic i2c (so that all the devantech drivers work with the serializer), grid slam service (waiting for real data tests) etc. , but two 'real' bits of work have come in, so they may have to sit on the shelf for a while. I hate releasing half finished code, but then again code is always unfinished....

J-Phones sharing blog said...

Hello...
I would like to know more on how you power up the motherboard.
Can you tell me more?
Thanks.

Chris Kilner said...

Hi,

its pretty simple with the M2 power supply. You feed it 12V from the battery and route the motherboard's power on connector to a push switch. Then push the switch like a normal PC.

Hope this helps

J-Phones sharing blog said...

Thanks for explaining.
Since this is "Part 1", then there will be Part 2 right? Which to read Part 2 too.
You supply power to the robot using four motorcycle batteries through M2 power suply is it? Then the robot is going to be very heavy?
Thanks.