Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PicoMite: driving a small speaker
Page 8 of 14 | |||||
Author | Message | ||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
I'm not offended, "hijacking" of threads (the occasional "weird rant" not withstanding) onto semi-related topics, anecdotes, biography, or "Four Yorkshiremen" sketches is by-the-by. I generally find I can nudge them back on topic by asking an appropriate stupid question. In this case I think your comments are on topic and I won't personally be starting a new thread; I purposely didn't mention the title of my project in the subject of this thread so as to ensure maximum participation. Sounds like a recommendation, but they don't seem to be widely available and where they are, they are ~8 GBP each . Best wishes, Tom Edited 2023-04-01 22:47 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
mozzie Regular Member Joined: 15/06/2020 Location: AustraliaPosts: 68 |
@JohnS Oops, that should be "130mW idle power" as you suggest, not sure why I can't edit the post? @phil99 I used P=VI, there is approx 4.3v across the voicecoil and 30mA circuit current, so 130mW, although we seem to have the same answer anyway Regards, Lyle. |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1611 |
Alternate suggestions are always welcome. But there are specific requirements. For one the Pico is being supplied by a battery and using the Pico's internal buck/boost regulator. This is apparently causing noise on the power supply and it appears to have poor regulation causing the flashing of the heartbeat LED to affect the supply. An H-bridge may well be a useful alternative IF it proves to be relatively noise free under those conditions. The PWM signal appears to have noise on it which is caused by the regulator. Will an H-bridge circuit be somehow immune from that noise it is running from and switching the same noisy supply? Is anyone trying their alternative or 'improved' circuits under those conditions? Bill Keep safe. Live long and prosper. |
||||
mozzie Regular Member Joined: 15/06/2020 Location: AustraliaPosts: 68 |
Cheers Tom trying to hold back on the "Four Yorkshiremen gags" I guess there are other alternatives to the DRV8838, no doubt now we have a proof of concept someone will know of a suitable and cheaper IC If you hit a brick wall with the PAM module and want to try the "CLASS D" option there is always the 4 transistor circuit as well, just doesn't provide as much drive to the speaker Also noticed in your "LaserCycleMusic" program that the volume is only set to 15, turning this up 25 might help with the noise issues. With the volume at 25, Triangle waves set and some decent speakers, the output of the PicoMite is really quite good. Regards, Lyle. |
||||
mozzie Regular Member Joined: 15/06/2020 Location: AustraliaPosts: 68 |
@Turbo46 This was the reason for looking into this, Volhout (and others) were on the same track I just bet them to it. The noise is, as far as I'm aware, both the switchmode supply itself and the Pico output driver feeding internal noise down the PWM(audio) signals, the DRV8838 completely removes this noise by buffering the outputs and working from a separate and decoupled supply. I have it hooked up here in front of me and it is SILENT, both on USB supply / Battery supply / and from the 3v3 output of the PicoMite itself. The 4 transistor version is not quite as good, you can JUST hear the noise from the regulator under the same conditions, but its pretty good. As Phil99 hinted very early on and provided circuits for, it seems a waste to take what is effectively the output of a class d amp that is coming from the Pico, converting / filtering / limiting it in the analog world (and picking up noise) and then sending it to a class D amp to be turned back into a PWM signal again, just at much higher frequency (and introducing more switching noise...) However, we also need to get the PSU noise issue sorted out so we can use the Pico internal regulator with line out / headphone applications. Regards, Lyle. |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6814 |
The RP2040-generated noise will be VHF. At the lower end you have a 1MHz frequency from the switching supply, then all sorts of mush from the clock frequency upwards. All the GP pins can have very fast rising and falling edge signals on them. I definitely feel that RF techniques should be used to minimise it: Preferably surface mount the PicoMite so that it has a grounded backplane. From the PWM pin put a ferrite bead then the resistor, leads as short as possible. Do not run any digital signals near the audio from this point otherwise you'll capacitively couple the noise back in. Filter the supply to the PicoMite with another ferrite bead or an RF choke next to the supply pin to reduce switching noise getting off the PicoMite board and back onto the 5V line. The ferrite beads should be chosen to reject the 1MHz freqency in particular. As for choosing them.... er... I have a bag of unknown ones! Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6814 |
I feel some experimenting coming on. My LM4871 chips turned up today and I've just soldered a couple onto SOIC-DIL header converters to make them breadboard-friendly. I have a feeling they'll make a lovely 5V amplifier for 8R speakers. About 1W per channel at 0.5% THD (max), which is plenty for most purposes. It can run down to 2V, so a 3.7V lithium cell is a possibility. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
For info: The next beta will have support for a external MCP4822 DAC rather than using PWM to generate audio. This couple with a LM4871 should give excellent results |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2141 |
Hi Tom, As you have LM386 chips on the way you could use two for a bridged output. The only other components are an inductor and pot (optional) in series with the speaker. Mozzie's POKE SHORT &h40050000,&h09 trick provides the phase inversion for the second channel. chip 1 PWM L to pin 3 Vbat to pin 6 Gnd to pin 4 Speaker+ to pin 5 chip 2 PWM R to pin 3 Vbat to pin 6 Gnd to pin 4 Inductor to pin 5 Speaker- to Inductor I don't have a second LM386 to try it myself. |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1611 |
@mozzie, your approach DOES sound like a viable alternative. I'm just a little confused by your statement: Particularly the "separate and decoupled supply" part. Does it work from the battery or not? Maybe schematic showing your setup would help. Back to the PAM, if I were to pursue that further then I would try Volhout's filter with the clipping diodes and reduce it to one stage of filter. If the volume is too low then two diodes in series each way may help. I think that I will leave this post to others from now. Bill Keep safe. Live long and prosper. |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Hi folks, @phil99 - will do, but probably need to buy inductor as only have 2.2 and 4.7mH ones for building @Volhout's improved filters. What would you recommend ? Tomorrow's plan is to try out Volhout's circuit in full before discarding any bits. Then again that was also today's plan but the family didn't cooperate . Best wishes, Tom Edited 2023-04-02 09:43 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
hitsware2 Guru Joined: 03/08/2019 Location: United StatesPosts: 713 |
Again I will ask : What driver / enclosure are you using as a ' speaker ' ? my site |
||||
mozzie Regular Member Joined: 15/06/2020 Location: AustraliaPosts: 68 |
G'day All, Going to order a couple of BD6211F and see if they are a cheaper alternative to the DRV8838 @Matherp - that will solve a lot of problems in one hit, do we still have the option of PWM for speaker drive? @Mixtel - The LM4871 should work well, same with TDA2822 (I have some here but can't find) The class AB amps will behave a lot better if overdriven and can provide a fair bit more power at higher distortion, in this application it isn't going to matter. Hopefully the RF techniques work. @Turbo46 - apologies if I came across a bit harsh, the circuit is posted a page back: https://www.thebackshed.com/forum/ViewTopic.php?TID=15748&P=7#201392 But this doesn't show the battery supply, if you have a look at: https://core-electronics.com.au/piicodev-lipo-expansion-board-for-raspberry-pi-pico.html This is the battery backed base I use with the Pico, due to the IC buffer it really doesn't matter if there is a few mV of noise on the PWM output from the Pico, it would only be noise on the VCC to the DRV8838 and that is much easier to remove, so the source of VCC is flexible and I tried them all. I2S is used for the same reason, basically immune to noise. Just a bit of background - I have been building and repairing audio gear on a small scale since the late 80's and had a go at building a few class D amps before they became mainsteam, never really successful but learnt a lot about feeding squarewaves into speakers etc, they really don't behave as you expect they will. A large class D amp is closer to a high power inverter or converter and can be just as easy to get wrong, I have let the smoke out of far too many Instrument tech / Autoelec by trade and microcontrollers / micromites / audio / electronics / british cars as a hobby (yeah I probably need help) I'll stick a pic in the photos thread one day so everyone can have a dartboard target. (mozzie should be a hint) Regards, Lyle Edited 2023-04-02 12:40 by mozzie |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2141 |
@Thwill "need to buy inductor as only have 2.2 and 4.7mH ones" For testing purposes use the 4.7mH one (or a few in series, just ensure the DC resistance of the string is less than 10R) with a 100nF cap across the speaker. If they are already in use replace with a resistor. Start with 10R and if the current is a bit low reduce to 4.7 or 2.2. Edit For other PWM channels:- CH 0- POKE SHORT &h40050000,&h09 CH 1- POKE SHORT &h40050014,&h09 CH 2- POKE SHORT &h40050028,&h09 CH 3- POKE SHORT &h4005003C,&h09 CH 4- POKE SHORT &h40050050,&h09 CH 5- POKE SHORT &h40050064,&h09 CH 6- POKE SHORT &h40050078,&h09 CH 7- POKE SHORT &h4005008C,&h09 Edited 2023-04-02 18:08 by phil99 |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Hi folks, I finally had time to some proper building and testing: 1. Using a better speaker (2" 8R 0.5W) makes the biggest difference so I can see I'm going to have to order a selection of different small speakers from AliExpress in the hopes of finding something better than the current one (@hitsware2, this one: https://bitsboxuk.com/data/sensors/st060.pdf) 2. Using the triangular wave (rather than sinusoidal) is definitely the way to go for the TomBoy even if I dismissed it when doing the original work on PicoMite VGA, CMM2, and MMBasic for Windows, thanks a@mozzie. - EDIT: I've also made a note to try pitching the music +1 octave to remove some of the troublesome low notes. 3. The "diode clipper" (tested using @Volhout's circuit) is definitely an improvement, not sure exactly how much since I was comparing it built on solderless breadboard with my original protoboard circuit which relies rather more on solder and less on hope. - I'm pretty sure it is eliminating the difference in noise between USB power and battery power. I probably I need to transfer it onto protoboard to do a proper comparison. 4. With regards @phil99's two "bridged" LM386s, it's very quiet on the 2" speaker and almost inaudible on the 20mm one - perhaps I am doing something wrong ? - Note that just one of my 4.7mH inductors has a resistance of 17-18R. 5. I've no idea where Peter's latest changes to the firmware to support an external DAC leaves me; they're relatively expensive. - EDIT: though @Mixtel90's comment about the price being more than the Pico doesn't seem correct ? - the 12-bit one, 4 more bits than I assume I would need seems to be about the same price. Where next ? - actually I may let it lie for a week or so. Best wishes, Tom Edited 2023-04-03 01:39 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6814 |
Whether you *need* the extra bits is immaterial if the firmware only supports the 12-bit DAC. That's the one you have to get. :) RS price is 4.88 UKP including VAT, but you need carriage on that and some more VAT (about 13 UKP in total for one chip). Ebay prices (for unknown variants!) are quite a bit less but by the time you've got postage on they are still about 8 UKP or even more. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4256 |
Mick, Maybe the 8,10,12 bits use the same data format. Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
It does |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6814 |
That's handy. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
hitsware2 Guru Joined: 03/08/2019 Location: United StatesPosts: 713 |
> (@hitsware2, this one: https://bitsboxuk.com/data/sensors/st060.pdf) > Using the triangular wave (rather than sinusoidal) is definitely the way to go Because the triangle wave has harmonics that a small speaker like that can reproduce . Hence also your " troublesome " sinewaves . It is hard to reproduce music with a small ( and inexpensive ) device . Best I ' ve found for small : http://www.tb-speaker.com/products/list/31 Though not that inexpensive my site |
||||
Page 8 of 14 |
Print this page |