Help with LEDs on model railway project

@wildbill So I had a chance to test what you're asking.

Run the code with analogWrite. RGB are going crazy. Unplug power to the drivers for the sun lights, same code running and RGBs are working perfect.

Good news I suspect - code's fine, you just have an electrical or power problem to find.

1 Like

Anybody think something like this might fix the problem?

I think if you have EMI problems (as it looks) and you do not know

  • where they come from and
  • where and how they are injected into the disturbed system

any answer would be solely guesswork ... :wink:

If you still have an old portable AM radio ... you might be able to identify the source by tuning it to some place where there is no radio to hear and walk along your installation.... Just a chance, no guarantee ... I had a broken wire (dug into the ground) of my robot lawn mover and was able to identfy the place where it was broken by "scanning" the track. After the break the signal almost disappeared from one side.

The power supply or electronic switches (dimming?) of your "sunlights" could be suspect to be the cause. Cables in LED stripes could act as antennas and then tend to jam the digital lines.

To know where it comes from is not the solution, I know, but may help to find one ...

Good luck and success!

Looking at the photos you posted way back when, there's a lot of intertwined wiring with potential for interference. You might consider running the wires for the sun lights away from the rest of the system. I think you want PWM, so perhaps look at using D11-D13 and route them away from the Mega, moving the mosfets(?) away from the rest of the wiring too.

1 Like