Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

PWM Input

  1. Sep 14, 2010 #1
    Hi there!

    In the circuit attached, I am curious about OK5 (the optocoupler on the right side). Is it ok to leave the collector like that, with no resistor limiting it? Should I set it up differently, with the pin attached to the collector and a pull-up resistor, grounding it when the LED is on? This is in a high noise environment, so I would like to clean up as much as possible.

    P.s. Do you see any other issues that should be addressed in the circuit?

    Attached Files:

  2. jcsd
  3. Sep 14, 2010 #2


    User Avatar
    Science Advisor

    There should be a resistor to ground from the emitter of this transistor to pull the output to the Stamp low when the PWM is off. Maybe try a 4.7 K there and adjust on test.

    Assuming the Stamp input is high impedance, even some slight leakage of this transistor would cause the Stamp input to go high without an external resistor to ground.
  4. Sep 14, 2010 #3
    I'm curious why you picked the value of 4.7k ohms. I've not been instructed formally in the use of pull-up/pull-down resistors, and I have been generally assuming 10k is appropriate for what I'm doing. How should I be deciding on a resistance?
  5. Sep 14, 2010 #4


    User Avatar
    Science Advisor

    Just experience. It may be necessary to modify this, but 4.7 K would be a typical value.

    You could try 10 K but I wouldn't try 100 K. It is just a figure to put you in the right ballpark.
    4.7K means the maximum current of the transistor would be about 1 mA, so I expect you would have to make this resistor lower than 4.7 K if anything.

    You could put in a 10 K pot as a rheostat and find the best value like that and then measure the resistance and substitute a suitable fixed resistor. Or just leave the pot in position.
    Put a 470 ohm resistor in series with the pot to avoid the transistor being destroyed by too much current if the pot is set too low in resistance.

    Incidentally, the collector should be bypassed at the chip. This is not shown, but you may intend to do it anyway.
    It tends to stop digital garbage from other parts of the board getting into your opto coupler.

    I use 0.1 uF monolithic ceramic capacitors and these seem to do a good job, although you can rip the legs off them pretty easily if you are too rough with them.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook