How to set up smartphones and PCs. Informational portal
  • home
  • Windows 10
  • Raspberry pi 2 installation and configuration. Technically optimal setting of regulators

Raspberry pi 2 installation and configuration. Technically optimal setting of regulators

The recommended operating system for Raspberry Pi 3 is Raspbian. It is her that 90% of all new users of this platform install after purchasing the device. But at the same time, beginners do not always understand exactly how this distribution is installed and what needs to be done after its first launch.

Why Raspbian is the best solution for "Raspberry"

Raspbian is a modification of the popular GNU/Linux distribution Debian. It has many distinctive features from its progenitor. All of them can be found in the official "Wiki" of the project. And here it makes sense to list only the main ones:

  • the ability to work on ARM-processors;
  • the presence of all necessary drivers in the kit;
  • good optimization for a relatively small amount of RAM;
  • GPIO support out of the box.

Of course, there are other distributions for Raspberry. But many of them initially do not have support for the necessary functionality, and they need additional configuration. Raspbian on Raspberry Pi 3, in turn, can work normally right after installation.

What you need to install the OS on Raspberry

First of all, it is necessary to consider the question regarding what is required in order to install Raspbian on the Raspberry Pi 3.

In addition to the board itself, you will also need:

  1. computer and card reader;
  2. 5 Volt power supply and USB/MicroUSB cable;
  3. set of software;
  4. mouse and keyboard connected via USB;
  5. monitor/TV;
  6. HDMI cable;
  7. MicroSD card formatted in FAT32 (speed class - 4 and higher, volume - from 4 gigabytes).

Raspbian installation and configuration process

There are several options for installing Raspbian on Raspberry Pi 3. The first is to use the NOOBS utility, the second is to write the contents of the image directly to the card. The use of a special application allows you to select the OS. In this case, you just need to install Raspbian. Therefore, the second option will be described.

First you need to download the distribution kit from the Raspbian.org website and insert the MicroSD card into the card reader. Then, using the Win32DiskImager utility (or some other utility with similar functionality), you will need to write the image to a flash drive. This is done easily - the path to the downloaded distribution is indicated; the letter under which the system mounted the "disk" is selected, and then Write is pressed.

When the progress bar is completely filled and the program reports the successful completion of the recording process, you can remove the card from the card reader and insert it into the Raspberry. Then it remains only to turn on the single-board device, having previously connected a monitor and peripherals to it.

Setting up Raspbian after installation

After turning on the RPi for the first time, it will not load the desktop, but the Configuration Tool built into the system. It only needs to do one thing - define a suitable desktop environment. To do this, go to the third paragraph, press Enter and select the appropriate option from the list. It is recommended to use LXDE, as it is quite convenient and the lightest environment. Then it remains to return to the main menu and click on Done. The system will reboot.

After downloading, it will ask for access details. Standard in Raspbian are: login - pi, password - raspbian. They must be written in small letters.

Once logged in, Raspbian will load the desktop. Now you can use all the features of the system. Additional setup of Raspbian on Raspberry Pi 3 may also be required. To do this, refer to the official documentation of the system. It should be noted that many instructions for Debian apply to Raspbian as well.

How can you be sure that the answer to the question "how to install Raspbian on Raspberry Pi 3?" is pretty simple. In fact, the process of writing the system for this single-board is even easier than installing Windows on a regular computer. Therefore, even a child can handle it. And the whole process, in turn, takes no more than half an hour of pure time.

To determine the optimal settings for the controllers (parametric optimization) of the ACS, it is necessary to have information about the static and dynamic characteristics of the regulated object and the existing disturbances. The most reliable are experimentally determined static characteristics.

The optimal setting of the PID controller allows you to bring the object to the setpoint as quickly as possible and almost without overshoot. A sign of the correct setting is a smooth, jerk-free increase in the adjustable parameter and the presence of braking impulses when approaching the setpoint both from below and from above (Fig. 14.39).

If the object reaches the setpoint with little overshoot and fast-decaying oscillations, you can reduce the gain slightly, leaving all other parameters unchanged.

The magnitude of the maximum amplitude-frequency characteristic of a closed control system, as well as its resonant frequency, can be determined from the time characteristic of the system relative to the control action by the conditional value of its damping degree and frequency (Fig. 14.40).

