Noisy Power on a raspberry pi - I Think - Page 1
Forum section: electronics / beginners

author: ObsequiousWoe
author_rank: Newbie
timestamp: August 16, 2024, 07:59:39 am
content: Howdy Team,I'll start with the fact that I'm a total beginner in this space to please forgive my ignorance to what is likely a straight forward problem.The problem :I'm running this project :https://github.com/mcguirepr89/BirdNET-Piwhich basically uses a microphone on a raspberry pi to listen to bird calls and identifies them via a ML model developed by Cornell.https://birdnet.cornell.edu/Cool project, I'm lucky enough to live in a forest and with a little tuning I was able to start seeing 2000+ detections a day with ~30 unique species found. Pretty pumped.So I went full scale and installed the PI into a plastic enclosure under my house. And this is where the problems began.Intial setup was with the PI powered by a USB port on the back of a monitor in my office and the mic stuck out the door onto the deck. Worked great -- crap securty e.g. door left open.Current setup is it's installed under the house in an enclosure powered by a offical raspberry pi power brick. And the audio quality has gone to heck. Now seeing single digit detections daily with ~4 uniques .. basically a bird has to land on the mic and scream into it for it to be detected. Listening to the audio files and or live audio you can hear a audible HUM. Looking at the spectrograms that the software renders it's VERY visible.The reason i think it's mains related is that if I power it from a little lithium power bank, in the same location without changing anything else it doesn't appear to have this problem. I've tried MANY different bricks e.g. iphone / mac book pro / and now the official raspberry pi brick. They all seem to have the same issue.I've read that switched mode PSU's (which I assume all that I've tried are) are very noisy and can cause this type of problem. So a linear PSU may fix it ? though they are super pricey particularly if I want to scale up my deployments and roll out numerous of this little do dads. Further I've put ferrites on all in and out leads thinking perhaps I was picking up something else -- they made zero difference.Happy to hear any theories people have ?One current thought is an old PSU from a early 2000's era IBM laptop pushing 16vdc may very well be a linear PSU .. and pairing it with a LM7805 may work though it's a touch low on the amps side.Any who thanks for reading my wall of text.Happy to post an MP3 or pics of setup if that would be useful.ChursOW

author: RoGeorge
author_rank: Super Contributor
timestamp: August 16, 2024, 08:27:02 am
content: Pictures with the physical install + the wirings and the distances might help, to see where is the power brick, where is the raspberry pi, where is the audio amplifier and where is the microphone, and how they are connected together.Try a metallic enclosure. DIY an aluminium box, mount the microphone in a hole made in the metal box. Put all the electronics, except the power brick, inside the metal box. Leave the power brick outside of the metal enclosure. Connect the metallic box to the GND of the Raspberry Pi, on the inside of the metal box (put a screw+nut+metal tab through one wall of the metal box, and electrically connect it with a wire to the GND of the Raspberry Pi, all inside the metal box).

author: wasedadoc
author_rank: Super Contributor
timestamp: August 16, 2024, 08:28:47 am
content: Are you placing the PSUs inside the same enclosure as the RPi?

author: pcprogrammer
author_rank: Super Contributor
timestamp: August 16, 2024, 08:36:34 am
content: With the problem gone when running from a battery pack would suggest it being the power supply, but since your initial test were with USB power from a monitor challenges that suggestion. USB power is not the cleanest in the land so to speak.It might be that the microphone and its leads being closer to the power source might be the problem. What type of audio input interface are you using with the Raspberry PI?And like RoGeorge wrote, "Show us the pictures"

author: radiolistener
author_rank: Super Contributor
timestamp: August 16, 2024, 08:41:35 am
content: Quote from: ObsequiousWoe on August 16, 2024, 07:59:39 amYes, linear one can fix. But, it's not clear from your post which noise you're talking about. Could you record a short WAV with example? Also show us the photo of your installation, this is critical how you mounted all things.It is possible that it can be fixed with some measures.Genuine RPI PSU is noisy, but this is not the worse case which you can get if you use other cheap PSU.

author: PGPG
author_rank: Frequent Contributor
timestamp: August 16, 2024, 08:51:46 am
content: Quote from: ObsequiousWoe on August 16, 2024, 07:59:39 amFerrities put on cables can help for around 100MHz noise while your noise is probably at 1000 times lower frequency.We don't know how far are your supply from microphone amplifier. It can be that noise is inserted by wires but also through the air (directly from inside switching supply current to your microphone circuits) if supply is close to microphone itself and its amplifier.If by wires you have to filter it as much as possible with pi-filter (or more then one). It can also be common mode inserted noise. In such case common mode choke could help but it probably should be the huge one (I have never worked with sensitive acoustic signals.

