Quickster, the CD-bot

Submitted by Ro-Bot-X on January 27, 2008 - 6:44pm.

General.

I wanted a simple and easy to build platform, to test out mapping and object finding. The robot sould be able to look around for some type of objects, go pick them up and deliver them to specific points on the map. These delivery points have to be recognized by the robot and marked on the map. Eventualy this code will be ported to another robot.
The robot should be moderately easy to replicate and the parts should be available in most countries in the world.

 

Brainstorming.

One day I was emptying a plastic CD box at work and thought that it would make a nice robot. I took it home and started to take measurements to see how can I make a robot that would be able to do something similar with I-Create robot that Admin used for mapping. After some time I decided that I should write down how I want it to behave. Here is what I wrote:
 - the robot should fit inside a (empty) box of 25 blank CDs
 - one CD should be the chassis
 - the perf board should be custom cut to fit the available space
 - the robot should have 3 servos, 2 for driving and one for scanning
 - the wheels should have the circumference an even amount of cm for easier distance counting
 - the encoders should give at least 0.5 cm resolution
 - the battery pack should be of 7.2 V (6 x 1.2V) 2300 mAh NiMh that I have
 - the robot should use a BlueSmirf module to comunicate with my laptop (maybe for code uploading too)
 - the robot should use a I2C memory for map storage
 - the robot should have proximity sensors as short distance bumpers
 - after the mapping code is ready, the AVRcam should be installed on the robot
So I started making this robot by building the Chassis. You can see all of the parts here:

All Parts

 

Chassis.

I got some double sided tape (the one that looks a little spongy) and I cut 2 pieces at one servo lenght. I taped together the scanning servo to one of the driving servos and after that to the other driving servo, making sure the driving servos are horizontal and the scanning servo is vertical and all the axles are oriented in the same direction. I measured the total width of the 3 servos and marked a transparent CD (one of those transparent plastic CDs that you can find in the CD box at the bottom) and cut 2 equal sides off, to make room for the wheels. The result was a rectangle with 2 round edges and with a hole in the middle. I used that to mark the perfboard and cut it so it was a little longer than one half of the chassis CD. Then I cut out a small piece to have room for the vertical servo to get in. The result was something like a horse shue... (see the picture above) then I cut 3 pieces of double sided tape and taped the servos to the chassis CD in a way that the axles would be in the center axis of the CD. Using tie wraps I tied the servo leads in front of the robot so they don't get loose under the wheels.

 

Wheels.

Chosing the right diameter for the wheels was a pain. I looked around for plastic jar lids, bottle caps, anything that would be round and a 'nice size diameter". I finaly got 2 bottle caps, a little under 50 mm diameter. I added a piece of ruber from an bycicle inner tube and it had almost 51 mm in diameter. That made about 160 mm circumference. Divided by 32 I got 5 mm, so I made a round wheel encoder with 32 stripes that fit the inside of the bottle cap. To make the encoder disc I used a post script template and GhostScript program to print it out to the laser printer on a piece of photo paper. I found the template on the Seattle Robotics Society website.
Here is the script code I used for the 16 black and 16 white stripes:

%! Postscript program for printing encoder wheels
%
% On unix systems this can be viewed/printed with gv, amongst others
% For WinX a free ghostview is available

/inch {72 mul} def % 72 printer points == 1 inch

% Paper size, probably some predefined constant for this?
/width 8.5 inch def
/height 11.0 inch def
/margin 0.25 inch def % minimum edge separation top, bottom, left, right.

/radius 7 8 div inch def % radius of encoder wheel "7 8 div inch" means 7/8"

% these define how many encoder wedges appear on a wheel, to make all the
% wheels the identical, set min and max to the same value.
/min_wedge_count 16 def
/max_wedge_count 16 def

% helper variables
/num_shapes max_wedge_count min_wedge_count sub 1 add def
/offset_wedge_count min_wedge_count 1 sub def
/edge margin radius add def % minimum distance from encoder center to page edge

% define a pie-shaped path
/wedge {
  3 dict begin
  /radius exch def
  /start_angle exch def
  /finish_angle exch def
  newpath 0 0 moveto
  0 0 radius start_angle finish_angle arc
  closepath
  end
} def

% draw a circle of alternating black and white wedges
/wheel {
  gsave
  2 dict begin
  /radius exch def
  /segments exch def
  180 segments div
  0 1 segments dup add {
    1 index 0 radius wedge
    1 index rotate
    2 mod 0 eq {1} {0} ifelse
    setgray fill
  } for
  pop
  end
  grestore
} def

% take the modulo with a "one" origin eg: 2 5 1mod -> 2 ; 5 5 1mod -> 5 ; 6 5 1mod -> 1
/1mod {
  exch 1 sub exch
  mod
  1 add
} def

% draw a circular outline around the encoder wheel
/outline {
  1 dict begin
  /radius exch def
  0 0 radius 0 360 arc
  stroke
  end
} def

% draw a little dot in the center of the wheel to aid alignment
/centerdot {
  1 dict begin
  /radius exch def
  newpath
  0 0 1 0 360 arc
  fill
  end
} def

% draw an encoder wheel
/encoder {
  2 dict begin
  /radius exch def
  /segments exch def
  segments radius wheel
  radius outline
  radius centerdot
  end
} def


