Search This Blog

Saturday, August 27, 2011

Laser Message Projector - Laser light show development experiments

On vacation at the beach, I saw many junk shops selling laser pointers.  I think there are some neat uses that could be developed now that lasers are cheap and plentiful.   In college I used laser interferometers for measurements at NIST.   With stuff lying around my shop I could build an interferometer, but at the moment I can't think of something I want to measure that accurately.   An interferometer uses the interference pattern to measure position or speed down to counting wavelengths of light.

People use lasers for bouncing off a window pane and interferometry to hear what is being said inside a house.   Cool spy gear, but my neighbors aren't interesting enough to care what they are saying.  Laser communications are possible by modulating information onto the beam.  But with wifi and cellphones who would bother any more.

So instead my idea is for a laser projector.   I decided to see if I could modulate the laser, while sweeping it with simple moving mirrors to create a picture or words on a distant object.   Brightness may be an issue with a single laser, but given the price of these things I could use several.  The higher power ones I've seen have notes about not being suited to continuous operation, and this will require the laser be on for a long time.
If Batman could do it in 1965, I certainly can!
I just have to shine a laser pointer at spinning mirrors, synchronize and modulate intensity over time to make words or a picture.  Three colors are possible red green blue, so I could even make color pictures on clouds, buildings, and definitely NOT airplanes.   I hear you can get sent to the pokey for that.

I found this link:
http://hackedgadgets.com/2010/07/18/spinning-mirror-laser-project/
and a few others where people used spinning mirrors to make patterns.   Haven't seen one yet where actual words and pictures were shown.  Maybe because it won't work?  We will see.

Later I found this fairly complete project, looks like a fair amount of $$ was spent
http://elm-chan.org/works/vlp/report_e.html

Several lasers out there to use, and cheap.  Might use a small array or just one R, G, B

The basic outline of my idea is this:

  • R,G,B lasers, probably just laser pointers
  • Box fan to spin mirror for X and Y deflection
  • PWM speed control the motor
  • IR remote sensor to monitor laser coming by and measure speed, or use the fan tach
  • Two box fans at different speeds for two axis, one fast, one slow
  • Modulating laser pointer on and off, may need a small interface circuit.
  • An arduino microcontroller board to switch the laser to form a picture or words
 Plan is to use a mirror glued on the hub of a computer block fan.  The speed of the box fan may be regulated electrically, using its built in tach, or by a photo transistor looking for the spot to come by at regular frequency. Fans can have two, three or four wires.

Some basic parameters of the design and math.   

X and Y will be done raster style.  To make a video quality picture of 320 x 240, with 20 frames per second, the pixels will modulate at 20Hz*320*240= 1.535Mhz.  Probably too fast to modulate the laser and the Arduino won't be able to keep up supplying the picture.   We will start with 128x32, which will be adequate for ASCII art.  I'll allow some visible flicker, and we could go as low as 128 x 32 x 10 FPS = 41kHz.  Whew what a difference! 

Collecting some data on fans:

Below you have a breakdown of the function of each pin and the most common color for the wire attached to that pin. There are two important things to notice here. First the color of the wires may change depending on the fan manufacturer. These are just the most common ones. Second, all fans are fed with+12 V; however several fans use a red wire on their +12 V line, being different from the color code used by the power supply, where red means +5 V. Pin Function Wire Color 1 Ground Black 2 +12 V Red or yellow 3 Fan Speed Sensor Yellow, white or green 4 PWM Control Blue

A link to a good article on fan speed control is here
http://www.analog.com/library/analogDialogue/archives/38-02/fan_speed.html

They make motors for copiers that spin "optical polygons" which is exactly what I want.  I can't get enough specs though to know if this includes the mirror.  I think it does, but I'm not sure.  Plus the interface circuitry would probably all just get in the way.

 http://cgi.ebay.com/New-Ricoh-AX06-0181-AX060181-Polygon-Mirror-Motor-/110714901232?pt=LH_DefaultDomain_0&hash=item19c71f52f0#ht_1243wt_1396
Enlarge photo for this Polygon Mirror Motor for the Ricoh AX060181
This page shows several mirror and motor assemblies and specs.
http://www.lincolnlaser.com/products/offtheshelf.cfm
These normally run $100 to $200, but a few on ebay seem to be $20.  Not sure why.
http://www.ebay.com/itm/New-Ricoh-AX06-0181-AX060181-Polygon-Mirror-Motor-/110714901232?pt=LH_DefaultDomain_0&hash=item19c71f52f0#ht_1243wt_1396