Rice. 14.39. Optimal PID performance

Rice. 14.40. Step response of closed loop control system

This circumstance makes it possible to approximately determine the parameters of the controlled object and according to the experimentally obtained curve of the transient process under stepwise action from the regulator master. Indeed, if the degree of attenuation of the transient process and its frequency, as well as the numerical values ​​of the controller settings at which this process was recorded, are known, then in principle it is not difficult to determine what the numerical values ​​of the plant parameters should be in order for the amplitude-phase characteristic of an open-loop system with known parameters of the controller settings touched the circle with the index corresponding to this degree of attenuation at a frequency corresponding to the frequency of the transient.

The procedure for determining the optimal setting of the PI controller according to the graph of the time response of a closed-loop control system using graphs is as follows:

1. The control system with an arbitrary setting of the controller is included in the work. After making sure that it works stably, they quickly change the setting for the regulator by some sufficiently large value, but acceptable according to the operating conditions, and register the process of changing the controlled variable over time.

2. From the resulting graph of the change in the controlled value, a typical view of which is shown in fig. 14.40, the degree of attenuation and the period of oscillation of the transient are determined T.

3. Having calculated the value of the ratio of the oscillation period of the transient process to the value of the isodrom time set in the controller during the experiment, the values ​​of the correction factors are found for the value of the transmission coefficient of the controller and for the value of its isodrom time, i.e. determine how many times the numerical values ​​of the controller settings should be changed so that the setting is close to optimal.

4. Having set the found settings in the regulator, the experiment is repeated and a re-calculation is performed, similar to that described above. If it turns out that the numerical values ​​of the correction factors are close to unity (they are in the range of 0.95–1.05), we can assume that the adjustment is over. Otherwise, you need to reconfigure.

In the practice of adjustment work, they use approximate formulas for determining the optimal settings for regulators for objects described by the expressions below for various optimality criteria.

1. All-Union Thermal Engineering Institute named after F.E. Dzerzhinsky (VTI) For a damping rate over a period of  = 0.75 and an integral quadratic estimate close to the minimum, the following formulas for calculating the parameters of a transfer function PI controller are recommended:

W(P) =K p( T from R+ 1)/T from R.

At 0<  об /T a< 0,2

, T from = 3.3 vol.

At 0.2<  об /T a< 1,5

, T from = 0,8T a .

At = 0.9, 0< об /T a< 0,1

, T from = 5 vol.

At 0.1<  об /T a< 0,64

, T from = 0,5T a .

2. Available nomograms for similar objects, in order to determine, depending on the parameters of the object and the given attenuation, K R ,T from (Rotach method).

3. Exists large constant compensation methodobject time (T from = T about ) at damping coefficient = 707 (modular optimum).

4. Analytical calculation of the stability limit and controller parameters for a given degree of oscillation for extended frequency response(stephanie method) it is also used in the presence of a computer and appropriate calculation methods. All methods give close results of calculating the parameters of the controller and, accordingly, close transient processes.

5. In practice, the calculations of regulators end up with adjustment work when using experimental methods of parametric optimization.

These methods are based on the direct control of transient or frequency responses in the process of selecting the optimal tuning parameters or with parameters that obviously provide a stable ACP movement. Then, by introducing a perturbation, the reaction of the system to these perturbations is observed. Purposefully changing the settings of the regulator, the desired nature of the transient process is achieved. This is a multi-step iterative procedure. These methods have been developed to such an extent that they make it possible to automate this process with minimal human involvement 3 .

The simplest setting is when in a closed ACP with a PI controller (with a PI controller T of install very large) increase K p up to the stability limit, determine K p .cr and T lane kr period of steady oscillations. Then set the parameters:

For P controller K p .opt = 0,55 K p .cr;

For PI controller K p .opt = 0.55 K p .cr, T out = 1.25 T per.cr.

6. Gives better results stepwise optimization with an estimate of the transient response at each step .

In the plane of the PI controller settings, there are lines of the same degree of attenuation  (Fig. 14.41).

