are these resistors on these LED modules?

I picked up these 5V traffic light 5mm LEDs modules off of eBay, but not sure if they already have resistors. Are those resistors next to the LEDs (pictures attached)? If so, can I directly connect these modules to Arduino's pins? Can I connect them directly to a relay?

Yes, they are resistors. You can determine the values by the codes written on the top. In your Screenshot_20200823-212049.jpg:


the resistor for the red LED is marked "221", which means 22 x 101, or 220 ohm.

The resistor for the yellow LED is marked "472", which means 47 x 102, or 4700 ohm.

The resistor for the green LED is marked "0", which mean 0 ohm, the equivalent of a piece of wire.

These are strange values, and you should certainly not use an LED with a 0 ohm current limiting resistor.

I have some of these modules, but mine have 330 ohm resistors on all the LEDs, which is a sensible value.

So I have no clue what is the deal with that module in the picture. I would recommend that you take a look at th actual modules you have to check if they have different resistor values.

digity:
can I directly connect these modules to Arduino's pins?

Only if the current limiting resistor used with the LED will cause it to not exceed the maximum current rating for the pin.

digity:
Can I connect them directly to a relay?

Yes, though that green LED might not have a long lifetime with a 0 ohm current limiting resistor.

pert:
I have some of these modules, but mine have 330 ohm resistors on all the LEDs, which is a sensible value.

I looked at the actual modules and it says 331 on all the resistors. So all LEDs have a 330 ohm resistor, correct?

Just curious - what are you using these modules for (mine is a traffic light system for my kids' Hot Wheels & Lego street sets - I bought too many modules, so it'd be cool to find another purpose/project for the extras)?

I'm trying to build a traffic light system for my kids' Hot Wheels and Lego sets. I was able to piece together one intersection 4 way traffic light system with 4 x generic 5V traffic light modules (photos attached) and one Arduino Uno (with all pins occupied, 2 to 13 - 12 LEDs total, 12 pins). It works great, but I would like to have 5 total intersections/4 ways and I can't think of how to do this except to have 5 total Arduino Unos each controlling a 4 way. That would be bulky and hard to integrate easily around their toys. Is there a less bulky, more efficient way to accomplish this?

Arduino Pro Mini?

I looked at the actual modules and it says 331 on all the resistors. So all LEDs have a 330 ohm resistor, correct?

If they all have 331 on them that means they are 330 ohm resistors and are fine to connect directly to an Arduino pin.

The main market for these things is education. Programming a traffic light system for a pedestrian crossing or road junction is a popular project, mainly because it gets the students to think about what is going on and can be quite complex when you start adding extra delays For pedestrian crossing requests and stretching amber when a fast car is approaching.

but I would like to have 5 total intersections/4 ways and I can't think of how to do this except to have 5 total Arduino Unos each controlling a 4 way

You need more pins so either use port expanders at each set of lights and connect them to the I2C lines of the Arduino, or get a Mega and use those pins.

Do pairs of your signals always show the same lights? If so, you can connect those pairs to the same pins. With 330R series resistors, each led will draw 8~10mA, so an Arduino pin can safely drive 2 LEDs.

Of course, using an Arduino to control 2 or more intersections, you will need to change your sketch. If you wrote or found that code, it's likely to be typical beginner style, using delay() for example. Adapting it to control more than one intersection will be a challenge and an opportunity to move your programming skills off the bottom rung.

Use "Neopixel" WS2811/WS2812/APA106 LEDs.

These are addressable LEDs, and only need power and data line(s), can be daisy chained and will make wiring very easy.

Grumpy_Mike:
stretching amber when a fast car is approaching.

And in what galaxy do they do that?

Or for that matter, adding extra delays for pedestrian crossing requests?

Do you mean that it automatically delays a pedestrian crossing requests to prevent "chicken running"?

digity:
I looked at the actual modules and it says 331 on all the resistors.

Yay! I'm glad you got some good modules.

digity:
Just curious - what are you using these modules for

My use for them is just to have a few LEDs on hand that are in a form that's quick and easy to connect to any pin on an Arduino for a test. Most often, I use it for testing whether PWM is working on a pin. I could use my logic analyzer or oscilloscope for that purpose, but I don't have those all set up ready to go so the LED is way faster and good enough for the purpose except for the very rare occasion when I do want to check the frequency and duty cycle.

UNOs are not really practical for serious projects - unless there is a shield that performs the complete interface.

Nanos (clones) are cheaper and more practical. A "four way" junction without turn signals is only six aspects, so a Nano could drive two such junctions.

Otherwise port expanders are generally useful, except that you are using comon cathode modules!

If you removed the resistors (shorted them out), a MAX7219 module drives 64 LEDs, or 16 RGBs.

Paul__B:
And in what galaxy do they do that?

Or for that matter, adding extra delays for pedestrian crossing requests?

Do you mean that it automatically delays a pedestrian crossing requests to prevent "chicken running"?

The part of the galaxy called the UK. Yes all that.
Pedestrian delays are variable depending on the time of previous request and the traffic sensors. We had a talk at our radio club some years ago from someone who worked for a traffic light company.

He also told us that Manchester was a pioneer of synchronised traffic lights in the late 50s. The main street had several sets of lights and they were synchronised, so that if you drove within the speed limit you would find every light on green. If you exceeded the speed limit you would have to stop on at each junction.

While that street as long since been pedestrianised there is still a section of road on the outskirts of the city that still works like that. It is called Great Clowes street, if you want a google drive down it. It used to be a main shopping area but development of the city center has left it mainly residential.

noiasca:
Use "Neopixel" WS2811/WS2812/APA106 LEDs.

These are addressable LEDs, and only need power and data line(s), can be daisy chained and will make wiring very easy.

Useful in some circumstances, but in this case, the little modules are particularly appropriate for the application - miniature traffic lights!

Useful in some circumstances, but in this case, the little modules are particularly appropriate for the application - miniature traffic lights!

read what the TO has in mind

It works great, but I would like to have 5 total intersections/4 ways and I can't think of how to do this except to have 5 total Arduino Unos each controlling a 4 way.

Before adding more Arduinos or trying to drive different LEDs with a MAX7219 and getting a mess of wiring, I propose to switch over to Neopixels. A simple 4 wire daisy chain line for all 20 (x3) traffic lights seems to me a far more realistic approach than a bundle of 60 wires plus power sources to each of the 20 traffic lights.

but as always, the thoughts are free, do whatever you want.

Who is the "TO" you quote here?

Clearly does not understand what a MAX7219 is. :roll_eyes:

Matrixing massively simplifies the wiring. From a MAX7219, you only ever have up to 16 wires going to 64 LEDs or - as I pointed out - 16 RGB combinations, and there are no separate power wires. You can chain a reasonable number of MAX7219s over a distance with only five wires; you may need to reduce the driving speed to compensate for wiring capacitance which is perfectly easy to do in software.

These modules are intended to be used as a somewhat stylised traffic light on a model layout and will fit in just fine while it will take some jiggery-pokery to replicate the appearance with NeoPixels and in fact given the high data rate, operating NeoPixels over longer distance is a major problem.
Screenshot_20200823-213627.jpg

I was favoring the port expander approach, but trying to suspend 4 modules above a toy intersection and then run wires to the next intersection is looking to be too messy (and probably not safe for kids). What about putting a module on each corner of the intersection - which would be the best small micro controller that can be slapped on the back of the traffic module with a battery and that's wireless so it can talk to the other 3 lights and sync/operate together?

Maybe one module per intersection, but not 4 per intersection, surely?

IR emitters and reciever on each module is a possibility, bouncing signals off the ceiling?

Some port expanders will not work with these displays as the displays are common cathode and the common PCF8574 type - can only drive common-node displays however the MCP23017 can.

The modules used to be readily available on eBay before the plague. :roll_eyes:

"Battery" and "Wireless" is not a good combination, :astonished:

Paul__B:
"Battery" and "Wireless" is not a good combination, :astonished:

To clarify Paul's comment, wireless and long battery life is pretty difficult to achieve. In your case, each battery powered module is running several leds continuously anyway, which is also not good for long battery life, but I guess they only need to last for a play period of a couple of hours.