author: iMo
author_rank: Super Contributor
timestamp: August 16, 2024, 08:59:12 am
content: Quote from: ObsequiousWoe on August 16, 2024, 07:59:39 amThe first indication it is a switcher is its weightThe linear bricks are heavier and bulkier as they include a transformer..For your app do use a linear source, with a transformer (best with a shielding between primary and secondary), good filtering with capacitors, etc. Optimally giving 7.5V DC (after the diode bridge) at 2-3A load..Also mind the 7805 is only an 1.5A absolute max (with a heatsink), not sure it is enough with your Pi4 (what Pi do you use?)..PS: an LM350T may work better (3A one, adjustable, mounted on a heatsink) still pretty cheap at ie. Mouser..PPS: another, perhaps simpler to make for you option, is to use the LM350 after the switcher, with good wiring, grounding, decoupling. You would need a switcher brick with 7.5V/3A (max 9V/3A) DC output and that will be the input for the LM350 set to 5V output. The LM350 (or a 7805 for lower currents) has to be mounted on a heatsink. The linear regulator will work as a "filter" then..

author: radiolistener
author_rank: Super Contributor
timestamp: August 16, 2024, 10:34:55 am
content: Quote from: iMo on August 16, 2024, 08:59:12 ampi4 overclocked to arm_freq=2100/gpu_freq=700 consume about 1 Amp max without peripherals and ethernet. With ethernet and laser mouse (100-150mA) it can rise up to about 1.3 Amps peak with average current about 1.0-1.1 Amps under load and 0.5-0.7 Amps with no load.

author: rstofer
author_rank: Super Contributor
timestamp: August 16, 2024, 01:31:37 pm
content: Drag the monitor under the house and try again. The problem is almost certainly with the brick. Try to find one rated around 4 Amps (20 Watts). Which Pi are you using?You may be limited to 3A on Pis with Micro-USB inlets. Still, it's more capable than those 1.5A units laying in some drawer.

author: Ian.M
author_rank: Super Contributor
timestamp: August 16, 2024, 02:03:31 pm
content: The official Raspberry Pi PSU along with many other 'wallwart' form factor SMPSUs is not grounded, (and the Australian version doesn't even have a ground pin). The monitor PSU probably was grounded, either via its mains lead if it has a three pin power plug, or via the screen on its video cable to a grounded desktop PC.Non-grounded SMPSUs are notorious for their line frequency common mode leakage current due to the fact that almost all have a capacitor between secondary side 0V and the negative of the primary side DC bus to provide a return path for the HF leakage current from the switching node via the primary to secondary interwinding capacitance in the transformer, to enable them to pass EMC testing.Eliminate the line frequency common mode voltage and you will almost certainly eliminate the hum. As your Pi is under your house, and bearing in mind Australia's draconian regulation of DIY electrical installation work, the easiest way to do this would be to drive a dedicated ground rod in to the ground as close to the Pi as reasonably practicable, and connect it to the PI 0V/Gnd. For testing a temporary ground connection could be made to any metal water pipe or electrical ground, but it is likely to be noisier than a dedicated ground + water pipes shouldn't be used for power grounding as catastrophic failure of the PSU + a previously undetected bonding fault could result in dangerous voltages on taps, sinks etc.

author: ObsequiousWoe
author_rank: Newbie
timestamp: August 19, 2024, 12:02:43 am
content: WOW -- Thanks for all the responses.I'll start trying some of these things out and start reporting back.Attached are images of the install / audio of the noise & pictures from the birdpi installation which visually shows how the noise is impacting the recordings.The raspberry pi is the 4b.There is a few meters of USB lead between the pi and the sound card and another meter or so between the sound card and the lapel mic (this is no different from my original installation). The installation is directly below a bathroom, it doesn't have heated tiles or anything similar so there isn't any adjacent power or other wiring. My house is ~700m from the street and is powered by a 3 phase 55amp circuit. I have tried different power points, though I honestly dont know if there were on the same phase or not ... I'd need to talk to my sparky to understand if the different GPO circuits are across different phases. The other power pack you can see beside the raspberry pi is the PSU for my ring door bell.Thanks again for your replies.CheersOW

author: pcprogrammer
author_rank: Super Contributor
timestamp: August 19, 2024, 05:32:21 am
content: The microphone picture shows it all.You are picking up toilet noises.But seriously now, your first test should be to ground the Pi with a ground rod.

author: ObsequiousWoe
author_rank: Newbie
timestamp: August 20, 2024, 02:34:36 am
content: FIXED !! Well I think so...I took the ground pin advice, cut a ~300mm piece of N12 deformed bar .. beat it into the ground... wound a copper wire around the exposed end ... heated it with a torch and dumped a bunch of solder on it ... and connected it to ground pin on the pi.In the ~30 minutes since I made the change it's had 100+ detections of primarily Bell Minershttps://en.wikipedia.org/w/index.php?search=Bell%20Minerif your bored.Attached new image .... a LOT cleaner.Thanks everyone for your suggestions.ChursT

author: radiolistener
author_rank: Super Contributor
timestamp: August 20, 2024, 05:19:19 am
content: Probably this issue is due to missing ground terminal on the rpi psu. It has capacitors filter which give about 100V AC mains hum, the current is limited with capacitors to be safe for humans, but it can produce a lot of noise on sensitive ADC input like sound cards or radio receivers. Also missing ground terminal on the mains socket can lead to damage your equipment if you use on the fly connections (for example hdmi or usb).Adding ground partially fix this issue, but if you want to get better result it's better to use power supply with ground terminal on the mains socket. But the best result can be achieved with linear psu with no capacitors from mains to the GND pin. In addition, linear psu also eliminates 20-400 kHz noise spurs which is present on smps.