1. Set up the Raspberry Pi
In this section, you set up your Raspberry Pi.
- Set up your Raspberry Pi with the Raspbian distribution. If you haven’t yet installed Raspbian on your Raspberry Pi, see the NOOBs (new out of the box software) video guide.
- Turn on your Raspberry Pi. You can use a powered USB hub.
- Connect a keyboard and mouse to the Raspberry Pi.
- Connect a HDMI cable to a monitor.
- Insert a microSD card on with Raspbian installed via the NOOBs setup.
- Connect the micro USB power cable.
You will see many Raspberry Pis operational without a keyboard, mouse or monitor, and controllable via remote access, but this is only possible if you know the network IP address of the Raspberry Pi, and you configured SSH and VNC into the Raspberry Pi.After you have the IP address of the Raspberry Pi, you can run it headless, meaning that you can run it without a monitor, keyboard, and mouse. You’ll need only a power connection for it to function. SSH allows you to access the Raspberry Pi remotely via a terminal. VNC allows you to access the Raspberry Pi via a remote desktop.In either case, to set up remote access, follow these instructions:
- To SSH into the machine, determine its IP address by running this command in a terminal window on the Raspberry Pi:
hostname –I
Now that you know its IP address, you can access it remotely.
- On your computer, open a terminal window.
- Run the following command:
ssh [email protected]<ip address for pi>
- Enter your SSH password for the Raspberry Pi.
- Access the Raspberry Pi via VNC on your computer by running this command:
open vnc://[email protected]<ip address for pi>:5901
- Enter your VNC password for the Raspberry Pi.
- Keep your Raspberry Pi up to date by periodically running this update command in the SSH terminal:
sudo apt-get –y update
Wait for the update to complete. - Apply upgrades:
sudo apt-get –y upgrade
- Apply a fix for a DNS problem.Before moving to the next step of updating the out-of-the-box node.js and Node-RED installation on the Raspberry Pi in the Raspbian distribution, there is a known problem with some Internet providers whose DNS servers are unable to find the appropriate GitHub repositories.
- To work around this problem, change directories to
/etc
in your SSH window.
- Open the file resolvconf.conf file for editing.
- Find
name_servers
in the file and uncomment the following line and add the Google DNS of8.8.8.8
- Save your changes.
- To work around this problem, change directories to
- Update Node.js and Node-RED on the Raspberry Pi, by running this command:
update-nodejs-and-nodered
- Update Node.js and Node-RED on the Raspberry Pi, by running this command:
update-nodejs-and-nodered
- Start Node-RED:
node-red-start
- Open a browser on your computer and open the Node-RED flow editor for the instance running on your Raspberry Pi.
http://{ip address for pi}:1880
Tip: To stop Node-RED, open a new SSH terminal and run the command node-red-stop
The Node-RED documentation for the Raspberry Pi also shows you how to set up your device so that Node-RED automatically starts when you start your computer.