Help with a simple circuit

I’m trying to connect an arduino to a sensor using a PC817. I would like to add reverse polarity protection and surge suppression to the 15vdc side to protect the sensor, but I’m not sure of the proper way to wire it up. Below is a picture of what I have drawn up, but I would like to make sure it is correct prior to damaging equipment… I’m new to this and trying to print my own pcb, so any help would be great!

Thanks in advance for the help!


Not sure from your schematic. What is connected to pins 4, 2, and 1 of J3? Is pin 2 of J1 doing something with your sensor?

Also, why the series resistors rather than a single one on the IR LED and the collector of the PC817? Seems like 2.33K is a little higher than optimal. If you are providing 5V on pin 1 of J3, you would have about 1.63mA, nominally, going through the IR LED, which would probably work most of the time, but there could be conditions under which it may not be reliable. You might want to knock down the resistance to allow at least 5mA through the LED to make it more reliable.

J1 = Arduino (1 = 5v, 2 = Signal, 3 = Gnd)
J2 = 15vdc power and enclosure ground
J3 = Learning switch (1 = Signal, 2 = Gnd, 3 = Learn, 4 = 15vdc)

The PC817 (I was) told needed ~1.2vdc to operate the LED and (with the resistors I have on hand) 2.33K was reading ~1.15vdc from the ~14.5vdc coming in on the sensor pin of J3. On the Arduino side, I had to add the resistors (again, from what I had on hand) in order to prevent the signal from floating and giving me counts when there were not suppose to be any.

Along with the code, that seemed to be working, so I wanted to add surge protection (I thought with the V22MA1B varister and 103 capacitor) and reverse polarity protection with the FQP47P06 (or FQP27P06?) to protect the sensor as much as reasonably possible. I don’t have the parts to test this part, so I wanted to determine if my google-foo was correct in these selections. I’m truly not sure between the FQP47P06 and FQP27P06 as to which I need because the only difference I can tel is one is +60v and the other is -60v.

I hope this clarifies my conundrum…

The varistor needs to go in parallel with the 15V power supply, you have it in series. It should also be connected in between the MOSFET and the input terminals.

A varistor protects by creating a short circuit when the clamping voltage is reached. To help it work you want the least amount of impedence between the varistor and power source and the most amount of impedance between the varistor and the rest of the circuitry. So when you lay out the circuit board place the varistor as close as possible to the terminal strip. Make sure the traces from the terminal strip go only to the varistor. Then run traces from the rest of the circuit to only the varitor, not the terminal strip.

Another problem is the capacitor since it is being continuously subjected to 15V you should use a 30V or higher capacitor. A 16V cap won’t fail right away but it will degrade fast and then fail if used continuously @ 15V.

I’ve never had the chance to use a MOSFET for polarity reversal protection but I think it looks right.


Is this more of what you are thinking?

What happens to the capacitor and varistor if the polarity is reversed? Would they be destroyed or damaged? I was thinking the reverse polarity would be the first protection item then surge, but again, I really don’t know…

Any idea?


No, the capacitor is not to be in series with the varistor. Keep the capacitor where you had it before, between 15V and ground next to J3.

PaulH is correct regarding the positioning of the varistor. Keep it very close to J2, and connected directly to pins 1 and 2 of J1.

Regarding the FQP47P06 and the FQP27P06, the only significant difference is their current ratings, which are 47A and 27A, respectively. They are both 60V (or -60V depending on ones perspective) P-channel MOSFETs. Either would be fine. It appears to be correctly connected for reverse polarity protection.

If pin 1 on J3 will be in the 14V range, then your resistance is fine for the IR LED.

If pin 2 of J1 is a digital signal going to the Arduino, then 3K is probably fine, though 10K is more optimal. Optocouplers tend to have a wide range of output characteristics depending on the production lot, so one might work fine with higher collector current, while another may not. It has to do with how sensitive they are to the IR light source (the spec is the current transfer ratio, or CTR). By reducing the collector current to under one milliamp, it should give you good results regardless of which specific production lot you get.


