Wednesday, January 26, 2011

Don't Cross The Streams!

Dr. Egon Spengler: There's something very important I forgot to tell you. 
Dr. Peter Venkman: What? 
Dr. Egon Spengler: Don't cross the streams. 
Dr. Peter Venkman: Why? 
Dr. Egon Spengler: It would be bad. 
Dr. Peter Venkman: I'm fuzzy on the whole good/bad thing. What do you mean, "bad"? 
Dr. Egon Spengler: Try to imagine all life as you know it stopping instantaneously and every molecule in your body exploding at the speed of light. 
Dr Ray Stantz: Total protonic reversal. 
Dr. Peter Venkman: Right. That's bad. Okay. All right. Important safety tip. Thanks, Egon. 


My system is composed of a laptop computer (a MacBook Pro that belongs to my employer and I use to make a living), an Arduino microcontroller and a HobbyCNC EZ Driver stepper driver. The stepper driver has a 32V power supply and can push 10A before blowing a fuse. The Arduino is powered by the laptop. Since the Arduino sends signals to the driver, there has to be a connection between them, meaning there is is a connection between my laptop and that 32V, 10A power supply. I've already tested the driver with an old desktop PC so I know I put it together right, but there is probably still some opportunity for me to make a mistake. I can't afford that.

I said there needs to be a "path" from the laptop to the stepper driver. That's usually a wire carrying electricity. There is another way. Imagine 2 ships in the night communicating by flashing lights at each other, Morse code or whatever. This is the basis for an opto-isolator, usually an LED and a light sensor in a light-tight box. Properly designed, such a circuit keeps the two sides electrically separated. It would take a lightening bolt to jump across such a barrier. A good surge protector could add even more protection.

I tried to find an existing product I could just plug in. What I found was either too expensive or possibly too slow. Or I couldn't find a way to buy it. I really wanted to buy a couple of these. The RepRap folks seemed to have figured everything out. Except it didn't seem to be for sale. I found an affordable one but it didn't used the same chips as the RepRap design and from what I could find, the affordable one seemed like it would not be fast enough. The RepRap design calls for a chip with 10Mb throughput which according to my calculations... well I don't know how to figure out if it's fast enough, but I trust the RepRap guys.

So I downloaded the schematic and bought the components. The top picture is a test setup, just blinking some LEDs. I spent quite a bit of time studying and researching everything. I tore down the prototype and rebuilt it so many times I can do it from memory now.

Here's my test setup connected to the stepper driver:



I've got a potentiometer at the bottom that I turn to adjust the speed. I cobbled together a program that uses the Timer1 component of the Arduino to trigger interrupts that step the motor. I made several mistakes both in wiring and coding but finally got it working. I found the shortest time between steps to be 300 microseconds. I'm half-stepping the motors so with my 1/4-20 lead screw that works out to 22 inches per minute of feed. I think that's pretty fast. Much faster than I'll be cutting at. My rapid movements might not be more than 15ipm.

The opto-isolator subproject isn't really something I accounted for in the beginning. It's going to amount to quite a bit more work than I'd like to do, but I'm really learning a lot and I think it's going to be quite satisfying in the end.

No comments:

Post a Comment