37 Sensors Overview

Sensor.Engine MICRO

  1. Sensor.Engine MICRO Features
  2. Pinout and Pin use
  3. BASIC Overview
  4. SEM Library functions

37+ Sensors

  1. Analog Hall-effect
  2. Analog Joystick
  3. Analog Temperature
  4. Ball Switch
  5. Bi-color LED
  6. Button
  7. Character LCD
  8. Flame
  9. Hall-effect Switch
  10. HMI Display
  11. Humidity and Temperature
  12. IR Receiver
  13. IR Transmitter
  14. Keypad
  15. LASER
  16. Light Cup
  17. Liquid
  18. Mercury Switch
  19. Microphone
  20. Multicolor Flashing LED
  21. Obstacle Avoidance
  22. Photo Interruptor
  23. Photoresistor
  24. Piezo Driver or Annunciator
  25. Pulse
  26. Reed Switch
  27. Relays and Drivers
  28. RGB LED
  29. Rotary Encoder
  30. Servo
  31. Shock and Impulse
  32. Speaker
  33. Temperature 18B20
  34. Temperature Threshold
  35. Touch Sensor
  36. Tracking
  37. Ultrasonic Distance

USBmicro U4xx

  1. U401
  2. U421
  3. U451



  1. Controlling MedeaWiz Sprite



Image: RGB LED module, through-hole (150 ohm current limiting resistors)

Image: RGB LED module, surface mount 5050


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).


• LED: Either TH (5mm) or SMT 5050
• Current: under 20mA typical per LED
• 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 – 330 Ohms. The three LED dice internal to the package are common cathode.

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.

Module Pin-out:

Image: Typical/common pinout. Always check the pinout for the module that you have.

Sensor.Engine:MICRO RGB module test

Blink the red, green, and blue elements of the RGB LED using the Sensor.Engine:MICRO.

RGB module test wiring

Image: Wiring the RGB LED to a SEM.

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


  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

'Comment here

Code: RGB module test code in MMBasic

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.

RGB module test results

Image: Animated .gif

Animated .gif:
Linked file: 20190322_213036.gif

r = 1
g = 1
b = 100

PWM 11000, r, g, b
PAUSE 5000

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

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

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

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

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

  PAUSE 5000

Code: RGB module test code in MMBasic

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.

On Instructables:

USBmicro U4xx RGB module test

Blink the red, green, and blue elements of the RGB LED using the USBmicro U4xx. The U401 connects to a computer using USB and can be controlled in several languages running on the computer.

Image: RGB module test wiring:

Black wire – Common ground, U4xx Ground

Red wire – RedLED element, U4xx A0 - Module R

Green wire – RedLED element, U4xx A1 - Module G

Blue wire – RedLED element, U4xx A2 - Module B


Dim workstr As String * 255
Dim result As Integer

DIm PortAval as byte

'thinAir Visual Designer

'---Needed thinBasic modules

'---Controls IDs---
Begin ControlID
End ControlID

' Public this
DIM hDlg     As Long

' Main thinBasic function
Function TBMain() As Long
End Function

' Create main Window
Function MainWindow_Create(ByVal hParent As Long) As Long

'Local hDlg     As Long
Local hFont    As Long
Local lStyle   As Long
Local lStyleEx As Long
lStyle = _                          
        %WS_DLGFRAME          | _   
        %WS_CAPTION           | _   
        %WS_SYSMENU           | _   
        %WS_OVERLAPPEDWINDOW  | _   
        %WS_CLIPCHILDREN      | _   
        %WS_CLIPSIBLINGS      | _   
lStyleEx = 0                        

Dialog New Pixels, hParent, "RGB1", -1, -1463240, lStyle, lStyleEx, TO hDlg

hFont = Font_Create("MS Sans Serif"8)
Dialog Send hDlg, %WM_SETFONT, hFont, 0


  ' Display DLL info
  workstr = ""
  CONTROL APPEND TEXT hDlg, %IDC_EDIT_2"DLL Info: " + workstr
  workstr = ""
  CONTROL APPEND TEXT hDlg, %IDC_EDIT_2"DLL Ver: " + workstr
  workstr = ""
  CONTROL APPEND TEXT hDlg, %IDC_EDIT_2"DLL Copyright: " + workstr

  result = USBm_NumberOfDevices()
  CONTROL APPEND TEXT hDlg, %IDC_EDIT_2"Number of devices: " + STR$(result)

  PortAval = 0

Dialog Show Modal hDlg, CALL MainWindow_Proc

Win_DeleteObject hFont

End Function

' Main WIndow CallBack handler
CallBack Function MainWindow_Proc() As Long


LOCAL PageNo   AS LONG     

LOCAL hFontTab AS LONG    
  Local RedState as long
  Local GreenState as long
  Local BlueState as long


            CASE %IDOK
            CASE %IDCANCEL
        END SELECT

        If RedState = 1 then
          PortAval = BIT_Set(PortAval, 0)
          PortAval = BIT_reSet(PortAval, 0)
        If GreenState = 1 then
          PortAval = BIT_Set(PortAval, 1)
          PortAval = BIT_reSet(PortAval, 1)
        If BlueState = 1 then
          PortAval = BIT_Set(PortAval, 2)
          PortAval = BIT_reSet(PortAval, 2)

End Select
End Function

Code: RGB module test code in thinBasic

This test code sets port A to output, then sets pins A0 (red), A1 (green), and A2 (blue) high or low to turn the color element on and off.

Image: RGB1.tBasic screen

All content, not otherwise posted with a copyright notice, is Copyright 2017+ to the owner of