Is this more in line to what you are describing?

Pin 1 on J3 is coming from a WLG4S-3P3232 (10-30vdc), but the power I’m jumping off of is ~15vdc with a final signal voltage of ~14.5vdc. If this was connected to 24vdc by mistake, would the protection help as drawn or would it cook the PC817 due to the resistors being to small?


No, a varistor is not designed to protect from slightly higher voltages, it protects from large voltage spikes (lightning, static, etc.).

At 15 VDC you have about 5.9mA drive current for the LED. With 24 VDC power you’ll have about 9.8mA drive current. Check the data sheet to see if the optocoupler LED can handle the current (most work with 5 to 20mA so it’s likely OK)


Sounds good. I’ll check the sheet. Does everything look good on the schematic? Is there a difference in having the traces intersect together or do I need to keep the junction points to a minimum?


You don’t need to keep the junction points to a minimum. Make the circuit as simple as possible for yourself.

1 Like

If the schematic is correct, does it look like I have the correct parts selected? I am confused on the varistor selection, so I kinda took a shot in the dark.


The Varistor should be fine. it will handle the normal 15VDC, and will protect the circuit from a major power spike.

The varistor will try to clamp the voltage at 22V. Any voltage above that will damage the varistor if it remains for any length of time. It is only meant to handle transient high voltages (well under 1 second). Therefore, if there’s a possibility of applying 24V across it, it will likely fail eventually. If you expect to apply 24V, you need to select a varistor rated for higher than that. Of course, that will mean that it will allow much higher voltages than 15V into your system without clamping, so that’s a trade-off.

Paul is right about the LED current. It can handle up to 50mA (though I wouldn’t go anywhere near that), so 10mA is just fine.

1 Like

If you need it to also work at 24V, here are a few varistors to consider:

399-VM474MK801R020P050-ND This one is nice in that, not only will it handle 24V, but it also has a 0.47uF capacitor in parallel, which helps reduce noise in your system.

V33ZA20P-ND This is a standard 10mm diameter varistor which will handle 24V.

F11291-ND This will behave just like the V33ZA20P-ND except that it is 20mm diameter and it can handle significantly more energy before being damaged.

1 Like

If I go with the 399-VM474MK801R020P050-ND, will it protect at both 15vdc and 24vdc or is it still an either or?

A higher continuous voltage varistor works at all lower voltages.

Usually the only significant difference is that the clamping voltage will be higher. I haven’t read the data sheet but I’d bet going from a part suitable for 15v to a 24V suitable part will have a negligible lowering of protection capability.

So, the way varistors work is they act as invisible components as long as the voltage is below some specified value. We refer to this voltage as the maximum continuous working voltage. The V22MA1B is rated for 18Vdc max continuous working voltage.

Somewhere above that value (depending on variables like production lot, temperature, probably humidity, etc.) they will begin to start to conduct current and start to clamp the voltage. For instance the V22MA1B will start to conduct and clamp somewhere between 19V and 26V. The maximum clamping voltage under a certain set of conditions is 51V. That may seem very high, but most electronics designed for 15V or more can handle that for the short time of a transient (usually in the microsecond range).

The 399-VM474MK801R020P050-ND has a max continuous working voltage of 26Vdc and will begin to clamp between 26.4V and 39.6V. The maximum clamping voltage under a certain set of circumstances is about 54V.

Notice that the max clamping value between the two only differ by 3V. Therefore there is very little difference in how much protection one offers vs. the other for the most common types of events. If there were repeated events occurring between 18V and 26V, the V22MA1B would probably protect better, but those voltages are unlikely to do damage anyway.

Therefore, choosing a varistor rated for 26Vdc will give most of the the same protection as the lower voltage one but allow you to put 24V into the system without damaging the varistor.

1 Like