CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Electronics > General Electronics Discussion


General Electronics Discussion Discuss basic electronics, power supplies and anything else electronic related here.


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 08-31-2004, 04:20 PM
 
Join Date: Oct 2003
Location: Sweden
Age: 34
Posts: 398
arvidb is on a distinguished road
How to sense a switch with both opto-isolator and logic?

I have a problem. In the circuit below I want to read the state of the switch with a logic IC - from the GND and SIGNAL lines.

Now there are a few problems. I cannot really control the things on the left of the dotted line. V1 is not sure to be 24V (but 24V is max). I can't even be sure the opto coupler to the left will be in the circuit. The things on the right of the dotted line will sit on a PCB I'm cadding.


1) I could use a diode followed by a pull-up resistor (as drawn). The diode is needed so as not to activate the opto coupler to the far left (it would see 3.3V as ground if the 3.3V were allowed to sink current). But then the low level for the SIGNAL will be 0.7V, only 0.1V below the max voltage for a low logic signal. And the cables to the switch and back are several meters... not very much headroom for noise and component tolerances.

I'm not sure if the schmitt trigger would solve this; after reading some schmitt trigger data sheets it looks like they also guarantee low level up to 0.8V only.

2) I could use an opto coupler on my board. But I have 12 inputs, and this would get prohibitively expensive, not to mention clumsy (most opto-couplers seem to be hole mounted and single per package). Also since I cannot be sure that V1 is 24V this might not work very well.

Any ideas? This is driving me nuts...

Arvid
Attached Thumbnails
Click image for larger version

Name:	switchin2.gif‎
Views:	154
Size:	3.5 KB
ID:	3310  
Reply With Quote

  #2   Ban this user!
Old 08-31-2004, 04:30 PM
 
Join Date: Oct 2003
Location: Sweden
Age: 34
Posts: 398
arvidb is on a distinguished road

Hmm, now I got an idea. If I moved the diode to the Vcc "leg", it still cannot sink current, and the high level would be 3.3-0.7 = 2.6V. That is 0.6V above the lowest permissible high voltage for LVTTL logic. And there's no long cables since the pull-up is right next to the device. Should work?

Arvid
Reply With Quote

  #3  
Old 08-31-2004, 04:49 PM
*Registered*
 
Join Date: Apr 2004
Location: Norway
Posts: 678
ESjaavik is on a distinguished road

Exchange D1 with a resistor and put a couple of diodes in series from behind it to GND to limit the voltage. The R should have high enough restistance to make sure it is not able to draw enough current through the diode to trigger it, but low enough to make sure it triggers the schmitt even if volts are a bit low.

BTW, you can get surfmounted optocouplers. One example: Elfa 75-300-74

Last edited by ESjaavik; 08-31-2004 at 04:54 PM.
Reply With Quote

  #4  
Old 08-31-2004, 06:58 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,543
Al_The_Man is on a distinguished road
Buy me a Beer?

Could you use the old favorite of mine, the 2n7000 it has very high impedance and can tolerate a wide range of gate to source and gate to drain voltages, and it is only 10c per.
Although the gate will switch at 3.3v it will allow a maximum of +- 40 volts gate-source.
It is really intended for logic to high voltage output, but I see no reason why it would not work in this case??.
Al
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #5   Ban this user!
Old 08-31-2004, 08:04 PM
pminmo's Avatar  
Join Date: Jun 2003
Location: St. Peters, Mo USA
Age: 59
Posts: 3,325
pminmo is on a distinguished road

arvid,
Putting the diode in the vcc line will possibly damage the gate. If it were me I'd simply use a pnp small signal transistor. What is you logic voltage, 3.3V?

Phil
Reply With Quote

Sponsored Links
  #6  
Old 08-31-2004, 08:46 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,543
Al_The_Man is on a distinguished road
Buy me a Beer?

Originally Posted by pminmo
arvid,
. If it were me I'd simply use a pnp small signal transistor.
Phil
I think the base current would introduce too much leakage through the opto, I was looking through the app notes on the 2n700 and it shows a very similar senario as to what you want to achieve. It also shows connecting the drain to 5v and a 1k to 10k resistor in the source to gnd and feeding the gate with high voltage 12~24 in, the top end of the resistor would then connect to your logic and voila, no load imposed.
I could run a simulated test tommorrow if I get the chance.
Al
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #7   Ban this user!
Old 09-01-2004, 07:54 AM
 
Join Date: Oct 2003
Location: Sweden
Age: 34
Posts: 398
arvidb is on a distinguished road

Einar: I would still need a pull-up in case the opto coupler was not included in the circuit. I'm not sure how/if that fits into your suggestion?

Phil: yes, my logic voltage is 3.3V. The IC is 5V compatible though, so it can take up to 5V on its logic inputs.

Al: I'm reading up on the 2n7000. So I would use the gate as an input (from the external circuit)? What happens when the gate floats (when no opto-coupler is connected in the circuit)?

Another solution would be to use a schottky diode in my original schematic (only 0.4 V drop).

Thanks for all your help so far!

Arvid
Reply With Quote

  #8  
Old 09-01-2004, 09:23 AM
*Registered*
 
Join Date: Apr 2004
Location: Norway
Posts: 678
ESjaavik is on a distinguished road

Arvid: Ohh. I didn't know the opto was not there all the time. Guess I didn't watch the schematic long enough to notice.
A pullup directly on the gate would work. Just keep it high resistance.
Reply With Quote

  #9   Ban this user!
Old 09-01-2004, 10:04 AM
 
Join Date: Oct 2003
Location: Sweden
Age: 34
Posts: 398
arvidb is on a distinguished road

*LOL*

To be really sure the opto coupler doesn't activate, what would be a reasonable max current? 0.1 mA? In that case I'd need about 200kOhm resistance on the input. I guess that would put my pull-up resistor in the MOhm range. Would this work?

edit: forget that, the total input resistance to Vcc should be 200k. So perhaps 20k input resistor and about 200k pullup would work?

edit2: but that would give me ~0.3V low level voltage. About the same as the schottky diode, without the added benefit of overvoltage protection the schottky/pullup combo gives. Hmm...

Arvid

Last edited by arvidb; 09-01-2004 at 10:10 AM.
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -5. The time now is 09:27 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361