The same attenuation (let ψ= 0.75) can be obtained with different controller parameters. At the same time, it is necessary to ensure the minimum quadratic error, which changes in the plane, as shown in Fig. 14.42. Thus, it is necessary to look for the optimal tuning point.

From the curves (Fig. 14.43) for various settings, it can be seen that at the points 1 and 2 transient processes are delayed, at the point 4 there is an aperiodic component that delays the process. The search for the optimal setting consists of the following steps (Fig. 14.44, 14.45):

1. Overestimate T out, underestimate K R(point 1).

2. Increase K R so that during the oscillatory process ψ = 0.8–0.9 (point 2 ).

Rice. 14.44. Steps for practical setting of PI controller parameters

3. Reduce T from to get rid of the aperiodic component (points 3 ,4 ).

4. Reduce K R so that at ψ= 0.95…1 and with various variations of the dynamic properties of the control object, the transient processes are slightly oscillatory (point 5 ).

This optimization method does not require an accurate determination of the object parameters and controller parameters, since the tuning parameters are varied relative to the initial values, therefore it is widely used.

Rice. 14.45. The nature of transient processes at different settings of the parameters of the regulators

For example, in the instructions for the ATS adjuster with a digital PI controller, the following recommendations are given.

    the controller is set to PI control;

Rice. 14.46. PI output transient

    block diagram of control is shown in fig. 14.47;

Rice. 14.47. Structural diagram of object control with pneumatic actuator: w– setting influence; x– adjustable value; xd- deviation of the controlled value; y– control action; 1 – measuring transducer; 2 – value setter; 3 – adjusting amplifier; 4 - electro-pneumatic signal converter; 5 – sensor; 6 – pneumatic actuating unit

- proportional coefficient K R = 0,1;

- isodrom time T n= 9984 s;

- lead time T v =off;

– setting the parameters of the PI controller:

set the desired setpoint and manually set the control deviation to zero;

switch to automatic mode;

slowly increase K R, until the control circuit begins to oscillate through small changes in the setpoint;

slightly decrease K R until the fluctuations are eliminated;

reduce T n until the control circuit begins to oscillate again;

slowly increase T n until the oscillation bias is eliminated.

Ticket number 16

    pumps - machines that supply liquids;

    fans and compressors - machines that supply air and technical gases.

Fan- a machine that moves a gaseous medium at a degree of pressure increase Ep< 1,15 (степень повышения давления Ер - отношение давления газовой среды на выходе из машины к давлению ее на входе).

Compressor- a machine that compresses gas with Ep > 1.15 and has artificial (usually water) cooling of the cavities in which gases are compressed.

According to GOST 17398-72 blowers (pumps) are divided into two main groups: dynamic pumps and positive displacement pumps.

    In dynamic superchargers, the transfer of energy to a liquid or gas occurs through the work of mass flow forces in a cavity permanently connected to the inlet and outlet of the supercharger.

    In volumetric superchargers, an increase in the energy of the working fluid (liquid or gas) is achieved by the force action of solid bodies, for example, pistons in piston machines in the working space of the cylinder, periodically connected by means of valves to the inlet and outlet of the supercharger.

Raspberry PI is a device that has sufficient performance so that robots capable of recognizing images, performing the work of people and other similar devices for automating and performing complex computational actions can be built on its basis. Because clock frequency of the Raspberry PI 3 processor m.b. 1.2 GHz and its bit depth is 32 bits, then the Raspberry PI 3 is significantly superior to the usual Arduino, which has a clock frequency of 16 MHz as a rule and a microcontroller bit width of 8 bits, Arduino certainly takes its place in performing operations that do not require high performance, but when it is no longer enough for Raspberry PI " comes to the rescue" and covers such a wide range of possible applications that you can be absolutely sure of the expediency of purchasing this Raspberry PI 3 single-board computer (can be ordered from the link) . Because The Raspberry PI is a computer, in order to use it you need to install an operating system on it (although there are workarounds, it is still better and easier to install the operating system (os below)). There are many OSes that can be installed on the Raspberry Pi but one of the most popular (for use with the Raspberry Pi) and most suitable for beginners is the Raspbian OS. In order to install the OS on the Raspberry Pi, you need a micro sd card with an expander so that it can be inserted into a regular computer and write the OS to it. The SD card must have at least 4GB of memory when installing the full version of Raspbian and at least 8GB for installing the minimum versions of Raspbian. Minimal versions may not (and most likely do not) have a graphical interface and a lot of other things that can be considered superfluous and take up space. To avoid problems with the lack of necessary files, you can install the full version. You can use a class 10 SD card with 32GB of memory (checked it works (as see video below)). After purchasing a memory card, you need to insert it into the computer into the appropriate slot, then look with which letter the disk appeared in the "my computer" section and remember, then you need to download the OS from the official website https://www.raspberrypi.org/downloads/raspbian / by clicking the "Download ZIP" button under "RASPBIAN JESSIE" to download the full version or under "RASPBIAN JESSIE LITE" to download the lite version but, for beginners, it's better to choose "RASPBIAN JESSIE" i.e. full version. After downloading the "RASPBIAN JESSIE" archive, you need to unzip it, then download the program (or from here https://yadi.sk/d/SGGe1lMNs69YQ), install it, open it, then you need to specify the drive letter in the upper right corner (remembered earlier), find unzipped os image

