Sunday, February 28, 2010

Mill: new bed, new spindle, new problems...

I did end up getting an aluminium plate to increase hight consistency and a spindle to eliminate runout. Here's a picture of both installed:



They did their job. Hight is much more consistent now and runout is nonexistent. Also, the new spindle is sooooo quiet! Here is a closeup of a 39mm by 17mm circuit outline done with this setup.



As you can see, the bit consistently took the copper off without leaving burrs and the bit never went deep enough to dig into the glass fiber / epoxy, which dulls the bit. Another reason why you don't want to dig past the copper layer is because the bits for this kind of work are V shaped and would make the traces thinner the deeper they went. Also, when you dig in it just looks ugly. Anyways, I thought all my problems were solved... but it turns out I just got lucky. I have now identified a lot more problems.

First, let me explain my experiment setup. In order to waste as little material as possible I wanted to try something a lot smaller than I have tried in the past. I settled on an opto end-stop that I use on my mill and printer (thanks Zack). I can now say that choosing this board was brave. The traces are 16mil (0.4064mm) and the pads are 10mil (0.254mm) from each hole's edge to the edge of the pad. Still, this board should be obtainable and prove I will have no issues with SMT moving forward.




I attempted this board five times, using different settings. Six problems consistently surfaced, of which I will describe below.

1) PCB Thickness Tolerance


Problem:

I am still experiencing depth issues! I was under the impression that blank PCBs had a consistent thickness. I was wrong. The board I am working with varies in thickness from 1.49mm to 1.52mm randomly. This is enough to make the bit dig in, in some areas.

Solution:

Poul-Henning Kamp, a FreeBSD developer who dabbles in milling PCBs has considered this problem and has a solution. His solution entails grounding the board, turning off the spindle, and probing the board with the milling bit in a 4mm X 4mm grid. He then parses new Z values into the GCode based on this hight information. His unique solution cannot be directly used by me, but the concept could be applied.

I estimate it would take me 20 hours to write and test software / firmware to automate this task.

2) Bad Motor Coupling


Problem:

Refer to the following image.



What you are looking at is a diagonal trace, enhanced and sharpened. As you can see, every 1.41mm the Y axis seems to slow and then speed up, resulting in a wave type effect. Inconsistencies like this can be really bad if they are in certain places of the design. They could result in an incomplete circuit, or a circuit that will fail. The cause is a bad motor coupling that is causing the motor to wobble, storing up energy and then releasing it once per revolution. The motor also looks a little off axis, or it could be that the drive-shaft is slightly bent.

Solution:

I need to redesign the part and print a new one. I also need to make sure the motor is being held in the right position and that the shaft is straight.

It may take me a few prints to get the coupling right, so I will estimate it taking me 3 hours not counting printing time.

3) Not Round




Problem:

These pads are suppose to be perfectly round and they're not. I double-checked the gcode through NCPlot and the code looks fine.

Solution: ??

I'm not sure on this one. Either this will be fixed when I fix the Y axis or there is something else at play.

4) Incomplete / Grounded Pad




Problem:

Two of the pads have a little bridge connecting them to the rest of the copper. Again, I checked the gcode and this should not have happened. What's odd is it's the same two pads on all five goes. If this was the aforementioned Y axis issue then I should have seen some randomness.

Solution: ??

Again, not sure. I think it may have to do with play from starting and stopping quickly in a small area. I am planning on running a few tests to eliminate possibilities.

5) Drifting Hole




Problem:

When drilling after milling I'm finding that the holes work their way to a milled groove.

Solution:

Pcb-gcode has a feature to tap the holes with the milling bit after milling. I think that will eliminate this issue.

6) Inconsistent Traces




Problem:

As you can see, the trace on the left is thinner than the trace on the right. This should not be because they are both 16mil traces. Again, I double-checked the gcode.

Solution: ??

I'm crossing my fingers that this is the Y axis again. I will just have to see.


So... it looks like it will take me +25 hours to solve these problems. I mention this because I want to make it clear that if you are planning on milling PCBs then plan on spending a lot of time getting it to work. Granted, some of these problems would not be faced if I had just bought a mill, but there are still a lot of things to get right.

Friday, February 26, 2010

Spiderwheels: Golden Ratio...

Lately, in the back of my mind, I have felt that there was something visually wrong with my spider. Finally, the reason for wrongness clicked. I didn't incorporate the golden ratio. I've heard about this ratio from several sources lately. The most in depth source I remember was from NOVA: Secrets of the Parthenon. You may be able to still catch it on hulu. Wikipedia also has a pretty good overview of the golden ratio. My understanding is that this ratio has been known for a really long time and can be thought of as the mathematical equivalent for beauty and is around 1 / 1.6. Here is the golden ratio found in the Vitruvian Man:



