Detecting 110V DC

So what ?

Sorry if I offend you. But I still think it is the wrong approach. Maybe I am not as professional as you, though.

On that same post, @Wawa said 15K 2W is ok. Please read the entire post.

The point is, I am grabbing data from a bigger system. I don't want to have any connection between my circuits, and that I am monitoring. Those few components with optocoupler are way too much.

You have not offended me at all. A forum is a place for exchange of views. Other contributors to this thread have also written that my potential divider suggestion would not be satisfactory without giving any reasons. I made it clear that my suggestion would not be suitable if the 110V could have high voltage transients on it. My circuit proposal can be criticised because there is no data (that I've found at least) to say what current the Arduino's input protection diodes can take. However, even if the voltage were to go up to +470V or down -470V the appropriate protection diode would still have to take less than 0.1mA. Another criticism that can be levelled at my circuit suggestion is that the input to the Arduino could pick up some interference from nearby data and clock signals. A smallish capacitor across the 100K resistor would sort that out if necessary.

If you do not want to connect the negative side of the 110V to the ground of your Arduino circuit then it is appropriate to use an optocoupler. I have found differing datasheets for the PC817C. The Farnell datasheet says the current transfer ratio (CTR) is "50% to 600% at input current of 5mA". The table on page 5 of the datasheet seems to indicate that the "C" suffix means that the collector current would be in the range 4mA to 20mA for 5mA LED input current. However that is for a collector-emitter voltage of 5V. Unfortunately the datasheet gives virtually no information on what input current is required to get the transistor into saturation (so the collector-emitter voltage is well under 1V). However Figure 8 on page 7 confirms that, for an input current of 5mA, the collector current is fairly independent of collector-emitter voltage (down to about 0.5V). Figure 6 on page 6 shows that the current transfer ratio varies with input current (but that must be only a typical graph). At 1mA it is about the same as at 5mA. Especially if your circuit is going in a small plastic project box you don't really want your R1 resistor unnecessarily dissipating about 1W. It therefore makes more sense, as suggested by @Wawa, to design for an input current of about 1mA, so R1 would be 68k (to give about 1mA when the input voltage is 70V). The maximum dissipation of the R1 resistor would then be down to about 0.25W. We now need to decide the value the R2 resistor. This is where we would like better information from the datasheet. If we assume that CTR will be at least 50% with input current of 1mA, then we could expect the collector to be capable of delivering at least 0.5mA. Allowing an extra margin, we could design R2 to ensure the collector is pulled low if the collector current is only 0.25mA. This would mean R2 being 15kΩ. We still have a trick up our sleeves that we could use: if the collector is connected to an Arduino analogue input, we would be able to detect much lower collector currents. If this is a one-off, not going into production, I would consider increasing R1 and R2 further while ensuring that 70V is detected. If you were prepared to use a potential divider going to an analogue input instead of an optocoupler you would be able to set a voltage detection threshold very much more accurately.

Not sure what you mean by this...... are you suggesting the opto is to complex / too many parts?

I use the same circuit as in your original post to sense 120 VAC. My input resistor is 120K

For your 70 volt requirement I would suggest something in the 80k to 100k range.

Maximum voltage on 1k resistor = 5V

In parallel to 1k resistor you can attach LED as voltage indicator, max current in the circuit is 10 mA

And what maximum power on 10k?

Please explain why.

100V/ 10 000 Ohm = ....

10 mA x 100V = ...

OR

E^2 / R = 100 * 100 / 10000 = ________ (answer in the back of the book) :slight_smile:

As I said, I don't want much interfering with the system. I wanted to say that I will put what is necessary, but not much. The resistor and optocoupler are ok.

Ah.... OK gotcha.

Then your original circuit with R1 = 80k to 100k should be all you need.

So you suggest that post #2 is not what I need?

Last week I installed one PCB with 100K 1206 and I get detection. Sort off. Readings vary, not what I expect. In the database, I get some strange data. When it should write LOW, it puts a few HIGH. When it should be all 0's, I get 0, 1, 0, 0, 1, etc. If there is voltage, there should be all zero's.

Post # 2 recommends 14k, not 100k. The optocoupler must have enough current to open the transistor.
Take a multimeter and measure the voltage at the output of the optocoupler (or use analogRead() in Arduino if you have no DMM), you will see if it gives a low voltage or not.

You probably should add a 0.1µF across the transistor. You might need to drop R1 to 80K.

@80k you will be burning about 1/4 watt which is right at the power rating. If there is a lot of copper near by you should be OK.

And/Or you can increase R2 to 20k. Or you could remove R2 and enable the processor internal pullup.

Just a note, at 14k the power dissipated in R1 would be ~ 3/4 watt. You would need a different resistor than a 1206.

From the original post, to ensure detection of voltages over 70V, that needs to be done with an input voltage of no more than 70V .

My post #23 suggests using 68k for R1 and 15k for R2. That's based on a datasheet for the optocoupler taking the wide tolerance of current transfer ratio into account. That's not based on guesswork.

But the topic starter does not listen to your advice, he puts R1 = 100 kOhm and asks why the circuit does not work.

I suggest that he measure the voltage at the output of the optocoupler and understand why it does not work.
Probably, the phototransistor does not open completely.

You should have used internal pull up on the pin instead of the external 10k resistor.
That would have made it easier on the transistor.
And, what JohnRob said, a 100n cap across the transistor, to bridge short interruptions.
100k LED CL should work ok after these mods, but you should have used 68k (for >=1mA).

Don't know if I would put 130volt across a 1206 smd resistor.
If you use smd, then use two of half the value in series.
Leo..

1 Like

SMD 1206 resistors can be rated at 200V.

Where is the 70V to 130V DC coming from? Is it steady DC with no ripple?