Experiments in optics and image processing

After successfully mating a web cam with my microscopes (http://www.thingiverse.com/thing:216821) and telescope (https://www.youmagine.com/designs/web-cam-adapter-for-meade-telescope-eyepiece), I decided to design and print adapters to mount my Droid Turbo phone on the same scopes (https://www.youmagine.com/designs/microscope-adapter-for-droid-turbo-phone and https://www.youmagine.com/designs/droid-turbo-phone-to-telescope-adapter) so I could shoot higher resolution stills (21 Mp) and 1080p (and even 4k) video.   The telescope adapter fits over a Meade 32mm focal length Super Plössl eyepiece and provides about 47X magnification with the telescope.  I printed a similar adapter for my surgical microscope.

IMG_0995_crop

 

 

 

 

 

 

 

 

 

 

 

 

The telescope adapter firmly grips the phone and the eyepiece.

 

IMG_0993_crop

 

 

 

 

 

 

 

 

 

 

 

 

Initial tests were a little disappointing.  The combination of the phone’s camera and the telescope’s optics has significant pincushion distortion.  The image has only been mirrored L-R and scaled down (original is 21 Mp).  Note the lack of contrast (looking through 1/2 mile of humid air) and the curves in the power line and pole, and even the grass line:

pinch test original

 

 

 

 

 

 

 

 

 

A quick search found that the Gimp has built in transform tools to correct (or create) lens distortion.

 

gimp

 

 

 

 

 

 

 

 

It only took a couple minutes of messing around to get acceptable results.  Here’s the same image with the pincushion distortion corrected (whole image), contrast stretched and white balance corrected (rectangular area).  The pole, power line, and even the grass line now look straight.

pinch test corrected

 

 

 

 

 

 

 

 

 

And here’s the final image with all corrections and cropping applied:

final

 

 

 

 

 

 

 

 

 

 

Next step: photograph known square grids through the microscope and telescope and then create and save some preset corrections to apply with Gimp.

I wonder if something like this exists for video.  Hmmmmm…

 

 

 

 

 

Son of MegaMax Enters Instructables 3D Printing Contest

Many 3D printers being given away as prizes!  If I win one I’ll be donating it to my son’s school or other school or library that would like a machine and doesn’t already have one.  To do that I need your votes!

Son of MegaMax

Son of MegaMax

Please see my Instructable here:  http://www.instructables.com/id/An-Almost-Reliable-High-Precision-3D-Printer-Son-o/and vote for me by clicking the little red “vote” ribbon in the upper right corner of the start page.

Thanks!

http://www.instructables.com/id/An-Almost-Reliable-High-Precision-3D-Printer-Son-o/

Scrap Yard Success

Yesterday some of us went on a little field trip to a couple local scrap yards.  We met the people there and learned the ropes of how to do things right and not get hurt while digging for treasure in the piles of stuff they have laying around.  Wear gloves, old clothes, safety glasses, and sturdy shoes!  Stay away from moving cranes!

Here’s one of the discoveries from yesterday’s trip- explosion proof mercury vapor light fixtures:

A pallet full of explosion proof lamps at the scrap yard.

A pallet full of explosion proof lamps at the scrap yard.

And here’s what can be done with about an hour to figure out how to get it apart to remove the mercury vapor lamp and ballast and  clean it up a little.  Another 10 minutes went into installing the hardware, wiring, and a 6W LED bulb.  I wouldn’t call it finished yet- the base is crying out for installation of pipes to act as feet, a little more cleanup, and maybe a dimmer switch.  Total invested: $18 to get the fixture from the scrap yard, and another $12 for the hardware and LED bulb.

Explosion proof industrial lamp turned into table lamp.

Explosion proof industrial lamp turned into table lamp.

Further Adventures in 3D Printer Upgrades (upgrades?)

As previously promised, MegaMax’s Y-axis has been converted to screw drive along with the addition of a larger motor, DSP based driver, and 32V power supply.  The SmoothieBoard arrived and was quickly swapped in to replace the ATMega2560/RAMPS combo.  After studying and configuring the Smoothieboard I attempted a few test prints.  That’s when the problems started.

32V Power supply for Y axis motor.  No regulation necessary!

32V Power supply for Y axis motor. No regulation necessary!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Smoothieboard is supposed to read the config.txt file from its uSD card (conveniently accessible via USB) every time it boots.  That makes changing configuration very easy and fast – all you do is edit the config.txt file, save it , and reboot the board.  Firmware is updated the same way.  With the ATMega2560 you have to find the configuration variables by searching through multiple configuration files, make the necessary changes, recompile the firmware, then flash the controller.  I said the SmoothieBoard is supposed to read the file every time it boots, but it wasn’t doing it.  I’d make changes and they would not appear in the behavior of the printer.  Hmmmm.

Layers kept shifting in the X-axis- I expected Y-axis problems, but not X!

Layers kept shifting in the X-axis- I expected Y-axis problems, but not X!

 

 

 

 

 

 

 

 

 

 

 

I attempted some prints and managed to get two decent ones in about a week of screwing around with it.  I tried dozens of combinations of speed, acceleration, junction deviation (smoothie-speak for jerk) and even tried different slicers.  The machine went completely nuts on two occasions and ignored the Z-axis limit switch and slammed the extruder into the print bed, gouging through the Kapton tape and into the aluminum!  I decided I needed some professional help so I got on the #smoothieware IRC channel and discovered that the developers of the board/firmware hang out there quite a lot.  After a lot of back and forth Q and A and testing someone suggested it might be the uSD card causing the problem.  I picked up a new card at Walmart, put the firmware and config files on it , booted the machine, and attempted a print.  PERFECT!

The new uSD card worked!  The small round post is 4mm diameter.

The new uSD card worked! The small round post is 4mm diameter.

 

 

 

 

 

 

 

 

 

 

I have made several prints since last night and they have all come out fine.  I still have a little tweaking to do and to test the limits of the machine’s performance, but I think the problems are behind me.

Next up:  X-axis redesign/build.  I’m replacing the two guide rails with a single linear guide.  I have also ordered and received a BullDog XL extruder to replace the hacked up QUBD unit I’ve been using.  I’ll be adding a DSP driver and 32V power supply for the X-axis motor, too.

After that, I have some ideas for a filament respooling machine and ways to fix the retraction problem in the SnakeBite extruder.

It never ends!

 

Update on the Never-Ending Printer Project

I installed the Y-axis screw drive in MegaMax using the old NEMA-23 stepper motor.  A couple really good things came from this:

1) I can now adjust the bed leveling screws from the underside of the bed using thumbwheels instead of a screw driver.  I know, I know, everyone else in the world has been able to do this from day 1…

