If someone could shed some light....please!
I have a project that will need to have 6 inputs isolated from the real world.
Picture if you will an old fashion knife switch. Exposed low voltage on the short end, ground on the long part (handle) of the blade. So by connecting an opto I should be able to provide, some level of protection to the micro, against inadvertent static.... so the thought goes...
So as I am going thru the Opto's, I come across 2 kinds...
5 wire and 4 wire....
I attach a schematic of what I think is the 4 wire correct..
What is the difference?
5 wire usually has a wire to the base of the transistor also.
That can be ignored, and the collector pulled up as you indicate.
I guess I should clarify..
The section marked output is the input to the micro.
Software set to internally pull up.
So when the Opto is on, the input is pulled low.
Yes, that was how I understood your question.
You will have separate grounds between them as well?
I havent worked thru that all the way.
I am thinking I want the reverse... See revised.
I am concerned about a static discharge.
Thanks for the help..
Richard
Either way, thu uC input is high until you close the swithch.
There is only tens of mA going thru the LED, static discharge won't be an issue.
Thanks,
When I finish the schematic, I will post.
Richard
Qsilverrdc:
I havent worked thru that all the way.
I am thinking I want the reverse... See revised.
I am concerned about a static discharge.
Thanks for the help..
Richard
If static discharge is your main concern then you should not wire the grounds together from the opto's input side to it's output side, it defeats the reason for using a optoisolator in the first place.
Lefty
I have revised the diagram for clarity.
I understand that I can't protect everything, but without a second power supply, I don't know how to do better.
If you have any thoughts on the matter, they are appreciated.
Thanks,
Rich
Qsilverrdc:
I have revised the diagram for clarity.
I understand that I can't protect everything, but without a second power supply, I don't know how to do better.
If you have any thoughts on the matter, they are appreciated.
Thanks,
Rich
Let me put it this way, by using a single voltage source and single ground system you are not adding ANY additional static discharge protection by using the opto-isolator. AVR chips already offer some limited built in static discharge protection using input clamping diodes on all the I/O pins. You would have to better quanitify the additional protection level you are seeking, in a amplitude Vs time format, to see which additonal protection methods might be useful and practical.
I was reading the Cpu doc's :~ (Not sure if that's a good thing)
The Atmel328 document says that If the I/O pin is configured as input and internally pulled up, it will source current if externally pulled low.
So what I have drawn in schematic is a short, when I close the switch?
If that's true, is there another way to do the circuit without adding a load resistor, or external pull ups?
Just looking for measurable input signals.
Rich
If that is all you are worried about, I would go the simpler route and just add a surge suppressor on each input pin.
Search for
"TVS - Varistors, MOVs"
at digikey.com,
filter by in-stock.
form factor you want,
find the voltage & current you are to protect against.
Fewer components needed, and better protection provided vs blowing up your optoisolators which are not designed as shock control devices, they will fail also.
Nothing wrong with researching the underlying docs.
The internal pullups are "weak", meaning the device connected needs to be able to sink
5V/20,000 ohm = 0.25mA, which is next to nothing electrically. The resistor is enough to hold the pin high when nothing is connected.
A mechanical switch connecting the pin to ground is one of the most common things done.
Have your code act when it see the pin going low.
Add a TVS from the pin to ground for static electricity protection.
Qsilverrdc:
I was reading the Cpu doc's :~ (Not sure if that's a good thing)
The Atmel328 document says that If the I/O pin is configured as input and internally pulled up, it will source current if externally pulled low.
So what I have drawn in schematic is a short, when I close the switch?
If that's true, is there another way to do the circuit without adding a load resistor, or external pull ups?
Just looking for measurable input signals.
Rich
Not if you are trying to 'read' a simple switch contact. An input pin must be presented with at all times with either a valid digital HIGH voltage or LOW voltage. A 'dry' switch contact is not capable of supplying either as it just offers a 0 ohm connection when closed and a open circuit when opened between it's two contact pins. See the difference? The input pin is designed to sense the voltage level wired to it's input, so it's up to you to provide the proper wiring and components to preset both the valid high and low voltage levels.
Lefty
CrossRoads:
The internal pullups are "weak", meaning the device connected needs to be able to sink
5V/20,000 ohm = 0.25mA, which is next to nothing electrically. The resistor is enough to hold the pin high when nothing is connected.
A mechanical switch connecting the pin to ground is one of the most common things done.
Have your code act when it see the pin going low.
Add a TVS from the pin to ground for static electricity protection.
I miss read this as the 20ma sourcing output.
I guess I should have realized they meant that my circuit had to be able to sink the pull up current.
Ok,
I see where you are going….
Since I am on common ground system, having the addition of an Opto doesn’t do alot.
Having a TVS diode back to ground would be as effective, and less likely to self destruct.
I am going to have several of these exposed open switches in application.
Does something like a SP721 fit the bill?
(SP721 is an array of SCR/Diode bipolar structures for ESD and over-voltage protection to sensitive input circuits.)
Am seeing discussions on other threads where D13 is used as an input with pullup resistor enabled, and its just enough current to turn on the L LED.
Yes, the SP721 looks like it would work nice.
I have attached a schematic, of sorts.
The UNO (R3) inputs are to the right.
6 Exposed switches, and all the rest also are left.
I believe that this is switches MAXIMUS with respect to reserving USB/serial communications.
I know that there are a couple others inputs on the other chip 16U2, but I'm not going there. (At least not now) I don't even think there is a pad under some of these.
Anyone see problems with the schematic attached?
(any thoughts count...)
Thanks,
Richard
Inputs Side Schematic.PDF (212 KB)
Looks fine, make sure internal pullups are enabled, test for a low to see if switch is closed.