Skip Navigation

Assignment 2: Charge the RTC Battery and Connect to WiFi

For this assignment, you will read the official Raspberry Pi documentation to learn how to get the RTC battery to charge. You’ll also connect your environment to WiFi using either your home network or eduroam.

Page Contents

Background

RTC

The Real Time Clock (RTC) battery that you plugged into the Raspberry Pi 5 as part of the previous assignment is a rechargeable type. By default, the Pi will not charge this battery, so it will eventually die whenever the Pi isn’t plugged into its AC adapter for a while. When the battery charge runs too low, the RTC forgets the current time of day. Information about enabling RTC charging is provided in the official Raspberry Pi documentation:

Note that the Raspberry Pi instructions use a confusing shorthand notation to explain how to check the charging voltage via the sysfs interface. They list 3 files, followed by a colon, followed by the value of that file. In reality, only the file /sys/devices/platform/soc/soc:rpi_rtc/rtc/rtc0/charging_voltage matters for our purposes. To check the value, open a terminal window and run the following command:

cat /sys/devices/platform/soc/soc:rpi_rtc/rtc/rtc0/charging_voltage

If the displayed value is 0, then charging is disabled. Once you have enabled charging in config.txt, the value should match your setting in config.txt.

Wi-Fi

In addition to the RTC, the Raspberry Pi has onboard WiFi and Bluetooth connectivity. To be able to access the Internet, we need to make some type of connection (wired or wireless). For this assignment, we’re going to focus on the wireless connection.

If you’re using the Pi entirely off campus or with your cell phone hotspot, then you can follow the WiFi setup instructions from the Raspberry Pi documentation. There are two places where WiFi can be configured: a wireless network can be added during the initial setup (following the Getting Started guide), or one can be added later.

eduroam

To connect to eduroam from campus, follow the above instructions from the Raspberry Pi documentation to pick the eduroam network. When you click on the eduroam network, you’ll be shown a network setup dialog box. On this screen:

  1. Be sure the security type is WPA/WPA2 Enterprise.
  2. Change the Authentication type to Protected EAP (PEAP).
  3. Leave the Anonymous identity and Domain boxes blank.
  4. Check the “No CA certificate is required” box. Technically, we should have NetworkManager check the certificate to prevent a man-in-the-middle attack, but we’re going to skip this step for now.
  5. Be sure the PEAP version is Automatic.
  6. Check that the Inner authentication is MSCHAPv2.
  7. Your username is your CCU email address.
  8. The password is your CCU password (the one you use for email, Moodle, etc.).
  9. Click Save when finished.

If you’re unable to connect to eduroam the first time, left-click the network status icon in the upper right part of the screen, and go to Advanced Options. Under Advanced Options, click Edit Connections. In the Network Connections window, click eduroam, then click the little gear icon at the bottom. Navigate to the Wi-Fi Security tab and check the above settings, that you typed your email address correctly, and that your password is entered correctly. Click Save when finished.

Procedure

  1. Enable RTC battery charging on your Raspberry Pi. Verify that it is enabled after rebooting the Pi by checking the value of charging_voltage in the sysfs interface.
  2. Connect the Raspberry Pi to a WiFi network and verify that you can access the Internet through a browser on the Pi.

Submission Checklist

Once you’ve completed the procedure for this assignment, open a terminal window on your Raspberry Pi. Run the following sequence of commands:

whoami
date
cat /sys/devices/platform/soc/soc:rpi_rtc/rtc/rtc0/charging_voltage
nmcli connection show

Using your cell phone:

  1. Take a photo of your screen, showing the terminal window with the above output.
  2. Upload the photo to Moodle as part of the assignment submission.
  3. In the Moodle assignment submission comments, explain how you know the battery has been configured to charge properly.

ABET Assessment

Successful completion of this assignment satisfies the following performance indicator: