Mouse-controlled Microscope

Arduino + geared stepper motor control of microscope XY stage and focus. Inspired by need for an amputee to do veterinary lab work.

Similar projects worth following
A relatively inexpensive lab-grade microscope is converted to be operated using a mouse.

Using a microscope sourced on eBay, designed custom 3D-printed motor mounts and gears to control the XY stage and focus. With the exception of using longer screws to replace existing microscope screws so that the motor mounts can be secured, and gluing on some magnets for home positioning the XY stage, there are no modifications needed for the microscope.

An Arduino MEGA is used with a prototyping shield to manage sensor, mouse input, and motor driver control. The control system is mounted in a custom 3D-printed box with external illuminated rotary encoder and push button to manage settings and modes.

A separate 3D-printed housing holds 3 stepper motor controllers; one each for X and Y movement, and one for focus. Geared steppers are used to ensure fine control.


Updated previous version to include hall sensor mounts and license. Mechanical stage motor mount for OMAX Microscope 40x-2500x. This body style However, may be able to modify for other bodies.

scad - 5.00 kB - 07/08/2017 at 18:24



A model of the 28BYJ_48 geared stepper motor. Useful for creating mounts and making sure that your mount matches the motor. For example, I import this model and have an option to display it "in place" or slightly offset from the mount I am designing...

scad - 3.65 kB - 07/08/2017 at 17:32



A simple block mount for the 28BYJ_48 motor.

scad - 1.59 kB - 07/08/2017 at 17:31


gear_generatorKSK 2.scad

Modified from design by Leemon Baird, 2011,,

scad - 15.46 kB - 10/31/2016 at 04:52



Case for ULN2003 breakout boards.

scad - 4.59 kB - 10/31/2016 at 04:51


View all 7 files