And press the "write" button.

After that, a warning window will appear and in this window you must click the "Yes" button,

After the recording is over and a window appears informing about the successful recording (Write Successful), you need to click the "Ok" button in this window.

Then close the program, remove the SD card in a safe way and insert it into the Raspberry Pi.

Next, you can connect a usb keyboard (or ps2 via an adapter), a usb mouse and a monitor or TV via an hdmi cable to the Raspberry Pi, or you can connect an ethernet cable (but this is for advanced users, so we will consider the first option below). After that, you need to connect the power via micro usb, for example, from a charger from a smartphone. After connecting the power, the installation of the operating system will begin. As a rule, in new (at the time of this writing) versions of the OS, the ability to communicate with Raspberry Pi via SSH is already configured, and therefore, in order to configure communication with Raspberry Pi 3 via wifi, it is enough to configure only wifi. To do this, in the upper right corner of the screen there is an icon on which you need to click and select wifi,

Then enter the password for this wifi in the text field that appears,

After these steps, wifi on the Raspberry Pi 3 will be configured and then it will be possible to program the Raspberry Pi 3 remotely via wifi without using wires. After setting up the Raspberry Pi 3, you can turn it off by typing sudo halt on the command line (in the LXTerminal program, which can be opened by double-clicking on the program icon) or by pressing the corresponding shutdown buttons in graphics mode, after the final shutdown, you can turn off the power and the next time you turn on the power of the Raspberry Pi 3 turn on wifi. Now, in order to program the Raspberry Pi 3 via wifi, you need to find out what its ip address is. In order to do this, you need to power on the Raspberry Pi 3, wait for the OS to finish loading, go to the router's web interface (by entering 192.168.1.1 in the browser line or what you need to enter the web interface, enter your login and password), find the DHCP tab Leases or something like that, find the line with raspberry and the ip address of the Raspberry Pi 3.

Next, you need to open the PuTTY program (if it is not there, then download (or) and install it before) set port 22, connect via SSH, enter the ip address of Raspberry Pi 3 in the "Host Name (or IP Address)" field,

Then press the "Open" button at the bottom of the window, then a black window will appear asking you to enter a login. By default, the login is "pi" - you must enter it and press enter. Next, you need to enter a password, the default is "raspberry". When entering a password, it is not displayed - this is normal. After the password is entered in invisible letters, you need to press enter and if everything was done correctly, then we will get access to the Raspberry Pi 3, if not, then you need to repeat the steps. After gaining access to the Raspberry Pi 3, you can program it, first you need to enter the "pi" folder, for this you need to enter the command

And press enter (after cd necessarily space).
Now you can open the nano text editor. Nano is a special text editor found on most Linux-like operating systems in which you can write programs for the Raspberry Pi. To open this editor and at the same time create a file with the name "first" and the extension "py", you need to enter the command

