Introduction: My Beautiful Night Light With Raspberry Pi
Recently, I found that I fall in love with the beautiful light on raspberry pi.
I am jacky~, and i love make things on raspberry pi and recently i found that there are a series product for raspberry pi is very cool~
It based on I2C protocol communication, and it so easy to use.
The following pictures are the four products: 1. Docker Pi night light board ( based on ws2812 and communicate with raspberry pi via I2C protocol)
2. Docker Pi 4 channel Relay board ( based on relay module and communicate with raspberry pi via I2C protocol and can be stacked)
3. Docker Pi Power board with Fan ( this is all the same but it can provide 5V / 4A power supply, make sure the pi work properly while statcked)
4. Docker Pi IoT-Node(A) module ( It contains GPS, GSM(GPRS) and Lora module onboard, and still communicate with you pi via I2C protocol)
PS: It's all compatiable with Rasbperry Pi 4B !!!
1. Configuring I2C(Raspberry Pi)
Run sudo raspi-config and follow the prompts to install i2c support for the ARM core and linux kernel Go to Interfacing Options > then I2C > Enable > Done
2. Direct control without programming(Raspberry Pi)
The following script demonstrates turn on and turn off each LED.
for i in $(seq 1 24)
i2cset -y 1 0x15 $i 0xFF # turn on the led
i2cset -y 1 0x15 $i 0x00 # turn of the led
3 .Program in Language C(Raspberry Pi)
Create source code and name it "led.c"
#define BUTTON_REG_ADDR 0x19
int is_press = 1;
int is_draw = 0;
int i = 0;
fd = wiringPiI2CSetup(0x15);
for(i = 1;i<25;i++)
if (wiringPiI2CReadReg8(fd, BUTTON_REG_ADDR) == 0x01 )
is_draw = 1;
if(is_press && is_draw)
is_draw = 0;
for(i = 1;i<25;i++)
if(is_press > 3)
is_press = 1;
if(((i + is_press) % 3) == 0)
gcc led.c -lwiringPi -o led
* Program in Language Python(Raspberry Pi)
The following code is recommended to be executed using Python 3 and install the smbus library:
import time as t import smbus
DEVICE_BUS = 1
DEVICE_ADDR = 0x15
bus = smbus.SMBus(DEVICE_BUS)
for i in range(1,25):
bus.write_byte_data(DEVICE_ADDR, i, 0xFF)
bus.write_byte_data(DEVICE_ADDR, i, 0x00)
except KeyboardInterrupt as e:
print("Quit the Loop")
Step 2: Step 3. You Will See...
It's shining and blinking.