@@ -18,12 +18,12 @@ Setup Guide
1818Your sensor has the four different connectors: VCC, GND, SDA, SCL. Use
1919the following pins to connect your SCD4x:
2020
21- * SCD4x* | * Raspberry Pi*
22- :------: | :------------------:
23- VCC | Pin 1
24- GND | Pin 6
25- SDA | Pin 3
26- SCL | Pin 5
21+ * SCD4x* | * Raspberry Pi* | * Jumper Wire *
22+ :------: | :------------------: | :-----------:
23+ VCC | Pin 1 | Red
24+ GND | Pin 6 | Black
25+ SDA | Pin 3 | Green
26+ SCL | Pin 5 | Yellow
2727
2828<center ><img src =" images/GPIO-Pinout-Diagram.png " width =" 900px " ></center >
2929
@@ -66,12 +66,72 @@ the following pins to connect your SCD4x:
6666Troubleshooting
6767---------------
6868
69+ ### Building driver failed
70+
71+ If the execution of `make` in the compilation step 3 fails with something like
72+
73+ > -bash: make: command not found
74+
75+ your RaspberryPi likely does not have the build tools installed. Proceed as follows:
76+
77+ ```
78+ $ sudo apt-get update
79+ $ sudo apt-get upgrade
80+ $ sudo apt-get install build-essential
81+ ```
82+
6983### Initialization failed
7084
85+ If you run `./scd4x_i2c_example_usage` but do not get sensor readings but
86+ something like this instead
87+
88+ ```
89+ Error executing scd4x_get_serial_number(): -1
90+ Error executing scd4x_start_periodic_measurement(): -1
91+ Error executing scd4x_read_measurement(): -1
92+ ```
93+
94+ then go through the below troubleshooting steps.
95+
7196- Ensure that you connected the sensor correctly: All cables are fully
7297 plugged in and connected to the correct pin.
7398- Ensure that I2C is enabled on the Raspberry Pi. For this redo the steps on
7499 "Enable the I2C interface in the raspi-config" in the guide above.
75- - Ensure that your user account has read and write access to the I2C device.
76- If it only works with user root (`sudo ./scd4x_i2c_example_usage`), it's
77- typically due to wrong permission settings.
100+ - If running the same command as root with `sudo ./scd4x_i2c_example_usage`
101+ works then your user is likely missing access permissions for the I2C
102+ interface. See the next chapter how to solve this.
103+
104+ ### Missing I2C permissions
105+
106+ If your user is missing access to the I2C interface you should first verfiy
107+ the user belongs to the `i2c` group.
108+
109+ ```
110+ $ groups
111+ users input some other groups etc
112+ ```
113+ If `i2c` is missing in the list add the user and restart the Raspberry Pi.
114+
115+ ```
116+ $ sudo adduser your-user i2c
117+ Adding user ` your-user' to group ` i2c' ...
118+ Adding user your-user to group i2c
119+ Done.
120+ $ sudo reboot
121+ ```
122+
123+ If that did not help you can make globally accessible hardware interfaces
124+ with a udev rule. Only do this if everything else failed and you are
125+ reasoably confident you are the only one having access to your Pi.
126+
127+ Go into the `/etc/udev/rules.d` folder and add a new file named
128+ `local.rules`.
129+ ```
130+ $ cd /etc/udev/rules.d/
131+ $ sudo touch local.rules
132+ ```
133+ Then add a single line `ACTION=="add", KERNEL=="i2c-[0-1]*", MODE="0666"`
134+ to the file with your favorite editor.
135+ ```
136+ $ sudo vi local.rules
137+ ```
0 commit comments