Input from multiple sensors to Uno

I am building a model railway and I need to input several signals from, mainly, Hall sensors, to a Uno. There are not enough pins on a Uno to monitor each Hall sensor. Is there a way I can multiplex the input from several sensors, through a chip, and pass the combined signal to a Uno pin? The Uno would then need to analyze the input and decide which Hall sensor sent the signal.

What sensors are you using?

Many ways!

An IO expander would be one way; eg,

https://www.sparkfun.com/categories/tags/gpio-expander

Another way would be to use sensors with a bus interface; ie, many sensors sharing one communication path...

On a model railway layout, RS485 could be good...

https://www.cuidevices.com/blog/rs-485-serial-interface-explained

But perhaps there are already some established comms systems in the railway modelling world...?

I am using Hall effect sensors at the side of the track with a magnet attached to the train. The sensor tells Uno that a moving train is passing a particular location.

There are many types of Hall effect sensors: some are analogue; some just give a digital on/off signal; some have interface like I2C or SPI - so which one(s), exactly, are you using?

Please post links.

Not sure, they are el cheapo so would not have a digital interface. Probably give off an analogue signal. I can buy better sensors if needed.

The SS49E sensor or similar like KY-024 have an LM393 circuit (double comparator) which gives you a Digital Out signal (pin DO) in addition to the analog signal (pin AO) and a potentiometer makes it possible to adjust the detection threshold to switch the digital signal

If you use the Digital Out (DO) you can then you can connect this to a port expansion board - there are many kind available and you can either poll or use interrupts depending on the model

the internet is full of GPIO expansion board discussions, see https://www.best-microcontroller-projects.com/arduino-port-expander.html for example (first google hit)

I don't think that follows.

Please post a link (or links)!

So you're connecting them to the Arduino's analogue inputs?

Not knowing what sensors you do have, it's impossible to say what might be "better".

Hello Bobsbees

It is best to use an Arduino Mega, because there is always something to measure, control and regulate on a model railway.

Have a nice day and enjoy coding in C++.

Thanks for the discussion everyone. Very informative.

just came across this, for example:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.