And press enter. The nano editor will open and you will notice that its interface is slightly different, but basically it is the same black box in which you need to enter commands. Because we want to control the general input output ports (GPIO), then before running the program to manage these ports, you need to connect some device to them so that you can see that the control has turned out. It should also be noted that the pins configured as outputs on the Raspberry Pi can deliver very little current (I assume up to 25mA) and given that the Raspberry Pi is still not the cheapest device, it is highly recommended to take care that the load on the pins is not too large. Low power indicator LEDs can usually be used with the Raspberry Pi. They only need a small amount of current to light up. For the first time, you can make a fixture with a connector, two LEDs connected in parallel in opposite directions and a 220Ω resistor connected in series with the LEDs. Because the resistance of the resistor is 220Ω, the current necessarily passes through this resistor and there are no parallel paths for its passage, the voltage at the terminals is 3.3V, then the current will not be more than 3.3/220=0.015A=15mA. You can connect this to free GPIOs, for example, to 5 and 13 as in the diagram

(pinout taken from https://en.wikipedia.org/wiki/Raspberry_Pi), it might look something like this:

After everything is neatly and correctly connected and there is confidence that nothing will burn, you can copy the first simple Python program into the NANO editor

Import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(13, GPIO.OUT)
GPIO.setup(5, GPIO.OUT)
GPIO.output(13, True)
GPIO.output(5, False)
time.sleep(1)
GPIO.output(13, False)
GPIO.output(5, True)
time.sleep(1)
GPIO.output(13, True)
GPIO.output(5, False)
time.sleep(1)
GPIO.output(13, False)
GPIO.output(5, True)
time.sleep(1)
GPIO.output(13, True)
GPIO.output(5, False)
time.sleep(1)
GPIO.output(13, False)
GPIO.output(5, True)
time.sleep(1)
GPIO.cleanup()

Then press

After exiting the NANO editor, you can enter the command

sudo python first.py

After that, the LEDs will flash a certain number of times. Those. it turned out to control the input/output ports of general purpose via wifi! Now let's look at the program and find out how it happened.
Line:

Import RPi.GPIO as GPIO

This is the connection of the "GPIO" library for pin control.
Line:

This is a connection to the "time" library for delays.
Next is setting the GPIO mode:

GPIO.setmode(GPIO.BCM)

Configuration of pins 5 and 13 as outputs:

GPIO.setup(13, GPIO.OUT)
GPIO.setup(5, GPIO.OUT)

Setting a logical unit on pin 13, setting a logical zero on pin 5:

GPIO.output(13, True)
GPIO.output(5, False)

Delay

Setting a logic zero on pin 13, setting a logic one on pin 5:

GPIO.output(13, False)
GPIO.output(5, True)

Resets all pins and the program ends. That. you can control any free pins via wifi and if you make 5V power from the battery, then you can already make some kind of autonomous robot or a device that is not wired to anything stationary. The Python programming language (python) differs from C-like languages, for example, instead of a semicolon, to complete the command, python uses a line feed, instead of curly braces, it uses an indent from the left edge, which is done by the Tab key. In general, Python is a very interesting language that produces easy to read simple code. After the work (or game) with the Raspberry PI 3 is finished, you can turn it off with the command

And after a complete shutdown, remove the power. When power is applied, the Raspberry PI 3 turns on and is ready to work (or play) again. You can order Raspberry pi 3 at http://ali.pub/91xb2. How to configure the Raspberry PI 3 and manage its pins can be seen in the video:

After successfully blinking the LEDs, you can begin to fully explore this computer and create projects using the Raspberry PI 3 capabilities that are limited only by your imagination!

Raspberry Pi has quickly become a popular platform for various projects. The low price, relative versatility and openness allow the board to be used both for amateur purposes and in commercial projects. After we have chosen / bought a model and installed it, we will start installing the necessary packages

Configuring Folder Sharing on Debian Jessie

To set up sharing on a Raspberry Pi on a local network, you need to install the package Samba

sudo apt-get install samba samba-common-bin

Set the owner for the required folder

Chown -R pi:pi /path/to/share

We change the contents of the configuration file /etc/samba/smb.conf to our settings:

Comment = WWW Folder path = /var/www create mask = 0775 directory mask = 0775 read only = no browseable = yes public = yes force user = pi #force user = root only guest = no

Change the password used in the SMB session

Smbpasswd -a pi

And restart samba

service samba restart service smbd restart service nmbd restart

The network folder will be accessible in the network environment at: \\RASPBERRYPI\www or \\X.X.X.X\www

Connecting a flash drive to increase additional space

For formatting we use fdisk, to create a file system - mkfs. After connecting the media, we check the device in the system

Sudo fdisk -l

The command will show all devices that are connected to our raspberry, for example:
Disk /dev/sda: 16.0 GB, 16013852672 bytes

Run fdisk to format the media:

sudo fdisk /dev/sda

Sections are deleted with the command d,
created by the team n,
Saving settings - w.

Create an ext2 file system on the media:

sudo mkfs -t ext2 /dev/sda1 sudo mount -t ext2 /dev/sda1 sudo mkdir /mnt/flash

We insert our data into the fstab file, for example

sudo nano /etc/fstab /dev/sda1 /mnt/flash ext2 defaults 0 0

Connecting a WI-FI adapter and setting up a wireless network

Disconnect the LAN cable from the network card and replace it with a wireless wi-fi adapter. Not all models of wi-fi adapters start working automatically. Some require drivers to be installed.
The adapter that worked in Rasbian on a plug & play basis is the D-link DWA140 (ID 2001:3c15 D-Link Corp.). But for the TP-LINK TL-WN727N wireless adapter, the drivers were not automatically connected.
The wireless network is configured using the wpa_supplicant.conf file
Opening the file

Sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

And we prescribe the settings for connecting to a Wi-fi network

Ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network=( ssid="Your SSID Here" psk="Enter Passkey Here" proto=RSN key_mgmt=WPA-PSK pairwise=CCMP TKIP group=CCMP TKIP )

ssid - wireless network name
psk - network password
proto - WPA2 or WPA encryption type.
key_mgmt - WPA-PSK or WPA-EAP
pairwise - CCMP (WPA2) or TKIP (WPA1)
group - CCMP for WPA2 or TKIP for WPA1

For OS Raspbian Jessie in the wpa_supplicant.conf file, it is enough to specify

Network=( ssid="The_ESSID_from_earlier" psk="Your_wifi_password" )

And restart the interface:

sudo ifdown wlan0 sudo ifup wlan0

Setting a Static IP Address for a Wireless Interface

Opening the network settings file

sudo nano /etc/network/interfaces

Auto lo iface lo net loopback iface eth0 inet manual allow-hotplug wlan0 iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

specify your network settings

Auto lo iface lo net loopback iface eth0 inet manual allow-hotplug wlan0 iface wlan0 inet static address 192.168.1.39 netmask 255.255.255.0 gateway 192.168.1.1 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Installing auxiliary system packages

View system information: CPU usage, memory usage, memory size

sudo apt-get install htop

File Manager

mc (Midnight Commander)

sudo apt-get install mc

Network utility for ping/tracing given hosts

mtr

sudo apt-get install mtr

Mail client for working with mail

sudo apt-get install mutt

Setting up a web server based on Apache

Having your own web server will help you practice creating websites, experiment with settings, plugins, and save you from crashing the main site.

1. Install Apache and PHP

sudo apt-get install apache2 php5 libapache2-mod-php5

2. Install MySQL
During the installation process, you must set a password for the root user for the database.

sudo apt-get install mysql-server php5-mysql

4. Install PHPmyadmin

sudo apt-get install phpmyadmin

5. Install WordPress

Before unpacking files, set permissions for the folder

chmod -R 777 /var/www cd /var/www sudo chown pi sudo rm *

Downloading the latest version

Sudo wget http://wordpress.org/latest.tar.gz

Unpacking

Tar xzf latest.tar.gz mv wordpress/* rm -rf wordpress latest.tar.gz

You can see detailed instructions for setting up WordPress.

In order for WordPress to be updated locally (without using FTP), you need to add the line define('FS_METHOD','direct'); in the wp-config.php file. , For example:

/** Sets up WordPress vars and included files. **/ require_once(ABSPATH . "wp-settings.php"); define("FS_METHOD","direct"); define("WPLANG", "ru_RU");

If there is no need to install WordPress, then it is enough to install the Apache package, place the index.html file in the /var/www folder and the WEB server is ready for use.

Using Raspberry as a media player

To turn your Raspberry into a complete network media player with IP-TV support, you need to install Openelec. There are alternative skins like OSMC, Kodi.

Openelec can be installed in two ways:
1. Write the Noobs distribution to a flash drive, select Openelec at startup. Settings are made using the graphical shell.
2. Or download the distribution kit from the Openelec website and write the image to be installed on the media using Win32DiskImager:

Image for RPi First-Generation single-core models (Model A/B/B+ 256/512MB)

Image for RPi2 Second-Generation quad core models (Model B 1024MB)

CCTV

The most common video surveillance packages are: Motion, Zoneminder. Using Zoneminder requires additional system resources and is difficult to install, so after configuring and adding cameras, system performance will noticeably decrease. The Motion package has a wide range of camera control capabilities without loading the system.

Motion package

Package installation

sudo apt-get install motion

Program configuration file: /etc/motion/motion.conf

Key parameters to be changed

We fix:
daemon=OFF on the daemon=ON
webcam_localhost = ON on the webcam_localhost=OFF

The package is started by the service motion start command

In order to see the image from the cameras, you must specify port 8081 after the IP address.
You must use port 8080 to access the settings.

Access to the camera in our example is possible only within your local network. To connect to the video server remotely, you need to configure redirection of incoming connections on your home router. If instead of the image on the screen there is a gray rectangle, then you need to check the port to which the webcam is connected. The video capture device configured in the system must match what is written in the motion.conf configuration file

This article will address the issue of installing and configuring the MajorDomo system (hereinafter MD) on a Raspberry PI3 single-board computer (hereinafter RPI3). All of the following is an accumulation of the work of users and developers of MD. Almost all the material is based on messages from the MD forum, for which special thanks to all forum participants, and to comrade nick7zmail in particular)). Please write about any inaccuracies and errors in the material presented in the comments.

