Fairy Lights PWM Part 2

Follow up from the thread Oct 2019 Minimising EM noise from PWM switched fairly lights?

Hi folks,

Recap - this is an educational project for my son to drive some existing garden LED fairy lights from a Raspberry Pi ZeroW

The only problem, as fully expected, is they are chucking out more EMI than I'd like and I don't want to be causing problems for others. So - yes, it's a crappy control method but we are where we are (see below) This is a case of trying to do a little more with a non ideal starting point and I'd be super grateful for any pointers on that basis :)

The noise I have is showing up on an AM radio as a clear buzz at the base PWM frequency (100Hz), audible across the MW range. This becomes undetectable about 5 - 10 yards from my property boundary depending on direction. The locals have been warned and no one's complained yet. However it's a lot noisier than the supplied controller and without a scope I can't see what the manufacturer did - but that leads us to Q1:

model, simple few turnes of wire antenna and looking at the spectrum (I think spectrum software comes bundled with the Picoscope)?

Q2) I've read about frequency dithering of PWM to spread the noise out from narrow to broadband. That's something I could do in software easily. No quite sure how far to dither - 100-200Hz, 100-1000Hz? Anyone heard of that?

Q3) Low pass LC filter to attentuate some of the higher harmonics:

formatting link
- analogue isn't my thing, not quite sure where to start with L and C values. Happy to buy a few values and suck it and see, if Q1 gives me a sensible method of measuring the effect.

On the plus side, I am really pleased with the software :) Pity my electonics skills suck which is why I'm reduced to using pre built HBridge L298 modules from ebay. But I'm keen to try to learn a little more and this is as educational for me as the lad - any help gratefully received :)

If starting from nothing, I wouldn't do it like this - I'd go straight to NeoPixels and have all the lamp control localised to each lamp. I might indeed order some strngs from China next year - but for this year, I do have these existing lights wrapped around trees already - and PWM is an instructive project in its own right. I am just mindful that I have the responsibility to not wreck havoc on my neighbours :)

Cheers and all the best,

Tim

============Lights spec =============

This is the equivalent circuit: The LEDS are wired in alternate-reversed configuration so that lamp 1,3,5... are driven on a forward current, lamp 2,4,6... are driven on reverse current.

Drive voltage 30V, about 140mA for all 150 lamps in 3 strings.

formatting link

That's what it is - they're wrired like that as bought based on 4 wires. Not certain of the exact configuration - might be 5, 6 or more in series depending on the exact Vf of the LED. =====================================

Reply to
Tim Watts
Loading thread data ...

=====

=============

I think others have explained pretty well that it is the fast rise and fall times that are the problem. They have harmonics well up into the MHz rang e. While those harmonics fall off, they don't go to zero and have potentia l of being radiated well by the "long wire" antenna you call a pixie light string.

So there are two ways of fixing the problem. One is to find a way to not r adiate the noise such as improving (or degrading, depending on how you look at it) the antenna properties of your wiring. The other is to minimize th e edge rates of your transitions to reduce the harmonics.

One way of minimizing the harmonics that just occurred to me is to not have any, by driving the strings with a combination of a low frequency sine wav e and DC. Any brightness level of the two sets of LEDs can be obtained by combining a DC level between the +max and -max along with an AC component w ith an amplitude of 0 to max value pp. A class D amplifier can drive the l ights and a simple filter can remove all the problematic harmonics that wou ld be generated by the class D output. All that remains is a 100 or even 6

0 Hz output and a DC component. No harmonics, no interference.
--

  Rick C. 

  - Get 1,000 miles of free Supercharging 
  - Tesla referral code - https://ts.la/richard11209
Reply to
Rick C

Hi Rick,

Thanks for your reply.

That's the RC filter option?

I'm not going to pretend to understand why that works - but I understand what you describe. So we do as you say by using what we have (HBridge) but driving at a higher clock rate and finding a digital tranform to represent the 100Hz sine + DC offset. Did I understand that correctly?

