Voltage spike when switching pwm duty cycle

Status
Not open for further replies.

CranberryFire

New member
Hello, first post here and some what new to electronics.

I noticed a weird issue where the output of a pin briefly spikes when i switch the pwm value via analogwrite. When I go from 255, to 0, to 1 I get a large spike at the start. This is most reproducible when the pwm value preceding going from 0 to 1 is fairly high.
61852782637__7C9E9F86-671C-4741-8359-00383E8B249F.jpg

After the spike, it proceeds to pwm correctly for that value, as seen.

Set up details: teensy LC, pin 23 in 8 bit mode @ 5000hz, driving an npn with a 220o resistor*, set up on a bread board

*I am aware the LC has a max current rating of 5 to 20ma depending on a pin. Is it bad practice to use such a low value resistor on the pin, even though it is driving a transistor? (this particular transistor needs to be driven a bit hard).

Thanks for any help you can give.
 
Status
Not open for further replies.
Back
Top