1. Set up the Raspberry Pi

In this section, you set up your Raspberry Pi.

  1. 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.
  2. Turn on your Raspberry Pi. You can use a powered USB hub.
  3. Connect a keyboard and mouse to the Raspberry Pi.
  4. Connect a HDMI cable to a monitor.
  5. Insert a microSD card on with Raspbian installed via the NOOBs setup.
  6. 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:

    https://www.raspberrypi.org/documentation/remote-access/

  7. To SSH into the machine, determine its IP address by running this command in a terminal window on the Raspberry Pi:hostname –INow that you know its IP address, you can access it remotely.
  8. On your computer, open a terminal window.
  9. Run the following command:ssh [email protected]<ip address for pi>
  10. Enter your SSH password for the Raspberry Pi.
  11. Access the Raspberry Pi via VNC on your computer by running this command:open vnc://[email protected]<ip address for pi>:5901
  12. Enter your VNC password for the Raspberry Pi.
  13. Keep your Raspberry Pi up to date by periodically running this update command in the SSH terminal:sudo apt-get –y updateWait for the update to complete.

  14. Apply upgrades:sudo apt-get –y upgrade
  15. 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.
    1. To work around this problem, change directories to /etc in your SSH window.
    2. Open the file resolvconf.conf file for editing.
    3. Find name_servers in the file and uncomment the following line and add the Google DNS of 8.8.8.8
    4. Save your changes.
  16. Update Node.js and Node-RED on the Raspberry Pi, by running this command: update-nodejs-and-nodered
  17. Update Node.js and Node-RED on the Raspberry Pi, by running this command: update-nodejs-and-nodered
  18. Start Node-RED:node-red-start
  19. 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}:1880Tip: 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.