Using RGB LED From 37 Sensors Kit

by indestructable in Circuits > Sensors

831 Views, 3 Favorites, 0 Comments

Using RGB LED From 37 Sensors Kit

pasted_image.png
pasted_image001.png

So you went out and bought a kit of electrical sensors and modules for a good price called "37 Sensors" ( like this one here or others on Amazon), but can't find information on the modules to be able to use them? This series of Instructables will help you out with all of the modules in the 37 Sensors Kit. There are other kits that sell a different number of modules than 37, such as a 20 module kit, and a 45 module kit. These sensors/modules are also available from some online stores individually.

These kits are excellent for STEM (Science, Technology, Engineering, and Mathematics) experimentation and education.

The modules from the 37 Sensors Kit called "RGB LED" are a through-hole and surface mount RGB LED. This is an LED with three different LED colors included in one package.

(Images and information used with permission from 37sensors.com)

RGB LED Module Description

LED containing red, green, and blue emitters, each controlled independently. Some modules have current limiting resistors, some do not.

Also called: full color LED, three color LED, tri-chromatic LED, KY021, KY016.

Found in kits: 37 sensors, 45 sensors (through-hole LED).

Found in kits: 20 sensors, 37 sensors, 45 sensors (SMT LED).

RGB LED Module Specification

pasted_image002.png

LED: Either TH or SMT 5050

Forward voltage drop red: 2.1V

Forward voltage drop green: 3.2V

Forward voltage drop blue: 3.2

Red: 625nm

Green: 530nm

Blue: 465nm

Size: 20mm X 15mm

Some modules have current limiting resistors, some do not. The typical resistance value is 120 – 270 Ohms.

Pins are frequently labeled incorrectly. RGB, BGR, GRB, etc.

There are a number of different sources for these modules. Not every module that looks similar to the ones here behaves exactly the same. Check the specific module that you have for differences in function, voltage levels, pinout, and inactive/active states. Some modules have been found to have incorrectly labeled pins and even poorly soldered components.

RGB LED Experiment Supplies

sem1.png

Just to see the basics of how this module works, this experiment shows how to interface it to a simple-to-understand microcontroller board, the Sensor.Engine:MICRO. There is no need for a complicated development system as the 32-bit micro that is part of this board has all of the smarts built in.

Code for other microcontroller platforms would likely be in a different language/syntax, but similar in form.

Here is the small list of components for this experiment:

RGB LED Module from 37 Sensors Kit. (This experiment's source: CircuitGizmos) Kits also available at Amazon and online in many places.

Jumper Wires, female to female "DuPont" style. (This experiment's source: CircuitGizmos) Jumpers of this type are also available online.

Microcontroller Board. (This experiment's source: CircuitGizmos)

A PC with a serial terminal application is used to communicate with the board via USB. One such free and useful program is Beagle Term.

With all of this, you can perform an experiment to test the RGB LED Module.

RGB LED Module Experiment Hookup

pasted_image003.png

Black wire – Common ground

SEM GND - Module Ground

Red wire – RedLED element

SEM P4 - Module R

Green wire – RedLED element

SEM P5 - Module G

Blue wire – RedLED element

SEM P6 - Module B

This particular through-hole LED module has a current limiting resistor so no external resistor needed

RGB LED Module Experiment Code

MMeditor.jpg
2019-04-08_151320.jpg

With the PC connected to a powered microcontroller board, Beagle Term is the window into what is happening on that board. You can enter program code, see the printed results of that code, and even interact by typing information into a running program.
Typing EDIT at the ">" prompt will connect you to the built-in editor. It is in this editor that you will enter the program code. You can save the code that you type in with a Control-Qkeystroke. You can save and immediately run the code that is in the editor with Control-W.

Control keys for the program EDIT function. (Function keys don't work right in Beagle Term)

  • Control-U - Move to line home
  • Control-U Control-U - Move to start of the program
  • Control-K - Move to the line end
  • Control-K Control-K - Move to end of the program
  • Control-P - Page up
  • Control-L - Page down
  • Control-] - Delete
  • Control-N - Insert
  • Control-Q - Save the code
  • Control-W - Run the code
  • Control-R - Find
  • Control-G - Repeat find
  • Control-T - Mark text
  • Control-Y - Paste text
  • ESC - Exit from editor abandoning changes.

Enter this experiment's code in the editor:

SETPIN 4, DOUT
SETPIN 5, DOUT
SETPIN 6, DOUT

DO
  PAUSE 200 : PIN(4) = 1 : PAUSE 200 : PIN(4) = 0
  PAUSE 200 : PIN(5) = 1 : PAUSE 200 : PIN(5) = 0
  PAUSE 200 : PIN(6) = 1 : PAUSE 200 : PIN(6) = 0
LOOP

This test code sets pins 4, 5, and 6 to outputs and then sets each of those outputs high and low to turn the color element on and off.

r = 1
g = 1
b = 100

PWM 1, 1000, r, g, b
PAUSE 5000

DO
  for r = 0 to 99 STEP 2
    PWM 1, 1000, r, g, b
    PAUSE 10
  NEXT r
  
  PAUSE 5000
  
  for b = 100 to 1 STEP -2
    PWM 1, 1000, r, g, b
    PAUSE 10
  NEXT b

  PAUSE 5000
  
  for g = 0 to 99 STEP 2
    PWM 1, 1000, r, g, b
    PAUSE 10
  NEXT g

  PAUSE 5000
  
  for r = 100 to 1 STEP -2
    PWM 1, 1000, r, g, b
    PAUSE 10
  NEXT r

  PAUSE 5000
  
  for b = 0 to 99 STEP 2
    PWM 1, 1000, r, g, b
    PAUSE 10
  NEXT b

  PAUSE 5000
  
  for g = 100 to 1 STEP -2
    PWM 1, 1000, r, g, b
    PAUSE 10
  NEXT g

  PAUSE 5000
  
LOOP

This test code uses PWM to slowly increase/decrease the output of the R, G, and B channels in patterns. There are 5-second delays between the changes.

The PWM outputs can be run through a solid state relay (see relay page) or a FET to drive 5V or 12V RGB LED strips.

RGB LED Module Summary/Feedback

If you have any additional information on the specifications or behavior of this type of module, please comment here and I'll include the relevant information. If you know of a module that is similar, but perhaps available singly or in a different kit of modules, please mention that.

The comments area would also be a good place to include a small sample code for other microcontroller platforms if you have experimented with this module. or visit 37 Sensors and 37 Sensors Docs .