Steve Anderson wrote:The RC filter I suggested should be good enough for the job averaging the 187kHz PWM back into audio, at that frequency the resisual PWM should be around -60db on 5V p-p, i.e 5mV p-p.
Now you used the word 'noise', noise by nature is random whereas the PWM is regular and a fixed frequency. So is it truly noise or is it residual PWM? If it's residual PWM then that perhaps points to a better filter being required...or dare I say it, a better board layout. If you're still using breadboard - anywhere - get rid of it. Make sure all earths/0V cables are short and FAT.
In addition did you add the signal attenuator I mentioned some time back?
Steve A,
I spent a good hour this evening with the oscilloscope and camera, as I was going to post some images of the signal at various points. But I've come away completely befuddled. The board doesn't seem to even work anymore, and when I connect to my USB port for power it soon gets rejected with "this device using too much power". That's not a good thing. I started by measuring with the scope the output to the speaker pins, and I was getting a definite signal there - with no power input whatsoever (!) which made pretty much no sense to me whatsoever. It was almost a (very corrupted) sine wave with a high peak, flat area, low peak, flat area... 200mV peak to peak, and repeating at 20ms. That's mains frequency. Like I built some sort of power-collecting device. As I said, absolutely no power connection whatsoever - the board plugged into nothing (no motor, no LED, no speaker, no power) and I'm getting that signal on the speaker output. Or I was, anyway - I think as I said the board is now dead.
So this evening's a complete bust. What I've learned that it's much more difficult to debug a printed board than it is a breadboard. I can hardly find places to put my probe, and everything is so much more inaccessible.
But I have a plan. Since I had three of these boards made, I'm going to start populating another one, and measure as I go. First I'll put in the Arduino and make sure it's alive. Then I'll put in the RC filter and have a look at what's coming out (PWM) and filtered. If that's all OK, then I'll hookup the PAM8302 AMP to the filtered PWM and check the output there. If that looks OK I'll plug in a speaker. That will sort the sound
If sound is OK, then I'll move onto the IR sensors, and make sure that they're triggering OK. Then I'll go back to the sound and see if there's been any change there.
If IR and sound OK, then I'll try powering with the 12V external power and see if everyting is still OK. If so, I can then try the LED breadboard string. Again, check everything else.
The most suspicious issue on the (now dead?) board was the IRL540 which was getting waaay too hot. It should be pretty much ambient temperature, and in my original circuit it was - as confirmed by the thermal imaging I did. Something's possibly wrong in that area of the circuit design, perhaps? I'll go back and reconfirm with my original circuit and what documentation I have, that I'm using the same resistor values. One thing I did rely on was that my packets of resistors actually HAD the correct resistor in the packet. I went through some time ago and measured all - but I guess I really should have confirmed values before soldering into circuitboard. Lesson learned, even if I didn't put an incorrect one in, I realise I should have been more careful in this regard.
I'll probably post various oscilloscope images as I go. One example issue I had tonight that I simply couldn't understand - I had what looked like a sine wave at (say) 20mS scale and 0.5V with amplitude something like 2V peak-peak. But when I switched to the scope to 0.2V the reading became flat - instead of 2.5 times as big. It was very confusing and I just don't know what the hell was happening. At the same time the board seemed to be deteriorating before my very eyes until I no longer trusted it.
Steve Anderson wrote:In addition did you add the signal attenuator I mentioned some time back?
Steve A,
I guess not - I'm going to have to go back and find what you said, because I'm not remembering, sorry. I have the RC filter but... attenuator.... no.
For the record, I have nothing on breadboard during the tests tonight, except briefly the LED string, which I soon disconnected.
I do not have a ground plane on my board, something which I will definitely add to my version 2 design.