Why do this? Sometimes we face the problem that how can I get the Raspberry Pi's IP address without a screen and unable to view the IP through the router? This is really a big problem, especially for the newbies. For people who are very familiar with the Raspberry Pi or other embedded systems, they would use the serial port to see the ip address. However, there's not always a USB-TTL serial tools....
I have a few Raspberry Pis in the room, and the lights are a bit dazzling at night, and I want to turn them off. I checked the Raspberry Pi circuit schematic and found that the power and status indicators can be turned off.
After experiments, you can turn off the power and status indicators of the Raspberry Pi 3 and Raspberry Pi 4. For Raspberry Pi 1, 2, and zero, I guess it is also possible.
Turn off the onboard LEDs
Login to Raspberry Pi using ssh
Enter the following command on the command line:
echo 0 | sudo tee /sys/class/leds/led0/brightness echo none | sudo tee /sys/class/leds/led0/trigger echo none | sudo tee /sys/class/leds/led1/trigger echo 0 | sudo tee /sys/class/leds/led1/brightness
If you want to run it automatically after booting, you can edit the
sudo vim /etc/rc.local
Add the following lines
echo 0 | tee /sys/class/leds/led0/brightness echo none | tee /sys/class/leds/led0/trigger echo none | tee /sys/class/leds/led1/trigger echo 0 | tee /sys/class/leds/led1/brightness
Turn off the network LEDs
The network indicator can also be turned off. The following method has been tested on the Raspberry Pi 3. Raspberry Pis 1 and 2 should also work. Raspberry Pi 3+ and Raspberry Pi 4 should not work due to different chips.
- Login to Raspberry Pi using ssh
- Enter the following command on the command line to install dependencies:
sudo apt-get install libusb-dev
- Download the source code
wget https://www.raspberrypi.org/forums/download/file.php\?id\=6355 -O llctl.tgz
- Unzip and compile
mkdir build cd build tar xvf ../llctl.tgz make
sudo ./llctl f0 l0 d0
If you want to run it, just add it to /etc/rc.local.