-
Notifications
You must be signed in to change notification settings - Fork 2
Adding a RTC to Raspberry Pi
A RTC, or "Real Time Clock", will be used to keep track of time for our datalogger.
When a Raspberry Pi turns on, it asks the internet what the local time is. If there is no internet connection, it will fall back to a default time.
Because we wish to start up the datalogger out in the field, it is necessary to keep a module responsible for tracking time. So, we will add Adafruit's breakout board for the DS1307 to our project. It works just as the clock in your watch does.
This chip will communicate with our Raspberry Pi via a communication protocol called I2C ("i squared c").
I2C, or inter-integrated chip communication, is a protocol to allow communication between different chips. Falls under the master-slave model, where one chip is the centralized hub and there are several slaves providing information. Our Raspberry Pi with various helper chips follows this models.
I2C is often visualized as
The SCL, or clock signal, keeps chips synchronized. The SDA, or data signal, will pass information.
Each chip attached to these lines will be given an address, and as many as 128 different chips can be attached.
Though beyond the scope of this project, please see Quick2wire's I2C explanation for a further introduction to the protocol.
Please follow these instructions to set up I2C on the Pi.
With I2C configured for our Pi, we connect the RTC. Refer to Adafruit's wiring instructions.
As of August 2016, DO NOT follow Adafruit instructions to "Set RTC Time". Instead, please refer to AB Electronics' RTC Pi on a Raspberry Pi Raspbian Jessie.
Next, we need to test that your RTC works correctly.
Simply disconnect from the internet, reboot the pi, and then see if the time was set.
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Temporarily change the name of your wifi so it does not automatically connect.
If the time shows up correctly without the internet, you have successfully added the RTC!
With the time and a sensor connected, we are ready to start saving our readouts to log files! The Pi is becoming a datalogger...
Wiki for Rhewlab Environmental Sensing Project
- Setting up Raspberry Pi
- Getting started with GPIO
- Reading Temperature and Humidity with DHT
- Adding a RTC to the Raspberry Pi
- Datalogging with Python
- Connecting to ADC with Raspi
- Finishing up
Digital
Analog
