Technical University of Iasi - Fac. Automation and Computers |
Tuesday, January 29,
Laboratory work no. 5|
Linux Machine - RTC + DS1820 + CRON module
The laboratory experiment shows a RTC + DS extension for Linux systems based on the use of the I2C protocol DS1307. Detailed Linux Kernel Configuration operations for RTC are detailed as well as how to deploy applications that can be launched with UNIX Cron .
Raspberry Pi 3 platform, RTC_DS extension, logic signal analyzer.
- Fundamentally UNIX
E5.4 Sample Program Sources:
Test program DS1820_LED
Active program for crontab
E5.5 Exploration / Tracking Experiment:
- Review the RTC-DS interface schema represented in the figure below:
Using raspi-config the I2C protocol and 1 wire are activated;
Analyzing I2C protocol signals:
Using the i2cdetect -y command 1 identifies the presence of the RTC as follows:;
- In the /boot/config.txt file, add the parameters for the RTC as follows:;
dtoverlay = i2c-rtc, ds1307 Disable fake-hwclock as follows:
> sudo apt-get -y remove fake-hwclock
> sudo update-rc.d -f fake-hwclock remove
> sudo systemctl disable fake-hwclock
The / lib / udev / hwclock-set file removes the following commands:
#if [-e / run / systemd / system]; then
# exit 0
- RTC reading operation:
> hwclock -D -r
The initial RTC information is set as follows:
> data -s "19 APR 2018 16:24:12"
The transfer to DS1307 is done as follows:
> sudo hwclock -w
To enable kernel mode to boot sequence, insert the / etc / modules line:
View module:> lsmod | grep returning
> ls / sys / bus / i2c / devices Run crontab -e with the following options:
and analyzing the execution of the programs at the specified times
- Solve the proposed problems;
1. Create an action that will be launched at no 10 and fixed (ring time).
2. Develop a solution that will emails every hour at current temperature.
3. Create a Python program that will allow you to generate preset hours;
4. Develop a solution that will activate a 220V outlet to which a radiator is connected if the temperature is less than 18 degrees
5. Develop a solution that will turn the LED on during the pause.
E5.7 The experiment can be extended to:
- Making multiple process distributors;
- Developing NTP servers;
- Making active systems in programmable time sequences;
- Making public lighting systems activated at precise hours;
E5.8 Documentary references:
© 2018 Fl. Pantilimonescu - Fac. Automation and Computers Iasi