Review article on Raspberry Pi and Arduino and a thread for radio amateurs

Professor

Professional
Messages
213
Reaction score
22
Points
18
Moved from a recent webinar for the attention of all interested.

I have already posted three more or less detailed articles on cryptography and cryptanalysis, as well as penetration into other people's corporate networks, in author's articles on the forum (link in the head of the material); I would now like to consider such a fashionable topic as the general public's passion for such products as Raspberry Pi and Arduino. I am not entirely sure that anyone on the forum is interested in this at all, but appetite comes with eating, so I decided to write a small review article here, maybe someone will be interested. Actually, there used to be a couple of Arduino users on the forum, Arduindr and another guy (they even participated in a radio engineering competition here once and won prizes), but later, as I understand it, both of them screwed up and disappeared somewhere. There was another lady (?), who was also interested in this topic, but she also disappeared somewhere.

So, what are we talking about? Raspberry Pi is a small, two matchbox-sized, cheap single-board computer with an ARM processor (Advanced RISC Machine, RISC means reduced instruction set computer, well, you get the idea, :)cheap and cheerful, with a simplified set of commands). It is produced by British scientists, the British company Raspberry Pi Foundation, since 2012 and to this day. The first models were completely wooden, with a clock frequency of a 32-bit single-core ARM 11 processor of about 700 MHz and RAM 256 or 512 MB; now models with 64-bit 4-core processors with a clock frequency of 1.5 and even 1.8 GHz are already available. The product is also equipped with USB ports in the amount of 1 to 4, a coaxial antenna input, a TRS 3.5 mm audio input/output, an Ethernet port, Wi-Fi on older models is provided via a USB dongle, and on newer ones it is built-in; there is also an HDMI port for connecting a monitor and other devices and a slot for an SD memory card, which stores the file system, kernel and user files; new models may also have built-in Bluetooth. All this works under Linux/FreeBSD operating systems; Raspbian (a special build of Debian) and Pidora (a special build of Fedora, Lieutenant Rzhevsky, shut up, this is not what you just thought!) with a lightweight LXDE graphical interface are quite common. People also use ArchLinux, Gentoo, FreeBSD, Sailfish OS; it is possible to use Android 7.0 and even Windows 10 IOT (I really want to say “idiot”, because it is utter idiocy IMHO to push Windows into Raspberry, it’s like loading a small donkey with a sack of bad proprietary sand-lime bricks, but wouldn’t that lousy Bill Gay (shh!) have stuck his long nose in here too and vulgarized everything, just like he did with Skype, buying it from a Luxembourg company in 2012).

raspberri_view.jpg


Raspberry_Pi_scheme.jpg


So what, you say, so small, so cheap (35 Baku somewhere), so what? The biggest advantage of the said device IMHO is the presence of a GPIO (general purpose input/output) interface of 26 pins (on more modern models as many as 40!), which opens up a wide field of possibilities for controlling all sorts of peripherals. The normal voltage on the pins is 5 and, accordingly, 3.3 V; do not supply more - you can burn the pins! So, we have, among other things, 2 pins with a constant voltage level of 5 V, 2 pins with a constant voltage level of 3.3 V, 5 common pins (ground), 17 digital software-controlled pins. I give the pinout options for 26 pins below.

gpio-srm.png


GPIOs.png


Let's consider something simple below, for example, how to blink an LED using the GPIO interface of our Kalinka-Raspberry Pi and using, for example, Python. Because, paraphrasing the Latin cogito ergo sum, we can say, "it blinks, so it works!"
We command in the command line to install Python:

Code:
sudo apt-get install python-rpi.gpio (или python3-rpi.gpio)

Code:
sudo python

Code:
import RPi.GPIO as GPIO #connect the library
GPIO.setmode(GPIO.BCM) #set the numbering mode
GPIO.setup(7, GPIO.OUT) #configure GPIO 7 as an output
GPIO.setup(8, GPIO.IN) #configure GPIO 8 as an input
GPIO.output(7, True) #output logical "1" (3.3 V) to GPIO 7

GPIO.output(7, False) #output logical "0" to GPIO 7
signal = GPIO.input(8) #read the signal from GPIO 8 into the signal variable
GPIO.cleanup() #finish working with GPIO

