Hall Effect Sensors as Limit Switches

RobCee
Posts: 587
Joined: Wed Jan 08, 2014 11:33 am
Location: Birmingham, UK

Re: Hall Effect Sensors as Limit Switches

Post by RobCee » Mon Jan 27, 2014 5:01 pm

CBB, Yes the + voltage I am using is the Arduino's 5vDC

I wanted to share this stuff as it sounds simple but is deceptively complex to the uninitiated (that's me!).
All my knowledge here is self taught, from reading and the old faithful, trial and error.

I was just doing the drawings and schematics for myself, but thought it would be good to share.
I will have to make some notes in the original posts to indicate the incorrect circuits though.

Rob
ShapeOko2 #3400 - Chinese 800W AC Spindle - Stiffened X-Axis - TR10 Z-Axis - Inverted Z Motor - Hall Effect Limits - Drag Chains & Custom Brackets

MeanderBolt
Posts: 560
Joined: Mon Nov 04, 2013 6:45 pm
Location: Georgia
Contact:

Re: Hall Effect Sensors as Limit Switches

Post by MeanderBolt » Mon Jan 27, 2014 5:52 pm

Hey Rob, I will reply tonight when I have a computer. My earlier reply (and this one) is via phone. I am getting my words crossed as editing sux on a phone.
Shapeoko 2 # 3569 - DW660
Current tool chain > Draftsight > CamBam > ChiliPeppr
Build log

CrazyBillybob
Posts: 199
Joined: Mon Dec 16, 2013 2:09 pm
Location: Ohio
Contact:

Re: Hall Effect Sensors as Limit Switches

Post by CrazyBillybob » Mon Jan 27, 2014 6:52 pm

RobCee,

As I double checked your Schematic I find myself questioning D1. What is it's purpose? Are you using it as protection for the Arduino inputs?

Image

forgottenCNC
Posts: 34
Joined: Mon Jul 30, 2012 6:36 am

Re: Hall Effect Sensors as Limit Switches

Post by forgottenCNC » Tue Jan 28, 2014 1:36 am

CrazyBillybob wrote:RobCee,

As I double checked your Schematic I find myself questioning D1. What is it's purpose? Are you using it as protection for the Arduino inputs?
...
The D1 (diode) is there to stop the other LED from turning on by limiting the direction current can flow. If you do not have the diodes in the above schematic when the hall effect triggers by pulling the output pin to ground (LOW) both LEDs are on a common section, so both LED will light up.



On another note If your looking for a hall effect sensor already wired - with LED, just plug and play. Freetronics does one

Schematic >> http://cdn.shopify.com/s/files/1/0045/8 ... pdf?100731

Note: they use a capacitor to minimize false triggers.

RobCee
Posts: 587
Joined: Wed Jan 08, 2014 11:33 am
Location: Birmingham, UK

Re: Hall Effect Sensors as Limit Switches

Post by RobCee » Tue Jan 28, 2014 8:44 am

Yes, the D1 diodes are working to allow the dual signals coming from the Max/Min limit switches to be combined for input into the single XYZ inputs on the Arduino.
Without them, the signal stays high and the Arduino never sees any limits. Both directional LEDs light up too!

They work as an AND logic circuit with the 'pull up' resistor behind them. You need an AND combination as the output signals you want are LOW, if you are looking for HIGH output, then you would combine them with a OR logic.

I'm away at the moment and will post a bit more on this when I get back later today.
ShapeOko2 #3400 - Chinese 800W AC Spindle - Stiffened X-Axis - TR10 Z-Axis - Inverted Z Motor - Hall Effect Limits - Drag Chains & Custom Brackets

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Hall Effect Sensors as Limit Switches

Post by cvoinescu » Tue Jan 28, 2014 9:23 am

According to the SS443A datasheet, the output is open-drain, so you don't need the diodes. You can just wire any number of sensors together in parallel, with a single pull-up resistor for all of them. The maximum current the sensor can sink is 20 mA, which gives 250 ohm as the minimum value for the resistor (at 5 V). Given the noisy environment, I recommend a value for the resistor at the lower end of the range (say 470 ohm).
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

RobCee
Posts: 587
Joined: Wed Jan 08, 2014 11:33 am
Location: Birmingham, UK

Re: Hall Effect Sensors as Limit Switches

Post by RobCee » Tue Jan 28, 2014 5:06 pm

@Cvoinescu - Thanks for that, it makes sense from the signal perspective. Are you saying that my 'pull up' resistor only needs to be 470 ohm?

On a practical note, all my LEDs are in one place, so I need the diodes to stop them all indicating at once in my latest circuit. Unless you can see a way to reconnect things so that they don't.
ShapeOko2 #3400 - Chinese 800W AC Spindle - Stiffened X-Axis - TR10 Z-Axis - Inverted Z Motor - Hall Effect Limits - Drag Chains & Custom Brackets

CrazyBillybob
Posts: 199
Joined: Mon Dec 16, 2013 2:09 pm
Location: Ohio
Contact:

Re: Hall Effect Sensors as Limit Switches

Post by CrazyBillybob » Tue Jan 28, 2014 8:38 pm

RobCee

I ordered a few of these http://www.ebay.com/itm/181273523876?ss ... 1439.l2649

To Try, they were about half the cost of the Freetronic ones.


Just want to point out that the limit switches are setup a OR . Because you only need one condition met to cause a reaction. Limit max switch or Limit min switch Triggers Arduino to stop.
AND requires two or more conditions to be met at a time. Like Limit MAX On and Limit Min OFF (but you'd have to use 2 Arduino pins for each axis to check for this in Software or a combination of AND gates and Inverter Gates... or NAND gates...... But I digress).

Thanks for explaining why you had the D1 there. I looked at it and just couldn't figure it out. It makes since to want only one LED to light if you have the display arranged in one area like you do. If you only had LEDs on each sensor and didn't mind that they lite up when either max or min trips you can eliminate an extra part.

Keep up the Good work. For being your first electronics adventure your doing GREAT!

Thanks,
CBB

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Hall Effect Sensors as Limit Switches

Post by cvoinescu » Tue Jan 28, 2014 9:15 pm

That makes sense. If you also have the LEDs, make sure you're not exceeding the maximum current sink capability of your optocoupler. Maybe size the resistors so that you get only 5-10 mA through the LED (which would still be plenty visible) and 5-10 mA through the pull-up. Also think whether you really need a separate LED for each end of an axis -- you can't possibly hit both at the same time, can you?
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

RobCee
Posts: 587
Joined: Wed Jan 08, 2014 11:33 am
Location: Birmingham, UK

Re: Hall Effect Sensors as Limit Switches

Post by RobCee » Wed Jan 29, 2014 6:20 pm

Cvoinescu - Thanks for the information here. I have thought about what I am trying to achieve and I was being overly complicated. As you noted, it is pretty obvious which end of the limits everything has hit, just by looking at the machine!
I have updated my schematics and the veroboard design and would appreciate your thoughts before I commit again.

As you suggested, my LED's resistor (R2) is 220ohm, so it is only drawing about 8mA. I did some calculations and I need about 500ohm to cover the 10mA current on the pull up resistor. I don't have anything around that value, so I put two 1k ohm resistors (R1) in parallel to make 500ohm.
The final part, which I don't have yet, is including a 47uF capacitor (C1) to suppress power spikes. I have only seen this done in other circuits, but it looks like it is simply connected across the supply. Is this correct, or have I misinterpreted it?

Once again, thanks for your input.

Here are the schematics - Pair of limit switches:
HallEffectSensorPairMk3.png
Hall effect sensor pair Mk3
HallEffectSensorPairMk3.png (44.47 KiB) Viewed 2669 times
Schematic - Three Axis pairs:
HallEffectSensorMultiplePairMk3.png
Hall effect sensors - 3 Axis Mk3
HallEffectSensorMultiplePairMk3.png (69.48 KiB) Viewed 2669 times
My VeroBoard design:
HallEffectSensorVeroBoard Mk3.png
Hall effect sensor VeroBoard Mk3
HallEffectSensorVeroBoard Mk3.png (242.15 KiB) Viewed 2669 times
/Rob
ShapeOko2 #3400 - Chinese 800W AC Spindle - Stiffened X-Axis - TR10 Z-Axis - Inverted Z Motor - Hall Effect Limits - Drag Chains & Custom Brackets

Post Reply