A few words about the capabilities and features of the system:

  • F2FS file system (optimized for memory cards);
  • Optimization of database write cycles to a memory card;
  • RHVoice voice engine;
  • Sound via MPD service;
  • MQTT broker Mosquitto;
  • Apple HomeKit-compatible (via HomeBridge);
  • Installed development tools: PHP, Python, NodeJS, Perl;
  • Latest MajorDoMo and Raspbian Jessie updates (at the time of release of the current version);
  • The installation of add-ons from the Market works, as well as updates to the system core.

Configuration feature - everything is configured to minimize the number of write cycles to the SD card. The database uses tmpfs with a periodic "commit" (once every 15 minutes). Those. it is possible that during a power failure the system will be restored with the loss of data for the last few minutes.

After installation, the sound works, the radio works (mpd and the 101.ru module from the market are used), updates, installation of modules from the add-ons market.

To get started on installing the MD system, it is advisable to acquire the following:

  • RPI3 . The copy in this article was purchased by . I liked the complete set of the order - everything is included (the RPI3 itself, a beautiful case, a set of radiators, a power supply, a 16GB memory card) and delivery speed (less than 2 weeks);
  • microSD memory card. At least 16GB, class 10 (highly recommended) don't choose SD card from the category of cheap, as this may affect the further stability of the system);
  • card reader;
  • Audio speakers(not necessary);
  • ProgramWin32diskimager . You can download ;
  • SSH client. As a variant of Putty. You can download ;
  • Installation image. You can download .

Now about everything in order:

Preparing a memory card. At this stage, we need to transfer the MD image to the SD card. So, we take the card, insert it into the card reader and run the Win32DiskImager program. In the window that appears, in the "Device" field, select our flash drive, and in the "Image file" field, specify the MD image unpacked from the archive and press the "Write" button.

You must wait for the recording to complete, which should pass without any errors. Otherwise, you need to replace the SD card with a new one and try again.

First startRPI3. We insert the card into RPI3, connect the network cable, speakers and supply power. Pay attention to the choice of a power supply unit, the load capacity of which must be at least 2.5A (preferably 3A), otherwise system failures may occur. In general, for long-term and stable operation of the system, it is desirable to connect power from the UPS.

After booting, the system should receive an IP address via DHCP and be accessible via the web interface. In my case, after turning on the power, after some time I heard the following phrases from the speakers “The system is loaded” and “IP address 192.168.0.33”. Below is a screenshot of the "clean" screen of the system (main):

Now you can login to RPI3 via SSH/FTP, login details:

Database Manager (phpMyAdmin):
Username: root
Password: rootpsw

The MajorDoMo service starts automatically, but you can manage it through the console: sudo /etc/init.d/majordomo stopsudo /etc/init.d/majordomo start

SettingMD

Training. This article will consider the possibility of configuring the system via SSH access. In principle, the same can be done by connecting a monitor, keyboard and network cable to the RPI3 (without using Putty).

