Re: The best way to drive a heating element?
I understood that part.
However, to drive even such "heating element", you still need some technical specs. Can't do without them. At all.
Like any science question, step #1 is always: identify the problem... in this case, your heating element (which is not a problem per se... but driving it properly can be a problem if you don't do it right.)
If you don't know the specs on the heating element, then the thread question becomes almost equivalent to asking something along the lines of "what's the best way to cook potatoes?" Now bear with me for a moment here, please, I'm not trying to grill you.
(See what I did there?
)
But answering such question can yield a 1000 answers (or more), none of which may be relevant to your needs or what you're trying to do. So to help us help you figure out an answer to your question faster, always try to provide as many technical details as you can.
Back to the heating element in question, it looks just like a long trace on a PCB, and my guess is you're hoping to use that as a heating element by passing current through it. Well, that's OK. But if you want to do it this way, then either use proper formulas to calculate the resistance of the heating element, or determine it through experimenting / measurement. Knowing the resistance is really all we need. Knowing the power... that would be useful too, but not 100% necessary. After all, if you don't know the power rating of a heating element and you put too much through it, it will just overheat and likely break/burn out.
OK, GOOD!
Now we are getting somewhere.
I know this might not be the final design and I understand the resistance spec above could change... but let's assume this will be the spec so we can walk through the rest of the design process. Once you see how it's done, you can hopefully then use it for other future projects.
I understand you want to make something like a hot plate for your lizard... though not something that too hot. More like a warm plate, I presume - at least that's what 45-50C is. Either way, to avoid lengthy math calculations and somewhat complicated formulas about power, surface area, and temperature, it may just be easier to determine this experimentally. How? Experiment by running power sources of various voltage outputs connected directly through your "heating element" and see how hot it gets. Do that until you get one somewhere in the ballpark of your target temperature or maybe a little higher.
The only formulas you really should learn are Ohm's law and power. These in particular:
V = I * R
P = (V^2) / R
P = (I^2) * R
In this case we have R and we can choose V to get a certain P level. If the P level doesn't work for us (too low), we increase V. If P level is too high, then we use lower V.
Let's say you try it with a 5V source first and the heating element connected directly across it. If it really has 1.5 Ohms of resistance, then it should draw...
I = V / R = 5 / 1.5 = 3.3333 Amps of current.
And the power it uses will be....
P = V^2 / R = 5^2 / 1.5 = 25 / 1.5 = 16.7 Watts
Now 16.7 Watts may be too much or may be too little. It will all depend on how large that etched PCB is - particularly its surface area. But we are not changing that (yes?), so we can only adjust the power levels to get to a temperature we can use.
Let's imagine that after a few minutes of heating, the surface area of the PCB has reached more than 50C... like 70-90C. Higher is better in our case, because we can now use a switching/controlling device (be it BJT, MOSFET, or whatever) to regulate the power of the heating element. In turn, this will regulate the heat given off of the plate and get you to your target temperature.
- Notice above that I said to regulate power and not current. Doing so make it easier to drive the "heating element", regardless if you picked BJT or MOSFET. This is where it's helpful to understand Duty Cycle.
If you only partially turn on the MOSFET or BJT to control current through the load (the heating element), then you will be wasting a lot of power (and produce a lot of heat) on your MOSFET / BJT - possibly even more than what the "hot plate" / heating element is producing. This is inefficient and also harder to design for, because now you will need a really big heatsink for the BJT / MOSFET. You will also need to make sure it's coupled well to it. But most importantly, you will now have to look at ton of datasheet parameters and curves (SOA, temperature vs. power dissipation, and etc.) when it's time to pick a part from your inventory, because you would need to determine if the part is even suitable for your design.
In short, trying to control the current through the heating element in a continuous (linear) fashion is not recommended. It's harder and more wasteful. There are exceptions to this, like with linear regulators (where low electrical noise output is more important or really needed.) But here, we don't need any of that. We just need a temperature between 45-50C and that's it.
So the best way to drive a heating element, at least for your project here, is with duty cycle - i.e. cycle power to the heating element On and Off to keep it, on average, between 45C and 50C.
There are many different ways you can do this. Since this appears to be a relatively small plate with not much thermal mass, then using large-period duty cycle may not be ideal. For example, if you keep the plate On for 5 minutes, then Off for 5 minutes, the power output will be 16.7 Watts for the first 5 minutes and then 0 Watts for the other 5 minutes. This will give an average of 16.6/2 = 8.3 Watts of power for the entire 10 minute period. But again, because the PCB that you are using as a heating element is rather thin and with not much thermal mass, you might find this to yield unsatisfactory results, where in the first 5 minutes, the temperature gets too hot (too much over 50C) and then too cold (too much below 45C) in the other 5 minutes.
To get around this, you can change the period. Instead of 5 minutes on and 5 minutes off, you could do 30 seconds On and 30 seconds Off... or even 5 seconds On and 5 seconds off. This will give a more controlled and stable temperature of the PCB. If that's not enough, you can go into even smaller increments: 500 ms On and 500 ms Off... or even 50 ms On and 50 ms Off. This way, essentially you are now supplying the heating element / PCB with only half of the power that it would normally use at full 5V.
OK, so you determine that perhaps the above (5 "something" periods On and 5 "something" periods Off) yields too low of a temperature. Then just bump up the duty cycle. Maybe try something like 7.5 "something periods On and 2.5 "something periods off... i.e. perhaps 750 ms On and 250 ms Off... and repeat this every second. If this yields a temperature in the range of 45C to 50C, then you just program your MCU to toggle the MOSFET or BJT On and Off with the following periods above.
Now let's say the room temperature changes a little... or more than a little. It could make it that this 750 ms On and 250 ms Off scheme is no longer outputting temperature in the range of 45 to 50C. This is where you use the temperature sensor of your MCU and program the MCU to change the duty cycle as needed to adjust the temperature. For example, if the room is hotter and 750 ms On / 250 ms Off is too hot, then the MCU switches to something like 600 ms On / 400 ms Off scheme. Still too hot? Let it switch schemes again in the code. Maybe 500 ms On and 500 ms Off? If that all of a sudden is too low and the temperature is below 45C, then have the MCU bump back the scheme to 600 / 400 ms. If that's not enough, go back up to 750/250, and etc. Just make sure to program it so that when the MCU switches "schemes" as stated above, it stays with a certain scheme for at least 10-100 such full periods of the scheme. This will avoid a situation where the MCU is over-reacting to its own constant re-adjustment of schemes.
Essentially what I describe above is quite similar in many ways to what PID does. But the above is in much more simplified form and one you can easily modify to suit your design with some trial and error.
With that said and going back to driving the heating element, which was the main question at hand in this thread...
OK, so you found that a 5V source can produce enough heat to drive your heating element more than hot enough for your needs. Next, we're tasked with picking a part than can drive the heating element. In a circuit similar to the one shown above in your first post, when the transistor (be it BJT or MOSFET) is fully On, we determined that the current the heating element will draw is 5V / 1.5 Ohms = 3.333 Amps. I see you listed IRF510N as one of your available parts. Let's look at its datasheet. It says it can handle up to 100V between Drain-Source and up to 4 Amps of continuous Drain current at T_case = 100C (or 5.6 Amps with T_case = 25C... but let's assume the worse rating, just in case - i.e. 4 Amps.) In theory, this MOSFET should be able to handle this heating element as a load if you drive it / toggle it fully between On and Off states (hence the whole explanation above of duty cycle.)
So now all you really need to do is connect this MOSFET in your design, like you showed in the first post (but with correct symbol, please, now that you're aware of what device you will be using
). And then have the MCU sent full 5V to the MOSFET's Gate to turn it On or shunt the Gate to 0V to fully turn if Off. Just add something like a 1-10 KOhm pull-down resistor to ground (in place of R1), in case the MCU output floats for some reason (otherwise you could be stuck with a fully turned On MOSFET all the time.)
And that should be pretty much it.
The rest will be all code and you experimenting with it to determine a "base" duty cycle, where the temperature of the heating element is in the range of 45-50C, along with how the duty cycle "schemes" can vary so that the surface temperature of the heating element will stay between 45-50C regardless of the room/surrounding temperature.
Well, in the case where you drive a real heating element with a high inductance, once the MOSFET or BJT turns Off abruptly (assuming you are doing duty-cycle / PWM driving) the heating element will have some electrical energy stored in it due to its inductance. Now remember this: inductors do not "like" "sudden" changes in the current flowing through them. Any time a sudden change tries to happen, the inductor will try to push / sustain the same current that was there before, until it runs out of energy. This is called inductive kickback. If you don't deal with it properly, the voltage at the MOSFET/BJT end of the heating element can overshoot greatly and break down / damage your MOSFET/BJT. You don't want that! Having a diode in reverse bias in parallel with the heating element provides a path for the inductor to sustain / maintain its current until the energy stored in it is depleted. Otherwise with no such path, your MOSFET / BJT will be force to provide one... and when that happens, it will go 
So for future projects, particularly if you ever have to drive relays, motors, or any such similar inductive device, then read up on inductive kickback and how to curb it. A simple reverse-bias diode is the most simple way to do it..., but it may not always be enough. As the inductance (and stored energy) gets larger and larger, more complex circuits will be needed to handle this energy. Read up Snubber circuits if you'd like to understand this better. I think even Electroboom had a good video on that matter a while back that had good visuals in it so you can see what's happening.
Anyways, hopefully this "essay" is specific enough to answer some of the questions in regards to your project here, yet also broad enough to use for other projects you may have.
Originally posted by EasyGoing1
View Post
However, to drive even such "heating element", you still need some technical specs. Can't do without them. At all.
Like any science question, step #1 is always: identify the problem... in this case, your heating element (which is not a problem per se... but driving it properly can be a problem if you don't do it right.)
If you don't know the specs on the heating element, then the thread question becomes almost equivalent to asking something along the lines of "what's the best way to cook potatoes?" Now bear with me for a moment here, please, I'm not trying to grill you.


But answering such question can yield a 1000 answers (or more), none of which may be relevant to your needs or what you're trying to do. So to help us help you figure out an answer to your question faster, always try to provide as many technical details as you can.
Back to the heating element in question, it looks just like a long trace on a PCB, and my guess is you're hoping to use that as a heating element by passing current through it. Well, that's OK. But if you want to do it this way, then either use proper formulas to calculate the resistance of the heating element, or determine it through experimenting / measurement. Knowing the resistance is really all we need. Knowing the power... that would be useful too, but not 100% necessary. After all, if you don't know the power rating of a heating element and you put too much through it, it will just overheat and likely break/burn out.
Originally posted by EasyGoing1
View Post
Now we are getting somewhere.

I know this might not be the final design and I understand the resistance spec above could change... but let's assume this will be the spec so we can walk through the rest of the design process. Once you see how it's done, you can hopefully then use it for other future projects.
I understand you want to make something like a hot plate for your lizard... though not something that too hot. More like a warm plate, I presume - at least that's what 45-50C is. Either way, to avoid lengthy math calculations and somewhat complicated formulas about power, surface area, and temperature, it may just be easier to determine this experimentally. How? Experiment by running power sources of various voltage outputs connected directly through your "heating element" and see how hot it gets. Do that until you get one somewhere in the ballpark of your target temperature or maybe a little higher.
The only formulas you really should learn are Ohm's law and power. These in particular:
V = I * R
P = (V^2) / R
P = (I^2) * R
In this case we have R and we can choose V to get a certain P level. If the P level doesn't work for us (too low), we increase V. If P level is too high, then we use lower V.
Let's say you try it with a 5V source first and the heating element connected directly across it. If it really has 1.5 Ohms of resistance, then it should draw...
I = V / R = 5 / 1.5 = 3.3333 Amps of current.
And the power it uses will be....
P = V^2 / R = 5^2 / 1.5 = 25 / 1.5 = 16.7 Watts
Now 16.7 Watts may be too much or may be too little. It will all depend on how large that etched PCB is - particularly its surface area. But we are not changing that (yes?), so we can only adjust the power levels to get to a temperature we can use.
Let's imagine that after a few minutes of heating, the surface area of the PCB has reached more than 50C... like 70-90C. Higher is better in our case, because we can now use a switching/controlling device (be it BJT, MOSFET, or whatever) to regulate the power of the heating element. In turn, this will regulate the heat given off of the plate and get you to your target temperature.
- Notice above that I said to regulate power and not current. Doing so make it easier to drive the "heating element", regardless if you picked BJT or MOSFET. This is where it's helpful to understand Duty Cycle.
If you only partially turn on the MOSFET or BJT to control current through the load (the heating element), then you will be wasting a lot of power (and produce a lot of heat) on your MOSFET / BJT - possibly even more than what the "hot plate" / heating element is producing. This is inefficient and also harder to design for, because now you will need a really big heatsink for the BJT / MOSFET. You will also need to make sure it's coupled well to it. But most importantly, you will now have to look at ton of datasheet parameters and curves (SOA, temperature vs. power dissipation, and etc.) when it's time to pick a part from your inventory, because you would need to determine if the part is even suitable for your design.
In short, trying to control the current through the heating element in a continuous (linear) fashion is not recommended. It's harder and more wasteful. There are exceptions to this, like with linear regulators (where low electrical noise output is more important or really needed.) But here, we don't need any of that. We just need a temperature between 45-50C and that's it.
So the best way to drive a heating element, at least for your project here, is with duty cycle - i.e. cycle power to the heating element On and Off to keep it, on average, between 45C and 50C.
There are many different ways you can do this. Since this appears to be a relatively small plate with not much thermal mass, then using large-period duty cycle may not be ideal. For example, if you keep the plate On for 5 minutes, then Off for 5 minutes, the power output will be 16.7 Watts for the first 5 minutes and then 0 Watts for the other 5 minutes. This will give an average of 16.6/2 = 8.3 Watts of power for the entire 10 minute period. But again, because the PCB that you are using as a heating element is rather thin and with not much thermal mass, you might find this to yield unsatisfactory results, where in the first 5 minutes, the temperature gets too hot (too much over 50C) and then too cold (too much below 45C) in the other 5 minutes.
To get around this, you can change the period. Instead of 5 minutes on and 5 minutes off, you could do 30 seconds On and 30 seconds Off... or even 5 seconds On and 5 seconds off. This will give a more controlled and stable temperature of the PCB. If that's not enough, you can go into even smaller increments: 500 ms On and 500 ms Off... or even 50 ms On and 50 ms Off. This way, essentially you are now supplying the heating element / PCB with only half of the power that it would normally use at full 5V.
OK, so you determine that perhaps the above (5 "something" periods On and 5 "something" periods Off) yields too low of a temperature. Then just bump up the duty cycle. Maybe try something like 7.5 "something periods On and 2.5 "something periods off... i.e. perhaps 750 ms On and 250 ms Off... and repeat this every second. If this yields a temperature in the range of 45C to 50C, then you just program your MCU to toggle the MOSFET or BJT On and Off with the following periods above.
Now let's say the room temperature changes a little... or more than a little. It could make it that this 750 ms On and 250 ms Off scheme is no longer outputting temperature in the range of 45 to 50C. This is where you use the temperature sensor of your MCU and program the MCU to change the duty cycle as needed to adjust the temperature. For example, if the room is hotter and 750 ms On / 250 ms Off is too hot, then the MCU switches to something like 600 ms On / 400 ms Off scheme. Still too hot? Let it switch schemes again in the code. Maybe 500 ms On and 500 ms Off? If that all of a sudden is too low and the temperature is below 45C, then have the MCU bump back the scheme to 600 / 400 ms. If that's not enough, go back up to 750/250, and etc. Just make sure to program it so that when the MCU switches "schemes" as stated above, it stays with a certain scheme for at least 10-100 such full periods of the scheme. This will avoid a situation where the MCU is over-reacting to its own constant re-adjustment of schemes.
Essentially what I describe above is quite similar in many ways to what PID does. But the above is in much more simplified form and one you can easily modify to suit your design with some trial and error.
With that said and going back to driving the heating element, which was the main question at hand in this thread...
OK, so you found that a 5V source can produce enough heat to drive your heating element more than hot enough for your needs. Next, we're tasked with picking a part than can drive the heating element. In a circuit similar to the one shown above in your first post, when the transistor (be it BJT or MOSFET) is fully On, we determined that the current the heating element will draw is 5V / 1.5 Ohms = 3.333 Amps. I see you listed IRF510N as one of your available parts. Let's look at its datasheet. It says it can handle up to 100V between Drain-Source and up to 4 Amps of continuous Drain current at T_case = 100C (or 5.6 Amps with T_case = 25C... but let's assume the worse rating, just in case - i.e. 4 Amps.) In theory, this MOSFET should be able to handle this heating element as a load if you drive it / toggle it fully between On and Off states (hence the whole explanation above of duty cycle.)
So now all you really need to do is connect this MOSFET in your design, like you showed in the first post (but with correct symbol, please, now that you're aware of what device you will be using

And that should be pretty much it.

The rest will be all code and you experimenting with it to determine a "base" duty cycle, where the temperature of the heating element is in the range of 45-50C, along with how the duty cycle "schemes" can vary so that the surface temperature of the heating element will stay between 45-50C regardless of the room/surrounding temperature.
Originally posted by EasyGoing1
View Post

So for future projects, particularly if you ever have to drive relays, motors, or any such similar inductive device, then read up on inductive kickback and how to curb it. A simple reverse-bias diode is the most simple way to do it..., but it may not always be enough. As the inductance (and stored energy) gets larger and larger, more complex circuits will be needed to handle this energy. Read up Snubber circuits if you'd like to understand this better. I think even Electroboom had a good video on that matter a while back that had good visuals in it so you can see what's happening.
Anyways, hopefully this "essay" is specific enough to answer some of the questions in regards to your project here, yet also broad enough to use for other projects you may have.
Comment