💡 Control Raspberry Pi LED breakout's with Node JS
- A Raspberry Pi
- Power supply
- microSD card
- An LED breakout connected to the raspberry pi
Note: This guide was wrote for a Raspberry Pi 3 A+. Raspberry Pi Zero W and older versions will have issues installing the latest version of node and using visual studio code remotely.
- Download raspbian lite
- Install the operating system by flashing the microSD card with the
.imgfile. You can use etcher. - If you have ethernet cable, keyboard and monitor, plug them into your raspberry pi and skip to step 5. If you do not you can set up the raspberry pi headless.
- SSH into the raspberry PI
ssh pi@raspberrypi.local(password:raspberry) - Run
sudo raspi-configto finish setting up your Raspberry Pi - Choose
5 Interfacing OptionsselectP5 I2Cand enable ARM I2C interface
- Update and upgrade the installed packages
sudo apt-get update && sudo apt-get upgrade - Install NVM to your Raspberry Pi
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/main/install.sh | bash - Restart
sudo reboot - Reconnect with SSH
ssh pi@raspberrypi.local - Check NVM is installed and working
nvm --version - Install Node JS and NPM
nvm install node. - Test that node and NPM work
node --version && npm --version
- Install the Remote SSH extension
- Click the remote explorer icon in the side bar and input
pi@raspberrypi.local - Click the folder icon next to
raspberrypi.local - Enter the password in
raspberry
- Install i2c-tools
sudo apt-get install i2c-tools - Get the address on the LED Module by running
i2cdetect -y 1and compare the found addresses with the numbers on the LED Hardware. For example it should be0x75or0x77. - Install this package
npm install raspberry-pi-led-breakout
- v0.0.0 -