Andrew Davie wrote:I have now spent many hours trying and failing to get a good PWM picture on my televisor.
I found some code to increase the speed of the PWM output significantly, and confirmed with my oscilloscope that frequency was correct. Still have very poor, hard to even recognise, picture with long lines and poor shading. Then I started to wonder - if I seem to be putting a reasonably fast PWM out from the Arduino, what could be going wrong. Is it possible that the LEDs I am using simply can't switch that fast? I looked up LEDs - they generally switch VERY fast. Then the next candidate was my darlington TIP122 -- looked it up... uh oh... "Designed for general−purpose amplifier and low−speed switching applications." Oh dear, could it be that this transistor has been the cause of my frustrations? I haven't yet found what "low speed" means, but it sure looks like a possible culprit.
Hmmm, very possibly, however, the TIP122 is often used as an output transistor for good quality amplifiers so clearly it's response is fine for audio so I doubt it was a culprit in your early experiments, now we are up at 375kHz that's another matter of course, the specs, show a significant roll off in gain and at 375kHz it's down to about 100 (there could well be other factors) which is enough gain for our purposes, having said that, the transistor's switching times are inversely proportional to collector current, but even that seems ok unless I am completely misreading the specs (as is likely).
Darlington transistors are regarded as having fast switching times in general.
You say the PWM looks fine on your scope, I assume that's coming out of the pin or DAC? What does it look like on the top of the emitter resistor?
It would be good if you could hack a bit of code together to do a frequency sweep.
Is there any chance you could send me your current code?, I have a nano and due here that I can run it on and have a look.
EDIT: I should say, of course, even if the TIP122 is too slow it's easily replaced with a high speed version, or even a MOSFET.
EDIT2: Or, we can simply filter the circuit before the TIP122