Select your language

Preparing Raspberry Pi for SW 1.x.x


I do all the preparatory and programming work on a work computer with Win7 64-bit. I use a terminal and ftp to communicate with the Raspberry Pi. So what programs are needed in my case:


1) Linux preparation.

I use the official Raspbian as the operating system for the Raspberry Pi. It can be downloaded from the official website here. For the purpose of positioner control, the smallest Lite variant is sufficient. I will unzip the downloaded * .zip archive with the WinRAR program and upload it to the SD card using the Disk Imager program. Another option is to use a faster and more reliable SSD disk connected to the USB port via a reducer instead of an SD card. But it is not necessary for this single-purpose device. All you need is a good SD card.

After loading Linux, the boot partition on the card is formatted to FAT32. I made two adjustments in this section. I created a text file here called ssh. This will allow communication from the terminal via SSH protocol when starting the Raspberry Pi. I also added to the config.txt file

# my comment, Pullup resistance setting on selected GPIO pins


This sets the selected ports as inputs when starting the Raspberry Pi and activates pullup resistors to + 3.3V. These resistors are necessary for the correct operation of the designed HW, but the used onoff SW library cannot activate them.

Further settings are already made from the terminal using the PuTTY SSH protocol on port 22. The first time you connect from the terminal, the default name / password is set to pi / raspberry. I recommend performing a basic configuration right after connection.

sudo raspi-config

Here I set at least these items:

  • Change user password
  • Boot Options: B1 Desktop/CLI, B1 Console
  • Localization: I2 Change Timezone, Europe, Prague
  • Localization: I4 Change Wi-fi Country, CZ Czech Republic
  • Advanced Option: A1 Expand Filesystem

At the end of these adjustments, a restart is required. For other connections from the terminal, now under a new password, I will perform updates.

sudo apt-get update

sudo apt-get upgrade -y

sudo reboot


sudo rpi-update

sudo reboot


2) Install node.js, npm

The program I'm writing for Raspberry Pi is run by the Node.js Node.js website. It is already part of the Raspbian repositories and should be installed in the standard way together with the npm support program.

sudo apt-get install nodejs npm -y

But when I started, there was an old version in the repository that reported bugs. So I had to install the current version manually according to the following procedure.

  • download the current archive for Raspberry Pi 3 - ARMv7 (node-v12.16.3-linux-armv7l.tar.xz). This archive also contains the npm program
  • copy the archive using an ftp client to the Raspberry Pi, /home/pi/ directory
  • create directory for Node.js
    sudo mkdir -p /usr/local/lib/nodejs
  • unzip the archive to this directory
    sudo tar -xJvf node-v12.16.3-linux-armv7l.tar.xz -C /usr/local/lib/nodejs
  • set environment variables with the nano text editor
    nano ~/.profile
    by adding the following lines to the end
    # Nodejs
    export PATH=/usr/local/lib/nodejs/node-v12.16.3-linux-armv7l/bin:$PATH
  • then activate the edited and saved file
    . ~/.profile
  • and finally create simlinks:
    sudo ln -s /usr/local/lib/nodejs/node-v12.16.3-linux-armv7l/bin/node /usr/bin/node
    sudo ln -s /usr/local/lib/nodejs/node-v12.16.3-linux-armv7l/bin/npm /usr/bin/npm
    sudo ln -s /usr/local/lib/nodejs/node-v12.16.3-linux-armv7l/bin/npx /usr/bin/npx

Whatever way you install Node.js and npm, it's a good idea to check that everything is working. For example, using a list of versions.

node -v

npm version

npx -v


3) Installation of auxiliary libraries

The basic program Node.js can be supplemented with function libraries in javascript. The administrator of these libraries is the npm program, which is used to install them. The onoff library will be needed for basic communication with the GPIO port pins. Another library for web communication is These and other necessary libraries can be installed as follows:

npm install onoff

npm install


4) Run the user program using Node.js

The principle of running programs in Node.js is as follows. Create a directory for the application in the /home/pi/ directory.

mkdir -p SatProwler

Copy all the files of the written program to this directory. There can be a larger number of them, they can be sorted into other subdirectories, but they must always contain two default files, index.html and satprowler.js. Then move to this directory in the terminal.

cd SatProwler

and start the web server

node satprowler.js

The program started in this way depends on the terminal from which it is run. This is useful when testing a program where operating or error messages are displayed in the terminal window. The running program is terminated by pressing Ctrl + C. Switching off the terminal also terminates the program.

This makes the Raspberry Pi ready for trial operation. From now on, it is possible to write and test your own user program.


No thoughts on “Preparing RasPi for SW 1.x.x En”

Leave your comment

In reply to Some User