The pigpio library is set up by describing a waveform in terms of a chain of on and off times for a set of GPIO pins.

So if a complete 100Hz cycle can be adequately represented in the available memory which should be possible, a full cycle can be set up and left running, until it needs adjusting for a new brightness.

I'm going to have to get my head around how (set-1-duty-%, set-2-duty-%) maps to x.DC-level + y.sin-amplitude though :)

Reply to
Tim Watts

Just an aside:

If this all proves too tricky, we'll relegate the idea to a spare set of the same lights on the Christmas Tree: 1/3 of the problem, small area, indoors, round the back and much less likely to cause long range issues.

But I'll have a try with some of the new ideas just for education - but playing it safe.

Reply to
Tim Watts

if it's audio-frequency PWM but it's coming out an AM radio it's the broadband noise of the steps that's making the noise, you need to round off those PWM corners.

if it has a spectrum analyser mode it could show you what others describe.

dithering the PWM frequency will not reduce the noise amplitude in any way and will make it more annoying to AM listeners.

perhaps just put a bigger resistor in series with the MOSFET gate.

oh, right modules. you have those anti-parallel LED strings. use a low resistance capacitor (10nF or so ceramic) across the lines and a common-mode choke in series with them. either salvage one from some junk, or buy one.

--
  When I tried casting out nines I made a hash of it.
Reply to
Jasen Betts

fall times that are the problem. They have harmonics well up into the MHz range. While those harmonics fall off, they don't go to zero and have pote ntial of being radiated well by the "long wire" antenna you call a pixie li ght string.

ot radiate the noise such as improving (or degrading, depending on how you look at it) the antenna properties of your wiring. The other is to minimiz e the edge rates of your transitions to reduce the harmonics.

No, that would be changing the geometry of the wiring to not be an effectiv e radiator and it is not likely to work well. Even with twisted pair it's still going to radiate enough.

I don't think a simple RC filter will do a very good job with your circuit. By definition you need to have a strong AC component in order to drive bo th polarity LEDs. It could be worth a try, but you will lose power in the R and need a larger C to make up for keeping the R low.

have any, by driving the strings with a combination of a low frequency sine wave and DC. Any brightness level of the two sets of LEDs can be obtained by combining a DC level between the +max and -max along with an AC compone nt with an amplitude of 0 to max value pp. A class D amplifier can drive t he lights and a simple filter can remove all the problematic harmonics that would be generated by the class D output. All that remains is a 100 or ev en 60 Hz output and a DC component. No harmonics, no interference.

I was thinking of ditching the H bridge and using a class D amp, but you co uld use the H bridge to roll your own amp. It would in essence be PWM of t he instantaneous drive level required. This CAN be filtered much more easi ly, better by an LC than an RC though. With the higher frequency it will w ork with much smaller L and C.

You will have three mappings. One is two LED levels mapped to an AC plus D C levels. The DC plus AC levels are mapped to instantaneous levels over th e course of the sine wave. These instantaneous levels are mapped to a duty cycle in a pretty simple manner. 0 to max is zero pulse width to max puls e width and then deal with the polarity.

There will be some complications involved. Don't forget to take into accou nt that the original circuit every drove an LED to half amplitude because o f the duty cycling. So the max DC ever needed is half the max amplitude. There is also the issue of the max AC value will only be 0.707 time the pea k value, but that is RMS and I expect what will be important is average whi ch is 0.637 times the peak value. So you may not be able to get full brigh tness from the string with the AC waveform. The same would be true of an R C filtered square wave since the ramp times take away from the amplitude. This can be improved by adding in the third and maybe the fifth harmonics. 300 and 500 Hz are still well outside of anything that will cause interfer ence. That will give you something pretty close to a square wave without t he annoying harmonics.

--

  Rick C. 

  + Get 1,000 miles of free Supercharging 
  + Tesla referral code - https://ts.la/richard11209