As you can see, from navel to foot is 1.6 times the distance from navel to head. There are an enormous amount of other examples found in nature and architecture, but I will leave that for Wikipedia. I decided to apply this ratio to my spider in two ways. First, I decided to make the tibia 1.6 times the length of the femur, as shown.



Second, I decided to make the circuit board 1.6 times longer than it is wide. To tie it together I made the width of the board the same length as the tibia. Here are some renders of before and afters. I am in the process of printing the new parts.







For me, incorporating the golden ratio into the design makes it pop. I am interested in how others feel, as well as in whether the golden ratio has influenced robotics design before.

Sunday, February 21, 2010

Spiderwheels: first steps...

I am a perfectionist, which is not always a good thing. I have had the hardware needed to make my long anticipated spider for months. However, I was focused on doing it right the first time. I was focused on designing a pcb and making it on my mill. I finished designing the board weeks ago, but my mill is still not ready.



I decided a simpler proof of concept was well overdue. This weekend I buckled down and drank a lot of Red Bull. I finished printing the parts I needed for the legs, I cut and stripped the wires, and I hooked my sanguino up to a breadboard.



Connecting all 18 servos alone took hours.



Snapping the legs together took longer than expected, too.



But the finished product, though only a proof of concept, gave me chills. I have been awaiting it's completion for many months.



Extending the firmware to support all six legs, as well as writing the walk sequence took several hours. Every time I dig this deep into c++ I end up having to re-conceptualize pointers. The sequence could still use some tweaking, and some of the parts could be more exact, but it moves!!



I am still excited to see the more robust solution I envisioned, but I am still months away from that. In the mean time, since I have STL files from the printed parts, it wasn't much trouble to render an animation of what it should look like after the prototype phase.

Sunday, February 14, 2010

Spiderwheels: the third dimension and circles...

If you've been following this blog you'll know that I did most of the math needed for spider movement several months ago. However, to keep it simple I left out a dimension. Where once I only considered D and H I now need to consider x, y, and z.






This weekend I pulled the equations back out in order to add the third dimension. Thankfully the previous equations could remain unchanged with the realization that:

D = sqrt(x2 + y2).
H = z.

Thus, I could still use these equations:

a1 = 180� - tan-1(D / H) - cos-1( (L12 - L22 + D2 + H2) / (2 * L1 * sqrt(D2 + H2)) ).

a2 = cos-1( (L12 + L22 - D2 - H2) / (2 * L1 * L2) ).

The third and final piece of this puzzle is an equation for the angle a5. Simple trigonometry gives us:

a5 = tan-1(x / y).

I've also been working on building out custom servo / leg libraries for my arduino. In order to prove that the equations for a1, a2, a5 work together fluidly and that my libraries are coming along I ran this expression:


void loop(){ 
  // circle
  for(float i = 0; i<360; i = i +0.9){
    goTo((70+(24*cos((i/180)*PI))), (0+(24*sin((i/180)*PI))), 30);
  }
}
void goTo(float x, float y, float z){
  int i;
  for(i=leg1.findNeededPulses(x, y, z); i>0; i--){
    leg1.pulseToPosition(x, y, z, i);
    delay(10);
  }
}

It simply draws a circle of radius 24mm at a height of 30mm. Here is a video of it in action:

Saturday, January 2, 2010

Mill: milling PCBs with a Rockcliff CNC...

My vision for the direction of my research requires me to be able to rapidly prototype PCBs. I started working towards this goal way back in March of 2009 when I attempted milling on a darwin. This is why I am building a mill. Through trial and error and a lot of reading I am realizing just how precise my manufacturing techniques need to be. I am also hitting a lot of obstacles.

I found that bolting down the circuit board on my grooved bed causes the corners to be further from the milling head than the middle of the board by 0.1mm. It is absolutely essential that the board is perfectly flat. Otherwise the V shaped bit will mill away more than it should in the highest areas of the board, making the traces too thin. I stumbled upon http://millpcbs.com this week which promotes a very elegant solution to this problem. They suggest mounting an aluminum plate to a leveled bed and then gluing the copper board to the aluminum plate with super glue. I didn't have a piece of aluminum plate, but I did have some aluminum exit foil sheets from think tinker. First, I scored and drilled the board.



