Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

optocoupler question

Status
Not open for further replies.
ok kpatz thank you, and when you said LED earlier im assuming you were talking about the diode inside the opto? just making sure i might be missing something lols
 
ok kpatz thank you, and when you said LED earlier im assuming you were talking about the diode inside the opto? just making sure i might be missing something lols
Yes, that's what I meant. The diode in the opto is a LED and the transistor is a phototransistor. The LED lights the phototransistor and turns it on.

You can make your own crude opto by taping a LED and a phototransistor together end-to-end with black electrical tape, if you're so inclined. ;)
 
poor man's opto ; )

about the 1k resistor what does this do?

is this what you call debouncing?

my pic reads multiple signals coming in when it's not attached.
 
poor man's opto ; )

about the 1k resistor what does this do?

is this what you call debouncing?

my pic reads multiple signals coming in when it's not attached.

hi,
Its the load resistor for the opto transistor, its in the emitter circuit to 0V.

Without the 1K, when the opto is OFF the PIC pin will be floating and cause problems. Pick up allsorts of interference.

With the 1K in circuit, when the opto is OFF the PIC pin is pulled to 0V, which it should be. OK.?:)
 
Last edited:
Also known as a pull-down resistor, since it holds the PIC pin to 0V when the opto's transistor is off. Without it, the opto can pull the pin high when on, but the pin will float when it's off, causing your erroneous readings.

Debouncing is different--that's dealing with the fact that switch contacts don't close/open cleanly and can cause multiple on/off cycles over a short period of time when the switch is moved/button is pressed.
 
theres a small hitch, the pulse coming from the coin mech happens so fast the PIC cannot read the signal. is there a way i can amplify or prolong this pulse so my PIC can read this signal? i tried to jumper wires instead of the coin mech the way you guys have taught me and the PIC received the signal pretty well. prolong pulse?
 
Last edited:
and can a lm555 in monostable accomplish this?

**broken link removed**
 
Last edited:
eric, hows the circuit above?

It look OK, what length do you want the pulse to be.?

Do you need idea's on how to connect the opto output to the 555.

BTW: why are you using the opto coupler in the project.??:)
 
hi,
Looking at the application, why dont you use the PORTB.0 interrupt pin to detect the 'fast' pulse from the opto output, that way you dont need a 555 mono.

Looking at the opto isolator, unless you need isolation from the coin machine, you could just use a resistor potential divider from the 12V coin signal and connect the +5V output of the divider to pin PORTB.0.??

EDIT: something like this circuit.
 

Attachments

  • AAesp01.gif
    AAesp01.gif
    7.5 KB · Views: 306
  • AAesp02.gif
    AAesp02.gif
    35.4 KB · Views: 247
Last edited:
i wanted to isolate the 12v from 5v of my PIC so thats why the optocoupler. is this opto redundant already?

i was thinking to attach it to the trigger part of the 555, pins 4 and 5 of the Opto act like the switch instead of a push button. you think im doing this right?

about the length, enough for the PIC to detect the high so some interrupt would cause some led to light up.
 
i wanted to isolate the 12v from 5v of my PIC so thats why the optocoupler. is this opto redundant already?

i was thinking to attach it to the trigger part of the 555, pins 4 and 5 of the Opto act like the switch instead of a push button. you think im doing this right?

about the length, enough for the PIC to detect the high so some interrupt would cause some led to light up.

hi,
Look at my previous post, thats the way I would do it, keeps the component count to a minimum [ and the cost].

Connect the 0V of the coin machine and PIC togther, power them from their own supplies of 12V and 5V. Have some decoupling caps on the PIC's +5V , say 47uF and 100nF and it should work ok.

If you are not sure about the coin machine decoupling add say 100uF and 100nF across its 12V supply.
 
Last edited:
wow this is one badass solution eric lols. this will save me two ics.

theres one problem the coin mech signal is negative so can i reverse the polarity, R2 to +5?
 
wow this is one badass solution eric lols. this will save me two ics.

theres one problem the coin mech signal is negative so can i reverse the polarity, R2 to +5?

hi,
When you say 'negative' do you mean its a minus voltage.?

post a sketch of the coin mech signal, mark on it the voltages etc.:)
 
thanks so much ill try to absorb and test in my protoboard these things. forgive me since im a lil bit slow okay. thanks ill be back.
 
hi,
When you say 'negative' do you mean its a minus voltage.?

post a sketch of the coin mech signal, mark on it the voltages etc.:)

will this work?

i forgot the signal pin of the coin mech is 0v when NO and +12 when NC
 

Attachments

  • eric.JPG
    eric.JPG
    11.8 KB · Views: 253
Last edited:
will this work?

i forgot the signal pin of the coin mech is 0v when NO and +12 when NC

I dont think so.:)

What you are saying its not a negative pulse, which makes things easier.

Use the +12V signal to the R1/R2 divider as I posted in the drawing.

The program can be set to detect either a low or high going edge on the PORTB.0.

OK.?

Do you have any diagrams of the coin circuits.?
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top