A paper on polygonal mirrors
http://www.optics.arizona.edu/opti696/2005/Polygonal%20Mirror%20Assemblies.pdf

For $10 here is a surplus copier board that has a lot of goodies on it, including a polygon and motor:
http://www.surplusshed.com/pages/item/m2875.html

A page on how laser shows work, which includes machines for doing this very thing
http://www.laserfx.com/Works/Works3S.html
These parts are too expensive, $200
http://shop.ebay.com/i.html?_nkw=galvanometers+Cambridge&_sacat=0&_odkw=High+speed+galvanometers+Cambridge+Technology&_osacat=0&_trksid=p3286.c0.m270.l1313

Collecting some links on lasers:



 Laser module data sheets are pretty worthless.  These are pretty much intended to just be powered.  I don't know what's in here besides the laser diode.  Nice thing is these come with optics to columnate.

http://www.quarton.com/pdf/VLM-635650-03.pdf

A bare laser diode may be OK.  They work just like LEDs.  There is a data sheet here:
http://www.us-lasers.com/d650nm5m.htm

This one looks intense:
http://www.laserpointerpro.com/100mw-650nm-flashlight-style-1010-type-red-laser-pointer-pen-with-16340-battery-p-429.html

Some others:

AIXIZ 650nm 5mw 12x30mm laser module 3.2VDC
Mini Blue Laser 405nm 5mw 8x13mm exclusive AixiZ
AixiZ mini green DPSS 532nm laser worlds smallest 


 Back to the fun....

Two experiments to determine basic feasibility:

  • Experiment is to switch a laser pointer at high speed and see if switching works OK.  Move the laser and see if I get a dashed line of reasonable brightness
  • Get a single mirror assembly made up to see if the speed control and weight of the mirrors works ok.
If all that works, the project will move forward with a full assembly, buying some better lasers, and writing some code.

Experiment 1:
We need to find out if a laser pointer module can be switched on and off at relatively high speed so that we can draw a picture with it, synchronized to a spinning mirror.  I have no idea what is in a laser pointer module, they are designed just to hook to a battery.   A plain laser diode can be switched at high speed, that is how fiber optic communications work (my day job).  But the laser pointer module might have some power regulation or capacitance in it.

I set up a simple MOSFET driver circuit to switch the power to an old laser pointer I had lying around.   This is way overkill but I have an Arduino and some MOSFETS lying on my workbench from the LED driving experiment.

Here is the circuit



Here  a picture of the breadboard.    I taped the switch of the laser pointer down, removed the end cap and touched one wire to the battery and one to the case.  The MOSFET acts like the power switch and turns it on and off



The software for the Arduino is nothing more than the "blink" example that comes with the user environment download.   I sped up the blink rate from 2Hz  to 1/20ms = 50Hz to start by just changing the delay() statement to delay(10)

FTW! This video shows how when I hook up the laser pointer and move it, I get a  dashed line on the floor.  It is a little hard to see in the video unless you go full screen.  Watch the laser circle on the floor, it looks like it is made up of  dots when I move it.  Very promising start, I'm excited, this is going to work!!

Next I set the pulse rate to 1/2ms = 500kHz, and wiggled the pointer as fast as I could and still hold the wires on and start the video.  Need more hands :)
If you look carefully, especially at the very end, you can see the line is made up of dots.  That shows the laser is being switched on and off.  The video doesn't do the effect justice, to the eye it looks persistent.  Plus the video seems to have gotten blurry than the original when it was posted.

Experiment 2:
To really see if the laser modulation is any good, I need to get a spinning mirror on line to deflect the laser in a consistent way at a high speed.  Off to the craft store to get some mirror tiles and glue them to the hub of an old computer case fan.

 I went to the hardware store and craft store (boo to shopping) to find some small mirror tiles to build my optical polygon.  I didn't want to wait to order them online, since I'm still proving if this project is feasible.   Of course the hardware store didn't seem to have them after a long aimless wander around a huge store.  I tried the craft store and they were sold out.   I ended up buying six 2.25" mirrors that were made for a Christmas ornament.  Cost $8 at Michaels.   Waste, but I was eager to keep going.
Hexagon mirror medium



Basically I got some of these without the "Feliz Navidad!".    This test polygon will have to be larger than I wanted, I will order some smaller 1" tiles to make the final one.

The best part of making stuff is the aha moments when you realize that there is an easier way to do what you were planning.  My whole ethos is about doing complex and cool stuff on the cheap with easily purchased and repurposed stuff.  

