As someone who holds an engineering degree but is sort of new to circuit design/ electronics, I'm probably not aware of the many conventions and techniques that a more experienced circuit designer would assume are obvious. I would like to learn to become a competent circuit designer, however, and I was wondering if you wouldn't mind taking a look at this simple circuit I designed to test a pair of sensors. The sensors operate at 27V which is why I use MOSFETS to interface between the microcontroller and the inputs/outputs. The relay is there because those pins provide 27V power to the sensors so it would need to provide more current than the mosfet could, and also as a fail safe.

Specifically what I am not sure about is if I should place more diodes / caps to protect the circuit and reduce the chances of problems/ malfunctions arising.. I have placed diodes and caps on the input power, and a diode across the relay coil, but that is basically it, and I am not too confident about my cap choices.

Also, any observations / recommendations regarding the circuit, or even ways to improve the schematic layout would be great!

Thanks in advance!

enter image description here


Thanks to all the help, I have updated a schematic with the changes. I have replaced the linear regulator with a switching regulator, added bypass caps, fixed the relay placement/ made it a 24V relay, double checked that components will meet current/ voltage specs, added series resistances to fets, added TVS diodes on inputs, added fuse / on/off switch, tweaked the input voltage divider. added caps on inputs, and I think that is it.

Updated: http://ge.tt/2o9qXZ32/v/0?c

  • 2
    \$\begingroup\$ add a 100nF capacitor as close as possible to each VCC input of your microcontroller. Also you might want to add a resistor between your microcontroller and your MOSFET Q4 (failsafe output). Your reset circuit needs to be pulled up to 5V. Add a 10k resistor for this that is connected to 5V and your reset output of the microcontroller. This are just some things I see now, maybe there are more things that should be changed / improved. \$\endgroup\$
    – T J
    Nov 3, 2014 at 8:02
  • \$\begingroup\$ Might be a good idea to put your relay from the source to the drain of Q4 (similar to what you did on Q6) \$\endgroup\$
    – efox29
    Nov 3, 2014 at 8:12
  • \$\begingroup\$ Is D1 for reverse polarity protection ? Is it rated for the current draw ? \$\endgroup\$
    – efox29
    Nov 3, 2014 at 8:15
  • \$\begingroup\$ You might want pull-downs somewhere on the gate drive to the two 'test' output FETS, to make sure they're off when the micro is in reset and its outputs are tristate. You might consider a small cap across R2/7/10 to filter noise from the fet inputs. Also on the fet inputs your gate voltage is half the input voltage, so you'll need to make sure you have a fet with a threshold voltage that's suitable for your input signals. \$\endgroup\$
    – user1844
    Nov 3, 2014 at 8:20
  • 2
    \$\begingroup\$ I agree with @efox29 the diode D1 for input protection should be rated to handle the current expected to go through it. Q4 is being used as a high-side power switch, but is not going to work. You will need to move it down to a low-side switch. N-Fets need to get the Gate voltage higher than the source to turn on, which you will not be able to do with the current set up. Low side is easy, because basically any + gate voltage applied is higher than GND :) \$\endgroup\$
    – KyranF
    Nov 3, 2014 at 8:57

1 Answer 1


You're using a linear regulator to get 5V from 27V- further the regulator is only rated at 30V abs max. If the 5V relay draws only 25mA and the rest of the circuit 10mA you've got 750mW dissipation in the regulator - could be a problem. Turn the LEDs all on and you may have several watts. Maybe consider a 24V relay with a series resistor or LED (flyback diode directly across the coil). I would suggest at least a 40V rating on the regulator. Perhaps consider better LEDS that don't need as much current. A switching regulator may be a better choice.

As others have said, bypass cap on the micro, and use series gate resistors and pull-up/pull-down resistors consistently on each MOSFET, and fix Q4 (use a p-channel MOSFET) as Kyran said- pull-up or pull-down for off or on respectively on the port pin and a series gate resistor. Or an n-channel and put the relay between drain and +5V. 100k is okay for the pull-xx resistors, except for the reset switch where 10K is better (consider ESD on the reset finger too).

Speaking of which, I'm not a big fan of using MOSFET gates connected to the outside world, even with the 1K resistors. Use TVS or dual diodes on the gates of Q1~Q3 to protect against over voltage. The circuit as shown will never survive an ESD test. BJTs with added EB diodes are a cheaper way to go.

Make sure the internal reset and WDT of the micro is adequate or allow for an external one.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.