auto leveling laser cross

Upload: miguel-torres

Post on 11-Oct-2015

45 views

Category:

Documents


0 download

TRANSCRIPT

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    Food Living Outside Play Technology Workshop

    Auto Leveling Laser Crossby msuzuki777 on December 7, 2011

    Table of Contents

    Auto Leveling Laser Cross . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    Intro: Auto Leveling Laser Cross . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    Step 1: Parts Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    Step 2: Laser Safety and Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    Step 3: Tripod mount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    Step 4: Accelerometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    Step 5: Top plate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    Step 6: Attaching the Laser Cross Diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    Step 7: Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    Step 8: Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    Step 9: Arduino Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    Step 10: Software Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    Step 11: Using AutoLevel Fixture & Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    Author:msuzuki777Lazy Old Geek

    Intro: Auto Leveling Laser CrossSo this Lazy Old Geek purchased a Laser Cross. I created a manual leveling Laser Cross to use for aligning stuff on my drill press:http://www.instructables.com/id/ManualLevelingLaserCross/

    Well, being a Geek I decided to make an automated platform that adjusts automatically with an Arduino.Well, the picture may look a little scary but Ill break it down into little bitty parts.

    Image Notes1. Laser Diode Cross2. Laser current source. The LM317 had a big hole in the heat sink so I added another bolt and nut to hang the module on. Be careful as there is voltage on this.3. Arduino4. 6 AA battery box

    Step 1: Parts ListsParts List Laser Assembly650nm

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    1 Dip switch 4 position piano $0.34@ TaydaElectronics.com1 FreeScale MMA7361 Module inclinometer accelerometer. I got my in an ebay auction for $9 but theyre available for $10-$14 from ebay.PCB I used another hunk of the following:5* Breadboard Bread Board Prototype 432 Points 5*7cm$1.39 ebay.comTotally cost is less than $30, most for Arduino-clone and battery box.I am not going to go into the details of making the Laser drive current source as it is explained in the above website.

    The HLM1230 is designed for 25mA or less. This is how I determined the 47 Ohm resistor value. (See picture) I added a 2.1mm power plug from my scrap pile.

    Image Notes1. My laser current source2. Added a 2.1mm connector

    Image Notes1. MMA7361 Accelerometer module2. X,Y,Z indicator

    Image Notes1. M35SP9 stepper motor with PCB and gear.

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    Image Notes1. 7/16 " vinyl tubing

    Image Notes1. Hot shoe bubble level

    Step 2: Laser Safety and Information***********************WARNING**********************************Any laser you buy will have a DANGER stick similar to this one. The particular laser that I am using is 5mW. The typical laser pointer is 1mW. Now Im haventresearched laser safety that much but as I understand it, even a 1mW can damage the eye if looked at directly. This one is five times more wattage so use carefully. Donot aim it at a person or animal.***********************WARNING**********************************

    Some readers may wonder how the cross is generated. Search Ebay.com for this: 650nm

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    The upper right and lower left corners are the stepper motor corners. (Lower left is not used) They are 4.25 from the pivot corner. For these, you also want to mark thelocations for the mounting hardware. I found the specifications for the M35SP9 stepper motors. The mounting holes are 42mm apart or 21mm from the center.

    I used 10-32 hardware for the standoffs. So drill a 3/16 hole for the pivot. I used 6-32 hardware to mount the stepper motors so I drilled 9/64 holes for the motors. I left the gears on my stepper motors so I drilled 5/8 holes using a spade bit for the gears and tubing to pass through.

    Pivot point: The only long 10-32 bolt I had was 2 7/8 so I put a nut on it, screwed it through the pivot hole and put a nut on top. I put two nuts on the bolt screwed themdown about 1/2 for the pivot point and tightened them together.Near the motor locations, I also drilled a couple of big holes for the wires to pass through. The motors will be mounted underneath but the wiring will go to my customArduino on top of the base.

    Steppers: I installed the steppers with 6-32 hardware. I cut two short pieces of 7/16 vinyl tubing and stuck it over the gears. Then I stuck two 10-32 x 2 stove bolts intothe tubing. If everything goes right, the three bolts will line up with the top assembly.

    Image Notes1. Tripod base plate

    Image Notes1. Center hole2. Pivot point3. Adjustable point4. Adjustable point

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    Image Notes1. Nut ready to be pulled into the plastic.

    Image Notes1. Nut pulled into the plastic2. These are left from another project. Ignore them. Image Notes

    1. Pivot point2. Holes for stepper motor3. Holes for stepper motor

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    Image Notes1. Stepper motor attached

    Image Notes1. Wires from the stepper motor.2. Vinyl tubing over the gear and a 10-32 bolt stuck into the tubing.3. Double nut to locate the bottom of the pivot point.

    Step 4: AccelerometerTheory: So you may ask what is an accelerometer? I asked that myself. Here is the Wikipedia definition: An accelerometer is a device that measures properacceleration. So this doesnt help very much. You have to go back to your old high school physics class and remember that gravity is also acceleration, so theseaccelerometers will actually measure tilt due to gravity.I did some research on accelerometers. Their sensitivities are measured in Gs (Gravity). To put it simply if its lying flat, that is 0G (for the X and Y) and it its turned 90degrees then it is 1.0G. It can go higher than 1.0G if it is in motion.Accelerometers have two or three axis, X,Y and Z. This is like mathematical graphing. I like to think of it as East-West, North-South and Up-Down.

    MMA7361: I selected the MMA7361 accelerometer module for the following reasons:Highest sensitivity is +/- 1.5G. this translates into a theoretical resolution of 0.5 degrees.Low price ~$11 for a moduleAnalog output. While many accelerometers have digital outputs, for me analog is easier to work with.The X,Y and Z orientation is marked on the PCB. (see picture)Technobabble: The MMA7361 IC has analog outputs. The zero output is about 1.65V and the output is 800mV/G. With Arduino Aref set to 3V, that means we cantheoretically measure about 1/3 of a degree of movement.This MMA7361 IC is a 3.3V device but the module has a 5V to 3.3V regulator on it. My schematic says its a RT9161 but I looked carefully at my module. The regulatoris a 1117/3.3. These are typically rated at 800mA and the MMA7361 IC requires about 500mA. I am going to use this 3.3V source to power my Arduino AREF pin whichwill add about 0.1mA to the regulator. Not a problem.

    The MMA7361 module has 0.1 header pins on the sides (See picture). So for the accelerometer mount, I used another hunk of the prototype board and added twofemale headers 0.9 apart. Now as I recall the header pins are greater than 0.9 apart but thats okay as it just holds the module a little tighter. (See picture) (Inhindsight, I probably should have used 1.0 spacing but 0.9 worked fine)On the other side, I connected GS(elect) to GND so that sensitivity is fixed at +/- 1.5G. I put a 10k resistor from SL(eep) to 3.3V (not to 5V). Then I connected 30AWG wire wrap wire to 5V(Input power), Gnd 3.3V(Output to Arduino) and X and Y (Analog outputs, Z is not used. Z would be useful if it wasdropping or rising, like in an elevator or rocket).I also drilled two bolt holes to mount the protoboard.

    Image Notes1. MMA7361 Accelerometer module2. X,Y,Z indicator

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    Image Notes1. Male header pins

    Image Notes1. Female header pins. The accelerometer attaches to these.2. Female header pins. The accelerometer attaches to these.

    Image Notes1. Top side of adapter board2. Added jumpers and resistors3. Wires come out the other side

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    Image Notes1. MMA7361 module installed on the protoboard.2. Wires going to Arduino

    Image Notes1. This is the accelerometer module.2. These represent the two stepper motors.3. Connector for USB adapter.4. Laser diode power.

    Step 5: Top plateI cut another piece of the cutting board 5.25 x 5.I marked the same 4.25 square, centered on this top plate.I drilled a 3/16 hole for the pivot corner and 3/8 holes for the adjustable corners. Using the same technique, I pulled 10-32 nuts into the adjustable corners. (See picture)My CD mechanism has three mounting holes with rubber gaskets for cushioning. I positioned it so that the CD would be centered on the top and drill three holes for mounting.Next I had to make a cutout for the accelerometer mounting board. With the CD assemble attached, I positioned the board near the pivot point. The way I have theaccelerometer oriented, East-West is X and North-South is Y. Z is not used but would be up-down.

    Theory: I was thinking it would've been better to mount the accelerometer in the opposite corner from the pivot point. Bu I guess, theoretically, it shouldnt matter wherethe accelerometer is mounted on the top plate. Its probably good to align the accelerometer square with the three corners.

    I marked and drilled the mounting holes and cut a hole about 1 1/8 x 3/4 for the female headers to clear. Yes, it's ugly.Then I attached the CD mechanism, the adapter board and the accelerometer module. The accelerometer attaches to the bottom of the adapter board so CDs will movefreely on top. The accelerometer doesn't care if it is upside down or not.

    Image Notes1. Pivot hole2. 10-32 nut pulled into plastic

    Image Notes1. Accelerometer adapter board

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    3. CD assembly mounting hole.4. CD assembly mounting hole.5. CD assembly mounting hole.6. Accelerometer adapter board mounting holes and opening

    Image Notes1. CD assembly attached Image Notes1. Under side of accelerometer adapter board

    Image Notes1. Accelerometer board attached

    Step 6: Attaching the Laser Cross DiodeI used an old regular CD and a mini-CD.

    Ok, here is my funky laser mount. (See picture) I took a strip of aluminum from an aluminum For Sale sign and bent it around my laser housing in a kind of P shape.I drilled a 9/64 hole in the bracket so that when a 6-32 screw and nut are used it will clamp down on the laser housing. I drilled a 9/64 hole in the mini-CD so that thelaser will be about through the middle of the CD. I also used a rotary tool (Dremel clone) to open up the mounting hole. Then using a short flat head screw through thebottom of the mini-CD, I attached the laser.Since the screw sticks out, I drilled a corresponding bigger hole in the regular CD to accommodate the head of the screw. For now, I just used some double sticky tape tojoin the two CDs together. Now the whole assembly can snap onto the CD mechanism on top of the two CD cases.

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    Image Notes1. Mini-CD2. Regular CD3. 'P' Adapter for laser diode assembly

    Step 7: ArduinoDesign: The Arduino reads the X and Y voltages from the accelerometer. If they arent zero then it sends signals to the East-West and North-South steppers motors.The motors turn the screws that position the top platform. So when the platform is level, the accelerometer will read zero and the steppers will stop. When it is level, it willalso apply power to the laser diode.I also added a couple of switches. As the assembly is shuffled around it may loose calibration so a switch will put it into calibration mode.The stepper motors require more current then the Arduino can supply so I used a ULN2003 Darlington driver. Each motor requires four drivers. The ULN2003 only hasseven circuits. So I added a BS170-FET for the eighth circuit. The other BS170 is for sending power to laser.

    Power: The laser drive circuit is constant current so voltage is not critical but it is suggested it be over 7Vdc. For convenience I wanted portable power so I used six AArechargeable batteries in the AdaFruit holder. With fully charged NiMh batteries, it puts out about 8.4Vdc. This supplies the laser and the stepper motors directly. I put a5Vdc regulator on the PCB for the Arduino.

    Assembly: The Arduino is the basic Arduino with reset as I have in my L.O.G. $10 Arduino. It is positioned on the board so that there is room for the ULN2003. I am notgoing to go into a point-to-point assembly as I am Lazy. I did include a schematic and pictures of the top and bottom.

    Clarifications: Mitsumi M35SP9 stepper motors. I am using Eagle schematic software. I couldnt find anything close to a stepper motor so I used a center tappedtransformer instead. The pins arent numbered on the Motor PCB so I made up the numbers according to the picture. These correspond to the schematic numbers.These motors had a connector with wires on them (one yellow and one black) so I just wired these directly to my Arduino PCB.I soldered some white wire wrap wires to the MMA7361 adapter board, 5Vin, 3.3Vout, Gnd, Xout and Yout. The other ends went to my Arduino PCB.I had a 2.1mm jack that I wired to my Arduino PCB. The jack plugs into the laser drive.I only connected two of the four piano-type switches.What I called the RS232 connector connects to a USB-BUB or my USB adapter:http://www.instructables.com/id/Arduino-USB/

    I also drilled thee holes in the base plate to attach the Arduino PCB. I actually drilled the holes too close to the edge of the PCB so they broke off. But I had enough to putnuts on the bolts. Since my drilling accuracy is bad, I just forced the bolts into the base plate and didn't bother to put nuts on the other side.

    Image Notes1. RS-232 connector for USB adapter2. RS-232 connector for USB adapter3. ULN2003 IC4. Reset button5. 5 Volt regulator

    Image Notes1. This is just a wire for strain relief of stepper motor wires

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    6. BS170 FET for stepper motor7. BS170 FET for stepper motor8. BS170 FET for laser power9. Piano switch. Far left is autocailbrate. Far right is calibrate.10. Piano switch. Far left is autocailbrate. Far right is calibrate.11. Wires to accelerometer adapter.12. Wires to accelerometer adapter.13. 2.1mm power connector14. Wires to laser power plug15. Wires to stepper motors.

    Image Notes1. This is the accelerometer module.2. These represent the two stepper motors.3. Connector for USB adapter.4. Laser diode power.

    Image Notes1. This is the way I numbered the stepper motor for the schematic.2. This is the way I numbered the stepper motor for the schematic.3. This is the way I numbered the stepper motor for the schematic.4. This is the way I numbered the stepper motor for the schematic.

    Step 8: AssemblyThe bottom plate should have the pivot screw and two adjuster screws attached to the stepper motors sticking up.Attach the Arduino to the base. The wires from the stepper motors should already be connected.So should the five wires from the acclelerometer adapter.Slip the top plate over the pivot hole and manually turn the stepper screws into the top plate until it is about level.Place a 10-32 nut on the pivot bolt. Do not tighten as this is where it pivots.Put the laser assembly onto the CD mechanism.Plug the power plug from the Arduino into the laser current drive.Put the hot shoe level onto the CD.Attach the fixture to a tripod.Place the AA adapter on to the bottom plate.Plug it into the Arduino.

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    Image Notes1. A loose nut on top of the pivot bolt2. Hot shoe bubble level3. 6 xAA battery holder.

    Image Notes1. 2.1mm power plug for laser coming from Arduino.2. Mini tripod

    Step 9: Arduino SoftwareThe Arduino sketch is attached.

    Comments: I used the stepper motor library for the stepper motors. I 'borrowed' this interface from another Instructable or off the Internet but can't remember where.There is an abundance of information on driving stepper motors, though.

    The accelerometer zero values for North-South(Y) and East-West(X) have to be determined for each fixture. My plan was to store the zero values in EEPROM so thefixture could automatically calibrate itself and store the zero values in EEPROM. But I couldnt get this to work. So I settled for a version that could autocalibrate and findthe zero values but it wouldnt save them if power was lost or reset. The next step explains how to calibrate the zero values.

    File Downloads

    AutoLevel.zip (2 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'AutoLevel.zip']

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    Step 10: Software CalibrationSet the fixture on a tripod. Manually adjust the stepper motor screws so that the top board is fairly level with the bottom. Stick the bubble level on to the CD. Adjust thetripod so that the bubble is centered.

    Plug the Arduino into a computer. Push the calibrate switch down. Open (the Arduino) serial terminal. The display should be displaying the center EW and NS voltages.Find the average values.

    Open up Autolevel.pde in a text editor. I use Notepad++.

    Change the two following values for the averages you found. They should probably be between 1 and 2.5.const float NSCenter=1.577;const float EWCenter=1.733;

    That should complete calibration.

    Step 11: Using AutoLevel Fixture & ConclusionsAttach the base to a tripod.

    Manually adjust the stepper motor screws so that the top board is fairly level with the base.Adjust the tripod so that the top looks fairly level.Make sure the rocker switches are all up.Plug in the AA batteries into the Arduino.The program should adjust the steppers until the top board is level.Then it will turn on the laser.After runtime (15 seconds), the laser will briefly shutoff to check the calibration.Conclusions: Well the fixture does what I expected it to do. Its not too reliable. Sometimes it tries to adjust past where it should and I have to push the reset. It couldprobably use some work in the sketch and maybe the electronics. But I am Lazy and probably wont do any more for now. Still it was a good learning experience inutilizing an accelerometer and automated feedback.

  • http://www.instructables.com/id/Auto-Leveling-Laser-Cross/

    Image Notes1. Projected laser cross2. Stepper motor and adjustment screw.3. Laser current drive4. Arduino

    Image Notes1. 2.1mm power plug for laser coming from Arduino.2. Mini tripod

    Related Instructables

    Arduino steppermotor andservos shield -AW GCSEBoard byAntMan232

    NES ControlledEtch-A-Sketch(video) byalpinedelta

    Laser cut gearclock - withChronoDot! bybpwagner

    Build a Laser 3DPrinter -Stereolithographyat Home byRobHopeless

    AutomaticMarshmallowRoaster (Photos)by -henry-

    ArduRollerbalance bot byfasaxc