Home / Limit switch

There has been some discussion about the need for a way to “know where you are” with the Openflex scanning stage. It was suggested that a home switch, indicating when the stage was at its center of motion, or close to it, would be better than a limit switch, indicating that the stage was at one extreme of its travel. I decided to try to develop such a thing. The general idea I’m showing would work for either an end-stop or a mid-scale home, but what I describe here is the latter.
I had been made aware, from work on another project, of the availability of cheap Hall-effect magnetic switches, which gave a binary output depending on the magnetic field around it (https://www.digikey.com/en/products/detail/diodes-incorporated/AH3377-SA-7/6124928). I also was aware of the existence of tiny rare-earth magnets; the ones I chose were 1/16” diameter x 1/32 thick (~1.6mm x 0.8mm) (MAGCRAFT® NSN0591 - Rare-Earth Disc Magnets). As part of this other project, I had designed a small PCB to hold the Hall sensor and a couple of passive components and some connectors. It seemed that could be the basis of some experiments with the idea.


The magnet is very hard to handle. I lost it several times. Scanning the floor with a strong refrigerator magnet always found it! You can see that the PCB is mainly full of connector pads. The actual electronics is only a few mm^2 in the center. I was able to remove most of the upper part of the board without breaking the connections to the chip, so that it could fit onto the microscope base (see later).
I first made a setup using some micrometer-driven translation stages, so I could assess the behaviour of the switch under the same conditions it would encounter on the microscope, i.e. with the magnet moving in the plane of the sensor, rather than perpendicular to it as it is intended to be used. The setup
is shown below. I connected the sensor output to an LED, so it would light up when the switch was activated. That way I could focus on the micrometer readings without having to look at a meter to know when the switch activated.
With this setup I could control the vertical and horizontal relative positions between the magnet and sensor, and also the spacing between the sensor and the magnet. The magnet and sensor are both glued to wooden blocks, to be sure there was no interference with the magnetic fields from the translation
stage components. The separation in the photo is about 0.5mm, which I felt was optimum, giving consistent actuation positions when translating the magnet.
Having established that the scheme could work, the first decision was where to put the switch. The easiest place is on the actuator, because that only moves in one dimension, whereas the rest of the stage moves in two, making life very difficult for a switch. The actuator arm is hidden from view normally, so I first had to expose it. This is easily done by cutting through the plastic, which I did (carefully!) with a bandsaw.

Mounting the magnet was a two step job. In order to bring the magnet and sensor to the correct separation, since I couldn’t easily recess the sensor PCB, I had to pack up the magnet by about 1.5 mm. I used a small piece of aluminium sheet, and glued the magnet to that first. That made handling the magnet much easier. Before gluing the magnet, I had to make sure it was facing the right way since the sensor is only sensitive to fields in one direction. I established which way was correct by powering up the sensor and offering it up to the magnet, then flipping over the magnet until the switch activated. I
then marked that face of the magnet with a black marker for future reference. It was easy to glue the aluminium/magnet piece to the actuator in roughly the right position. A final design would make proper provision for holding the magnet in the actuator.

I then glued the chopped-down PCB to the actuator housing. Once I was satisfied that the switch operated correctly, I attached a step motor so I could record the axis position at the point of operation in a more precise way. Driving the motor using the Arduino commands in the terminal monitor proved convenient. I made several sets of measurements of actuation position. The positions varied by around +/- 50 steps, and had a hysteresis of around 2000 steps. I don’t know how much of the hysteresis is electronic and how much is mechanical. I always removed backlash by backing off a few thousand steps and then measuring the on-off transition in the direction which pushed the actuator against the O-ring spring; in my experience that is more reliable than relying on the spring tension to restore the actuator position, and should give more reproducible results.

If I understand the motor gearing correctly, 100 steps is around 6 microns at the actuator, 12 microns at the sample position. I believe that is adequate for this application.
If the community is interested in this setup then it could be easily “civilized”, by designing a custom PCB, and redesigning the actuator foot to hold the magnet, and the microscope body to accommodate the PCB in a well-defined position. I am happy to make the PCB, but I don’t know the CAD software
which everything is drawn in so I would need help getting that done. I would be happy to print such a redesigned instrument and check it out.
As I mentioned, a similar setup could work as an end-of-motion limit switch. The magnet could be embedded in the bottom of the actuator, and the PCB in the microscope foot. Is there interest in that version?

4 Likes

Hi @siddons this looks really nice! I think homing the stage to 12 microns is definitely sufficient for most of the things you’d want it for - ensuring you’re roughly in the centre of the travel range, or figuring out an automatic compensation for the non-planar motion of the XY stage. This ticks a lot of the boxes for me, but one feature I’d be keen to see is knowing, without having to search, which direction you need to move in to find “home”. Is that something that’s possible with a Hall effect sensor? So far I’d assumed it would only work with an optical sensor (using a flag that blocks the beam when you’re below home, and treating the dark-bright transition as the home position).

There was a previous implementation with microswitches in the foot, but we hit an annoying problem, which was that either we needed to put it high enough that it limited the travel, or it became too slow to reach the bottom of the travel and “home” the system. I wonder if this would be a nice replacement for that - because you could have the “home” position close to one end of the travel (which means you usually know which way to move to hit it) but without introducing a mechanical limit.

I think for what I’d like to use endstops for, knowing which direction to move in is fairly important - but I’d be keen to hear from others what kind of solution would work best.

I think there are two different functions that people might want. End indicators so you don’t go over range and break things. I don’t think you can do that without them being at the end, and are either end stops at the very end, or are close to the end with some directionality. The other is a fiducial mark, probably at centre. This is when you know basically where you are, but need a periodic check. You would search over a fairly small range of motion where you think it should be. If it is not within that range you have to go to an end or put an error flag.

Hi Richard,
My first approach was to implement a limit switch, but I was steered away from that. As I said in my note, it would be trivial to implement it as a limit switch. You would need to make a cylindrical cavity in the bottom of the actuator (what you see if you look at the bottom of the microscope) and make a recess in the foot to accommodate the small PCB with the switch. I have attached an stp file of a draft of the PCB so you can see what I’m talking about. I would need to do a test to find the actuation distance for this geometry, I’ll try to do so.The magnet is 1/16"diameter x 1/32 thick. I bought 200 for $12, so if you want a few to play with I’d be happy to send some. Take a look at the board, and if you think it might work I’ll get a few made. I have no clue how to edit the scad files to make any of that happen. It looks like a nightmare to me:))
Pete.

(Attachment home_switch.stp is missing)

Sorry, first time my attachment was rejected. “stp” instead of"step"!

Hi Richard,
My first approach was to implement a limit switch, but I was steered away from that. As I said in my note, it would be trivial to implement it as a limit switch. You would need to make a cylindrical cavity in the bottom of the actuator (what you see if you look at the bottom of the microscope) and make a recess in the foot to accommodate the small PCB with the switch. I have attached an stp file of a draft of the PCB so you can see what I’m talking about. I would need to do a test to find the actuation distance for this geometry, I’ll try to do so.The magnet is 1/16"diameter x 1/32 thick. I bought 200 for $12, so if you want a few to play with I’d be happy to send some. Take a look at the board, and if you think it might work I’ll get a few made. I have no clue how to edit the scad files to make any of that happen. It looks like a nightmare to me:))
Pete.

home_switch.step (190 KB)

Following the above discussion, I set up my XYZ micrometer stages to find out where one would need to mount the magnet and PCB to implement a limit switch. It seems the actuation distance for motion perpendicular to the PCB is 2 mm. If we want to put it into the microscope foot, the PCB would need to be buried in the foot so its top surface is flush with the existing foot surface (which currently acts as a hard stop for the motion), and the magnet should be embedded in the actuator by ~2 mm. Can that work?
Pete.

I thought about this some more, and decided to try to hack something up to see if a second limit switch could be added at the other end of the motion. I believe it could, if one could get access to the top of the actuator. I cut into the other (Y) axis on my sacrificial microscope base and discovered I could attach the small magnet to it quite easily (well, after a certain amount of fiddling to figure out how to actually put it there :slight_smile: ). See the picture below.20210221_141124|375x500

The top of the actuator enclosure is actually 2.2 mm thick, but luckily it gets thinner in the center, going down to around 2mm; just the spacing we need for the switch to actuate. The PCB I have for testing these ideas is a cut-down board for another project, so I can’t actually install it and demonstrate its functioning, but holding the board in place and moving the stage by hand it clearly does the job. Space is limited up there, so there will need to be a special PCB designed (not a big deal) and the large gear will need to be spaced off by adding a nut to the leadscrew, and the motor also spaced off by the same amount (maybe some washers).

Next, I’ll try to mock up the lower limit, although it will somewhat shorten the travel in that direction, since a proper job would need redesigning the foot to accommodate the PCB.