0
\$\begingroup\$

enter image description hereI am trying to make a simple attiny circuit that switches 5V through PWM into 3.2V. The load will be a vape coil that draws 2A at 3.2V, so the 490Hz PWM signal is fine. When I tested the circuit with an LED that draws ~1A at 3.2V, the LED just flashed on and off quickly, as if the attiny was resetting itself. I tested the mosfet with a pwm generator, and it worked fine. What it happening?

\$\endgroup\$
2
  • \$\begingroup\$ Without details of your circuit (and yes, as already pointed out, power supply) this is unanswerable. It's not entirely clear if your overall plan is exactly viable, or if you will need to make some adjustments. Are you hopping to essentially do chopping current regulation using the coil inductance? Or to have a time-average reduction in power via PWM duty? \$\endgroup\$ Jan 5 at 16:57
  • \$\begingroup\$ Probably lack of decoupling. I would even consider a Schottky diode in series to Vcc if you have enough Vgsth to spare. \$\endgroup\$
    – winny
    Jan 7 at 13:10
3
\$\begingroup\$

that switches 5V through PWM into 3.2V

No it isn't. Voltage doesn't behave like that. 5V switched on and off with a 64% duty cycle is not 3.2V. It's still 5V, you're just turning it on and off. You're getting 5V for ~1.3 milliseconds followed by 0V for ~0.7 milliseconds, over and over, 490 times per second.

Current is equal to voltage divided by resistance, while power is equal resistance multiplied by the square of the current.

5V/1.6Ω = 3A, and the power dissipated is 1.6Ω*3A*3A = 14.4W. Even though it is only on 64% of the time, 14.4W*0.64 = 9.2W. Whereas if the coil was being powered by 3.2V only, it would dissipate only 6W. PWM by itself does not have any effect on the voltage, and is only turning it on and off, and this does not result in proportional current flow or power.

In the case of the LED, it is not resistive and current increases exponentially as voltage goes above the forward voltage. That LED might draw 2A at 3.2V, but you aren't giving it 3.2V, you're giving it 5V (for 64% of the time). A 3.2V LED that is designed to draw 2A at that voltage is going to draw substantially more than 2A or even 5A with 5V across it. It doesn't matter if that voltage is only across it 64% of the time or 1% of the time - it will draw way more than 2A.

So your ATTiny is behaving as if it is resetting itself because that's exactly what it is doing. The LED is likely causing the power supply to protection mode or cause the voltage to drop out, triggering the brown-out protection on the ATTiny, which results in a reset.

Your circuit may work if you try it with the vape coil instead, but it will dissipate closer to 10W, not 6W.

It would be far easier to simply wind a new vape coil from Kanthal resistance wire such that it will dissipate 6W when run off 5V - a resistance of about 4.1-4.2Ω would do the trick.

\$\endgroup\$
1
\$\begingroup\$

Probably your power supply is unable to supply the load - every time the load is turned on the supply voltage drops and causes the processor to reset.

You need a more capable supply or a separate supply for the load.

You also need to ensure the supply is adequately decoupled to minimize supply transients.

Be careful about the arrangement of wiring - the inductance and resistance of the power leads can cause voltage drops or surges as the current changes.

\$\endgroup\$
2
  • \$\begingroup\$ I am testing it with a bench power supply, which ca supply 5A, so I don't think it's that. I added a picture of my circuit. When the button is pressed, it sets a 64% duty cycle PWM on pin 0. And to elaborate, the load is a vape coil. \$\endgroup\$ Jan 5 at 17:39
  • \$\begingroup\$ @ladiesman217 - You don't show any decoupling. The inductance of the leads can cause significant transients that reset there processor. I would put both a small ceramic and a large electrolytic near the processor. Also as a test you can try running the processor from a separate supply, even a battery will do. \$\endgroup\$ Jan 5 at 18:08

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.