I was at the self checkout at the hardware store getting some glue, and looked inside and saw a spinning optical polygon.   Only one.   At first I thought the Y direction must be deeper inside, and my head was full of how I was going to align my optical polygon.   And I realized I only need one polygon, not two.  But I have to explain some backstory before we get to that.

An optical polygon is a polygon for a good reason.   A single spinning mirror could be used, but half the time the laser would be shining on the back.  So obviously we put two mirrors back to back.   This will deflect the beam to sweep over 180 degrees.  That is way wider than I want, and if you think of a copier, the laser would spend most of it's time not pointed at the little piece of paper.  To keep efficiency up, and keep the laser only sweeping across the target area, you want mirrors on the sides of a many sided polygon, so that the laser sweeps across a short arc, then moves on to the next polygon side and sweeps again, and so on.  This way you maximize the laser on target time, and thus the brightness.

Now that we have multiple sides, we have the issue that the mirrors all need to be matched and aligned or as the laser hits each mirror, the dot will jump around and the picture will be blurry.   If you are trying to print or scan at 1000dpm this alignment has to incredibly tight.   Actually this is what I was doing with interferometers at NIST in the beginning of this story, back in college, more years ago than I will admit.

What happens when you shine a constant laser at a many sided polygon, you will get a stripe on the wall.  As each mirror goes by, if it is out of alignment, the stripe will move up and down, the ends will not align, or the stripe will be at an angle.   When I make my polygon I will have to adjust each mirror to make the stripes overlap.  Finally the aha moment.

If I intentionally angle each mirror progressively, I can get the raster scan to happen with a single polygon!  This is going to be a bit of tweaky work, but I think it's possible.  My test polygon will only have six sides, because the mirrors are too big to do more.  So my "display" will have only six lines.  If I want 12 lines, I will need two lasers and have to align them.  Still seems doable.  Better than two motors at different speeds.

Since I'm hoping to have long range with my projector, I want a relatively short arc of deflection, which means many sides and small mirrors.  That is not what I have now, but keep that in mind for the final build.  I will have to do the geometry homework eventually, but not yet.

I did realize that I may need to precisely synchronize the position of the polygon, so that I start sending the picture timed with each side.  I had thought I could get away with just repeating, and who cared exactly if the image didn't come straight out the front of the machine.  That may be true, I'll see when I get a bit further.

Wow, that was a lot of blather, back to building the polygon....

Whipping up the polygon

 My first polygon is just to do proof of concept, I just want to get some mirrors spinning.   The mirrors I have are too big anyway for my final design.   So I decided just to slap something together so I could look at the effect of modulating the laser and be able to synchronize to the spin rate.

I went to the wood shop and cut out a polygon shape from 3/8" particle board using a mitre saw and some Pythagorean theorem. I drilled a hole in the center and trimmed it until it was as even as I could make it.

Here is where some multiple botches came up.  I can only laugh at my stupidity sometimes.  I started to mount the mirrors around the edges, taking advantage of the holes in the mirrors to put a screw through.  The first problem was that when I made the plywood polygon, I repeatedly trimmed the edges against the saw until all the sides were even.  Guess what.  It was a little too small and the mirrors wouldn't fit.   I had to put a piece of foam tape around the edge to make it large enough to fit the mirrors. 


The second and more hilarious botch was that I can't count.  I had six mirrors, I was going to make a six sided test polygon.   Look at the picture.  I didn't make a hexagon, I made an octagon.  I was thinking about 45 degree angles and woodworking finesse and didn't even notice I made an eight sided polygon until I started putting the mirrors on.  Idiot.  It's pouring rain and I don't want to go back to the craft store for more mirrors, or make the polygon again, so I will forge ahead with the spin test with two empty slots in the wheel.



This polygon is not nearly as precise as I'd like, the mirrors are all over the place.  I was planning to adjust and glue them but with the tape that is probably hopeless.  Let's just see what happens and I'll decide if I should redo the test polygon or go for the final build after that.

The final botch next.  I put a bolt through the hole in the polygon, and mounted the whole thing up in the drill press.  The speed was fairly low (I thought).   A few seconds after turning it on CRAACK and glass went flying across the room.  Two mirrors couldn't take the force and smashed.   Luckily it didn't fly in my direction.  A little scary.  What other blog is going to share failure with you, instead of just writing up the success.


Back to the drawing board.   I may have to resign myself to buying an optical polygon, or actually pay attention to the speed I'm spinning it.  I wasn't looking to build a weapon.  

In the downtime mourning failure, it is worth taking a minute to think about what speed it has to spin and not just slap it in the drill press.


