Go Down

Topic: Ir sensors (Read 3477 times) previous topic - next topic

Kal22378

Hello All, I am new to this forum. I am patiently waiting on my first Arduino board and I was wondering if I could get some advice on how to go about using IR sensors to turn on an led. But my problem that I have right off of the bat is that I need to have 128 nodes as I will call them ( the node consists of 1 IR LED, 1 IR photodiode, and 1 LED ). I need the IR sensor to turn on the led in that node and have 128 nodes. Any advice would be greatly appreciated.

Thanks
Kal

Grumpy_Mike

Are you also new to electronics?
That is a lot of input and output you need. Sure you can do it with shift registers, with each shift register chip being able to do 8 inputs or outputs depending on the shift register type. These are chained together, you need three chains, one for each of your different types of nodes.
However with so many chips you can't use solderless bread board it has to be soldered up and you have to supply proper decoupling on each chip.

Kal22378

Yes I am new to electronics. Hobbiest. So what do you mean by 3 chains?

Thank you for the response

Wawa

If you want to drive 128 IR LEDs, 128 indicator LEDs, and read 128 photodiodes...
Then you need to control 3*128 I/O pins.
That could be done with three shift register daisy chains.

It would be wise for a beginner in electronics to start with one node,
after you have done several examples from the IDE.
Leo..

Grumpy_Mike

One shift register will give you 8 extra inputs or outputs depending on the shift register type. If you want 16 then you have to wire two shift registers together to form a chain. For each extra shift register in the chain you get another 8. You need three such chain.
See https://learn.sparkfun.com/tutorials/shift-registers for how to use one type of shift register.

You will not be the first beginner who wants to do way more than their ability level as a first project.

PaulRB

Is this for some kind of interactive wall or table? The ir led & sensor detect an object and the visible leds light up in response?

You may be able to reduce the complexity of the circuit by arranging your nodes into a matrix and using a method called multiplexing. This makes the software/sketch/code more complex, but it is usually worth it.

To multiplex, you would divide your 128 nodes into 8 columns and 16 rows, or vice versa. The circuit would scan the rows or columns one at a time, in 8 or 16 steps. Let's suppose you scan 16 columns in turn. In each column you have 8 ir leds, 8 ir sensors and 8 visible leds.

Using a Mega, you would need 16 digital outputs to drive the columns, probably via transistors because of the current required. Also 8 digital outputs for the visible leds and 8 analog inputs for the ir sensors. Maybe 8 outputs for the ir leds, although you could maybe have those on full-time.

Kal22378

Yes this is a table PaulRB. Thank you again for the responses!! I planned on have the IR Leds on full time and just have the IR photodiodes and LEDS controlled by a Arduino.

Kal22378

Thank you for the link Grumpy_Mike!!

Grumpy_Mike

Quote
I planned on have the IR Leds on full time and just have the IR photodiodes and LEDS controlled by a Arduino.
That can be problematic. What happens is that the IR light from the LEDs leak onto adjacent detectors. The way round this is to only turn on the IR LEDs one at a time and look at the sensor you expect to pick it up from. That way their is no problem with light leakage.

PaulRB

#9
Jun 17, 2017, 06:01 pm Last Edit: Jun 17, 2017, 06:21 pm by PaulRB
That can be problematic. What happens is that the IR light from the LEDs leak onto adjacent detectors. The way round this is to only turn on the IR LEDs one at a time and look at the sensor you expect to pick it up from. That way their is no problem with light leakage.
Good point, Mike, but one ir emitter at a time would mean a very slow 128-step scan, wouldn't it?

What about, using my matrix suggestion, 8 ir emitters are on at once, but the "rows", or groups, are staggered, so that no two adjacent (or even close) emitters are on at once?

Group 1:
Code: [Select]

*---------------
----*-----------
--------*-------
------------*---
*---------------
----*-----------
--------*-------
------------*---


Group 11:
Code: [Select]

----------*-----
-------------*--
-*--------------
-----*----------
---------*------
-------------*--
-*--------------
-----*----------


This would be just a matter of wiring, no more complex in terms of the circuit. Possibly no more complex for the code, either, depending on the illumination patterns desired.

Grumpy_Mike

#10
Jun 17, 2017, 06:14 pm Last Edit: Jun 17, 2017, 06:15 pm by Grumpy_Mike
Quote
but one ir emitter at a time would mean a very slow 128-step scan, wouldn't it?
Not really if you look at the response time of your specific IR sensor.

However your idea of a matrix is a lot better than a bunch of shift registers. All though with a matrix for the display LEDs you would have to keep up the multiplex rate.

I recon the best bet is a multiplexed IR LED and IR sensor and use a WS2812b strip of LEDs for the visual display.

Kal22378

I would like the nodes to look something like this.       
           
             ○  ●
                □   

IR LED----> ○
IR Photodiode----> ●
LED----> □

PaulRB

So... In a triangle? I must be missing your point.

Kal22378

Yes.....that is what I am calling one node I guess. That will be in one square of the table

Kal22378

PaulRB....the * in your post would be one triangle as we will call it.

Go Up