9/17/2023 0 Comments Ds3231 arch linux![]() Then add in /usr/lib/systemd/scripts/ an rtc-setup shell script like thisĮcho ds1307 0圆8 >/sys/bus/i2c/devices/i2c- 1/new_device ![]() Description= RTC Clock Setup and Time Sync Before= Type= oneshot ExecStart= /usr/lib/systemd/scripts/rtc-setup WantedBy= multi-user.target Write in /etc/systemd/system/ a rvice file containing the following lines Create and enable rtc-init systemd service: With kernel updates and have to recompile it manually in the future.ġ. Well, laziness apart, I picked it because I didn't want to interfere A good article explaining this can be found here at .Īnother possibility is reading the clock and setting time from user space, and that's what I did, inspired by laziness :D The cleanest solution would be recompiling the kernel with static RTC support. Periodically with Internet time, I've also written a few steps to set up Loading time from the hardware clock at boot and keeping it updated If you want your system to behave like an usual personal computer, If the Pi was connected to the Internet since boot, it should be as easyĪs running hwclock -w.Else read the man page to find out how to set it manually. If you've made it so far, congratulations!Now the hardware clock (RTC) should be synchronized with system clock. Through the I2C interface and read the time stored on it. If everything goes fine the Raspberry should be able to access the RTC Typing a couple of lines in the shell will reveal if the hard work done up to this moment was worth it ) $ echo ds1307 0圆8 > /sys/class /i2c-adapter/i2c- 1/new_device Now power off the Pi, plug the RTC board on the GPIO and power it on again. should be enough I also added the i2c-dev module explicitly.ģ. Create a file /etc/modules-load.d/nf containing i2c-devĪlthough point 1. 3.18 (~ Jan 2015) which introduced Device Tree support. With the Pi running edit /boot/config.txt adding or uncommenting device_tree_param= i2c_arm= on This is the procedure I've followed, using root privileges:ġ. Good, it's now time to connect the Real Time Clock to the raspberry and see what happens. This what I've got in the end and how it looks stacked on the Raspberry Pi B+ You may also find by yourself a good way to solder the header. Look at the pictures for a better description. I soldered the wires to their pins and eventuallyįixed everything with some hot glue, making the board rock solid. IĪlso cut two 2x20 pieces of perfboard and used them to create a solidīase for the header. I used 4 1x10 stacking headers (usually sold for arduino projects)Īnd arranged them into a 2x20, since I couldn't find a cheap 2x20. Using a double side perfboard would probably make things Please note that soldering the four wires to the stacking header will beĪ bit tricky. If you are planning to stack something else on top of the Pi pick a Need to stack something else on the Pi I decided to install a stacking Since the I2C inteface supports multiple devices and I'll probably Optionally you could just connect the four wires to the GPIO without any header. Now solder the header and connect the +5V, GND, SDA and SDL wires to the header. Here's the scheme of the RTC and some pictures showing the process:įirst of all solder the components on the perfboard following theĬircuit diagram above leaving some space for the 2x20 header, which will Check with your requirements if it's accurate enough.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |