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 https://download.docker.com/linux/raspbian/gpg | 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] https://download.docker.com/linux/raspbian buster stable" > /etc/apt/sources.list.d/docker.list
exit

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 containerd.io

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 ~
wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-armv7.tar.gz

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
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=multi-user.target

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
global:
   scrape_interval: 15s
scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs: 
      - targets: ['localhost:9090']
  - job_name: 'node_exporter'
    scrape_interval: 5s
    static_configs: 
      - 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: https://prometheus.io/

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 ~
wget https://github.com/prometheus/prometheus/releases/download/v2.12.0/prometheus-2.12.0.linux-armv7.tar.gz
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!

global:
  scrape_interval: 15s

scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs:
      - 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

[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
    --config.file /etc/prometheus/prometheus.yml \
    --storage.tsdb.path /var/lib/prometheus/ \
    --web.console.templates=/etc/prometheus/consoles \
    --web.console.libraries=/etc/prometheus/console_libraries

[Install]
WantedBy=multi-user.target

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

ifconfig

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!

G1Tech BME680 – Temperature, Humidity, Pressure and Gas Sensor

Brand-new instrument for the measurement market, a small sensor that can measure: Temperature, Humidity, Pressure and VOC. Bocsh made VOC measurement new in the sixth series

Sensor parameters and its form factor were also slightly changed.

Package: 3.0 mm x 3.0 mm x 0.93 mm metal lid LGA
IAQ range: 0-500
Humidity range: 0-100%
Pressure range: 300-1100 hPa
Temperature range: -40-85°C

Is there any point in using this sensor in your DIY?

Let us look straight to the CONS of this sensor:

  1. Current consumption when measuring VOC is 18mA, which is a lot for low-power devices
  2. The sensor must work for at least 30 minutes to normalize VOC measurement
  3. Complex logic in converting resistance to VOC, however this can be solved using the API sensor.

Thus, if you do not create a low-power device, you get a compact sensor that can measure 4 parameters.

To test this sensor, we created a prototype module, according to the datasheet and after a month of testing, we can conclude: You can use bme680 when you are limited in space, in other cases we recommend using bme280 in conjunction with CCS811.

Download: EagleCAD PCB files on github

#DIY Vacuum Pick Up Tool part 1

Today one of stages of vacuum pickup construction is over.

All components are selected, and only a body and nice appearance are still in question.

Everything started with the difficulty of arranging small modules by a pair of regular tweezers, while it is hard to find good tweezers at all. At a glimpse, tweezers are just excellent, but, when one starts to work with 0603 components, tweezers’ imperfection is obvious.

Having studied the material on methods of arranging the components, I concluded that in order to arrange 0603 and other components, a vacuum pickup is necessary!

To test the idea and avoid high costs for buying a vacuum pickup, I decided to buy something similar on AliExpress. It was just a modified compressor for aquariums, and it had a pair of handles and 4 tips for various components.

First disadvantages of the device were seen already on the first day:

  • Very thin handles: it is not convenient to hold them
  • The hole in the handles to bleed vacuum: if a finger is released, a handle and a component jumped.

However, in spite of the disadvantages, the Chinese vacuum pickup was more convenient than a medical or radio amateur tweezers.

Therefore, I decided to go further and modernize it:

By thermal shrinkage I increased the handle diameter and made its form convenient for my finger.

After that I decided to add a pedal to switch off the compressor, and in 10 minutes it was ordered.

2 weeks later I assembled the first operable exemplar, which turned out to be very convenient.

However, it had some slight deficiencies as well: when the compressor switched off, vacuum still was in the system, and components were attached to the vacuum pickup.

Nevertheless, I saw advantage in it, since small components could hold for more than 5 sec and very easy detached, when getting in contact with solder cream. Unfortunately, big components could detach at any moment and lied on footprint unevenly.

Therefore, the second wave of studying materials and vacuum pickups started.

I decided to decrease operative voltage of the device from 220 V to 12 V.

So, I chose a 12 V vacuum motor, and to avoid component hanging, I ordered an electric valve.

After a while, I created the first prototype of a vacuum pickup without all deficiencies of the aquarium modification.

Among the advantages, I achieved the following:

  • Component force attraction control, since the motor can operate within the range of 3… 12 V.
  • Electronic valve control: it can be switched on/off depending on your requirements.
  • The most important advantage is that you work with a 12 V pedal.

Now I shall choose between 2 metallic case and I will need to:

100x60x125mm, 150x50x130mm

Install regulators and switches on the frontal panel, install ports for power supply, pedal, grounding on the rear panel.

So, very soon I prepare the second article describing a final solution.

However, if you want to have you own Vacuum Pick-Up, you can assemble it from the following components.

Among the problems is still creation of an ESD safe handle of proper diameter, and routing the tube through the device wall.

One can just drill a hole and install a protective rubber in it, however, when substituting the hose, it will be necessary to open the device cover.

If you have ideas on enhancing the device, please, share. and I go back to work.

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

WordPress › Error

There has been a critical error on this website.

Learn more about troubleshooting WordPress.