Automatic Control and Robotics

From Wikiversity
Jump to navigation Jump to search

How to Build Your Own Robot[edit | edit source]

How to build your own Nerd-Cam 2 degree of freedom robotic camera mount[edit | edit source]

Note: To run the camera once you have built it, read this. For a printer friendly version of this how-to, click here.

The Nerd-Cam 1.0.1

What you will need[edit | edit source]

  1. 12 Round head 2-56 3/8" machine screws + nuts.
  2. 14 Round head 2-56 1/2" machine screws + nuts.
  3. 8 Flat head 2-56 1/2" machine screws + nuts.
  4. 3 Flat head 2-56 1/2" machine screws + nuts.
  5. 8 Round Head 4-40 3/8" machine screws + nuts.
  6. 1/4" x 5/15" Tee nut, we used USS / 18891 from Crown Bolt, This can be purchased at Home Depot.
  7. Sliding screen door top roller (Model B-537 Prime-Line), I bought this at Home Depot.
  8. 2 STD TS-53, System 3000 servo motors from Tower Hobbies.
  9. A Camera, I recommend Unibrain Fire-i firewire camera (and a standard VIA chipset firewire card you can buy anywhere).
  10. A servo controller. We use a Mini-SSC II controller.
  11. Something to cut parts from, we use 1/4" Plexiglas for our camera.
  12. Parts diagram in Illustrator downloadable free from here, or as PDF from here. Additionally you can download the parts schematic from here. Additional PDF specs for pan and tilt with size info.
  13. Tools, we use a BLANK to cut the Plexiglas parts. For additional machining we use a Dremel tool.
  14. Safety glasses!

The first step is to machine the parts[edit | edit source]

If you use a BLANK you can cut them straight from our template. If you don't then you will have to be creative. Any rigid material will do, for the template to match up the parts must be only 1/4" thick.

You will need to drill pilot holes into the sides of the "side" parts[edit | edit source]

These will allow you to bond the "side" parts with the "bottom" and "holder" parts. The holes should be long enough so that you can insert 1/2" 2-56 screws. The bottom picture gives you an idea of what you are shooting for at this point.

Before you assemble the full holder assembly[edit | edit source]

As shown above you will also need to drill some counter sinks. This is so that the bottom base can lie flush on what ever you want to mount the camera on eventually. The picture below shows how the counter sink should look on the parts

For the "Pan bottom" you will need to insert a tee nut[edit | edit source]

This may require some chiseling since it's a very tight fit. The picture below shows how this should look. The Tee-Nut is so that you can mount the camera on a standard tri-pod camera mount.

Go ahead and assemble the bottom "pan" holder[edit | edit source]

Secure the top part with 2-56 1/2" round head screws ,but use flat head screws on the bottom so that the your camera mount will sit flush on what ever you mount it to. It should look like below.

Next insert a servo motor into the base[edit | edit source]

using the 4-40 screws as shown in the picture below

Next you will need to take the plus shaped top off the servo motor[edit | edit source]

Then connect it to the odd "tilt side" piece as shown below. Use the 3/8" 2-56 flat head screws. The left part is the same as the right part. It just shows what the part looks like before and after you mount the plus shape servo thingy. Note: be sure the screw that connects the plus shape thingy to the servo is on the plus shape thingy before you connect the plus shape thingy to the side part. Also, you will need to widen the holes on the plus shape thingy just a tad in order for the 2-56 screws to fit. I use a drill bit to do this.

Connect your new base to the piece you just completed as so[edit | edit source]

Next you will need to connect the "tilt bottom" to the sliding screen door roller[edit | edit source]

To do this align the rollers center of rotation with the center of rotation for the Plexiglas arm. This is about 8 mm back from the leading edge of the "tilt bottom" part. The first step is finding the center. Then you will have to decide where to drill three holes to connect this part to the "tilt bottom" part. This is the most difficult part and requires some solid measurements to make sure you center the piece correctly. You will also need to bevel an indentation as shown below so that swivel in the screen door roller has room to breath. Since this bevel will be hidden, it doesn't need to be pretty.

This picture above shows the three new holes and the beveled region[edit | edit source]

On the other side you will need to counter sink the three new holes as shown below

Not shown, you will need to counter sink the top two holes[edit | edit source]

Do this so that the screw you use will sit below the screen door roller. You will also need to cut slight notches into the screen door roller at the the points where it is fastened so that the screws hold tighter. The bottom picture shows the final result.

Next begin to assemble and connect the top to the bottom pieces as illustrated[edit | edit source]

Be sure that as you connect the pieces to the servos that you align the pieces. That is, move the servo all the way to one side then connect the arm at that position. This means that the servo should be in the top most position with the arm pointing upwards. If you do not calibrate at this point you most likely will have to take the robot camera apart and do it at some point.

You will need to connect the top servo to the "tilt arm"[edit | edit source]

Do this using the 2-56 3/8" screws.

Connect the tilt arm to the servo[edit | edit source]

The bottom picture shows the mounting finished without the camera added yet.