And, having previously connected the LED to the 7th pin and to the “ground” with jumpers, we get the desired blinking (this example was taken from “hexvolt”).

But how to blink a whole bunch of LEDs, we will enter the following into the blinker.py file and run it through the command line; time is in seconds everywhere, we connect the multi-colored LEDs through a bradboard and jumpers with one end to the number pin, and the other end to the “ground”.

Code:
import RPi.GPIO as GPIO

import time

GPIO.setmode(GPIO.BOARD)

GPIO.setup(7, GPIO.OUT)

GPIO.setup(10, GPIO.OUT)

GPIO.setup(13, GPIO.OUT)

GPIO.setup(19, GPIO.OUT)

GPIO.setup(23, GPIO.OUT)

GPIO.output(7, 1)

time.sleep(0.4)

GPIO.output(10, 1)

time.sleep(0.3)

GPIO.output(13, 1)

time.sleep(0.3)

GPIO.output(19, 1)

time.sleep(0.3)

GPIO.output(23, 1)

time.sleep(0.3)

while True:

GPIO.output(10, 0)

time.sleep(0.6)

GPIO.output(10, 1)

GPIO.output(13, 0)

time.sleep(0.6)

GPIO.output(13, 1)

GPIO.output(19, 0)

time.sleep(0.6)

GPIO.output(19, 1)

GPIO.output(23, 0)

time.sleep(0.6)

GPIO.output(23, 1)

First we light everything in turn, then (while True :)we perform a cycle. In a similar way we can control through a servo drive according to a program we have written, either a children's car, or a "smart" house, or a devil with horns (having first installed an electric motor in his ass :)).

arduino.png


Now let's pay tribute to the notorious Arduino. It is a family of microcontrollers produced by a company from Ivrea, Italy, near Turin, and named after a local beer/bar (where the locals actually invented the giulico bandito while drinking), which in turn was named after the local medieval king Arduino the XII. It (the microcontroller) comes with software in the form of an IDE development environment and a C-like programming language, or more precisely, C++ with the Wiring framework. The scripts for working in it are called sketches by the manufacturer. And here is an illustration of the Arduino Due pinout.

arduino_due_pinout_l.jpg


You can do the same things in them as in Raspberry, that is, control various hardware via pinout and with the help of scripts-sketches loaded from a computer via a USB port. At the same time, Arduino shields can be paired with each other like a sandwich, putting one on top of the other. And the LED in Arduino blinks something like this.

Code:
void setup () {
pinMode (13, OUTPUT); // Set port 13 as output port
}

void loop () {
digitalWrite (13, HIGH); // Set port 13 to "1", LED lights up
delay (1000); // Delay for 1000 milliseconds
digitalWrite (13, LOW); // Set port 13 to "0", LED goes out
delay (1000); // Delay for 1000 milliseconds
}

Now, what is the difference between Arduino and Raspberry. Raspberry is almost an honest computer, and Arduino is just a microprocessor, its capabilities are more, how to put it softly, somewhat limited. Critics of Raspberry will say that it works “not in real time”, that is, it is slow at times, so install a microkernel RISC OS or RTLinux on it and you will have real time, the ARM processor is initially sharpened for this. Is it possible to combine these two products in one product - of course it is possible, but is it necessary?

arduino_plus_raspberri.jpg


But some people say this: “Why do we need this Arduino at all, if we can take a programmer, flash a controller in a DIP case and install it on the board, getting a cheaper, more compact and portable device.” And they are right in their own way IMHO. And here is another opinion: “I will be glad if at least one person… changes Arduino for a simple microcontroller – maybe he will become a good developer of embedded systems in the future.”

The point is that Arduino is not the level of a decent engineer, but the level of some radio club at a provincial Palace of Pioneers (there were such during the Soviet era), where young pioneers used to sit with iron heads with soldering irons and solder and sniff rosin, and now they sit with bradboards and jumpers and almost don’t even solder, blockheads. And all these Arduinos are not haute cuisine, but a kind of McDonald’s, which, however, allows an unpretentious eater to quickly and heartily satisfy his hunger. And that they seriously relax the designer and wean him off analyzing, understanding the physical meaning of what is happening and generally screwing with his stupidity...
 
Top