If I want 10 frames per second and I get one frame per rotation.   The idea was all 8 lines of the image are painted by the eight mirrors each slightly tilted from the last.   10 frames per second is 10 * 60 = 600 frames per minute.   That means 600 RPM.  I was probably spinning it faster than that in the drill press.

A reasonable speed that a computer case fan spins is 1000 rpm.  This datasheet shows http://www.newegg.com/Product/Product.aspx?Item=N82E16811998109  fans will go as fast at 2000 rpm but I'm going to leave margin and assume 1000rpm.    1000 rpm is 1000 rotations/60sec, which is 16.6 rotations per second.  Each rotation will be 1/16.6 = 60ms. 


To make even an alphanumeric display, I would want 8 characters at 5 x 8 dots.  Lets stick to 10 frames per second for now.   8 characters * 5 dots = 40 dots per line.  So the bare minimum resolution I'd put up with is 8 dots x 40 dots.  That means the pixel modulation rate is 40 pixels * 8 characters * 10 fps = 3.2 KHz. 

Back to some thinking about what to do next.

New Plan
Here is the new plan.  Building a polygon is going to be more expensive and difficult than buying a surplus one here for $20.  I'm sure if I worked at it I could salvage one from used equipment for even less. 
http://www.ebay.com/itm/New-Ricoh-AX06-0181-AX060181-Polygon-Mirror-Motor-/110714901232?pt=LH_DefaultDomain_0&hash=item19c71f52f0#ht_1243wt_1396
Now
 I have to wait for it to come in the mail.  It comes with a motor so forget the computer fan, I will have to hack the connections to this board to control it.  This board should already have synchronization logic on it.

I will have to either use two of the polygons running at different rates to get my raster scan, or I will have to think of another way to get some vertical deflection.  One idea I had was to use a speaker or solenoid and put the laser on it.   Play a tone and it will move up and down.  The noise would be annoying though.

OK the boards arrived with the motor and laser polygon on them.  They were definitely worth the $20.   The IC on the board is a motor controller, a Panasonic an8244sb.  I couldn't find a data sheet on it but it is an integrated motor driver and speed control.  Awesome, everything I would build, already done.  I just have to reverse engineer the board and interface it to an Arduino and I'm done!

I found a datasheet of a AN8245K which is clearly similar.
http://pdf.chinaicmart.com/88888/20071113161625352.pdf

http://www.semicon.panasonic.co.jp/ds4/AN8245K_E_discon.pdf


The part must be obsolete, because panasonic website does not list it anywhere.

The board is smaller than I thought it would be when i saw it on line.
Looking at the board, it has a 5 pin connector at the bottom. Labeled J1, pins labed 1 to 5.
PIN 1 - signal pin goes to a skinny trace
PIN 2 - signal pin goes to a skinny trace
PIN 3 - signal pin goes to a skinny trace
PIN 4 - GND wide trace goes to the Regulator, goes to the wide fin on the IC package, and the metal plane on the back of the board.  Must be ground.

PIN 5 - wide trace .  Must be VDD

I will power the board and look to see if I get voltage out on any of the pins.
I suspect some are input control pins to set the speed, and some are output pins to read back the sensor that marks position.  The AN8245 takes 12V in.   This may be similar, but I'll start lower and see.

I dug through the my junkbox to find a connector that fit.  The pins were very closely spaced and didn't fit any of the standard PC fan connectors.  I found a 7 pin connector that had the right pin spacing in my junkbox, it was a mainboard connector from a broken Vizio flat panel TV (don't get me started on how crappy these sets are).   Since the connector I found was 7 pins, and I only needed 5, I cut the shroud off the polygon board connector.   I soldered the other end of the cable to a nice header that plugged into a breadboard.


Also note that I put the polygon board firmly in my vice.  While I'm figuring out the connectors I don't want the motor spinning up and breaking something.

Now to reverse engineer the pinout of the connector. 

Applied 5V to pin 5.  See 5V on the regulator input.  Nothing happens to the polygon
Measured
1 = 1.56
2 = 1.16
3 = 1.56VMy guess is the supply is too low, nothing is happening.

Applied 10.5V to pin 5 (used a diode from 12V).  Nothing happens to the polygon.  Nothing gets hot.
Measured pins.
1 - 5.0V - looks like a regulated output
2 - 1.5 volt that fades down to 0.3V.  Flaky.  Probably the input.
3- 5.0V - looks like a regulated output

Just to confirm that the regulator is power pins 1,3 i'm going to drop the supply voltage with another diode in series and see if the 5V holds.  Yes!  With 10V on the input power, pins 1,3 still read 5V dead on.  So the regulator is up and running and driving these pins.

This is what I think I have

