Traffic light intersection simulation project

I'm going to look into the XIAO ESP32-S3 and the Pro Micro. Basically, I'm looking for the smallest/cheapest/simplest microcontroller than can handle the traffic light logic for any conceivable kind of intersection. I may end up making more of these in future, so will want the option of using a battery or wall wart, depending on the situation.

I'll only look into a MOSFET if the lights are too dim at the max current of the microcontroller pins. I'm trying to avoid unnecessary complexity but if MOSFETs are what it takes to achieve the desired brightness, I'll add them for sure.

I'm thinking of running a single ground wire to each traffic light pole for the red/yellow/green AND pedestrian red/white LEDs — so all 5 LEDs will share a ground but will each have a dedicated connection to the digital output from the MCU for independent control. Sound good? (Only two LEDs max out of the five on a pole will be on any any given time.) For your high school project, did you have groups of 3 LEDs share a ground or did you run a pair of wires from the breadboard to each LED?

I guess it depends how bright they end up looking in real life. Sounds like I'll only be able to have one LED per output pin as that's already going to be pushing it. As long as the MCU I end up going with has at least 18 PINs and can deliver sufficient current at each one, I might not need to use MOSFETs.

The good thing about the MOSFET scenario is there will be so much power on each MOSFET pin that I'll be able to group the anodes for LEDs that always come on simultaneously together, which will reduce the number of MCU output PINs I'll need to use (i.e. from 18 down to 10).

Still brainstorming at this stage. I'm not sure yet which of these is the smallest/simplest MCU than will be able to handle the logic for pretty much any controlled intersection:

  • Uno
  • Nano
  • Mini
  • Pro Mini
  • Pro Micro
  • XIAP ESP32-S3

8mA per output pin would probably be too low but it's hard to say without trying it in real life.

I'm pretty sure I won't fry anything — I'm generally pretty careful. I guess the main risk isn't from outright shorting an output pin to ground but from accidentally going over the 20mA with too many LEDs/resistors.

The Pro Mini has 14 outputs, which isn't enough for all 18 traffic light LEDs to each have their own output pin but is enough if they can double up two LED anodes per pin.

What happens if I try to pull 50mA from a 40mA pin? Would it damage the circuit feeding it or would it just refuse to provide more than 40mA?


I'm thinking Pro Micro for prototyping (because of the USB port), then Pro Mini for the finished product (cheaper + smaller footprint).