Category Archives: Без рубрики

Install Docker on a Raspberry Pi 4

Add your new user to the sudo group

sudo usermod -aG sudo g1

Update the apt package index & Upgrade all current program package

sudo apt-get update
sudo apt-get upgrade

Install packages to allow apt to use a repository over HTTPS:

sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

Add Docker’s official GPG key:

curl -fsSL | sudo apt-key add -

look up the name of your linux distribution

lsb_release -cs

Setup the Docker Repo.

sudo su
echo "deb [arch=armhf] buster stable" > /etc/apt/sources.list.d/docker.list

Update the apt package index.

sudo apt-get update

Install the latest version of Docker Engine – Community and containerd without AUFS

sudo apt-get install --no-install-recommends docker-ce docker-ce-cli

Show Docker Version

sudo docker version

Verify that Docker Engine – Community is installed correctly by running the hello-world image.

sudo docker run hello-world

Give the ‘g1’ user the ability to run Docker.

sudo usermod -aG docker g1

How To Install node_exporter for Prometheus on Raspberry PI or Orange PI

Create one new user for node_exporter

sudo useradd --no-create-home --shell /bin/false node_exporter

download file

cd ~

unpack archive

tar xvf node_exporter-0.18.1.linux-armv7.tar.gz

copy files and directories

sudo cp node_exporter-0.18.1.linux-armv7/node_exporter /usr/local/bin
sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter

finally, delete files and directory from your home

rm -rf node_exporter-0.18.1.linux-armv7.tar.gz node_exporter-0.18.1.linux-armv7

create a new systemd service file.

sudo nano /etc/systemd/system/node_exporter.service
Description=Node Exporter



then reload systemd, start service and check status.

sudo systemctl daemon-reload
sudo systemctl start node_exporter
sudo systemctl enable node_exporter

change configuration in a file with named prometheus.yml:

sudo nano /etc/prometheus/prometheus.yml
   scrape_interval: 15s
  - job_name: 'prometheus'
    scrape_interval: 5s
      - targets: ['localhost:9090']
  - job_name: 'node_exporter'
    scrape_interval: 5s
      - targets: ['localhost:9100']   

Restart prometheus and check status.

sudo systemctl restart prometheus
sudo systemctl status prometheus
For check node_exporter, enter in the Expression field, node_memory_MemAvailable/1024/1024 and then press the Execute button.
then in console enter free -h

How To Install Prometheus on Raspberry PI or Orange PI

Prometheus is a leading open-source monitoring solution with alerting functional. By default, Prometetheus export only itself metrics and need aditioanl module for accept more information. You can finde more information on:

Safety First

We need one new user for prometeus service without home directory and shell access.

sudo useradd --no-create-home --shell /bin/false prometheus 

according linux best practise create two directorise, one for configuration and other for data.

sudo mkdir /etc/prometheus 
sudo mkdir /var/lib/prometheus

and set new user and group ownership

sudo chown prometheus:prometheus /etc/prometheus 
sudo chown prometheus:prometheus /var/lib/prometheus

Download and Unpack prometheus

Before download, find the latest stable verion on Prometeus download page. At this time it’s: prometheus-2.12.0.linux-armv7.tar.gz

download file and compere checksum:

cd ~
sha256sum prometheus-2.12.0.linux-armv7.tar.gz

if checksume match than unpack archive:

tar xvf  prometheus-2.12.0.linux-armv7.tar.gz 

copy files and directories

sudo cp  prometheus-2.12.0.linux-armv7/prometheus /usr/local/bin/ 
sudo cp prometheus-2.12.0.linux-armv7/promtool /usr/local/bin/
sudo cp -r prometheus-2.12.0.linux-armv7/consoles /etc/prometheus
sudo cp -r prometheus-2.12.0.linux-armv7/console_libraries /etc/prometheus

and set the user and group ownership

sudo chown prometheus:prometheus /usr/local/bin/prometheus 
sudo chown prometheus:prometheus /usr/local/bin/promtool
sudo chown -R prometheus:prometheus /etc/prometheus/consoles
sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries

finally, delete files and directory from your home

rm -rf prometheus-2.12.0.linux-armv7.tar.gz prometheus-2.12.0.linux-armv7

Configuring prometeus to monitor itself

Create configuration in a file with named prometheus.yml:

sudo nano /etc/prometheus/prometheus.yml 

Prometheus config file /etc/prometheus/prometheus.yml

Important: Prometheus configuration file uses the YAML format, don’t user tabs!

  scrape_interval: 15s

  - job_name: 'prometheus'
    scrape_interval: 5s
      - targets: ['localhost:9090']

set the user and group ownership

sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml

Let’s running Prometheus

create a new systemd service file.

sudo nano /etc/systemd/system/prometheus.service 

add following data into the file: /etc/systemd/system/prometheus.service