% Main loop
gsave
  /separation radius 3 mul def % distance between encoder wheel centers
  0 setlinewidth

  1 % count of which number wheel this is, starting from one:
  edge dup translate % move away from the lower-left corner of the page

  edge separation height edge sub { % loop upwards line by line
    pop
    gsave
    edge separation width edge sub { % loop across a line
      pop
      dup num_shapes 1mod offset_wedge_count add radius encoder
      1 add
      separation 0 translate
    } for
    grestore
    0 separation translate
  } for
  pop
grestore

showpage

 

Trying to screw the bottle caps to the big round servo horns I found out that the servo horn will go too much inside the bottle cap and I will not be able to install the wheel on the servo. So I cut 2 round pieces of 4 mm thick plywood and used them as washers between the bottle cap and the servo horn. After I screw them together, I cut a hole in the center of the encoder disc and superglued it to the inside of the wheel. You can see the wheels here:

Partly done

 

Caster.

At first I wanted to use one of the kitchen cabinets door buttons but I found out that it is too tall. So, I looked around to find a small ball with a hole in it. I found my whife's beads box and got a nice 12 mm diameter bead. I drilled 4 small holes and using a paper clip, I attached the bead to one of the round ends of the chassis CD. I had to cut a piece out to make the bead go through the CD a little, to have it at the right height.

 

Batteries box.

In the back of the chassis, right over the caster bead I installed the batteries box using a piece of velcro. This way I can remove it to charge the batteries. Hopefully I will build a charger station to charge them on the robot.

 

Boddy.

I cut 2 semi circles out of the round transparent CD box case to make room for the wheels. Then I drilled holes for the standoffs in the CD box case and in the chassis CD, just behind the servos, near the batteries box. After making the electronics board, I drilled a few more holes in the case, to make room for the IR sensors and IR LEDs. I drilled a hole for the ON/OFF switch and installed it on the top of the case.

 

Electronics board.

This is the longest step. I took me several days to complete. Here is the schematic and a PCB that I draw just to see if it can be done similar to the perf board that I used. What you see on the schematic is the second version of the robot, with a slave motor controller. In order to free up some memory space on the ATmega168 I decided to use a ATtiny26 that I had around to drive the servos and check the encoders. The two microcontrollers are connected through the I2C interface. The ATtiny is not yet installed on the perf board. The socket that you will see on the perf board was for an onboard MAX232 that I ended up not using since I have a small interfaceboard.

Schematic

 

PCB

 

I cut the perf board round to match the CD roundness in the front. In the back I cut out a piece where the scanning servo will be monted. Then I started to add components. The first thing I did was to install the 4 QRD1114 photoreflective sensors for the wheel encoders. I had to fiddle a little with the position to be close enough to the encoder disc (somewhere in between 5 and 10 mm). Then I started to solder the parts on the perf board, the IC sockets first, then the resistors, capacitors, pin headers, jumper wires, LEDs and IR proximity sensors, the crystal, the 5 pin sockets... Then I started to make connections using solder, between the pads on the perfboard for the close parts that needed to be connected together. Then I started to make the power and ground bus using solid insulated wire, a little thicker than the wirewrap wire. After that, I started to make longer connections between parts, using wirewrap wire. At the end, I wished that I had made a home made PCB... You can see the electronics board here:

Electronics top

 

Electonics front 

 

Electronics bottom 

 

Assembling the robot.

After all this hard work I started to put it all together. First I mounted the Electronics board just under the Scanning Servo mounting holes and used 2 M3 screws to hold it in place. Then I mounted the wheels (no screws yet) and then I plugged all the wires into the electronics board. Then I mounted the top case holding it in place with 2 short standoffs (they will be used latter for AVRcam add-on). Then I made a quick Lego Mount for the Sharp IR sensor and screwed it on top of the Scanning servo small round servo horn. All done! Here it is:

All together 

 

Programmer.

For the ease of programming I have decided that I will use the Arduino environment. So I have built the DAPA programmer using instructions from the Arduino website. I have attached it to the board and to the laptop and tryed to upload the bootloader without much success. Looking around I found the folder where the bootloaders are located and used the command line to uploade it. I think i managed to do it, because the status LED was flickering at startup. However I could not upload any sketch from Arduino environment. After some digging, I found that I could use my STK200/300 programmer with the command line loader. So I have compiled the simplest "Blinking LED" sketch and uploaded it. It worked! But that was without the bootloader, so I was back at fiddling with the bootloader. Bootloader uploaded fine but no sketch would upload using the bootloader. I wanted the bootloader to work so I can use Bluetooth to upload sketches. But in the end I gave up on it. I takes a lot of program space so there is little room left for the mapping stuff. Oh well, can't have it all right now...

 

Code.

Here comes the hard part. Well, at least for me. I am used to Basic, so Arduino is a lean transition to C language. I have made the first test sketches to see if the encoders work. But something happened when I tryed to upload them, my Mega8 did not work anymore... I hope I can get anoter one soon, hopefully a Mega168. Maybe this one will work with the bootloader...

 

(work in progress...)

AttachmentSize
TTStest.zip15.65 KB
( categories: )