1 - 5V logic output
2 - 5V logic input
3 - 5V logic output
4 - GND
5 - VDD 10-12V

I will try grounding and shorting the input pin 2 to 0V and 5V using a 10K resistor to limit current.
I'm able to pull the voltage to 0V and 5V with the 10K resistor, so it is a high impedance input.  Neither seems to start the polygon spinning or affect the output voltage on the other pins.  Connected to a 500Hz signal from the Arduino.  Nothing happens.

I will try spinning the polygon and putting pins 1, 3 on the scope.  Read 5V.  Spin the polygon both directions, see no change on the scope.  I can't tell what these two pins are for.

Things are not going well.  About to quit for a while when I accidentally short my 500Hz logic signal to Pin 3, which I thought was an output.  Whiizzzzzz.  The polygon starts spinning.  Wheee!  Pretty fast too.   Speed seems constant by the pitch of the sound.   Putting pin 3 on the scope shows it 0 to 5V,   it is not loaded.

Here is the polygon spinning scary fast with the 500Hz input to pin 3


Changed the arduino program to output 50Hz (this is just the LED blink program that comes with the software).  The polygon spins up, the tone is different and the speed seems slower.
Nothing but noise probing the other pins on the scope.  Hooking both to either 0V or 5V does nothing.

This is the pinout for the board that makes is spin: 

1 ?? - measures 5V
2 ?? - measures near 0V
3 5V Logic Input to make the polygon spin, Apply 50-500Hz square wave
4 GND
5 12V

Shine a laser pinter on it and I get a nice bright single line.  Of course this polygon is already well calibrated.   Confirms my decision that using a $20 surplus polygon motor board was the right move.  Saved building, aligning, mounting to a motor, countless hours of labor.  Here is a bad photo of a laser pointer bouncing off the spinning    polygon and drawing a line.

If I'm lucky, the polygon motor board has all the logic to sync the polygon to the incoming pulse train and this gets real easy. Based on the data sheet for the spindle motor driver, that may be the case.  I tried lowering the pulse rate to 50Hz, and the polygon moved very slowly.  So I clearly have speed control.

The next experiment is to pulse the laser in time with the pulse train, and see if I get a synchronized dashed line, or if it moves over time.

I used a pipe cutter to cut the head off my old laser pointer.  Up above I had simply used a MOSFET as a switch, and left the batteries in the pointer to power the laser.  That was because the laser module is deep in the bottom of the pointer.  I had to go ahead and destroy the case to solder wires to the laser pointer module directly.  Here I've cut the head off the top of the pointer with a pipe cutter.


I soldered wires to the laser module.  Note that the spring is actually the NEGATIVE terminal of the laser, unlike a flashlight.  The POSITIVE terminal is the case.  We know this because the batteries go in with the negative side first.





Here is the rig in action.   The polygon motor board is in the vise, with the head of the laser pointer clamped next to it.  The mirror is spinning, and you can just see a red line horizontally on the paper behind it.   In the foreground is the arduino board with the MOSFET driving the laser.


Here is the Arduino code I used. 


/*
 Drives an optical polygon motor board from a copier from the Arduino
 and pulses a laser in time with it
 */

#define polygon 13   //this pin drives a pulse train to the polygon motor board
#define laser 11     //this pin powers the laser through a mosfet switch

#define POLYGON_SPEED      15   //Hz of the polygon control waveform, 10 - 300 work OK
#define LASER_MODULATION   1500 //Hz of the laser modulation,  0 - 2000 work OK

void setup() {               
  // initialize the digital pins as an output.
  pinMode(polygon, OUTPUT);
  digitalWrite(polygon, LOW); 
  pinMode(laser, OUTPUT); 
  digitalWrite(laser, LOW);
}

void loop() {
  digitalWrite(polygon, HIGH); 
  for(int i=0; i<LASER_MODULATION/POLYGON_SPEED/2; i++) {
    digitalWrite(laser, HIGH);
    delayMicroseconds(1E6/LASER_MODULATION/2);
    digitalWrite(laser, LOW);
    delayMicroseconds(1E6/LASER_MODULATION/2);
  } 
  digitalWrite(polygon, LOW); 
  for(int i=0; i<LASER_MODULATION/POLYGON_SPEED/2; i++) {
    digitalWrite(laser, HIGH);
    delayMicroseconds(1E6/LASER_MODULATION/2);
    digitalWrite(laser, LOW);
    delayMicroseconds(1E6/LASER_MODULATION/2);
  }

}


