Hall US1881 sensor issue

Hi all, I´m developing a project and I have a little issue.

I´m using:

1 Arduino Mega
1 GSM shield
1 Reed Switch
1 LED
8 Hall Sensors (US1881)

The problem is that because I´m using the shield; I lose a lot of digital pins. Pin 13 is attached to the reed switch. And I have only 7 digital pins left to use with the halls, so 1 of them i had to attach it to a analog and use it like a digital.
In the first times, it works fine, but with time (days later), the hall literally dies. The other 7 are working properly months later.
I assumed that digital and analog pins works in the same way, maybe I must use a capacitor or a different resistor with this sensor? (actually im using 10k)

Any ideas? Thank you¡

Hi,

You should use a shift register. In your case, a "parallel in, serial out", such as the 74HC165, I think it could work (but I'm far from being expert) :wink:

http://playground.arduino.cc/Code/ShiftRegSN74HC165N

I think I'd opt for a mux like the 4051...

Basically you feed all of your hall sensors to the 4051, then using 3 pins you can select which hall sensor to read... saving you 4 pins and up to 8 sensors.

Thank you for the replies¡ With the multiplexer, I can read all the sensors at the same time? I´ve never mutiplexed before

martinhagreen:
Thank you for the replies¡ With the multiplexer, I can read all the sensors at the same time? I´ve never mutiplexed before

Nope, can you read all 7 hall sensors at the same time?

You iterate through all your sensors in a for loop....... selecting each individual sensor; to collect data from, one at a time.

Yep, I´m reading all of them at the same time, to know every moment wich one is the last switched on

martinhagreen:
Yep, I´m reading all of them at the same time, to know every moment wich one is the last switched on

I guess you're stuck then.. use a parallel mode on a shiftregister.... as suggested, that way you read it all in "1 go" in reality, it'll be 1 bit a time as it reads in the data, but to you, it will be instant.

I like the idea of a mux, because you get to control which sensors you access, and as far as the end user is concerned, it's pretty much instant to your eye (even with a for loop)

The schematic shows analog input A0 connected to what appears to be a Hall effect device, and digital pin 13 connected to what appears to be an anemometer.

I don't know of any reason that A0 shouldn't work as a digital input indefinitely. To test your theory that something fails with pin A0, I'd recommend swapping those two devices - connect the Hall sensor to digital pin 13, and connect the anemometer to A0. Naturally, you'll have to address that change in your code. Then observe which one, if either, fails.