We launch the Putty program. In the window that appears, enter the IP address received from the system and click the “Open” button.

Now enter the standard username and password. If everything is done correctly, the console will appear ready to work.

Preparations for setting up the system have been made, now the setting itself.

Setting a static IP address. For users who understand what it is and who do not need it, they can skip this paragraph. Enter in the console:

sudo nano /etc/dhcpcd.conf

Add the following lines (enter the addresses of your equipment):

Shell

nodhcp interface eth0 static ip_address=192.168.0.33 static domain_name_servers=192.168.0.1

nodhcp

interface eth0

static ip_address = 192.168.0.33

static domain_name_servers = 192.168.0.1

press key combinations and

Restart the network interface:

sudo ifconfig eth0 down sudo ifconfig eth0 up

We wait 5 seconds and check the correctness of the work performed by the command:

ifconfig

You can also ping google to check internet access:

sudo ping 8.8.8.8

Initial configuration using the Raspi-config utility(something like the BIOS of a computer). Enter in the console:

sudo raspi-config

In the window that appears, do the following:

  • in the “Change User Password” field, change the standard password (do not forget to write it down);
  • in the “Boot Options” field, in the “B1 Desktop CLI” submenu, select “B1 Console”;
  • in the “Advanced Options” field, execute “A1 Expand Filesystem”, and in the “Audio” field, select “Force 3.5 jack”.

Setting passwords for phpMyAdmin. We go through the phpMyAdmin web interface and change the password there (do not forget to write it down), for this we enter the following line in the browser:

http://_Your_IP/phpmyadmin/

Now we tell MD under which password to enter, for this we enter in the console:

In the window that appears, change the default password to your own:

Define('DB_PASSWORD', 'my_password ‘);

Stop MySQL with a line

sudo service mysql stop

copy current database from in-memory disk to SD card

sudo cp -R /tmp/mysql/* /var/lib/mysql/

and reboot the system

sudo reboot.

Set a password for logging into the system from an external network. To do this, enter in the console:

sudo nano /var/www/config.php

Find and uncomment the following lines:

Define('HOME_NETWORK', '192.168.0.*'); Define('EXT_ACCESS_USERNAME', 'user'); Define('EXT_ACCESS_PASSWORD', 'password');

Pay attention to the IP address mask in the first line!!! Next, enter your username and password (also do not forget to write them down), press key combinations and (save to file and exit).

Change the password of the broker MQTT Mosquitto. To do this, type in the console:

sudo nano /etc/mosquitto/mosquitto.conf

in the window that appears, add the following lines

#path to password file password_file /etc/mosquitto/passwd

#deny connections without login allow_anonymous false

Create/add user and password using mosquitto_passwd utility:

sudo mosquitto_passwd -c /etc/mosquitto/passwd username

Reporting this to homebridge

sudo nano /home/pi/.homebridge/config.json

We also inform the MQTT module in the MD web interface, for this we enter the received IP address in the browser, go to the "Control Panel"

in the left side menu, select "Devices"->"MQTT"->"Configure". Check the "authorization required" checkbox, enter the username and password, and then click the "Update" button.

Restart mosquitto

sudo service mosquitto stop sudo service mosquitto start

Increase the size of the temporary file storage. To do this, type in the console:

sudo nano /etc/fstab

In the line "tmpfs / tmp tmpfs defaults, noatime, nosuid, size=100m 0 0" change size=100m to size=500m, press key combinations and (save to file and exit).

Installing the MySensors module. We go into the system through the web interface and click on the "Control Panel" button.

In the left side menu, select - "System" -> "Add-ons Market" -> "Hardware", look for "MySensors" in the list and click on the add button.

Top Related Articles