View all 13 components

  • Arduino Camp Demo

    ksk07/26/2017 at 14:31 0 comments

    I finished the main functionality for the scope last week and took to the University of Alberta Engineering DiscoverE camp for a demo. It was the main, end demo for a little talk I gave a grade 7-9 "Awesome Arduino" campers on the idea of "software-enabled everything". 

    It was a lot of fun to be there and answer some very good, and sometimes hard questions. They all got to play with the scope. I'll get to present to campers in the second round Aug 10th.

    All that remains is to update the Fritzing file, fix a bad encoder button red LED wire, and tweak and update the arduino source. Then, of course, post it all.

    Then on to the next project!

  • Hardware Done

    ksk07/19/2017 at 01:38 0 comments

    The hardware is finished.

    Three new photos are uploaded to the gallery and 2 were deleted as they no longer represent the current state. The new photos focus on the stepper mechanicals. To mount the focus motor I had to drill and tap the back of the scope, which was a little nerve-wracking as I was not sure how much metal there was. I did take things apart completely and could measure the cast thickness near my drill locations, but could not measure them as I did not have deep enough calipers.

    I also have made the Arduino control case larger because the original case, based on a RAMPS case, was cramped when it came to wiring. Instead of my hacked together protoshield, I bought a proper shield from Digikey and rewired everything, taking the opportunity to add a reset button and "centre" button. The latter will move the XY stage to centre the slide under the optics; seems like a nice thing to have.

    The XY homing algorithm works nicely and I have X motion working with the mouse. Y will be the same, just different motor address. Focus will be the easiest because I don't have to worry about endstops or coordinates. The focus will control the "fine" adjustment knob since that's what you will use most one coarse focus has been set by hand.

    The wiring between the scope and control boxes is still kind of ugly, but it does work.

    Tomorrow I will finish code and test so that it's ready to be demo'd on Thursday to 16 campers at the U of Alberta DiscoverE "Amazing Arduino" summer camp. Should be fun.

  • openSCAD update

    ksk07/09/2017 at 03:46 0 comments

    I realized that the uploaded model for the XY motor mount was not what I thought; it was missing the Hall Effect sensor mounts that are clearly shown in the photos. Not sure why and I could not find a source file that had them, so I suspect I made mods in openSCAD and then did not save them. Silly!

    I've also included the 28BYJ_48 geared stepper motor and mount source files (openSCAD) that are referenced by the XY motor mount.

    The case for the Arduino Mega controller was too small, so I made changes to make it taller. That provides more space inside for wiring. It also seemed a good idea to add a reset button and a second button that I can use for mode selection or something -- I've not yet decided as I need to review the existing code.

    The next, and final step is to design a mount for the third 28BYJ_48 that moves the fine focus of the scope. Two more gears are needed, so back to my custom openSCAD gear generator, which will likely result in an update to that source. The code to control fine focus should not be too hard; I will use left and right mouse buttons for closer (down) and father (up).

    This all will have to be done in the next 11 days as I need the unit to show to Grade 7-9 students at a summer engineering camp with a focus on Arduino programming. Quite looking forward to it!

  • Push to completion...

    ksk06/08/2017 at 21:55 0 comments

    I will finally have time to complete this project and publish all the code and remaining artefacts (e.g., focus motor control mechanical design files). The push comes from the need to have it done before mid-July so I can use it as part of some university summer camp sessions. Volunteered to help with beginning Arduino programming for grades 7-9 and very much looking forward to it.

    It is only the focus control that needs to be completed and it should be easy enough to build on the existing design and code base.

  • Delays...

    ksk03/02/2017 at 21:22 0 comments

    This not really an update, but more of a whiny excuse blarg.

    Paying work and home renovations keep getting in the way of completing this project. Plus revamping my MendelMax 2 printer means that I haven't yet printed the final motor mount and gears for the focus function.

    While I wait for the final paper work on a continuation of a customer project from last year (SDR stuff), I hope to find time to finish the the microscope project and write it all up.

    It will get done!

  • Catching up on previous docs

    ksk10/31/2016 at 04:59 0 comments

    Uploaded a schematic, some openSCAD files for motor mounts and controller housings, and a component list.

    Still to do:

    • Design motor mount for focus control
    • Add in code for focus control
    • Review modes and see if I can't add a "centre slide" function/mode
    • Tune mouse control of XY motion

    One probably concern is how to keep the lens from crashing into a slide. Ideally you'd need a way to know which lens has been selected (2 hall switches and 3 magnets?) and then a calibrated focus height... too tired to think of that now.

  • Progress to date...

    ksk08/24/2016 at 16:12 0 comments

    I will be adding source files, links, and other details over the next few weeks. Everything is or will be open-sourced.

    The motor mounts and gears that are matched to the manual control wheels on the microscope are all specific to the microscope I bought. I suspect that there are many models from the same company that can use the designs as is, but it's likely you will have to modify the designs for your own. That means getting out a rule and other measuring tools to determine mount points, etc.

    As of this initial post, what is working includes:

    • XY stage motors mounted
      • Gears made and mounted on steppers and matching microscope XY spindles
    • Arduino-based mouse input and motor control
    • Hall sensor XY automatic homing
    • Illuminated push-button rotary encoder and second push button mounted and interfaced to Arduino
      • Encoder push button used to enter parameter setting mode
        • Set fast and slow speeds for motors
      • Other push button used to change mode; fast and slow XY, fast and slow focus

    May try to add a "slide center" mode.

    Moving on to testing mouse XY control integration ("unit" tests complete), then starting on focus mechanical.

View all 7 project logs

Enjoy this project?



Travis Hale wrote 04/18/2018 at 09:11 point

Looks fantastic, i have a Radical RXL-4T microscope which is a very similar style to the one you did your work on and I am keen to automate it in a slightly different way (software control). 

I am wondering if you could share the gear measurements you used for the X and Y axis microscope stage (e.g. not the motor side), as the Files include the gear generator but i am not entirely clear on how to create the gears for the X and Y axis (to be coupled to the microscope), also could not see how the Z axis is attached to the microscope in the model?

Z axis is less critical to me, as i have managed a direct couple using a NEMA17 stepper motor, although it would be much easier to use the smaller stepper motors. Out of interest how was the speed of the Z axis using the small stepper motors (since i thought they were geared fairly slow) and you are controlling the fine focus?

Thanks for a great project!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates