Controlling a Traffic Light with an ESP8266

I got lucky and acquired an old German traffic light.
It runs on 230V and has standard E27 sockets.
I'd like to be able to light all the lights individually however I want and also be able to dim them. I am very unfamiliar with how AC light-dimming works, so I'd be glad to get some tips or ideas. Another option would of course be to somehow modify them for LEDs which I could just control through PWM.

I'd love to hear your thoughts on what you think I should do here.

Working with AC is kind of dangerous, even for experienced folks. Using zero crossing detectors and timing you can vary the power to the lights. Basically you would be designing an AC dimmer circuit. So you can google that. However given the choice I would convert the lights to leds and use pwm.

1 Like

I would recommend matrices with smart LEDs like WS2812 for example. So you will not only show the three main colors but also additional information such as remaining time or a walking man as in the video and just dimming is bonus.

I vote for trying to use real lamps of the original kind.

I agree that working with mains power is risky, riskier in inverse proportion to your skill and experience.

So, what to do? google for

 arduino AC lamp dimmer module

and find things like


Write 100 percent of the code using LEDs on the Arduino PWM output. Once everything is functioning to your liking, simply feed the same PWM to your AC dimmer modules.

I saw quite a number, you can shop with your budget and the wattage necessary for the circumstances.

a7

The data posted states" * AC Phase Control Circuit (Dimming Circuit) / Home Automation, School Projects, Work Related Projects", This is not PWM but must be timed to the AC signal.Check this link: https://www.youtube.com/watch?v=zJQf6bNodhE

Gack! Good someone looked closer. THX.

There is a library that seems to take the pain out of using the module.

Here's what can be done with that unit

  dimmer.setPower(outVal); // setPower(0-100%);

which means that if developed as I suggested, only simple changes at the statements that might read

  analogWrite(proxyLEDPin, outVal);  // power 0..255

I won't look to see, I imagine most such modules I found are similar.

One I saw used a digital input and had provision for following an analog signal input as well, that might be another way to bridge the gap between the low and high voltage sides.

Here. I think I moved on to find something a bit less spendy.

Maybe wrong again… it happens.

a7

1 Like

I took a look at the video. I wanted to see how he did it with pwm but those things are hidden behind a library he used (or wrote). I think you could use pwm in a backwards sort of way. If you are dimming, the pwm initially keeps the triac off. When pwm changes state it turns the triac on. Basically the adc is setting the delay time via the duty cycle of the pwm signal.

I am probably making a bad assumption in thinking you understand what AC voltage is but: Triac devices and SCR devices once turned on and a minimum current is flowing (called holding current) they do NOT turn off until the current falls below the holding current or the sine simply crosses zero voltage.

You can do what you want using a MOSFET bridge but that is more complicated and requires experience in mains voltages.

1 Like

Don't be so condescending and get off your high horse.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.