Connect with us

Cheapest way to get data from multiple(100s) of sensors?

Discussion in 'Sensors and Actuators' started by Steve Peart, Jun 23, 2016.

Scroll to continue with content
  1. Steve Peart

    Steve Peart

    51
    3
    Sep 16, 2015
    Hey team,

    I am an electronics beginner/novice. Currently working with an Arduino UNO (though that isn't necessarily the only thing i'd want to use for this).

    I plan to have 100s of Reflective IR Sensors and want to be able to read from all of them at once in the cheapest way possible.

    Issues/Thoughts thus far:

    • Obviously, there aren't that many inputs on an Arduino so i can't just run wires to each one.
    • I would be up for getting each sensor to communicate via serial to the Arduino, but then they'd have to be addressable somehow, not sure how I'd achieve this, especially cheap.
    I would want to be able to receive something like an address, and the sensor output on the arduino, like 'Sensor 1A = 0.123' or something like that, so I know which one is being detected and at what value, etc.

    Any ideas? Questions? There may be some IC or some solution that is obvious to those with more training or understanding of electronics, I just don't know how to formulate the correct google query to return the solutions I need.

    Thanks!
    -Steve
     
  2. Kabelsalat

    Kabelsalat

    117
    22
    Jul 5, 2011
    Depends on what kind of sensor it is. It's probably possible to achieve this by demuxing a line. If using analog sensors I assume you can use one input only (connect all sensor outputs together because only the one given current feed will cause any change in sensor output - assuming normal open).
     
  3. Steve Peart

    Steve Peart

    51
    3
    Sep 16, 2015
    They are Reflective IR Sensors. I want to be able to respond to them individually, but need to know which one is changing when it does.
     
  4. Steve Peart

    Steve Peart

    51
    3
    Sep 16, 2015
    Also, I need to be able to read them async. I won't know which one is which if i just hook them all up together, right?
     
  5. Bluejets

    Bluejets

    3,779
    783
    Oct 5, 2014
    More info on what you are doing would help especially since there may be a better way to go about it.
     
  6. Kabelsalat

    Kabelsalat

    117
    22
    Jul 5, 2011
    You failed to describe the sensor - just quoting the term "Reflective IR Sensors" is just way too poor.
     
  7. Steve Peart

    Steve Peart

    51
    3
    Sep 16, 2015
    Sorry for not being more clear.

    The sensors I am currently using (could be changed, just testing so far) are titled this:
    "TCRT5000L TCRT5000 Reflective Optical Sensor with Transistor Output Infrared 950mm 5V 3A"

    I am attempting to build a small table filled with 5050 RGB Led's and IR sensors to make it capable of responding to touch events. Each small panel will have the LED and the IR sensor, when your hand or another object comes close to or on top of one of the modules, the IR sensor should pick that up and cause the LED to respond. It would also require the capability of having certain things being sensed but lighting up different LEDs based on the functionality. Like games being played by touching the table, etc.

    From the Arduino, I can control the LEDs individually by chaining Shift Registers to control more LEDs than I would have ports for on the Arduino itself. But my question lies around how to do the reverse, communicate the sensor values back to the Arduino, and still knowing which sensors have triggered and what their values are.

    Does this explain what I am trying to do better?
     
  8. Kabelsalat

    Kabelsalat

    117
    22
    Jul 5, 2011
    Yes. I can nothing about Arduino itself, but it's clear that the problem must be solved by properly coding.

    The method is as I explained briefly. You need to create a digital demux so that it can turn on one detector at time - rapidly of course. If you parallel all sensors C and E pin (transistor), you will still be able to find out which one is detecting something because only one sensor will have current through its infrared emitter.
     
  9. dorke

    dorke

    2,342
    665
    Jun 20, 2015
    If what you actually need to get from the sensor is "digital information" only,
    i.e. Is it sensing "proximity" or not.

    Then the way to go cheap is like a "PC keyboard" implementation.
    That is an I/O expander(matrix type,actually only input expander) with a serial interface.
    The serial interface can be a UART/I2C/SPI etc.

    When you say "100s", what is the maximum number you are talking about?
     
    Steve Peart likes this.
  10. Harald Kapp

    Harald Kapp Moderator Moderator

    9,663
    2,019
    Nov 17, 2011
    You can read data the same way. Use shift registers with parallel input, serial output, e.g. 74VHC165 (8 bit). Connect 13 of them in series, connect the inputs to the sensors' outputs, connect serial out to the arduino.Read the data continuously (from within a loop) to poll the sensors.

    You'll need three pins on the arduino:
    - 1 for receiving data
    - 1 for clocking
    - 1 for latching the parallel data into the shift register(s)

    The rest can be handled in software. You know which sensor has triggered from the position of the respective bit in the serial data stream.
     
    Steve Peart and BobK like this.
  11. Herschel Peeler

    Herschel Peeler

    401
    65
    Feb 21, 2016
    Analog multiplexers? Thirteen 8-bit analog multiplexers, like CD4051. 7 Digital outputs to select the device and which input. One analog input. 4 bit to 1 of 16 decoder (or two 3 bit to 1 of 8 decoders) to select the devices.
    RGB LEDs? Maybe IR LEDs matching the sensitivity of the IR sensors..
     
    Steve Peart likes this.
  12. Amar Dhore

    Amar Dhore

    129
    12
    Dec 2, 2015
    If you can get sensor/s with some sort of communication capability then it might be simple and cheap. Otherwise parallel to serial or multiplexer are good ideas but when you say 100s of sensor, Its gonna cost a bit more.
     
  13. BobK

    BobK

    7,673
    1,684
    Jan 5, 2010
    I second Harald's suggestion.

    Bob
     
  14. Steve Peart

    Steve Peart

    51
    3
    Sep 16, 2015
    @Harald Kapp I have been reading up on this, will the software still be able to read the varying proximity data from the shift register, or will it have to be a basic on/off being read? Currently, these sensors appear to have a granularity of about 30 from the Arduino, meaning I should be able to read 30 different proximity levels from them each. Will that value still come through? I have a handful of SN74HC595N's that I planned to use only for LED operation, but would be totally sweet if they can get the sensor data back in the same way. Would be exactly the solution im looking for.

    @dorke: To answer your question, I am looking to do about 400 of these, but I am attempting to make it modular enough to expand on it when I get more cash to buy the components. For the detection, I'd like to receive the analog signals from the sensors, so I can know when you're close, but know when you're right on top of it as well separately.

    Thanks so far guys! I will definitely report back as I get my breadboard wired up with this stuff!
     
    KeithM likes this.
  15. BobK

    BobK

    7,673
    1,684
    Jan 5, 2010
    No, it will not be able to read proximity, the shift registers work only for digital off / on data.

    You need a huge analog multiplexer to get proximity readings.

    Bob
     
  16. dorke

    dorke

    2,342
    665
    Jun 20, 2015
    Steve,
    What voltage and current are you planning to operate each sensor(actually the diode)?
    Are you looking at 5V/10ma ? other values?
     
  17. Harald Kapp

    Harald Kapp Moderator Moderator

    9,663
    2,019
    Nov 17, 2011
    Sorry,no. This was not obvious to me from your original post. If you need to read analog data, you could use analog multiplexer, see @Herschel Peeler 's post #11.
    Or you add a very small µC (e.g. Attiny) to each sensor, digitize the analog value and send it to the arduino via serial port.
     
    Steve Peart likes this.
  18. dorke

    dorke

    2,342
    665
    Jun 20, 2015
    As I said before ,the way to go is with a matrix.

    Row activation and Column read ,or vis versa .
    The basic is a square NxN matrix such that N^2 >400,thus N=>20.
    In general , it can be done with an NxM matrix ,such that N is not equal to M.

    Since commercial Analog multiplexers come in powers of 2, I would suggest you use 8 channels ones for creating a "MUX tree" .
    Only two levels are needed(up to 5 select bits).
    The use of 1 to 4 such MUXs will let you have an expandable square matrix of
    8x8,16x16,24x24 and and 32x32.
    (64 ,256,576,1024 Sensors)

    For driving a Row (or Column) you can use expandable serial in parallel out,
    8 bit shift registers(up to 4 are needed).
    So you would have up to 5 Muxs and up to 4 Shift registers with possible extra drivers like ULN2803s (depending on number of LEDs and LED current).

    The way the sensors are driven can be done in several ways:
    Like driving both the LED and photo transistor simultaneously,
    and reading the photo transistor current on a Collector or Emitter resistor.
    The drive can be either supplying the VCC or GND to the sensor.

    The Matrix: matrix.JPG





    The Column read Mux tree:

    mux tree.JPG
     
    Steve Peart likes this.
  19. BobK

    BobK

    7,673
    1,684
    Jan 5, 2010
    Actually, if we take this statement literally, the multiplexer does not help as it does not read them all at once. To do that, a sample an hold is required for each sensor. At that point, I would just go to a 6-pin micro per sensor, all tied to a clock signal to start the acquisition.

    So, what is the meaning of "all at once". Is, say, all within 10ms good enough?

    Bob
     
    Last edited: Jun 25, 2016
  20. Steve Peart

    Steve Peart

    51
    3
    Sep 16, 2015
    I suppose "all at once" is relative. I don't mind having to read them linearly, then making whatever decisions for them as I go. Within 10ms would be totally fine. I am still reading the other posts to wrap my head around them...
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-