Author Options:

Bi-Directional Led Sensing Answered

Hello, I have been working on Bi-Directional Led sensing for a school project. I have managed to build a prototype with just 1LED and a processing sketch to visualize the input which works perfect. Also I built a version with 2 LEDs which is not as good as the previous one. I can get response from the both Leds but they are interfering with each other most of the time. I am using the built-in pulseIn function of the arduino to measure the time of the Leds go from LOW to HIGH. With just one led it is perfect, but when I add more then 1 LED, two or three LEDs , lets say, they go into a weird condition. If anyone have some experience with Bi-Directional Led sensing with more then 1 LED, I will be glad if you share. Thank You



10 years ago

. Give each LED a unique pulse string - eg, short-short-long. . Or give each LED a short pulse, one at a time.


Reply 10 years ago

What do you mean by short-short-long can you explain a little bit.
For an instance what I do is:
Lets take Pins 10 and 11

Both Pins: OUTPUT
P10 - High
P11 - Low

Then Reverse
P10 - Low
P11 - High

Then here we make P11 INPUT

then measure the time that the Led discharge with:

value = pulseIn(11, HIGH);

then I print them like
LedID + Value so output looks like

The problem is they do not produce close outputs and more important they interrupt each other.
I found some AVR code in arduino site, I will try them tomorrow and send more info.

Thank you


Reply 10 years ago

. If each LED has a unique pulse string then they can ignore each other. If LED1 is programmed for s-s-l, it will ignore LED2's s-l-l.


Reply 10 years ago

Well the thing is here you just light-up Leds in normal way and then quickly reverse the flow of the electricty of the LEDs and calculate the time of the LED to discharge, so I am not pulsing the leds or doing any other thing like Long-Long-Short etc. The overall action is happening very quickly, I wil shoot a video and/or some photos and put it on blog if I can, then I am sure you will get the idea. Thanks for replies tho.