If you mount the unibrain firewire camera you will need to take it apart[edit | edit source]

I'm sure this voids the warranty so consider yourself warned. Mount the base part of the camera to the robot camera mount. Be careful, the unibrain camera contains surface mounted components that can easily come off. Be sure the camera is aligned when you mount it. The image below shows the finished camera.

The next step involves making the camera go[edit | edit source]

Connect the servos to the servo controller. Connect the servo controller to the computer. Power it up. Doesn't do anything? Relax, OK so now you have to make or get some software for your controller. For the Mini-SSC you can either download control

programs that work under windows from the manufacturer, or you can write a very simple program in C++ to send bytes to the serial port. The code below shows a simple method to move one of the servos on the Mini SSC II controller under Linux.

00121 bool moveRaw(const int servo, const byte rawpos)
00122 {
00123      // Command Buffer:
00124      // [0] is start character
00125      // [1] is which servo to move
00126      // [2] is position to move servo to (0 to MAX_POSITION)
00127      char command[3]; 
00128      command[0] = 255; 
00129      command[1] = servo; 
00130      command[2] = rawpos; 
00131      int fd = open("/dev/ttyS0",O_RDWR); // open serial port 0
00132      if(fd==-1) LFATAL("open failed");
00133      if(write(fd,command, 3)==-1){
00134           perror("open");
00135           LFATAL("write failed");
00136      }
00137      close(fd);
00138      return true;
00139 }
  • Note that here we input an integer from 0 - 256 for the int servo. This tells the servo what absolute position to move to. Notice that this is one limiting factor of using R/C servos, our precision is limited to 0.71 degrees if our camera is set to rotate by 180 degrees.
  • LFATAL can be anything you want the code to do if it fails. You might even omit this if you want it to silently fail (for some reason).
  • On many Linux machines writing to the serial port is only open to root. You may need to change the permissions on the serial port device if you have trouble writing to the serial port.

Nerd-Cam Notes[edit | edit source]

  • Camera accuracy can be influenced by the voltage applied to the servos. As such, if you give the servos more voltage the camera will move faster, but have an increased likelihood of overshoot the mark. If this seems to happen, a simple fix is to put in a resister to limit the voltage a little. You may need to experiment a little to find what works best. However, if you have access to an actual power supply with voltage adjustment, this is even more ideal.
  • Firewire cables tend to be rather rigid. While the Nerd-Cam can hold the weight of a firewire cable, care should be taken not to let it pull to hard on the camera.
  • Don't leave the camera powered all the time with the servos used here. They seem to wear out. In general the gears seem to wear down. A more expensive servo might fix this problem. However, if a servo does go bad it can be replaced within the housing.
  • If your camera is not perfectly calibrated, you can measure the amount of error in its movement and program corrections into your software. Thus, if it seems to be off by three degrees, you can set its movement back by three degrees to completely compensate.
  • To grab firewire images under Linux use the dc1394 library. For more info check

Connecting up the Camera[edit | edit source]

For the Mini-SSC controller, both serial and power can be carried over a single Ethernet CAT-5e cable. This is possible since CAT-5e has 8 wires inside. The current needed by the servos and Mini-SSC are low enough to make this option work. This also cuts down on costs considerably since a single CAT-5e cable is Dirt cheap.

Additionally, if you have several cameras, you can power them all from an old AT computer power supply. This provides both the 5 and 12 volts the Mini-SSC and servos need. It also provides way more power than one needs to run several cameras all at once. Additionally, if your Firewire cable does not carry power (Notebook PCMCIA Firewire usually does not) you can power the camera from the 12 volts. The use of the old AT power supply is helpful over the standard ATX power supply since you can manually switch it on. ATX requires a signal from either a motherboard or a power supply testing device to turn on. However, this is also an option if you can't find an AT power supply.

Manual Override Auto Switch Design[edit | edit source]

You can build a switch that allows you to override the computer servo inputs from a standard R/C car controller and then run the camera from the remote control manually. This is useful for any robot that is controlled by R/C servos. The design shown below allows such a switch to work. It was originally designed for a mobile robot, to allow for emergency manual override of the robot, but it can be adapted to be used with the Nerd-cam quite easily.

The servo switch designed by Daesu Chung works from an R/C car input. Note that the "Steering" and "Speed" servo connectors will connect to the Nerd-cam "Pan" and "Tilt" servos.

The override for the switch is provided by toggling the Transmission gearbox switch. On a normal R/C car, this causes it to change gears. Since we do not need this function, we use the transmission switch on the R/C controller to toggle the manual override. This switch has been tested and works well with a Traxxas EVX remote control and speed controller. However, there are probably cheaper R/C radio controllers that will also do the trick.

External Links[edit | edit source]

  1. Picture of the Nerd-Cam and Movies of it working
  2. Video on YouTube from the Nerd-Cam auto tracking
  3. Video on YouTube from the Nerd-Cam auto tracking
  4. How to build your own Mobile Robot
  5. Original Nerd-Cam How-to
  6. iLab, where the Nerd-Cam was developed at the University of Southern California