Hall effect Sensor - fails to dip to ground on longer cable

I have 22 arduino's around a model railway running colour light signals. Some actions are triggered by pins being switched by the points (turnouts) and some actions are triggered by trains fitted with magnets passing over Hall effect sensors.

The sensors physically nearest the arduinos are working perfectly, but all those that are located 5+ meters away don't trigger at all, no matter how strong the magnets are or how long or close you place them to the hall sensor. The arduino reads a normally high (pulled up) signal from them and actions are triggered when the hall sensor dips briefly to ground.

I have a 1uf cap across ground and 5v at all the sensors and the cables are twisted pair LAN cable. The sensor pins are pulled to 5v via a 330ohm resistor AND ground via a 10k resistor. Odd arrangement, I know... This is because the proto boards the arduinos are soldered to have been designed to be used with light sensors in a voltage divider arrangement (with a different set of code). I wanted to be able to use the same boards with either light sensors OR hall sensor without physical modification. This way I figured when I add the 330ohm pull-up for the hall sensor, the pull to 5v is much stronger (around 4.8v) and would work in 'reverse'.

Hmmmm.... Actually as I write that last paragraph I'm thinking that may be where my problem lies.... Perhaps my pull up is too strong, or perhaps I will have to hard-modify my circuits after all....

The only other things that springs to mind, though I haven't had a chance to test yet, is perhaps voltage drop over distance, but 5 meters doesn't seem far enough for that, even for 5 volts...? And if that was the case wouldn't the sensor pin simply receive too low a voltage in the first place?

I'm not sure if this would effect things but for the furthest sensors, to avoid running unnecessary long lengths of cable, I have fed the earth connection of the Hall effect sensors to a ground connection on the nearest arduino rather than the one it's sensor pin is connected to. All the arduinos on the layout are powered by the same common 12v bus via their v-in and ground pins. My relatively limited knowledge tells me that should be ok....?

Any insights would be appreciated!

Apologies for bumping this, but I haven't yet solved this issue...

