PROGRAMMING SCHOOL
Raspberry Pi-F5 / T5
1. LED LIGHT (DIGITALY)13. HEAT SENSOR (ANALOGUE)
2. LED LIGHT - MICRO SWITCH (DIGITAL)14. MAGNETIC SENSOR (DIGITAL)
3. LED LIGHT (ANALOGUE)15. COLOR SENSOR - COLORS
4. LED LIGHT - MICRO SWITHCH (ANALOGUE)16. COLOR SENSOR - BLACK LINE
5. PHOTO SENSOR - LED LIGHT (DIGITAL)17. ULTRASOUND SENSOR (DIGITAL)
6. PHOTO SENSOR - LED LIGHT (ANALOGUE)18. ULTRASOUND SENSOR (ANALOGUE)
7. DC MOTOR (DIGITAL)19. SERVO MOTOR
8. DC MOTOR - ONE WAY ROTATION (DIGITAL)20. I2C COMMUNICATION
9. DC MOTOR - TWO WAYS ROTATION (DIGITAL)21. RX - TX COMMUNICATION
10. DC MOTOR - SPEED CONTROL (ANALOGUE)22. ENCODER MOTOR - STEP - LESS PRECISE
11. IR SENSOR (DIGITAL)23. ENCODER MOTOR - HALF STEP - BETTER PRECISION
12. IR SENSOR (ANALOGUE)24. KAMERA - LED CONTROL (OPEN CV)

LED LIGHT (DIGITALY)
Pi_spoj_01.jpg

The LED lights up and goes out at half-second intervals.

LED LIGHT - MICRO SWITCH (DIGITAL)
Pi_spoj_02.jpg

Pressing the switch, the LED lights up.

LED LIGHT (ANALOGUE)
Pi_spoj_03.jpg

The program slowly increases the brightness of the LED.

LED LIGHT - MICRO SWITHCH (ANALOGUE)
Pi_spoj_04.jpg

By pressing the button, the bright LEDs light up.

PHOTO SENSOR - LED LIGHT (DIGITAL)
Pi_spoj_05.jpg

The LEDs light up when the PHOTO sensor is sufficiently illuminated.

PHOTO SENSOR - LED LIGHT (ANALOGUE)
Pi_spoj_06.jpg

The LEDs light up depending on the value read by the PHOTO sensor.

DC MOTOR (DIGITAL)
Pi_spoj_07.jpg

The DC motor starts rotating in one direction for 100 ms. It stops for 2 seconds and then repeats the action.

DC MOTOR - ONE WAY ROTATION (DIGITAL)
Pi_spoj_08.jpg

By pressing switch, the DC motor starts to rotate in one direction.

DC MOTOR - TWO WAYS ROTATION (DIGITAL)
Pi_spoj_09.jpg

Pressing the switch A and B, alternates the direction of rotation of the DC motor (both directions).

DC MOTOR - SPEED CONTROL (ANALOGUE)
Pi_spoj_10.jpg

Program, changes the rotation speed of the DC motor. Lower rotation speed, usually means lower engine power.

IR SENSOR (DIGITAL)
Pi_spoj_11.jpg

Depending on the IR sensor readout, the LEDs light up. The white surface gives the reading 1 and the black (line) 0.

IR SENSOR (ANALOGUE)
Pi_spoj_12.jpg

By analogous reading of the IR sensor, a white surface can be detected at a distance of several centimeters.

HEAT SENSOR (ANALOGUE)
Pi_spoj_13.jpg

By heating the thermal sensor to a certain temperature, the LED lights up. We heat the thermal sensor with light bulb.

MAGNETIC SENSOR (DIGITAL)
Pi_spoj_15.jpg

A magnetic sensor detects a magnetic field. By approaching the sensor to a magnetic field (permanent or electromagnet), the LED lights up.

COLOR SENSOR - COLORS
Pi_spoj_16.jpg

The color sensor reads colors as values (analog). According to the apparent color value, a certain color of the LED lights up. The readings are VERY dependent on the conditions (illumination) and may vary even though the color patterns are the same

COLOR SENSOR - BLACK LINE
Pi_spoj_17.jpg

The readings for white and black are usually different enough, so that with the help of two color sensors we can make robot car that follows the black line.

ULTRASOUND SENSOR (DIGITAL)
Pi_spoj_18.jpg

With the help of an ultrasonic sensor we can detect an object when it is at a distance less than the one set in the program (the LED lights up). If the object is at a greater distance, the program will not register it.

ULTRASOUND SENSOR (ANALOGUE)
Pi_spoj_19.jpg

Using the ultrasonic sensor, we can measure the distance to the object in front of the sensor. Depending on the sensor, larger or smaller maximum distances can be read. The LED illuminates less when the distance from the sensor to the subject is smaller and vice versa.

SERVO MOTOR
Pi_spoj_20.jpg

Example of operating the first servo motor. In the software example you can also see the code for controlling another servo motor.

I2C COMMUNICATION

RX - TX COMMUNICATION

ENCODER MOTOR - STEP - LESS PRECISE
Pi_spoj_23.jpg

We only count impulses (value 1). To avoid multiple sensor readings, we use the change indicator (ids). This method is less precise. The number of impulses we will count depends on the program itself. If the program only controls the engine, or still performs other operations. In the second case, especially at higher engine speed, the program will not be able to read all pulses.

ENCODER MOTOR - HALF STEP - BETTER PRECISION
Pi_spoj_24.jpg

We count the state changes (values 1 and 0). This method is better accurate than the previous one (STEP). The number of impulses we will count depends on the program itself. If the program only controls the engine, or still performs other operations. In the second case, especially at higher engine speed, the program will not be able to read all pulses.

KAMERA - LED CONTROL (OPEN CV)
Pi_spoj_25.jpg

The program works on the principle of comparing the new and previous image (frame). Each major or minor change in the image turns on the LED. Sensitivity can be changed by changing the value (if z_norm> 1000 :). The lower the value, the higher the sensitivity. Before running the program, you need to install and run OpenCV support. This program in a modified form can be used to monitor a space (interior).