enter image description hereI am working on a simple Arduino based project where I will use PID to modulate the PWM signal of an Arduino microcontroller, so the PWM values will vary from 0 to 255, as that is the resolution. I will be using AnalogWrite ( PWM voltage ) to out varied voltages. So my question is this, suppose I need a 12 V power supply that is connected to a resistive heating element, how would I control the amount of current flowing through a heating element. Note that I have already developed a on/off system that supplies maximial current, when I set the PWM to 100 % duty cycle and zero current, when I set the PWM to 0 % duty cycle.

I talked to my supervisor and he told me to connect the PWM to a mosfet and vary the PWM which will allow a varying current to flow through the heating element ( resistive).

Is this a good idea and will this work?

  • \$\begingroup\$ See the heated bed or nozzle MOSFET drive circuit of a typical Arduino-derived open-source 3d printer electronics. \$\endgroup\$ – Chris Stratton Nov 20 '17 at 21:14
  • \$\begingroup\$ Why would you supervisor tell you to do it if it wasn't a good idea? \$\endgroup\$ – Finbarr Nov 20 '17 at 21:20
  • 1
    \$\begingroup\$ @Finbarr, it's always good to get other opinions. \$\endgroup\$ – Niloy Alam Nov 20 '17 at 21:28
  • 1
    \$\begingroup\$ I haven't seen this particular xkcd one. \$\endgroup\$ – Paul Uszak Nov 20 '17 at 21:29
  • \$\begingroup\$ Your supervisor is spot on. That is a very good solution. Had you asked us the same question omitting your supervisors recommendation then I'd make an answer saying what s/he said. Also, great xkcd art. Also, FYI, you can increase the PWM resolution if you read the datasheet of your particular Atmega that is at the heart of the Arduino. With Atmega328p you can get 16 bit resolution. That's 256 times more than what you will be using. Look for Timer0 in the datasheet, if you are interested. \$\endgroup\$ – Harry Svensson Nov 20 '17 at 23:58

As drawn, you would need a P channel fet and you would never be able to turn it off as the gate voltage from your arduino would be 3.3V or 5V, no where near the 12V source voltage.

Use a n channel mosfet, switching the "valve" with the heater, would work. Of course, you need a mosfet that can allow x amount of current your heater needs, at y gate voltage, where y is your arduino voltage. Google low side driver circuit.

Or you can use a mosfet driver to enable or disable a P channel fet. Added complexity.

  • \$\begingroup\$ How would you control the valve with the heater. The valve is not really a physical valve, I am imagining it as water valve that will control the amount of flow. I want to use the NPN transitor (MOSFET). Essentially the valve is like the transitor or some device that can control the current flow. \$\endgroup\$ – Niloy Alam Nov 20 '17 at 23:05
  • \$\begingroup\$ By using PWM, you turn the mosfet on and off at a rate that equals a percentage of "on". So a 30% pwm will act like it was 30% of normal current. \$\endgroup\$ – Passerby Nov 20 '17 at 23:09
  • \$\begingroup\$ Thank you, but I am scared that if I supply a large current what if i burn my transistor. \$\endgroup\$ – Niloy Alam Nov 20 '17 at 23:13
  • \$\begingroup\$ You get a mosfet that can handle the current. \$\endgroup\$ – Passerby Nov 20 '17 at 23:19
  • \$\begingroup\$ Can I put mosfets in parallel? Not sure how to do it, like I know how to put resistors in parallel which will limit the amount of current flow accross each resistor. It's a very stupid question, for some reason I cannot visual it. I need like a schematic. \$\endgroup\$ – Niloy Alam Nov 20 '17 at 23:22

This would certainly work. This is exactly how most 3D printer motherboards drive the extruder and bed heaters. Take a look at the schematic of the RAMPS 1.4 for a good example:

  • \$\begingroup\$ That's illegible and you have no links to the other item mentioned. \$\endgroup\$ – Transistor Nov 20 '17 at 23:33
  • 1
    \$\begingroup\$ What is this? A schematic for ants? \$\endgroup\$ – Harry Svensson Nov 20 '17 at 23:57

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.