Thumb screw for leveling print bed.   Screw is threaded into teflon block.

Thumb screw for leveling print bed. Screw is threaded into teflon block.

 

 

 

 

 

 

 

 

 

2) Unlike everyone else in the world, with fully supported linear guide rails, the print bed does not move in any direction but along the Y axis.  In the old scheme, with the end-supported round guide rails, the rails would flex and the bed would move up and down when applying pressure to it (sometimes even the screw driver pressure to adjust the bed leveling screws).  Now, if the bed moves at all in the vertical direction it’s because the bed plate (1/4″ aluminum) itself is flexing!

A couple bad things were also discovered:

1) The vibration and noise problem I was hoping to solve has not been solved.  It has been made worse, though the character of the noise is improved to musical tones instead of just harsh buzzing and rattling.

2) Several failed test prints at ever decreasing jerk, acceleration, and speed settings have demonstrated that the old motor simply doesn’t have enough torque to drive the screw reliably at reasonable printing speeds.

Shift occurred in Y-axis due to insufficient motor torque.

Shift occurred in Y-axis due to insufficient motor torque.

 

 

 

 

 

 

 

 

 

 

 

 

Further research into the first problem indicates that the vibration and noise are inherent in using steppers, and worse in MegaMax than in machines that use NEMA-17 motors because of the higher detent torque in the NEMA-23 size motors.  Detent torque is the little bump-bump you feel when you turn the motor shaft by hand.  The solution to the problem is to use a good driver for the motor and a higher voltage power supply.  The little A4988 chips in the Pololu drivers on the RAMPS board are very unintelligent- all they do is provide microstepping.  They work OK for NEMA-17 size motors because of the speeds and low detent torques in those motors.  When used with NEMA-23 motors the driver limitations become apparent – as they have in MegaMax- lots of noise and vibration.

Good stepper drivers are DSP based and automatically sense resonance and damp it electronically.  They use phase controlled sine wave currents to drive the motors smoothly.  Fortunately, DSP stepper drivers for NEMA-23 size motors are pretty cheap.   Here’s video of the DM542a driver pushing a NEMA-23 motor around.  I have ordered a DM542a driver.

The best power supply for stepper drivers is not a switcher, and running steppers from a switching supply will often result in a dead power supply.  I will be building a simple, unregulated transformer, rectifier, and filter cap supply to go with the new driver.

Next came the question of how to determine how much torque is needed to properly drive the Y-axis.  A bit of research took me here: Motor size calculator.  You just select the scheme for which you want to size the motor, enter the appropriate data, and it magically tells you how much torque you need to do the job.  When I ran the numbers on MegaMax, it told me that I need about 350 oz-in of torque (about double the torque of the motor I have).  I did a quick search and found a Chinese made (of course) 425 oz-in motor for $50.  Also on order…

The motor mount I am using is designed for a NEMA-34 size motor with which I use an adapter plate to allow the NEMA-23 motor to fit.  Since I’m buying a new motor anyway, why not just get a NEMA-34 motor?  It turns out that the best stepper for the job is generally the smallest motor that can provide the necessary torque.  A NEMA-34 motor could provide much more torque but the detent torque and rotor inertia would work against smooth and fast operation, and require a bigger power supply.

Back side of MegaMax showing motor mount, adapter plate, flexible coupler, and drive screw  in Y-axis.

Back side of MegaMax showing motor mount, adapter plate, flexible coupler, and drive screw in Y-axis.

 

 

 

 

 

 

 

 

 

 

 

The ATmega2560 and RAMPS boards will be replaced by a SmoothieBoard.  It has a much faster processor, much better connections for motors/external drivers, etc.  It currently lacks an easy way to add an LCD controller, so I may have to connect to a computer to start prints up (it has ethernet and a built in web server so it can be accessed from any computer on the network).  When a clean way to add an LCD controller becomes available, I’ll add it.  SmoothieBoard review