Disappointingly, I'm getting a solid line instead of a dashed line.   The laser and polygon control signals are generated in synch by the Arduino.  However I really don't know the relative rates I should make the two pulses yet.   When the polygon is spinning down when I turn it off, I fleetingly get the dashed effect I want. 

I played around a bit changing the numbers and found that the polygon is really blistering fast.  I can't modulate my laser as fast as I'd like, at above 1kHz the light fades out.  That is not a huge surprise because I'm using an entire laser pointer module that was never intended to switch rapidly.  I may need to get a bare laser diode to be able to modulate it at the 44kHz I wanted.

At slow speeds the polygon motor doesn't work well, it jerks and stalls.  The control speed needs to be at least 10Hz.  The polygon is still spinning too fast to see at this point.  So I'm guessing you get one revolution per Hz on the control line.  10cycles/sec * 60sec/min = 600rpm. 

I found the closest I best I could get was 20Hz on the polygon and 1500 on the laser.  But the motor is just not happy running this slow.  I can see definite dashed line, but it is jumpy and faint. 
I'm wondering if I need to be sure that my laser is a factor of 6 from my polygon rate, since my polygon has six sides.   Need to experiment to see if I have a relative speed issue or a synch issue.

I tried making a short pulse instead of constantly pulsing, and had some success. 
I changed the code to just make a pulse once per rev of the polygon, and now I got a stable dash mark once the polygon spun up.


 Drives an optical polygon motor board from a copier from the Arduino
 and pulses a laser in time with it
 */

#define polygon 13   //this pin drives a pulse train to the polygon motor board
#define laser 11     //this pin powers the laser through a mosfet switch

#define POLYGON_SPEED      15   //Hz of the polygon control waveform, 10 - 300 work OK


void setup() {               
  // initialize the digital pins as an output.
  pinMode(polygon, OUTPUT);
  digitalWrite(polygon, LOW); 
  pinMode(laser, OUTPUT); 
  digitalWrite(laser, LOW);
}

void loop() {
  digitalWrite(polygon, HIGH);
  digitalWrite(laser, HIGH);
  delay(1);
  digitalWrite(laser, LOW);
  delay(500/POLYGON_SPEED);
  digitalWrite(polygon, LOW);
  delay(1);
  delay(500/POLYGON_SPEED);
 
}

}

Some success, I need to play some more with the timings, and order some laser diodes that I can modulate faster and of different colors to prepare for the final build.

A lousy picture but you can see the dash here.  In this picture instead of a line, I get a short dash because the laser pulse is timed with the polygon mirror spinning.   Proof of concept.  Bad picture, but see the short red line in the middle.

  
I found that I have a couple issues I need to clean up.  

My laser driver used a 100ohm current limit resistor, which I removed and replaced with a diode and a large cap to drop the 5V a bit and have a faster switching time.  It turns out my driver circuit needs some clean up, the high speed modulation of the laser works better now.  There is still some room for improvement here.  I updated the driver and used a mosfet to pull up and down, after putting the waveform on the scope I saw I had serious capacitance on the laser diode.  The pull down was strong but the turnoff was slow. The new driver makes a clean sharp waveform.  The blur in the photo above converged into a dot.   So I didn't have a sync problem, I had a drive strength problem.  I'll put the circuit up shortly.

The dashed line is a bit jittery, even after the polygon spins up.  I think (know) it is the fault of the delay() command on the Arduino.  I notice as I change the delay values in the Arduino, the waveform is sometimes happy, other times unstable.   delay() is known to have unstable timing when interrupts, etc happen.  I will switch the code to use the PWM. I always have to relearn the lesson that delay() function on Arduino is awful.

I'm not sure I'm hitting a pulse on each face of the polygon, so the brightness is down.  I need to try some different patterns and figure out the synch so I can start to make pictures and words.

I updated the code to use the pwm.  Wow! What a difference. 
Now I get bright, stable dashed lines, that I can see with the lights on.  You can make them out in this photo on the paper, with the flash camera even and in the video you can see the jitter.     I also learned that the polygon works better with a short positive pulse instead of a 50/50 duty cycle square wave.  The resulting output speed is more stable.  I achieve the low duty cycle with the analogWrite(polygon, 4) command, which makes the duty cycle 4/255.



The code I used to alter the PWM frequency I got from here:
http://www.arduino.cc/playground/Code/PwmFrequency   
// Uses PWM function to control a laser and optical polygon with exact timings

#define polygon 10   //this pin drives a pulse train to the polygon motor board
#define laser 11     //this pin powers the laser through a mosfet switch

#define POLYGON_SPEED      100   //Hz of the polygon control waveform, 10 - 300 work OK
#define LASER_MODULATION   100   //Hz of the laser modulation,  0 - 2000 work OK

