584,829 active members*
4,927 visitors online*
Register for free
Login
Page 1 of 63 1231151
Results 1 to 20 of 1243
  1. #1
    Join Date
    Oct 2005
    Posts
    2392

    Electronic home switches made easy!

    Hi, my Honeywell hall switches arrived and I figured it might be good to start an open-source thread on using electronic hall switches for home sensors (or limit sensors).

    Please contribute to the thread! Especially if you have any experience with electronic (contactless) sensors on your CNC machine, I've searched this forum a couple of times and there seems to be a lack of information on them.

    Hall Effect Switches.

    I chose the Honeywell SS441 sensor as it seems common enough and has some decent features. There is also a SS541 sensor, that seems to be the same device but in a surface mount package that requires a special PCB.

    The SS441 is probably easier to use for most people as it has legs that are more easily soldered.



    There are a few sensors in the range. The SS441 is "unipolar" meaning it just needs the presense of a magnetic field to operate. The "bipolar" sensors can detect if a magnetic field is North or South, which is not needed for limit switches.

    The SS441 is suited for lower strength magnets, and is temperature compensated. It's temperature compensation matches that of lower strength (older style) magnets.

    My initial testing showed that the new super magnets give a greater sensing distance from magnet to sensor, but this seems to reduce sensitivity as we need to detect a close precise distance. So unless testing proves otherwise it seems that older style low-power magnets are the best for this application.

  2. #2
    Join Date
    Oct 2005
    Posts
    2392
    Where to buy them;

    I bought them from Farnell, they were $3 each in the catalogue but when I phoned to order they were only 78 cents each.

    311-1477 Honeywell SS441A SENSOR, HALL EFFECT


    Datasheets;


    SS441 Datasheet;
    Honeywell SS441 Hall Switch.pdf

    SS541 (surface mount version) Datasheet;
    Honeywell SS541 Hall Switch.pdf


    How to test the sensor.

    The SS441 and SS541 have 3 legs;
    + (+5v power)
    - (0v ground)
    O (Output)

    The datasheet says 4v to 30v is ok for power, but I used +5v regulated as that is available on my CNC machine (and most machines) and using regulated voltage for the power eliminates one variable that might affect the sensing characteristics.

    The easiest way to understand these sensors is to see the output like a switch to ground, whenever the magnet is present.



    This is a very simple test rig that only needs a resistor and a LED. When the magnet is present the Output leg switches to ground and the LED lights up. The test rig took about 30 seconds to make, and was powered from +5v and ground via the Red and Black wires.


    Test rig results

    This worked well. I used a 1.5k (1500 ohm) resistor and a high brightness LED but the resistor value is not critical nor is the type of LED.

    The sensing surface of the SS441 is the front (or back) face. When a magnetic South field is present near the front face it switches on (Output connects to ground). Likewise it switches on the same if a North field is near the back face of the device.

    The front face has the writing and sloped sides. The back face is flat.

    I tested a few magnet types and settled on 2 small bar magnets that operated the sensor from about 5mm (3/16"). Hysteresis was about 3mm (1.8") or less.

    Hysteresis means that once the sensor turns on, the magnet must be withdrawn a certain distance for it to switch off again.

    Using a lower strength magnet means the magnet must be closer to activate the sensor, and the hysteresis is much smaller, and the repeatability of the "on" trigger point is better as this is over a smaller physical distance.

  3. #3
    Join Date
    Oct 2005
    Posts
    2392
    Mounting the sensors

    If you have the smaller, surface-mount SS541 sensors they will need small PCB made, or some tricky soldering.

    But I deliberately bought the SS441 to allow easy soldering. They can be soldered onto standard 0.1" stripboard ("veroboard" brand or similar) but in a pinch you could just solder the 3 wires to the 3 legs and secure the lot with a blob of epoxy.



    I cut 2 small pieces from 0.1" stripboard, leaving just 3 strips (to solder to 3 legs). The little PCB are about 10mm x 20mm (3/8" x 3/4").

    When bending the legs make sure you bend them out AND down, so only the points at the end of the legs touch the PCB strips. This makes it easier to solder and has less chance of shorting between legs.

  4. #4
    Join Date
    Oct 2005
    Posts
    2392
    First tests on the CNC machine

    I glued the little sensor PCBs onto small pieces of plastic using non-acetic (non corrosive) silicone as the glue. This will allow testing but also allows for removal and repositioning if needed.



    For the X axis I glued the magnet onto the moving part and the sensor PCB onto the gantry.

    The end of the magnet just covers the face of the SS441 sensor when at the home position. There is about 2mm gap between. It triggers the sensor when approaching, about 10mm (3/8") before it reaches the home position, about 5mm between the end of the magnet and the edge of the SS441.

    This will allow a safety margin of up to 10mm when moving home just in case it has skipped some steps in either way.



    On the Y axis I glued the magnet onto the moving table, and the sensor PCB to the machine's base plate. The distances are similar to the X axis setup, it triggers the sensor when approaching, about 10mm before reaching home.

    I'll let the silicone glue set a bit overnight and tomorrow I'll write some software to test the repeatability of both sensors with the machine moving home at different speeds.

  5. #5
    Join Date
    Jun 2003
    Posts
    2103
    Roman I will be watching this thread. I only wish I had something to give to it, but alas.....electronics is not my strong point.

    Mike
    No greater love can a man have than this, that he give his life for a friend.

  6. #6
    Join Date
    Feb 2009
    Posts
    1290
    Very nice write up.
    For a inexpensive 5VDC power supply, I used an old cell phone AC Adaptor with my optical home switches.

  7. #7
    Join Date
    Oct 2005
    Posts
    2392
    Thanks for the interest guys!

    Quote Originally Posted by turmite View Post
    Roman I will be watching this thread. I only wish I had something to give to it, but alas.....electronics is not my strong point.
    ...
    Actually that makes your viewpoint very valuable to the thread! As an electronics guy I know roughly what info to provide to help electrical people use these sensors but I don't know how scary this looks to a person from a non-electrical background. I've been trying to explain it simply and would appreciate feedback on whether I am making sense and making the sensors seem easy to use, or if it seems too hard or I am explaining it badly etc.

  8. #8
    Join Date
    Oct 2005
    Posts
    2392
    Actual sensor testing on the machine!

    Software test procedure;
    1. move the axis well past the sensor (eliminates backlash)
    2. move back close to the detect point
    3. slowly move back in 0.01mm steps, until detect
    (repeat for other axis)

    Results;

    Speed 4mm/sec;
    X Y
    994 873 (9.94mm, 8.73mm)
    993 874
    993 873
    994 873
    993 874
    994 874
    993 874
    993 874
    993 873
    993 873

    Speed 2mm/sec;
    993 873
    993 873
    993 873
    993 873
    993 873
    993 873
    993 873
    992 873
    992 873
    992 872
    993 873

    Speed 1mm/sec;
    992 873
    992 873
    992 873
    993 873
    992 873
    992 873
    992 873
    992 873
    992 873
    992 873

    Speed (back to) 4mm/sec;
    992 873
    992 873
    993 873
    992 873
    992 873
    992 873
    992 874
    991 873
    992 873
    991 873

    About the results;

    The results are interesting! Firstly my machine repeatability seems to be worse than the sensor. The first set of tests with cold machine you can see +/- 0.01mm noise, probably my leadscrews being cold and looser in my plastic leadnuts.

    I varied the speed of the tests, from 4mm/sec down to 1mm/sec. There seemed to be a little more error at 4mm/sec than the two slower speeds, so I will set it to 2mm/sec for future use.

    I know my screws tighten up a bit and accuracy increases after a few minutes use, this is visible as the tests progress. There also seems to be some sign of my leadscrew getting longer as it warms up, over the full set of tests which took about 10 minutes you can see about 0.02mm of increase in leadscrew length.

    Conclusion;

    1. My machine is probably repeatable to about 0.02mm (0.0008") when cold
    2. My machine is probably repeatable to about 0.01mm (0.0004") when warm
    3. The sensor is most likely more repeatable than my machine!

    I really don't think I can get any more accurate results than these. Moving my machine in 0.01mm steps makes its own error, because a stepper motor slowly moved one step "jerks" from step to step, and obviously my machine has friction and slop, so the actual distance "jerked" each 0.01mm step may be slightly different.

    You might notice that my Y axis is a bit more repeatable than X, this is probably because it has much less mass to move, less bearing stick, and a shorter leadscrew with less expansion. (edit) I just realised with my Y axis the home sensor is at the stepper motor end, so it is not affected by leadscrew thermal expansion (or is not measuring leadscrew thermal expansion).

    The results do look pretty good! I'm happy with the sensors and their present locations, which detect about 10mm before home. So they got glued down with a lot more silicone and will get some more testing over coming weeks.

  9. #9
    Join Date
    Oct 2005
    Posts
    2392
    Stepper motor error.

    There are 2 homing errors possible with stepper motors;

    1. Mechanical (jumped steps)
    This is the easy one. If a stepper motor is overloaded physically by some problem it will "jump steps". The armature of the stepper motor jumps to another position in the motors magnetic field. This commonly happens when your cutting tool tries to cut too deep or your machine tries to move too fast etc.

    A typical 200 step motor has 4 full steps, times 50. So there are exactly 50 positions on the magnetic field and when it jumps steps it must jump to one of them. So the minimum error is exacty 1/50th of a rotation, or 7.2 degrees. So it is easy to detect if the motor has jumped steps, and easy to correct.

    I forced my X axis motor to jump once, and recorded the results;

    (before jump)
    992 873
    992 873
    993 873
    992 873
    992 873

    (after jump)
    1008 873
    1008 873
    1007 873
    1007 873
    1007 873

    The X axis is showing an error of about 0.16mm in each step, which is because my X axis leadscrew moves 0.16mm for every 7.2 degrees of motor rotation. Obviously it has jumped exactly one magnetic "pole" and the software can easily compensate by moving the machine 0.16mm.


    2. Software/electrical (step pulse error)
    This one is a little harder. If your software has glitched or your electricals have experienced a spike or surge, then the stepper motor driver may have received additional "step" pulses or lost "step" pulses.

    The amount of error could be anything, in the resolution of your driver (ie in microsteps).

    This error is hard to detect, as it may be smaller than the repeatability of your machine. If you get a fault like this the best solution would be to turn the drivers off, and when the drivers start up again they will be on the "home" step. Then you can do the test above and align the steppers to the correct 7.2 degree magnetic "pole" giving zero step error.


    Homing procedures?

    Obviously it is going to be up to your CNC software to decide how to handle initial homing (at turn on) and detect/correct homing errors.

    The good news is for initial homing that it only needs to detect within +/- 3.6 degrees of motor rotation to find the correct magnetic pole, and then the system can be aligned to zero microstep error.

    If your software re-homes everytime it goes back to the sensor, this can be good as it will compensate for errors or thermal expansion etc, but can be bad as it will always be changing.

    I would be interested in hearing other people's homing/correction methods, or those used in standard CNC software. It might be good to start a discussion of the homing technique and possible changes to the sensor setup that might improve homing accuracy!

    For my system I am currently aligning to the correct stepper magnetic pole and then using the native accuracy of the machine so technically there is zero microsteps error after homing, and any real error is caused by the mechanicals of the machine.

    That's all I have for now, please comment and if you want me to do any specific sensor tests just speak up.

  10. #10
    Join Date
    Jan 2009
    Posts
    72
    Thanks for this thread Roman,
    I am looking forward to understanding a little bit more about electronics










    All Australian Politicians should serve two terms
    One in Parliament
    And one in jail

  11. #11
    Join Date
    Jan 2005
    Posts
    15362
    Hi RomanLini

    This has been use before, but like you say not much imformation on them any were, that is because they have very limited use on metal cutting machine, they would be ok on wood working machines,were you only have wood dust to deal with

    The magnets get covered with metal chip, so you know what happens next, & there's no way to stop this from happening

    There are lots of machines that use proximity sensors ,but they don't use magnets as there trigger

    You have done a great write up on this, that should help anybody that wants to try it
    Mactec54

  12. #12
    Join Date
    Oct 2009
    Posts
    272
    RomanLini,
    I too will be watching this thread!
    You have done a great job explaining/describing these sensors (even I understand your explanations). You made/make it seem as though even I could make these quite easily.
    If I had an apple, I would give it to you for being such a good teacher (perhaps a cold one will do)! :cheers:

    Randy,
    I may not be good....
    But I am S L O W!!

  13. #13
    Join Date
    Oct 2005
    Posts
    2392
    Thanks for the feedback guys! Hope more people will use these nice accurate no-moving-parts sensors.

    Since my last couple of posts were lots of words and test results, here are a couple of "easy" diagrams;



    Inside the SS441 hall switch
    The "brain" part is powered by the + pin; 4v to 30v, but +5v is a good enough choice. The brain does stuff like the temperature compensation, and ensures clean fast switching at the correct magnetic field strength.

    The "switch" part behaves basically like a normal switch. The switch is actually part of the silicon chip inside but we use it just like a normal switch; one pin is connected to ground, the other pin is the Output pin. Note! Because it is a silicon switch (FET) it is limited to only switching small currents (less than 20mA).




    Connecting the hall switches
    The +5v and ground are supplied from the controller, and the same +5v and ground can connect to all the hall switches on your machine.

    The output from a hall switch is connected back to a "home" or "limit" input on the controller.

    Some controllers have an internal pullup resistor, or you can select an internal pullup resistor. If not, then it is easy enough to connect an external pullup resistor, a value of 2200 ohms (2.2k or 2k2) is fine. Note! It should not cause a problem if you add the resistor when it is not needed, so if in doubt you should add the resistor.


    If anyone has specific info on a controller and how it would connect to these switches please post any info you have! I built my own controller so I am not familiar with all
    the common controllers and their specific setup.

  14. #14
    Join Date
    Oct 2005
    Posts
    2392
    Quote Originally Posted by mactec54 View Post
    This has been use before, but like you say not much imformation on them any were, that is because they have very limited use on metal cutting machine, they would be ok on wood working machines,were you only have wood dust to deal with

    The magnets get covered with metal chip, so you know what happens next, & there's no way to stop this from happening
    ...
    That is a good point mactec54, these sensors are not very useful in a machine that will be cutting steel or ferrous metals.

    But I think they are ideal for router type machines cutting wood, plastic, aluminium. Even with the small chance of getting metal shaving stuck to the magnets (which would change the sense distances) they are still more accurate and reliable than any type of mechanical microswitch.

    I want to make that point again that the best type of magnet for these sensors is a small one with a weak magnetic field, this gives closer sensing and better distance accuracy. Small weak magnets are also less likely to collect trash, and can be designed for easy cleaning as only one end of the magnet needs to be accessible to trigger the hall switch, the rest of the magnet can be buried inside a wood or plastic block.

  15. #15
    Join Date
    Oct 2005
    Posts
    2392
    Making mounts for the hall switches

    I know people don't want to go sticking sensors all over their machines with silicone (like my test setup above!) so this evening I put aside some hours to make some mounts out of clear acrylic (some scrap I had lying around).

    I roughed out some simple designs that can be cut out easily from 10mm (3/8") acrylic and from 6mm (1/4") acrylic.



    This mount above is 10mm, and has a deep pocket to hold the wiring, solder connections etc. There is also a shallow pocket of 2mm depth to hold the hall switch, to it is close to the surface and allows the magnet to come close to the hall switch.

    One drawback is that it needs to have a small hole drilled to insert the wires, and a special height pocket for the hall switch so there are 3 heights to be cut. Another drawback is that it needs more epoxy to fill it, and people using 5-minute araldite would be better with a small pocket that needs less filler.



    Above is my second design, I tried to simplify the mount to the simplest features possible. It is made from 6mm acrylic and only needs one height cut, for the shallow pocket and screw area are both cut about 2.5mm deep.

    It only needs a small amount of filler epoxy, and is more compact in general. The down side is that it is fiddlier to solder the wires because it is smaller and it is not as sturdy as the 10mm mount.



    Above is a (fuzzy) photo of the 2 mounts, on the right the 10mm mount shows the hole drilled for the wires, and the deep pocket for the soldering, and uoi can just see the tiny shallow pocket for the hall switch.

    On the left is the much simpler mount, with just one height cut for the pocket and screw recess. The wires are inserted by the simple slot.

    Below shows that I made 3 of the smaller mount, because these are smaller than the 10mm mount I think they will be better for my small machine.



    Next I soldered the wires to the hall switches and inserted them into the mounts. I added 2700 ohm resistors directly on the hall switches, there is room in the mounts to do this and it means I don't have to add resistors later.

    The hall switches were quickly glued down with a little spot of superglue.

    Then the wires were sealed with a hot melt glue gun so the epoxy won't leak out before it sets! You can also see where i glued the mounts onto a flat piece of plastic to hold them neat and level while pouring the epoxy. I put an extra glue blob on the wires too to hold them steady.



    I used a shielded 2-core cable for the larger mount. This is cheap microphone cable, red+white+copper shield. It's quite tough, very flexible, and the shield is nice to have on longer cable runs.

    On the small mount I used 3 wires, red, black and white. This will only have wires about a foot long so the shielding is not needed and was easier to solder in the confined space of the small pocket.

    The epoxy is setting at the moment, i'll post photos of the finished mounts tomorrow.

  16. #16
    Join Date
    Oct 2009
    Posts
    272

    Small (switches) Business Startup!

    RomanLini,
    Too bad, you already posted the instructions for these swithes. People would've had to buy them from you! I see people (all thumbs, like me) willing to buy them from you anyway. You should come up with a price and offer them for sale!
    BTW, great job documenting the design and assembly!
    I may not be good....
    But I am S L O W!!

  17. #17
    Join Date
    Oct 2005
    Posts
    2392
    Prototype mounts are finished!

    I let the epoxy cure for about 14 hours on my hotplate at 45 degrees C.

    The epoxy had a drop of red colour in it to make it more visible in the photos, but only a small drop because I wanted the parts inside to still be visible.



    The mounts were tacked down to a piece of plastic with hot melt glue, this will break straight off later.

    Below you can see the small mount leaked a bit! When I sealed the 3 wires with the hot melt glue it didn't get between the wires, so it slow leaked there. I countered by topping it up a bit more and because the mount was warm (on the hotplate) it hardened up faster than it leaked so it wasn't a big problem.

    The epoxy looks a lighter colour red in the small mount because it is much less thick.



    Below are the 2 finished mounts
    after breaking off the hot melt glue. If you chill the mounts in the fridge for a while the hot melt glue is brittle and breaks off pretty clean. Don't mess with the hot melt glue if it is warm, it just smears everywhere!



    Both mounts are successful and usable.

    Below you can see the large mount with the round drilled hole for the cable was a better result (cleaner, physically stronger, no leaks) than the simple slot used on the small mount. The round cable was better than 3 wires, and the round hole works better than the simple slot.

    The epoxy has nicely filled the tiny void around the cable in the round hole. The cable has no change in flexibility where it exits the mount, so there is no evidence of epoxy being sucked into the cable.



    The last photo below shows the volume of epoxy used. The larger mount used 4 times as much epoxy, and you can see a slight sink in the top surface where the deep pocket of epoxy has contracted as it cured.

    The small mount didn't have this problem because it was very shallow.




    Conclusion

    Both mounts came out good. Apart from the downside of the larger mount being well... larger! it was easier to solder, supports and seals the cable better, mounts the sensor at a known height and is overall more rugged and less likely to break.

    The pocket does not need to be so deep, this was obvious on the small mount which had a 2.7mm deep pocket. So the large mount could just have a shallower pocket than the 8.5mm deep pocket I used here, and this would fix some of it's issues.

    Holding both mounts in my hand, the larger mount feels much better, sturdier, and overall seems like a much better design.

  18. #18
    Join Date
    Oct 2005
    Posts
    2392
    Quote Originally Posted by DIYaholic View Post
    RomanLini,
    Too bad, you already posted the instructions for these swithes. People would've had to buy them from you! I see people (all thumbs, like me) willing to buy them from you anyway. You should come up with a price and offer them for sale!
    BTW, great job documenting the design and assembly!
    Haha! Nah this was never meant to be for profit! Open-source is for giving back to the community, I like to provide something back so the net total of my participation here is positive.

    From a manufacturing point there's probably 15 minutes of soldering and fiddly work with each mount, which is perfectly ok for open-source building them yourself but with the high labour costs here in Australia it just wouldn't be worth producing finished units to sell.

    But, if enough people show an interest I can improve the mount design a little and cut 100 or so mounts in 10mm clear acrylic, then supply them in kit form with;

    3 mounts
    3 hall switches
    3 resistors
    ?? yards of shielded cable

    I have a ton of commercial projects on this year so I really am not that fussed about trying to make money out of this. Maybe if someone else wants to make kits (which is basically a CNC machining job) I would be happy to act as unpaid advisor and pass on ideas for improving the mounts etc, although I would like to see it stay within this thread so it would acknowlege my input, and everyone else's input (open-source remember).

  19. #19
    Join Date
    Feb 2007
    Posts
    4553

    Question

    RomanLini,

    Have you tested the repeatability yet?

    Very nice work,

    Jeff...
    Patience and perseverance have a magical effect before which difficulties disappear and obstacles vanish.

  20. #20
    Join Date
    Oct 2005
    Posts
    2392
    Hi Jeff, yep see posts #8 and #9, the figues there are repeat tests.

    As far as I can tell the sensors repeat better than 0.01mm (0.0004") but my machine coord system only reports in 0.01mm resolution, and once my machine gets warm my leadscrews grow 0.02mm in length or more.

    Based on my Y axis where the sensor is on the motor end of the leadscrew (so it has minimal leadscrew thermal expansion), the repeatability seems around 0.01mm and is probably better than that.

    If someone has a machine with a low lead-per-turn screw (like 1/2" 10) and heavy high friction axes, (like a milling machine) I'm happy to mail them a sensor and they can test repeatability.

Page 1 of 63 1231151

Similar Threads

  1. Replies: 3
    Last Post: 11-05-2013, 02:54 AM
  2. Home made electronic for Spindle control
    By dinko in forum CNC Machine Related Electronics
    Replies: 1
    Last Post: 05-31-2012, 02:52 PM
  3. Auto backlash sensing with electronic home switches!
    By RomanLini in forum Open Source CNC Machine Designs
    Replies: 8
    Last Post: 11-14-2011, 02:36 PM
  4. The relationship of limit switches to home switches.
    By MikeAber in forum CNC Machine Related Electronics
    Replies: 4
    Last Post: 11-04-2004, 08:28 PM
  5. Home made CNC mill (and some products made by it)
    By gcamlibel in forum DIY CNC Router Table Machines
    Replies: 23
    Last Post: 04-05-2004, 11:54 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •