dirtyhanfri said:
I’m experimenting with a microcontroller inside an 1176 clone, just for simple tasks, control some relays and read the GR signal going to the meter.
Nice! I like it. Mixing microcontroller with analog circuits is a great idea. They can handle so much. But there are a lot of rules about mixed analog and digital circuits. It all has to be just so or you'll get ....
dirtyhanfri said:
Compressor works nicely and noise free, but as soon as I power the microcontroller (an Arduino like dev board) I get a 2.4KHz peak (with even harmonics) in the audio path.
Noise! So the 1-3kHz range. That sounds familar.
dirtyhanfri said:
Amplitude changes with output knob from -80 to -60 dbu at max level.
Ok, so lots of noise. That sounds familiar.
dirtyhanfri said:
I’m almost sure it’s noise coming from the microcontroller processor, as it changes its frequency with processor speed, when it’s running at 240MHz I get the mentioned noise, but if I run it at 80MHz, the noise goes to 800Hz, 1600Hz when running at 160Mhz... seems closely related.
Ok, that wasn't what I was thinking but like I said, there are multiple rules about mixed digital and analog which is to say you could have multiple problems going on simultaneously. So if you try one thing and the problem doesn't go away, that doesn't mean your fix didn't do anything.
dirtyhanfri said:
Another issue is after a while powered on and working, the 5V supply suddenly starts going on and off intermittently, not sure if it’s related to the low current demand to the PSU (I’m using about 800mA in the worst case)
Ah, that sounds familiar again.
dirtyhanfri said:
I’m using a 5V 5A SMPS just for the digital circuit, with a 0.1uF cap as decoupling for the microcontroller board (I ASSume processor circuitry is properly designed in the dev board) 100uF for the relays and 0.1uF for 4 RGB LEDs driven by the microcontroller.
5A!? Gadzooks! I think I definitely know what the part of the problem is.
dirtyhanfri said:
Digital and analog 0Vs are completely separated, meeting only at one point, in the chassis, if I disconnect digital 0V from chassis I can see how 2.4KHz. peak goes 3db’s up.
Then what do you use as the ground reference to feed the CV signal into the microcontroller? Are you connecting DGND and AGND together there too?
dirtyhanfri said:
Everything is built into a rack case, microcontroller, power transformer and 5V PSU on one side and analog circuit on the other side, keeping as much distance as possible and quite neat wiring.
Post a pic! If you're using wires for digital at all, that could be a problem.
dirtyhanfri said:
My doubts are: Is there any way to reduce the noise coming from the processor? Maybe a LPF in the 5V supply?
No.
dirtyhanfri said:
Am I suffering from Hiccup mode from the SMPS and should I switch to a smaller 5V SMPS?
Very likely.
I think building analog gear with SMPS and mircocontrollers is almost the only way to roll these days. Anything less is basically antiquated at this point. But it's not a good idea if you're not fluent in the rules of each. You should have knowledge of SMPS and how to make and use one with an analog circuit such that it's noise free. So a good first step is to make a mic pre, so that any noise from the supply is amplified, that you can then test and adjust to see that there's no noise whatsoever. Then you can try digital and start mixing stuff.
But clearly you're already committed so maybe we can make the best of what you have. Unfortunately I think you have multiple problems going on which makes it very difficult to diagnose one because they all manifest themselves as noise. So the first think that you're going to have to do is devise a rig for getting a spectrum of the noise. Pretty much everyone has a USB audio interface these days. Even a cheap one will out perform just about any analog circuit. Then get some software like Room EQ Wizard. When I was starting out, I used DSSF3 from ymec and thought it was actually pretty good but that was a maybe 15 years ago. Personally what I like to do is actually record a wav file and then study it offline. Whatever you do you're definitely going to need some visual way to see what the noise spectrum is so that as you make adjustments to your circuits, you can see if there is a change. Otherwise, you're "flying blind".
So what are these rules I keep teasing you about?
The rules for SMPS in analog gear:
1) You MUST load the SMPS with at least 20% of the rated current or it will switch into an efficient mode that modulates the output on and off at a low frequency. This is more commonly known as "hiccup mode". Hiccup mode often manifests itself as a whistle in the 1-3kHz range. For large supplies, it can create large amounts of noise at all frequencies.
The proper solution for this problems is to simply use a supply that is more closely rated to the current that you need. So at least 20% but in practice it should be more like 80%. Unlike linear supplies, SMPS actually work better when loaded. So you really could go to 90% or even near 100%. Above that and chances are that the SMPS would still work pretty well but the voltage would just start to drop. So if you needed say a 15V supply to make 300mA, you could probably use a 24V constant current supply that makes 250mA and just let the voltage drop a little. Although I've never done this. It would require some experimentation to find a supply that it really works well with. And you would loose regulation so you would need to regulate down but you would need to do that anyway if you wanted to make 15 from 24.
Another solution to this problem is to load the SMPS with a load resistor. But this is where you really need to pay attention to the power dissipated by the resistor. If your supply is 5A at 5V, to load it with 20%, that would be 5 ohms and 5V / 5R * 5V = 5W. So that would require probably one of those aluminum cased resistors mounted on a heatsink. That is not ideal. But for 500mA supply, 5V / 50R * 5V = 0.5W so strapping a 2W wirewound resistor with no heatsink directly to the output of the SMPS would probably work just fine.
One caveat to this is if the load varies a lot. For example, if you want to make a 48V phantom supply for a 16 channel console. If all of the 48V are off, the load is very low compared to when they're all on. I just posted a theoretical circuit for dynamically loading the SMPS more or less depending on the downstream load:
https://groupdiy.com/index.php?topic=77291.msg984180#msg984180
2) You MUST not load the SMPS with more than 100% of the rated current for longer than a few ms or it will switch into a short circuit protection mode that modulates the output on and off at a very low frequency. The most likely cause of this is too much capacitance directly on the output. Usually this capacitance is limited to a few hundred uF. So if you have a bunch of 100uF capacitors all over, when you switch the supply on, those caps will create a significant initial surge current that will trigger the short circuit protection mode.
The proper solution to this problem is to use a capacitance multipler circuit. The load of the CM will turn on slowly regardless of what is downstream. However, this does incur a diode drop in voltage because of the pass transistor. But usually this isn't too much of a big deal. If you're using 48V for phantom for example, a diode drop isn't really that much. Also however, if the current is more than a couple hundred mA, a one-transistor CM is not enough. The voltage will start to drop. You need the two-transistor CM and that will incur two diode drops. Fortunately, the higher current SMPS frequently come with a trim control to trim the voltage up to compensate entirely for the two diode drops. Once you have the CM in place, then you want a fat filter cap right on the output. That will be super quiet.
If you're designing the device being powered, the proper solution is to simply design it with smaller and fewer filter capacitors. SMPS are pretty quiet to start so you really don't need a lot of filtering usually. And if you do, a little bit of series resistance (like the RC supply filters feeding the upstream parts of a discrete mic pre for example) make a big difference in limiting surge current.
The rules for mixing digital with analog:
I won't go in depth about this because it's a little too broad but I will skim over some points:
1) Return follows supply. This means that if you have say a digital signal going out over an FPC cable, you need to use a ground line right next to it for the return currents to follow right next to the digital signal going out (supply).
2) Use "termination", all digital outputs should have a 100R resistor directly on the output. This stops the digital signals from suffering from transmission line effects of high frequency signals.
3) Do not run digital signal likes next to analog. If you have a bundle of wires, you cannot have a digital wire running adjacent to an analog wire. In fact, I would not use wires at all. When I did a mixed project like this, I used conventional wire to board interconnects for audio on top of the PCBs and then I used all SMD mounted FPC connectors with FPC cables running under the PCBs along the bottom of the chassis.
4, 5, 6, .... my tea has died