void setup() {              
  // initialize the digital pins as an output.
  pinMode(polygon, OUTPUT);
  pinMode(laser, OUTPUT);

  // Set pin 10's PWM frequency to 31 Hz (31250/1024 = 31)
  setPwmFrequency(10, 1024);
  setPwmFrequency(11, 256);
}


void loop() {
    analogWrite(polygon, 4);
    analogWrite(laser, 4);
 
}

/*
// Uses PWM function to control a laser and optical polygon with exact timings

#define polygon 10   //this pin drives a pulse train to the polygon motor board
#define laser 11     //this pin powers the laser through a mosfet switch

#define POLYGON_SPEED      100   //Hz of the polygon control waveform, 10 - 300 work OK
#define LASER_MODULATION   100   //Hz of the laser modulation,  0 - 2000 work OK

void setup() {              
  // initialize the digital pins as an output.
  pinMode(polygon, OUTPUT);
  pinMode(laser, OUTPUT);

  // Set pin 10's PWM frequency to 31 Hz (31250/1024 = 31)
  setPwmFrequency(10, 1024);
  setPwmFrequency(11, 256);
}


void loop() {
    analogWrite(polygon, 4);
    analogWrite(laser, 4);
 
}

/**
* Divides a given PWM pin frequency by a divisor.
*
 * The resulting frequency is equal to the base frequency divided by
* the given divisor:
*   - Base frequencies:
*      o The base frequency for pins 3, 9, 10, and 11 is 31250 Hz.
*      o The base frequency for pins 5 and 6 is 62500 Hz.
*   - Divisors:
*      o The divisors available on pins 5, 6, 9 and 10 are: 1, 8, 64,
*        256, and 1024.
*      o The divisors available on pins 3 and 11 are: 1, 8, 32, 64,
*        128, 256, and 1024.
*
 * PWM frequencies are tied together in pairs of pins. If one in a
* pair is changed, the other is also changed to match:
*   - Pins 5 and 6 are paired on timer0
*   - Pins 9 and 10 are paired on timer1
*   - Pins 3 and 11 are paired on timer2
*
 * Note that this function will have side effects on anything else
* that uses timers:
*   - Changes on pins 3, 5, 6, or 11 may cause the delay() and
*     millis() functions to stop working. Other timing-related
*     functions may also be affected.
*   - Changes on pins 9 or 10 will cause the Servo library to function
*     incorrectly.
*
 * Thanks to macegr of the Arduino forums for his documentation of the
* PWM frequency divisors. His post can be viewed at:
*   http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235060559/0#4
*/
void setPwmFrequency(int pin, int divisor) {
  byte mode;
  if(pin == 5 || pin == 6 || pin == 9 || pin == 10) {
    switch(divisor) {
      case 1: mode = 0x01; break;
      case 8: mode = 0x02; break;
      case 64: mode = 0x03; break;
      case 256: mode = 0x04; break;
      case 1024: mode = 0x05; break;
      default: return;
    }
    if(pin == 5 || pin == 6) {
      TCCR0B = TCCR0B & 0b11111000 | mode;
    } else {
      TCCR1B = TCCR1B & 0b11111000 | mode;
    }
  } else if(pin == 3 || pin == 11) {
    switch(divisor) {
      case 1: mode = 0x01; break;
      case 8: mode = 0x02; break;
      case 32: mode = 0x03; break;
      case 64: mode = 0x04; break;
      case 128: mode = 0x05; break;
      case 256: mode = 0x06; break;
      case 1024: mode = 0x7; break;
      default: return;
    }
    TCCR2B = TCCR2B & 0b11111000 | mode;
  }
}
 Drives an optical polygon motor board from a copier from the Arduino
 and pulses a laser in time with it
 */


}

I also experimented with making a galvanometer out of a speaker with a mirror glued to it.  This was just a hack up to see if I could use it to get vertical displacement of the laser, with the polygon giving me horizontal.   It worked surprisingly well.  So well I may consider expanding on this technique.

I ripped the speaker out of an old TV set.  It is a fairly heavy duty and compact speaker.  I used glue to mount a plastic tube and taped a mirror to it.  Really crappy build quality, but it served the purpose. 


I  modulated the speaker with 31Hz from the Arduino and got this!!

I got a circle and instead of a straight line because the speaker and mirror were really floppy.  If the mirror were better tied down it would have worked better.  However this shows I can get good deflection with a simple speaker.  Wow.

Lasers came in the mail.  I got one of each color.  It was cheaper to buy laser pointers than raw laser modules.  I can't understand that, but oh well.
These were the best/cheapest I could find