Reply to
Rick C

=====

=============

the problem is due ot how fast you're switching. Changing the 100Hz will ha ve no significant impact on that. Since you're using a module you can't slo w its output down so easily, but you could add ferrite beads to the output lines, fitting them close to the driver module. You could also add a very s mall cap across the aerial close to the beads.

NT

Reply to
tabbypurr

Place a ferrite around the cable, easy fix, no soldering needed

formatting link

Reply to
Klaus Kragelund

This removes common mode noise?

As the wires were balanced I assumed there wouldn't be much - but happy to give it a try :)

Cheers,

Tim

Reply to
Tim Watts

This is one of the references I found:

formatting link

It's too much for me to understand (I can only really grok the headline) but the claim is that it take sthe same noise and spreads it out over the spectrum, reducing the average EMI at any one frequency.

That's about as much I could get :)

Reply to
Tim Watts

Thank you :)

To contain my nonsense - I'm going to do this to the little Xmas tree inside the house (1 LED string) rather than the 3 big trees I have lights on in the front garden.

It's educational, even if just to realise controlling antisocial EMI is sometimes more of a challenge than expected :-|

Reply to
Tim Watts

In common mode the differentce between A on and B on is small, but the difference between either on and all off is significant.

--
  When I tried casting out nines I made a hash of it.
Reply to
Jasen Betts

Common mode is the typical problem for rf emissions

The differential has small area and primarily emits in near field

The CM antenna is huge for this garden light

Reply to
klaus.kragelund

Dithering impacts the fundamental and likewise the harmonics, but the harmo nics are only 100 Hz apart. So you will still hear the impact on your AM b and signals and all the harmonics would be running up and down your band of interested over top of one another.

If you had a 1 MHz fundamental, the harmonics would be 1 MHz apart and dith ering would spread the interfering signal so it appears as a lower amplitud e. I've never figured out if it actually reduces the interference or not. If the signal being interfered with is narrow band enough it could help, b ut not with a 100 Hz carrier.

--

  Rick C. 

  -- Get 1,000 miles of free Supercharging 
  -- Tesla referral code - https://ts.la/richard11209
Reply to
Rick C

You are dealing with fast pulses, they have wide-band spectrum and looking at spectrum tells you rather little. What counts is amplitude and for that AM radio directly gives you relevant info. Also, PicoScopes have (or at least had in the past) quite limited bandwidth and my miss important info.

You missed pretty important part of info: how you control the LED-s. More precisely, each H-bridge in L298 has 3 control lines, IN1, IN2 and EN. To minimize EMI you want signal coming from H-bridge to be as balanced as possible, that is when you PWM after driving one (or the other) polarity you want lines to float. It is easy to make mistake and in "idle" drive both lines low (or high) To float output you need to use EN line. This is somewhat long shot but incorrect driving could easily explain difference between your circuit and supplied controller.

--
                              Waldek Hebisch
Reply to
antispam

=====

=============

LED strings are not driven by voltage sources or pulses, they are driven by current sources. The LED current is exponentially related to the impressed voltage which makes for a great fast harmonic generator, whereas the LED v oltage resulting from a current drive has a logarithmic relation which is m ore less a smoothing function. Radiated energy at any frequency is proportional to the square of the ratio of string length to the wavelength of the frequency. If you bandlimit the current drive to something like 20kHz, the far field radiation is attenuate d by a factor of a million or more, which means there won't be any radiatio n. You can easily bandlimit with a differential C-L-C differential filter, which is 2x L's and 2x C's, for which you can use almost anything in the wa y of off-the-shelf components because your signal is relatively low power. If you use an AM radio as a "sniffer" then it's important to make the disti nction between far field and near field. Putting the receiver right up to t he string is a worthless measurement for interference because you're just p icking up close-in coupling which tells you nothing. You want to use the re ceiver in the far field which is displaced multiple wavelengths away from t he string.

Reply to
bloggs.fredbloggs.fred

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.