ExecStart=/usr/local/bin/prometheus \
    --config.file /etc/prometheus/prometheus.yml \
    --storage.tsdb.path /var/lib/prometheus/ \
    --web.console.templates=/etc/prometheus/consoles \


then reload systemd,

sudo systemctl daemon-reload 

start service,

sudo systemctl start prometheus 

check status,

sudo systemctl status prometheus 

and after successful running enable the service to start on boot

sudo systemctl enable prometheus

find out your IP address


open link in browser

How to charge lead-acid batteries?

The situation is that when a beginner buys a 12V battery, he usually finds 12V charger for batteries in the store. However, difficulties come exactly when 6V batteries are bought, and the question is how to charge it?

Let’s just talk this through, together!

Each battery has its own label, which is printed on the battery or is in the instructions.

As we can see on our on our batteries, it says, Cycle use and standby use with a different voltage range.

What is this for?

Cycle use is the situation when you use this battery in a toy car or in a vacuum cleaner or somewhere remotely.

It means that you charged a battery, installed it in a device where it is discharged during operation, and then you put it to charge again.

Then you need to set the voltage for charging for 6V battery in the range: 6.75V-6.90V

Standby use is the situation when your battery is used as a backup power source, such as a UPC. When the main power supply is lost, the power is supplied from the battery.

Is it enough to buy a simple power supply? No!

Because we need to set current limits in addition to setting the charge voltage.

For example, you need to set current limits at a maximum of 1.5A for our 6V battery, and you need to set to 1.2A for 12V battery.

Thus, we need a power source where you can set the voltage values ​​that fall into the range you need for 6V or for a 12V battery.

And do not forget about the current limit.

How to do it?

The easiest way is to purchase a simple banggood module to which you can connect any power supply with a higher output voltage than you need to charge, and connect other terminals directly to the battery.

 OUT + to the red terminal, and OUT- to the black terminal.

However, the most important thing before you start to charge is to set the voltage you need and use the trimmer to limit the charging rate.

According to the best practice, the charging rate is set equal to 10% of the capacity.

For my batteries, it will be: 5Ah / 10 = 0.5A (best practics) and not more than MAX 1.5A!

A more difficult option for soldering fans is to use the well-known LM317 Linear Voltage Regulators or L200CV, the same Voltage Regulators with the ability to set the output voltage and current limit.

How long does it take to charge the battery?

You need about 10-12 hours for fully charging.

If you have an ammeter, you can put it in the open section of the circuit, which will allow you to see at what stage of the charging you are. When the charging process ends, your charge current will be about 5%.

Does the Arduino will suffer the fate as Olimex?

If you are close to the DYI world, you know monsters like: arduino, adafruit, sparkfun and olimex!

At the time of the Arduino UNO, it was possible to say for sure that the Arduino is a monopolist in the DYI open spaces for the DEVELOPMENT board production.

Its leadership was that Massimo Banzi was the first to provide the world with an IDE for microcontrollers programming. Moreover, it was really a breakthrough; everyone could quickly automate his or her devices.

Prior to this, the Olimex development board was popular.

Due to which we know sparkfun now. At the beginning of its history, sparkfun was just a distributor, who became more and more independent creator of the DEVELOPMENT board and squeezing Olimex board from year to year out of the market.

You can just go to both sites and compare what happened to the companies after 10 years. Now we can definitely say that sparkfun succeeded.

Olimex made excellent development boards, but it was hard to program them. Therefore, Arduino easily forced this company out of the market and became the leader in its segment.

First attempts:
TI created its own Energia IDE (Processing→Wiring→Arduino→Energia ) for its own microcontrollers a few years ago.

It was one of the few attempts to reach Arduino, but the arduino remained in the leader due to the lower popularity of MSP430.

Now let us talk about the turning point.
In the near 2013, there was a successful startup on creating the python programming language, which was adapted for a microcontroller.

After that, the DYI world saw MicroPython, which also did not gain strong popularity due to the high cost of the development board and MicroPython small functionality. However, it was already a red flag for the Arduino. After all, American and European students prefer the python programming language rather than C. There was only to wait for the coming change.

Adafruit went on the offensive!

A very well thought-out tactic made it possible to begin the market redistribution in the DYI world. Adafruit started creating an inexpensive line of development boards compatible with micropython.

Supporting their development with technical articles and video lessons.
And recently, they created CircuitPython as a micropython analogue!

Now adaruit, like Arduino, provides us with both hardware and software for our developments. When adafruit reduced sales for original Arduino boards, and focused on building libraries for CircuitPython, it is safe to say that we will see a new leader in the DYI world in the next couple of years!

ESP8266: ThingBoard платформа для сбора и обработки данных




Цифровой датчик света и ультрафиолета на Si1145

UV Sensor


OpenWeatherMap пример работы