I need to read the analog values of up to 50 analog light reflection sensors which are used to determine distance to a specific object with an Arduino-compatible Microcontroller such as:

  • Arduino Due with the Atmel SAM3X8E CPU
  • Arduino Zero with ATSAMD21G18, 32-Bit ARM Cortex M0+ CPU

But when thinking about my idea I come up with quite some questions I can't really answer myself:

My first Idea was to use several ATSAMD21G18 to read a bunch of 6 analog devices. But that would end up in having at least 9 ATSAMD21G18 and in having to connect them with SPI or I2C.

So I thought of using several analog Multiplexer/Demultiplexer like the 4067 instead. Even this would end up in multiple units of the 4067 but I could use a single Arduino Due / Zero.

My concerns however are that the 4067 does not switch the analog inputs fast enough for my needs. I really would like to read all those analog values as fast as possible. How fast would a 4067 be in this application?

And also. Using the 4067 I have to use digital I/Os to set the input channel of the 4067. Can I wire them in parallel so that I would be able to share the digital I/Os with every single 4067?

And also does the length of the circuit affect the readings when having to deal with distances between the 4067 and the Arduino of about 50cm?

  • \$\begingroup\$ What sample rate? \$\endgroup\$ Commented Nov 24, 2015 at 10:39
  • \$\begingroup\$ 1 kHz for every single sensor? Don't know if this might be too fast since it is 1kHz * 50 sensors = 50kHz total!? Not really sure. \$\endgroup\$ Commented Nov 24, 2015 at 10:41
  • 2
    \$\begingroup\$ A system I designed earlier in the year simultaneously samples 160 analogue channels every 5 us so your application is really really slow. Get real and don't use provocative terms like "fast" - give real numbers without a question mark. \$\endgroup\$
    – Andy aka
    Commented Nov 24, 2015 at 10:44
  • 1
    \$\begingroup\$ Are you sure you want to read those reflex sensors as analog? They are mean to be used as digital (yes/no reflection) sensors. \$\endgroup\$ Commented Nov 24, 2015 at 11:03
  • \$\begingroup\$ @WoutervanOoijen Yes, I have done that with a single unit and I was able to read them analog. \$\endgroup\$ Commented Nov 24, 2015 at 11:10

1 Answer 1


In general, multiplex in digital, not analog. Someplace somewhere you're going to have 50 separate signals. Whether these go into a bunch of analog muxes then a small number of A/Ds, or into a bunch of A/Ds and a small number of digital ports doesn't change the complexity much.

You need to get your priorities straight. You don't do these kinds of things by picking the microcontroller first, then figuring how to kludge stuff on to eventually do what you want despite the micro. You start with the requirements, then pick a suitable micro.

Your logic for dismissing one digital muxing approach makes no sense:

But that would end up in having at least 9 ATSAMD21G18 and in having to connect them with SPI or I2C.

Um, OK, but how is that a problem? Again, you're going to have 50 separate pins somewhere somehow. Having these be inputs to a bunch of 8-channel (or whatever) A/Ds sounds like a reasonable approach. Then using SPI to mux the data from those chips sounds quite reasonable. Other than dismissing this, you haven't actually given any reason why this isn't a reasonable approach.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.