Then I mounted the aluminum sheets and glued the board down. I used reference pins to make sure the alignment was correct.



I then milled the traces using a 60 degree bit from think tinker and the pcbgcode extension of Eagle.



I learned two things from this experiment. I learned that I should buy a precision 3mm bit because my reference holes were off by 0.5mm on one side. I also learned that I need an aluminum plate because two sheets of aluminum exit foil still bubbles up and gives an inconsistent bed. I will order it right away.

I am also considering purchasing a 3Speed Spindle from http://www.cnconabudget.com/. If you pay close attention to the traces on the above image you will notice copper burrs caused by runout from my dremel. Using a more precise spindle should get rid of the burrs and allow for a higher resolution.

One final obstacle has been occupying the back of my mind for several weeks. Once I get the drills and traces PERFECT and reproducible the final obstacle is hole plating. The above board is a redesign of Zack's Sanguino for my spider robot. I chose to use all through-hole components on a double sided board. This means that hole plating is essential. I've only been able to find one through-hole at home experiment without much documentation. I am weary of trying it. Another option I am considering was suggested on the millpcps forum. Their suggestion is to simply use SMT wherever possible and strategically place vias to keep them accessible for soldering in a thin piece of wire. Why solve a problem when you can step around it? Haha. I don't know what I am going to do yet. I may try both. I may stumble on another solution. More to come...

Tuesday, December 29, 2009

Mill: servo switch relay...

I've been using my mill quite a bit in an attempt to make a circuit board. I've finally gotten annoyed with having to turn my dremel on and off manually and decided it was time to upgrade to automation. The first step was to come up with a simple way to control a high powered device through my arduino. I thought about using a relay board. However, I went with something I thought would be a lot more fun to assemble.



All the household switch parts cost about $4. The servo was just one I had lying around. I'm sure a $12 servo would do the trick.

Next, I did a little research on G-Code, knowing the commands were already standardized. It turns out M03 is the standard command for "Turn Clockwise" and M05 is the standard for "Stop Turning". I updated my firmware and added a servo library. Here it is installed:



I am happy with the result. I did a quick search on thingiverse to see if others have done this and found a much more elegant solution: Servo Controlled Switch by oomlout

Saturday, December 19, 2009

Spiderwheels: eyes...

I have been putting a lot of thought into how to make the head of my spider and finally settled on a simple proximity sensor from SparkFun with two degrees of freedom. It is always good to start with a proof of concept and so I wired it up to my breadboard sanguino. I basically made it pan until it finds an obstacle and then nod. Here is a video:



Here is the source code:

#include <Servo.h> 
Servo zServo; //rotates about z
Servo xServo; //rotates about x

float zPos = 90; //keeps track of position. 90 degrees is resting.
float xPos = 90; //keeps track of position. 90 degrees is resting.

int milisecondsBetween = 20; 
int vMax = 300;

int sensorPin = 0;    // select the input pin for the potentiometer
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup() {
  zServo.attach(13);  // attaches zServo object to pin 13 
  xServo.attach(12);  // attaches xServo object to pin 12 
  Serial.begin(19200);
}
void loop() {
  goLeft();
  goRight();
}
void goLeft(){
  float z = zPos;
  sensorValue = analogRead(sensorPin); 
  while(sensorValue < vMax && z > 50){
    z -= 10;
    moveTo(xPos, z);
    sensorValue = analogRead(sensorPin); 
  }
  if(sensorValue >= vMax){
    sayHi();
    printV(sensorValue);
  }
}
void goRight(){
  float z = zPos;
  sensorValue = analogRead(sensorPin); 
  while(sensorValue < vMax && z < 130){
    z += 10;
    moveTo(xPos, z);
    sensorValue = analogRead(sensorPin); 
  }
  if(sensorValue >= vMax){
    sayHi();
    printV(sensorValue);
  }
}
void printV(int v){
  Serial.print("v: ");
  Serial.print(v);   
  Serial.print("\r\n");  
}
void sayHi(){
  moveTo(90, zPos);
  moveTo(110, zPos);
  moveTo(90, zPos);
}
void moveTo(float x, float z){
  while(xPos != x|| zPos != z){
    if(xPos > x){
      xPos -= 1;
    }
    else if(xPos < x){
      xPos += 1;
    }
    if(zPos > z){

      zPos -= 1;
    }
    else if(zPos < z){
      zPos += 1;
    }
    zServo.write(zPos);
    xServo.write(xPos);
    delay(milisecondsBetween);
  }
}