Use of other Sensor module on DEBIX - Part 2

2024.6.24by debix.io

RGB Module

Overview:

When a high level is input to the R terminal of the RGB module, the RGB module emits red light;

When a high level is input to the G terminal of the RGB module, the RGB module emits green light;

When a high level is input to the B terminal of the RGB module, the RGB module emits blue light;


Hardware Connection:

lConnect the R terminal of RGB module to Pin31 of the 40Pin double row pin (J2) of DEBIX.

lConnect the G terminal of the RGB module to Pin32 of the 40Pin double row pin (J2) of DEBIX.

lConnect the B terminal of the RGB module to Pin33 of the 40Pin double row pin (J2) of DEBIX.

lConnect the GND terminal of the RGB module to Pin6 of the 40Pin double row pin (J2) of DEBIX.

Step:

1. Export GPIO and set GPIO properties.

GPIO number on R side = GPIO5_IO04 = ( 5 - 1 ) * 32 + 4 = 132

GPIO number on G side = GPIO1_IO13 = ( 1 - 1 ) * 32 + 13 = 13

GPIO number on B side = GPIO5_IO03 = ( 5 - 1 ) * 32 + 3 = 131

echo 13  > /sys/class/gpio/export

echo 131 > /sys/class/gpio/export

echo 132 > /sys/class/gpio/export

echo out > /sys/class/gpio/gpio13/direction

echo out > /sys/class/gpio/gpio131/direction

echo out > /sys/class/gpio/gpio132/direction

echo none > /sys/class/gpio/gpio13/edge

echo none > /sys/class/gpio/gpio131/edge

echo none > /sys/class/gpio/gpio132/edge

2. Set the output level of R, G and B terminals.

echo 1 > /sys/class/gpio/gpio13/value       // turn on the red LED

echo 1 > /sys/class/gpio/gpio131/value    // turn on the blue LED

echo 1 > /sys/class/gpio/gpio132/value    // turn on the green LED

echo 0 > /sys/class/gpio/gpio13/value     // turn the red LED off

3. From the three primary colors of light, it can be seen that:

Red + Blue = Purple;

Red + Green = Yellow;

Blue + Green = Yellow;

Red + Blue + Green = White;

For example, to output purple light, simply:

echo 1 > /sys/class/gpio/gpio13/value      // turn on red LED

echo 1 > /sys/class/gpio/gpio131/value    // turn on blue LED

echo 0 > /sys/class/gpio/gpio132/value    // turn off the green LED

Tilt Sensor Module (Same as IR sensor module)

lWhen the tilt sensor module is perpendicular to the desktop, it outputs a high level;

lWhen the tilt sensor module is parallel to the desktop, it outputs a low level;


Touch Sensor Module (Same as IR sensor module)

lWhen the finger touches the touch sensor, it outputs a high level .

lWhen the touch sensor is not touched, it outputs a low level;



The usage method is the same as the IR sensor module;

 

Active Buzzer Module (Same as Relay module)

lWhen the input of the active buzzer module inputs a high level, the buzzer module does not sound;

lWhen the input of the active buzzer module inputs a low level, the buzzer module sounds;



The usage method is the same as the relay module;

Light Sensor Module (Same as IR sensor module)

lWhen the Light sensor module has light, output high level;

lWhen the Light sensor module has no light, output low level;


The usage method is the same as the IR sensor module;