Go Down

Topic: Interfacing optoelectric proximity sensor with arduino (Read 2087 times) previous topic - next topic

TomGeorge

Hi,
Can you just connect the sensor up to your 24V supply on its own, no arduino connected, and measure the output volts when the sensor is detecting and not detecting please.
A picture of the sensor would be a help.

Tom.... :)
Everything runs on smoke, let the smoke out, it stops running....

TomGeorge

Hi,

Is this how your circuit is constructed?


Tom.... :)
Everything runs on smoke, let the smoke out, it stops running....

sheel

Hi,
Can you just connect the sensor up to your 24V supply on its own, no arduino connected, and measure the output volts when the sensor is detecting and not detecting please.
A picture of the sensor would be a help.

Tom.... :)
Thanks Tom,
The output voltage was the difference. Using the limiting resistors helped. Thanks again.

TomGeorge

Hi, good.
So how does you circuit look now?

Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....


sheel

HI Tom,
Here is the new circuit.

TomGeorge

Hi,
What are your LEDs, please show a link to where you got them, are they like this?

If so  you need to place resistors in series with each LED.
I find it hard to see how LED1 is lighting because the input current to the arduino input is very low.
We need to see a picture of your project please..

Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

TomGeorge

Everything runs on smoke, let the smoke out, it stops running....

sheel

Hi,
What are your LEDs, please show a link to where you got them, are they like this?

If so  you need to place resistors in series with each LED.
I find it hard to see how LED1 is lighting because the input current to the arduino input is very low.
We need to see a picture of your project please..

Tom.. :)
I am using the first LED, in your picture, everywhere. I got them from the local hardware store. It needs just 3V to light up. Sorry I can't show you a picture of the exact project. I am bound by my company rules.

outsider

Looks to me like the sensor is probably outputting 24V which is then pulled down by LED1 and pin 3 protection diode in parallel to some unknown, unstable voltage. Until that is fixed your circuit is not going to work as you expect. also you need current limiting resistors (330 Ohm)on LED 2 & 3 and pulldown resistors (10k) on pins 5 & 6.


TomGeorge

Hi,
Quote
I am using the first LED, in your picture, everywhere. I got them from the local hardware store. It needs just 3V to light up. Sorry I can't show you a picture of the exact project. I am bound by my company rules.
You don't have anyone experienced in electronics at your work place?

outsider's circuit is what I was leading you, too. 

A step at a time so  you would understand and learn what is going on.
You haven't answered post #15 yet, to really establish if the output is 24V high output.
Please read the references I have posted so you understand how to drive LEDs.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

sheel

Hi,You don't have anyone experienced in electronics at your work place?

outsider's circuit is what I was leading you, too.

A step at a time so  you would understand and learn what is going on.
You haven't answered post #15 yet, to really establish if the output is 24V high output.
Please read the references I have posted so you understand how to drive LEDs.

Tom... :)
Hi. Looking at outsider's circuit and reading the link posted by you, I now understand my mistake.

Regarding post #15, the output voltage was indeed 24V as guessed by outsider. So, with whatever knowledge I had in electronics, I just kept on adding 10K resistors in series to bring the voltage down to the range of arduino.

I thought I would learn basic electronics while working with arduino. But, it seems as if I had a completely wrong approach. I think I should go through basic electronics first before moving anywhere ahead with the arduino, or I might damage the arduino or my laptop or even worse myself.

Thank you Tom and outsider.

leolfs


  If your circuit is as drawn then of course it can't work properly. The LED is clamping the voltage to the input pin to only a few volts(depending on the LED colour) so the input pin will not go to logic high However, it is almost certainly saving your arduino from destruction.
Step back to basics. Forget the arduino for a moment.

  If your LED does respond to sensor activity as wired, then  the sensor is likely to be a source/sink driven output. These have a built in current limit and that probably why you have not yet destroyed it or the LED.
You must add a resistor in series the LED (470  to 1k ohms  or so-its not critical) to limit the current.
Now the sensor and the LED are happy. But you will destroy the arduino if you connect it to the sensor output. (oops 24V on the arduino. Very bad).
Solution: 4.7V zener diode between arduino input and ground.(stripe to the input) Then resistor (2k to 5k is ok for a small zener) from arduino input to sensor output. This will clamp the voltage appearing on the arduino input to a safe value. Sorry I can't be bothered drawing a diagram. Wire this up without the arduino and check voltages first. if ok then connect to arduino and work on the code. Good luck.
Crawl around a bit before standing up - more chance of success.


Go Up