I’ve been following this great tutorial: http://www.instructables.com/id/Micro-LASER-Show-with-a-CD-Lens-Mechanism
BUT: I’m having problems identifying which cables control which axis - any tips on how to find this out? I’m debugging, trying to isolate horizontal and vertical movement [with setPos(x, 0) and setPos(0, y)] and can manage to get a good clean vertical movement but the horizontal movement always has a small vertical movement as well.
Also, I wonder about the code line digitalWrite(8, HIGH); - doesn’t one of the corresponding coils need to be ground/zero/LOW for this to work?
Code can be found here: http://www.instructables.com/id/Micro-LASER-Show-with-a-CD-Lens-Mechanism/step7/Connect-the-signal-source/
but also see the comments below where it’s better formatted.
If you are projecting on a wall and the dot is above or below the source you will always get some vertical movement unless you specifically compensate for it. For compensation you’ll need to understand a few things:
When you draw an imaginary line from the light source perpendicular to the wall, you get the point closest to the laser source. Let’s call it normal point. If you try to project a horizontal line above that point you will actually get a U shaped line. If you project the same line below your normal point you will get an arching line (upside down U).
If you project a vertical line left of normal point, you will again get a curve curving “away” from the normal point. Opposite happens on the right side.
The closer you position your light source to the wall, more pronounce this effect is.
To compensate, easiest thing would be to measure how much it deviates from ideal and come up with a mathematical function which you would include while projecting.
So, to draw a dot on (x, y), you need to actually draw it on (x-xk, y-yl), or something similar, where k and l are coefficients for distortion. I don’t think the distortion is linear, so this particular formula most likely won’t work exactly (I don’t have time to figure out the exact formula, sorry), but this should give you an idea of what to look at. If you do use the above formula, k and l should be 0 < k < 1, and most likely k = l.
Forgot to mention that your normal point is (0, 0)
Thanks, there might be optical issues as well, but I'd like to rule out any mechanical and electrical issues first. I can see the CD lens' movement, so I can "debug" with my eyes to some extent.
Any input on my "which cable controls what" question?