I also went back to the craft store and found a bag of small mirrors for $1.99.  Why didn't they have this before????


I made a more compact galvanometer with the smaller mirror and a bottlecap




However the initial trial showed I got worse performance than I did with the big floppy mirror.  No longer a circle, but very little laser deflection.  What??  It seems simply moving up and down doesn't bend the beam as much as tipping the mirror.  Dang geometry.  I need to find a simple way to hinge the mirror and modulate one edge.

When I came back to this again, I hit upon the idea of having two, three, or even four speakers on the corners of a mirror.  By modulating the speakers I could tip the mirror in two axis.  This setup alone could be a good laser light show generator.  I burning through my collection of old speakers scrounged from old TV sets, but basically this setup is free.

I will report more as the project progresses...........

Work has not allowed me to move on this lately, but before I stalled there was a major breakthrough.  I used TWO speakers with a mirror across them as a bridge.   By driving the two speakers with inverted signals I was able to get excellent deflection in a very controlled way.



This technique worked so well, I have to reconsider using the polygon mirror at all.   I could use the polygon for x axis and the speakers for y,  or I could use THREE speakers to build a vector controllable tilting platform.   Most laser systems work on vector drawing anyway and I wouldn't have to chop the laser beam so much.  

A little rethinking too do, and I need to get three or four big speakers that match.  Problem is scrounging speakers, they come in pairs.

This project waits for me to have some more time...


17 comments:

  1. Did you get this working? Great post! Please update if this page if you can, I'd love to see the results. I'm working on a similar project to this laser projector and seeing your progress has been useful!

    Thanks!

    ReplyDelete
    Replies
    1. Thanks for the encouragement! Actually I made one more significant step before getting distracted by my real job and writing Android apps. I made a galvanometer out of two speakers that kicks butt. I'll add a picture to the post. I needed more speakers to finish things.

      Delete
  2. Wow, this is what I say to your blog. I like the image of modulation you've mentioned "I modulated the speaker with 31Hz from the Arduino and got this!!"

    Regards,
    Electro-Optic Deflection Systems

    ReplyDelete
  3. Great work reminds me of me ! I live in Australia and i have made a NBTV out of a octagon mirror and 4 sided mirror and laser best to PWM them you need to remove the electronics from any laser pointer you need the raw laser or it will filter the video signal you might get a narrow bandwidth with it but you really want just the laser diode .see
    https://www.youtube.com/user/039dalekmoore2007

    The builds of the mechanical glow drum sstv and octagon NBTV are on the nbtv FORUM
    SEE Harry Dalek posts .

    ReplyDelete
  4. Hallo, thank you. It was very helpful for me.
    I have motor with polygon with chip AN44000A.

    ReplyDelete
  5. Now I know what to do and where to go with my de-structed QMF1650 Laser printer... thanks very much for your publication.

    It failed on the spinning polygon as far as I could 'hear': the bearing was warn down and did not make the high speed rotation properly anymore... that's why the printer had to go... I will try to use a lower speed... it may still work. Btw, in the the printer's black box that houses the rotating mirror, the invisible laser, and the mirror that directs the ray onto the selenium drum, an oddly shaped lens segment is used to correct the geometric distortion introduced by the variable path length and angle of the ray with the given, constant pixel frequency.

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. Hi, I find reading this article a joy. It is extremely helpful and interesting and very much looking forward to reading more of your work.. install-christmas-laser-light

    ReplyDelete
  8. This content is written very well. Your use of formatting when making your points makes your observations very clear and easy to understand. Thank you. Best Christmas Laser Lights Projector Review

    ReplyDelete
  9. The author has so delightfully enraptured the consideration of crowd by this radiant blog.
    best-christmas-laser-lights-projectors

    ReplyDelete
  10. Fantastic blog article.Much thanks again. Awesome. sheet metal work

    ReplyDelete
  11. Say, you got a nice post.Much thanks again. Really Cool. sheet metal work

    ReplyDelete
  12. That is the excellent mindset, nonetheless is just not help to make every sence whatsoever preaching about that mather. Virtually any method many thanks in addition to i had endeavor to promote your own article in to delicius nevertheless it is apparently a dilemma using your information sites can you please recheck the idea. thanks once more. best projector under 300

    ReplyDelete
  13. CRT projectors also require precise placement. They must be perfectly square with the screen, at the correct elevation for good picture quality. mini projector

    ReplyDelete
  14. The higher the characteristic goals of the projector the more prominent the shading thickness picture. projector screen size

    ReplyDelete