( Pi Day - March 14 Pi Zero 2 W )
The laboratory work aims to address the ways of achieving elements of the type Internet of Things (IOT) connected via the protocol SMTP .
Hardware: Raspberry Pi 0-4 platforms, DS1820 sensors, oscilloscope, router with Internet connection
Temperature reading program from the DS1820 sensor Classic mail sending program > Send mail sensor program -------- Video sequence
Python - GPIO Interrupts Python programs accept external interrupts generated via GPIO configured as an input port like this: > GPIO.setup(40,GPIO.IN, pull_up_down=GPIO.PUD_UP) or >GPIO.setup(40,GPIO.IN, pull_up_down=GPIO.PUD_DOWN) Usually an external event can cause the current program to be interrupted and jump to the execution of a handler if the following sequences have been executed: GPIO.add_event_detect(40,GPIO.FALLING, callback=fa_ceva, bouncetime=250) The program, usually called handler, is defined as a function as follows: def fa_ceva(channel): .........print("handler is running") .........instr1 .........instr2 DS1820 Using Raspi-config, the 1-wire interface is activated as follows: ![]() ![]() In the /boot/config.txt file you can add the line: dtoverlay=w1-gpio like this: ![]() Its presence can be viewed as follows: > ls /sys/bus/w1/devices/ which will return : ![]() Loading the driver for the 1 wire sensor is done as follows: > sudo modprobe w1-gpio > sudo modprobe w1-therm Configuring the kernel modules for the temperature sensor can also be done and by adding the following lines to the /etc/module file: w1-gpio w1-therm A directory with the sensor code is created in the /sys/bus/w1/devices/ directory. Here is the file w1_slave which is updated with the temperature data as follows: The content of the w1_slave file is: ![]() Installing the Python module for ds1820 is done as follows: > sudo apt-get install python-w1thermsensor Recent versions can be located with the command: >sudo pip install w1thermsensor The pip utility can be installed in the classic way with >sudo apt-get install pip. The DS1820 sensor connects to pin 7 of the Rpi's extension connector according to the figure below. ![]() Python has a set of classes from which instances can be created that allow messages to be transmitted using the SMTP protocol. To ensure a high level of security, it is necessary to have a email account set up with the possibility of accessing through 2 levels of passwords according to the specifications below: ![]()
1. Connect 2 temperature sensors and create a program sequence for reading the data; 2. Replace the temperature sensor with the humidity sensor DHT11; 3. Modify the prototype program to send email based on 2 temperatures; 4. Develop a method to send email with the temperature in the lab. on March 23, 2021.; 5. Create a program that will send an email with the processor temperature when a button is pressed.
- Creation of sensor networks capable of communicating on the Internet; - Creation of alarm and protection equipment; - Creation of systems for ambient monitoring; - Creation of smart homes; - Remote actuator activation using messages sent via SMTP.
|