What is I2C and why is it used on the Raspberry Pi?
I2C (Inter-Integrated Circuit) is a simple communication protocol that allows multiple devices to talk to each other using just two wires. On the Raspberry Pi, it is used to connect sensors, displays, and other modules easily.
Click to reveal answer
beginner
How do you enable I2C on a Raspberry Pi using raspi-config?
Run the command sudo raspi-config, then navigate to Interface Options > I2C, and select Yes to enable it. Finally, reboot the Pi to apply changes.
Click to reveal answer
intermediate
Which files must be checked or edited to enable I2C manually on Raspberry Pi?
You need to check or edit /boot/config.txt to add dtparam=i2c_arm=on and ensure the i2c-dev module is loaded in /etc/modules.
Click to reveal answer
beginner
What command can you use to check if I2C devices are detected on Raspberry Pi?
Use sudo i2cdetect -y 1 to scan the I2C bus and see connected devices by their addresses.
Click to reveal answer
beginner
Why is it important to reboot the Raspberry Pi after enabling I2C?
Rebooting restarts the system and applies the changes made to configuration files and modules, ensuring the I2C interface is properly activated.
Click to reveal answer
Which two wires are used in the I2C protocol on Raspberry Pi?
ASDA and SCL
BTX and RX
CMOSI and MISO
DCLK and DATA
✗ Incorrect
I2C uses SDA (data line) and SCL (clock line) for communication.
What command starts the Raspberry Pi configuration tool to enable I2C?
Asudo config-i2c
Bsudo i2cdetect
Csudo enable-i2c
Dsudo raspi-config
✗ Incorrect
The sudo raspi-config command opens the configuration tool.
Which file should contain the line dtparam=i2c_arm=on to enable I2C?
A/etc/i2c.conf
B/boot/config.txt
C/etc/modules
D/boot/i2c.conf
✗ Incorrect
The /boot/config.txt file is used to enable hardware features like I2C.
What does the command sudo i2cdetect -y 1 do?
AEnables I2C on bus 1
BDisables I2C on bus 1
CScans the I2C bus 1 for connected devices
DLists all I2C drivers
✗ Incorrect
It scans the I2C bus number 1 and shows addresses of connected devices.
Why must you reboot the Raspberry Pi after enabling I2C?
ATo apply configuration changes and load I2C modules
BTo clear the I2C bus
CTo update the operating system
DTo reset the GPIO pins
✗ Incorrect
Rebooting applies changes and loads necessary modules for I2C to work.
Explain the steps to enable I2C on a Raspberry Pi using the raspi-config tool.
Think about the menu options and final step to apply changes.
You got /5 concepts.
Describe how to verify that I2C devices are connected and detected on the Raspberry Pi.
Focus on the command and what its output shows.
You got /3 concepts.
Practice
(1/5)
1. What is the first step to enable I2C on a Raspberry Pi?
easy
A. Run sudo raspi-config and select Interface Options
B. Install I2C drivers manually using apt-get
C. Connect the I2C device before enabling the interface
D. Edit the /boot/config.txt file directly
Solution
Step 1: Open Raspberry Pi configuration tool
Use the command sudo raspi-config to open the configuration menu.
Step 2: Enable I2C under Interface Options
Navigate to Interface Options and select I2C to enable it.
Final Answer:
Run sudo raspi-config and select Interface Options -> Option A
Quick Check:
Enable I2C via raspi-config = Run sudo raspi-config and select Interface Options [OK]
Hint: Use raspi-config Interface Options to enable I2C quickly [OK]
Common Mistakes:
Trying to enable I2C by editing config files without raspi-config
Assuming I2C is enabled by default
Connecting devices before enabling I2C
2. Which command correctly checks for connected I2C devices on Raspberry Pi?
easy
A. i2cscan -a
B. scan_i2c -list
C. checki2c devices
D. i2cdetect -y 1
Solution
Step 1: Identify the correct I2C scan command
The standard command to detect I2C devices is i2cdetect -y 1 where '1' is the bus number.
Step 2: Confirm other options are invalid
Other options are not valid Linux commands for I2C detection.
Final Answer:
i2cdetect -y 1 -> Option D
Quick Check:
Use i2cdetect -y 1 to scan I2C devices [OK]
Hint: Use i2cdetect -y 1 to list I2C devices on bus 1 [OK]
Common Mistakes:
Using incorrect command names like i2cscan
Omitting the bus number in i2cdetect
Typing commands with typos
3. After enabling I2C via sudo raspi-config, what is the expected output of i2cdetect -y 1 if a device is connected at address 0x40?
medium
A. An error message: 'command not found'
B. A grid showing 'UU' at 0x40
C. A grid showing '40' at 0x40
D. Empty grid with no addresses
Solution
Step 1: Understand i2cdetect output format
The command shows a grid of addresses; connected devices show their hex address.
Step 2: Interpret device presence at 0x40
If a device is at 0x40, the grid will display '40' at that position.
Final Answer:
A grid showing '40' at 0x40 -> Option C
Quick Check:
Device address shown as hex number in grid = A grid showing '40' at 0x40 [OK]
Hint: Device addresses appear as hex numbers in i2cdetect grid [OK]
Common Mistakes:
Expecting 'UU' which shows kernel driver usage, not just device presence
Confusing error messages with device detection
Thinking the grid is empty if device is connected
4. You enabled I2C in raspi-config but i2cdetect -y 1 shows no devices. What is a likely cause?
medium
A. You forgot to reboot the Raspberry Pi after enabling I2C
B. All of the above
C. The I2C device is not connected to the Pi
D. The I2C bus number is incorrect
Solution
Step 1: Check if reboot was done after enabling I2C
Reboot is required to activate I2C changes; missing reboot causes no detection.
Step 2: Verify device connection and bus number
If device is not connected or wrong bus number used, no devices appear.
Final Answer:
All of the above -> Option B
Quick Check:
Missing reboot, no device, or wrong bus = no detection [OK]
Hint: Reboot and check connections if i2cdetect shows nothing [OK]
Common Mistakes:
Not rebooting after enabling I2C
Assuming device is connected without checking
Using wrong bus number in i2cdetect
5. You want to enable I2C on a Raspberry Pi and automatically detect devices on boot. Which sequence correctly achieves this?
hard
A. Enable I2C in raspi-config, reboot, add i2cdetect -y 1 to /etc/rc.local
B. Edit /boot/config.txt to enable I2C, reboot, run i2cdetect -y 0
C. Enable I2C in raspi-config, reboot, run i2cdetect -y 1 manually each time
D. Install I2C drivers manually, reboot, connect device, no further steps
Solution
Step 1: Enable I2C using raspi-config and reboot
This activates the I2C interface properly on boot.
Step 2: Automate device detection on boot
Adding i2cdetect -y 1 to /etc/rc.local runs the scan automatically at startup.
Final Answer:
Enable I2C in raspi-config, reboot, add i2cdetect -y 1 to /etc/rc.local -> Option A
Quick Check:
Enable, reboot, automate scan in rc.local = Enable I2C in raspi-config, reboot, add i2cdetect -y 1 to /etc/rc.local [OK]
Hint: Enable I2C, reboot, then automate i2cdetect in rc.local [OK]
Common Mistakes:
Using wrong bus number in i2cdetect
Not rebooting after enabling I2C
Assuming manual scan runs automatically without setup
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.