The project (my uncle's O gauge railway) is physically a 3 hour drive away and won't be visiting again for some weeks. My plan is to try to replicate this issue at home where I can measure voltages in different locations on the circuit.

Meanwhile, is there anybody that may have any insight for me as to why the sensors aren't dipping to ground when on the end of a cable more than a few feet in length? Or a starting point for me to start looking into?

Thanks

Daniel

There are MANY different types of Hall effect sensors. Post a link to the data sheet for the one you are using.

Model: Honeywell SS443A

Here's a link to the product page: (my browser crashes when click the link tool at the top, sorry)

http://uk.rs-online.com/web/p/hall-effect-sensors/1811441/?searchTerm=181-1441&relevancy-data=636F3D3126696E3D4931384E525353746F636B4E756D6265724D504E266C753D656E266D6D3D6D61746368616C6C26706D3D5E5C647B337D5B5C732D2F255C2E2C5D5C647B332C347D2426706F3D313426736E3D592673743D52535F53544F434B5F4E554D4245522677633D4E4F4E45267573743D3138312D3134343126

...and the data sheet:

http://docs-europe.electrocomponents.com/webdocs/002e/0900766b8002e123.pdf

The symptoms you describe imply a cable or sensor fault - 330 ohms is a strong pull up and 5m of cable should have negligible resistance and not eough capacitance to matter with 330 pullup. The hall-sensor can handle a 330 pullup (just), so you have about the most robust setup on paper.

Is there a chance of bad interference to the cables causing damage to the sensors? Other than that just retest each part separately, sensor, cable, code... (check the pinout too!)

A digital pin only needs to be pulled up above 0.6xVCC for a "high". That's ~6k66 with a 10k resistor to ground. I would have picked 1k pullup resistors. Low enough for a good "high", and strong enough for 5+meters of ethernet cable. Leo..

Thank you both for your replies.

There is a certain amount of interference from the DCC system. A couple of functions performed by the same arduino boards involving a simple switch pulling down a digital pin when latched closed was causing problems early on over 5 foot+ cable. I had to stop using the arduino's integral pull-ups and use 2.2k external pull-ups instead. The internal pull-ups didn't always hold HIGH otherwise. This is partly why I went for a strong pull up with the hall sensors, and partly the way the protoboards are wired (sensor pin also attached to ground via 10k for when using same board with LDR's).

Could this interference be enough to actually cause damage? I hope not as I have at least 8 of these sensors on long-ish cables and they all behave the same :confused: All the hall sensors on 1-2 foot cable are working perfectly.

I suppose I could temporarily replace the 330ohm pull up with a variable pot and experiment with different values that way. I can explore this at home. When I'm next 'on the railway' I'll try pulling the cable length plus sensor away from any DCC wires eliminating any string interference and see if that makes any difference.

Thanks for your ideas, much appreciated!

Post a diagram showing how you have wired the sensors to the Arduinos. Did you run signal/ground of each sensor on one pair of the ethernet cable. And use 100n ceramic decoupling caps close to each sensor. Is nothing else using that sensor power or ground. Leo..

If you're powering the sensor with 5V and using a 330 ohm pullup, then this is getting too close to the max output rating of 20mA and I wouldn't expect it to switch all the way to GND. If the pullup is at the Arduino, then expect a bit more voltage to be dropped through 2x the cable length.

I would put a weaker pullup (as Wawa suggests) say 1K-4.7K for about 1-5 mA draw when the output is switched on right at the sensor. Test different values for best performance. Then, right at the Arduino, use a 1K series resistor to dampen noise/ringing picked up through the cable. For example:

|500x259

Actually, using opto-isolation would be the best solution (INPUT_PULLUP required): |500x268

This is how my sensors are setup (apologies for the modified/bodged diagram!)...

The 10k between sensor pin and ground at the arduino end is for when the board is run with an LDR instead of a hall sensor (creating a voltage divider). I hoped to be able to keep this in place when using the hall sensors instead but that could change if it had too.

The other thing to note is that 5v to the Hall sensors aren't necessarily coming from the same arduino as the signal out/sensor pin. They are coming from an arduino physically adjacent to the sensor to save on extra wiring. All arduinos are being powered via v-in with the same shared power supply.

Edit: image didn't work - try now...

https://www.dropbox.com/s/vg21mqg99s7ou6z/Photo%2018-01-2016%2011%2047%2010.png?dl=0

If you need to keep the 10K, then I suggest this:

@dlloyd: How do you make those nice figures?

@jremington

I use Scheme-it. Could just save your diagram to a png file and attach it here (it'll open with a grid background), but to present it as part of the post with matching background, it unfortunately takes more effort.

Steps: Use background object filled with RGB of 255,204,0 (same as forum background) Then capture the required screen area and save it to a file. Then use http://imgur.com/ to upload and get the link for forum.

Use that link here in your post and voila!

Thanks, dlloyd.

So the opto isolator reduces interference from the long cable? Is this essential with the extra 10k to ground in place?

Am I causing issues using 5v from one arduino and connecting signal & ground to another?

Did you run signal/ground of each sensor on one pair of the ethernet cable. And use 100n ceramic decoupling caps close to each sensor.

That's correct Leo.

Is nothing else using that sensor power or ground. Leo..

There are other bits of circuit using the arduino 5v rails for example to run variable resistor pots to input values to analog arduino pins and another hall sensor (up to 3 hall sensors per arduino). The ground is common to all the arduinos.

So the opto isolator reduces interference from the long cable? Is this essential with the extra 10k to ground in place?

The opto-isolator would eliminate interference and also provide full voltage swing on its output.

The circuit in reply #9 doesn't need the 10K (it would make the circuit fail as the signal wouldn't rise high enough with the internal pullup).

The 10K is required for the latest circuits (so you could leave it in place. I recommend inverted signal diagram for ease of swapping out the sensor for the LDR (the 4N35 could stay in place).

Am I causing issues using 5v from one arduino and connecting signal & ground to another?

You're using the same supply, so as long as the grounds are connected, it should be OK.

danielmc1: There are other bits of circuit using the arduino 5v rails for example to run variable resistor pots to input values to analog arduino pins and another hall sensor (up to 3 hall sensors per arduino). The ground is common to all the arduinos.

I was asking if the problem sensors are star-connected to one Arduino. And the power/ground does NOT go further to other devices. Because that could cause problems. Don't understand why you use 22 Arduinos for a train setup. I also don't understand why an opto setup is needed for small (almost) DC signals. Leo..

I was asking if the problem sensors are star-connected to one Arduino. And the power/ground does NOT go further to other devices. Because that could cause problems. Don't understand why you use 22 Arduinos for a train setup. I also don't understand why an opto setup is needed for small (almost) DC signals. Leo..

Each arduino runs two railway signals with inputs from the state of surrounding points (turnouts) and from trains running over sensors in various locations. There are other ways of doing it, but it started out as a learning project a couple of years back & determined to get them finished & working as I hoped they would when I started the project.

So I think my first port-of-call will be experimenting with a weaker pull up.

And am I right in summing up that the reason why the sensors on the long cables don't work and the ones on the short cables do work (despite being wired identically, all but 5v) is down to interference...?

danielmc1: And am I right in summing up that the reason why the sensors on the long cables don't work and the ones on the short cables do work (despite being wired identically, all but 5v) is down to interference...?

I don't know. Did not see a diagram with parts values, or code, or hall/magnet timings. A train over a hall sensor is, for the Arduino a very low frequency. Cutoff frequency (RC filter) can be low. What is the value of the cap from Arduino digital pin to ground. Leo..

Good point. I didn't include code as I had come to the conclusion it's likely to be a general electronics issue as it works over short distance. Or more accurately an issue with my knowledge on electronics in general :confused:

The cap is 0.1uF ceramic across ground and 5v right at the hall sensor. I wonder if this should actually be at the arduino end instead ? I'm sure I read somewhere that it should be close to the sensor.

The code uses pin change interrupts with the 'enableInterrupt' library. When the sensor pin senses a ground pulse, a function is executed. On the sensors nearest the arduino that are working, even the fastest train triggers the sensor without issue.