Install Node.js on Raspberry Pi

With the Raspberry Pi properly set up, login in via SSH, and update your Raspberry Pi system packages to their latest versions.

Update your system package list:

pi@w3demopi:~ $ sudo apt-get update

Upgrade all your installed packages to their latest version:

pi@w3demopi:~ $ sudo apt-get dist-upgrade

Doing this regularly will keep your Raspberry Pi installation up to date.

To download and install newest version of Node.js, use the following command:

pi@w3demopi:~ $ curl -sL | sudo -E bash -

Now install it by running:

pi@w3demopi:~ $ sudo apt-get install -y nodejs

Check that the installation was successful, and the version number of Node.js with:

pi@w3demopi:~ $ node -v

Get Started with Raspberry Pi and Node.js

Now you have a Raspberry Pi with Node.js installed!


Having an SSH connection established with your Raspberry Pi, enter the following commands to install Node-RED:

pi@raspberry:~ $ bash <(curl -sL

The installation should be completed after a couple of minutes.

Autostart Node-RED on boot

To automatically run Node-RED when the Pi boots up, you need to enter the following command:

pi@raspberry:~ $ sudo systemctl enable nodered.service

Now, restart your Pi so the autostart takes effect:

pi@raspberry:~ $ sudo reboot

Testing the Installation

When your Pi is back on, you can test the installation by entering the IP address of your Pi in a web browser followed by the 1880 port number:


In my case is:

A page like this loads:


Node-RED overview

Let’s take a look at the Node-RED visual interface.


Main sections

On the left-side, you can see a list with a bunch of blocks. These blocks are called nodes and they are separated by their functionality. If you select a node, you can see how it works in the info tab.

In the center, you have the Flow and this is where you place the nodes.


Creating a simple flow

Let’s test a simple example of a flow. Start by dragging an Inject node to your flow. Then, also drag a Debug node.


Connect your nodes together. You can drag them to confirm that they are connected.

Now, let’s edit the inject node. Double-click the node. In the figure below you can see different settings you can change.

Select string and type Hello!.


To save your application, you need to click the deploy button on the top right corner.


Your application is saved.

Testing the flow

Let’s test our simple flow. Open the debug window and click the Inject node to trigger the “Hello!” string.


As you can see, our message is being printed in the debug window. This is a very basic example and it doesn’t do anything useful. However, the purpose of this post is to get you familiar with the Node-RED interface.

Wrapping Up

This post is a quick guide to setup Node-RED on a Raspberry Pi and create a simple flow. I’ll be posting future tutorials doing things with a real world application, but I thought it would be useful to introduce this software first.

Source :


Dans certains projets, nombreuses sont les raisons qui peuvent nous mener à utiliser Raspberry Pi et Arduino ensemble. En effet, chaque carte possède ses avantages et ses inconvéniants. Certains modules seront plus faciles à utiliser sur l'Arduino, alors que d'autres fonctions seront plus facilement implémentables sur un Raspberry Pi. Pour tirer l'avantage de chaque carte, le mieux est d'établir une communication entre les deux.
Nous allons donc voir dans ce tutoriel comment mettre en place les 3 types de communication suivants :

  • Communication unidirectionnelle Arduino UNO → Raspberry Pi : Cette communication va permettre d'envoyer des données à partir de l'Arduino vers le Raspberry.
  • Communication unidirectionnelle Raspberry Pi → Arduino UNO : Exactement la même communication que précédemment mais cette fois, dans le sens Raspberry vers Arduino.
  • Communication bidirectionnelle Raspberry Pi ↔ Arduino UNO : Cette communication mélange les deux précédentes et permet d'à la fois envoyer et recevoir des données de l'autre carte sur chaque carte.

Modifier le fichier config.txt grâce à la commande: sudo nano /boot/config.txt

Ajouter à la fin du fichier les commandes suivantes

# NOOBS Auto-generated Settings:

display_rotate=3 #1,2,3ou 4

 Débloquer le serial


sudo raspi-config

interfacing options

En 6 serial il faut le desactiver no et no


Script domoticz arduino

Pour enlever le login au démarrage 

Logo Lycée Paul Sérusier

J'enseigne au
Avenue de Waldkappel
Tél : 02 98 99 29 29
Site :


Professeur de Physique Appliquée
Certification ISN
Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser.