• sales

    +86-0755-88291180

Raspberry Pi ------ 4.6 RGB effect User Guide

RGB effect

The Raspberry Pi RGB_Cooling_HAT needs to be properly plugged into the GPIO port of the Raspberry Pi and open the Raspberry Pi system I2C function.

This experimental phenomenon shows that all RGB light become purple breathing light.

1. File transfer

1.1 Install WinSCP tool on the computer side, connect the Raspberry Pi and transfer the temp_control.zip package to the pi directory of the Raspberry Pi.

Path of WinSCP:[Raspberry Pi RGB_Cooling_HAT]---[Tools]---[winscp556_setup.1416364912.exe]


1.2 Extract file

Open the Raspberry Pi terminal and input command ls to find the RGB_Cooling_HAT.zip file. 

As shown below:


Input command to extract file:

unzip RGB_Cooling_HAT.zip


2. Compiling and running program

2.1 Input command to enter temp_control find file:

cd RGB_Cooling_HAT/

ls


2.2 Input following command ti run program

python rgb_effect.py


We can see that all RGB light become purple breathin light.

3. About code

3.1 Initialize the I2C configuration of the Raspberry Pi, import the smbus module for I2C communication, import the time module for delay.

There are three RGB lights on the Raspberry-Pi-RGB-Cooling-HAT, so define the number of lights as 3. Define the register address: rgb_effect is 0x04, rgb_speed Is 0x05, rgb_color is 0x06, and rgb_off is 0x07.


2. setRGB(num, r, g, b) function:

Set the RGB lamp color, num refers to which lamp.

 0 is the first lamp, 1 is the second lamp, 2 is the third lamp.

If greater than or equal to 3, all lamps are set at the same time. The range of R, G, B values is 0~255.


3.Turn off RGB. According to the protocol, the register to turn off RGB is 0x07, and the data is 0x00.


3.4 setRGBEffect(effect)  function.

First,we need to judge the input value. There are five kinds of special effects to choice, 0-water light, 1-breathing light, 2-marquee, 3-rainbow lights, 4-colorful lights.


3.5 setRGBSpeed(speed) function.

Modify the RGB light switching speed of the mode. 1-low speed, 2-medium speed (default), 3-high speed. If you do not set, it is medium speed(default).


6. setRGBColor(color) function.

Set the color of the water light and breathing light, 0-red, 1-green (default), 2-blue, 3-yellow, 4-purple, 5-cyan, 6-white. If not set, the default is green.


7. An example of setting a purple high-speed breathing light.


TAG: JETSON-IO-BASE-A DeepSeek AI Voice Chat ESP32 S3 Development Board 1.83 inch TouchScreen Display 240x284 ESP32 S3 2.1 inch Round LCD Development Board 480x480 TouchScreen Display LVGL HMI With QMI8658C 6-Axis Sensor Electronic EYE 0.71inch Round LCD Display Screen For Arduino Raspberry Pi ESP32 Pico STM32 GC2083 SIM8230G M2 3G/4G/5G/GNSS/GPS Sub-6G PCIe M.2 Moudle For LTE-A/NSA/SA For DFOTA /VoLTE For SIMCOM ESP32-C6 WiFi 6 Development Board ESP32-C6-MINI-1Support WiFi6 Bluetooth5 Zigbee Thread Jetson RTL8822CE 5GHz WiFi Wireless Bluetooth5 Card NGFF-M.2 RTL8822CE-CG Core ESP32-P4 DEV-KIT C6 WiFi6 MIPI DSI 7/10.1 inch Display/CSI Camera/Audio Speaker For AI Deepseek Wireless AW CB375N 2.4G/5GHz Dual Band WiFi5 Wireless module RTL8822CE CG Bluetooth 5.0 Raspberry Pi Pico Display 240x240 NVIDIA Jetson Orin Nano/NX PoE Mini Expansion Board Power over Ethernet RJ45 802.3af compliant Raspberry Pi 5 PCIe to 2-CH PCIe FFC Dual PCIe HAT Board Pi5 Double Pi5 Pure-Copper Active Cooler Arduino MLX90641 BPI-M4 Zero Raspberry Pi Raspberry Pi Pico 2 RP2350 CAN Onboard XL2515 CAN Controller RP2350A Jetson Orin 5G/4G/3G expansion board GNSS GPS RM520N-GL