Led Traffic lights are all around us, and they seem simple enough but are they really? Real traffic lights can be a very complicated system because it requires sophisticated control and coordination for smooth and safe traffic.
Each light has its own PCB with 91 LEDs that are connected in 7 lines of 13 LEDs and each line has its own series resistor. Resistors are different for each light to compensate for different forward voltages of LEDs (but the green LEDs are still a problem because they are much dimmer than the other two colors).
I have written a python script that uses kicad libraries to arrange the LEDs in perfect circles. This way I was able to experiment with different number of lights in each circle and come up with optimal arrangement. The documentation for python interface with KiCAD is not very good so this was not as easy as I had hoped.
The light PCBs each has a positive and negative terminal that connects to the main controller PCB. The controller uses a step-up converter to boost the battery voltage up to 30 volts required for the LEDs. The step-up controller works in the open-loop configuration. The switching mosfet is controlled by the attiny microcontroller and the pwm duty cycle is determined only based on the input voltage. That works well enough for the constant load of LEDs. Because the battery voltage is measured and duty cycle adjusted, the LEDs brightness is approximately constant during the battery discharge.
The attiny841 also monitors the battery voltage and shows battery charge state when the device is turned on. When the battery is full the green light blinks, when it is half-full the yellow light blinks and when the battery is almost empty the red light blinks. When the battery is practically empty the device also automatically turns off.
The power switch is connected to the mosfet in series with the battery supply so the turned off current is 0. I have made the mistake on my pcb version and turned the mosfet the wrong way around and the circuit was powered through the mosfet diode even when turned off. This is fixed in the schematic and pcb, but the pcb is missing the reverse polarity mosfet - that is the second mosfet in that mess on the pcb. Stay tuned for my article next week that will describe the power switch and mosfet polarity protection in more detail.
The power is supplied by two 18650 rechargeable lithium batteries. Because I used high capacity 3000mAh batteries they should by my calculations last 20 hours, more than enough for an afternoon of children playing. The required voltage (5 volts) for the microcontroller is regulated with a linear regulator.
As a main manufacturer and exporter in ITS industry, FAMA Traffic always devote ourselves in providing equipment, technology and services in traffic signals, lamp poles and traffic controllers. Please feel free to contact us once you need any information from us.
Copyright © 2022 BOTTLE - aivideo8.com All Rights Reserved.