Skip to content

Add a diag script for Raspberry Pi user to check i2c && GPIO functinality - #46

Open
raz0rsedge1975 wants to merge 2 commits into
metriful:masterfrom
raz0rsedge1975:master
Open

Add a diag script for Raspberry Pi user to check i2c && GPIO functinality#46
raz0rsedge1975 wants to merge 2 commits into
metriful:masterfrom
raz0rsedge1975:master

Conversation

@raz0rsedge1975

@raz0rsedge1975 raz0rsedge1975 commented Jul 28, 2026

Copy link
Copy Markdown

After messing around with a dozen different Pi's with MS430 sensor boards and running into some challenging difficulties with i2c bus errors and/or GPIO errors (even if the sensor board was running fine before), I decided to write me a script that can do some diagnosis.

Why:

It may be helpful since even running Pi's with MS430 can run into errors due to loose cable, corrosion, updates etc.
i2c has some flaws that may render the sensor board unusable (bus blocking) until removing power cable for 10 secs
and GPIO is also difficult to handle, depending on your Ri hardware and OS version.

What it checks:

SDA/SCL pin function and level via raspi-gpio get (read-only — does not reconfigure the pins, so the I2C bus stays untouched)
Status pins (LIGHT_INT, SOUND_INT, READY)
I2C reachability at address 0x71
Register write access (reset command + particle sensor select register), polling READY after reset instead of a fixed delay

Summary output:

The script ends with a clear DIAGNOSTICS FINISHED: OK (GO) / NOT OK (NOGO) summary, listing any failed checks by name, and exits with code 0 (OK) or 1 (NOT OK) — so it can be used in cron/systemd/CI health checks, not just interactively.

Dependencies:

Python: RPi.GPIO, smbus (already used elsewhere in this repo)
System package: raspi-gpio (sudo apt install raspi-gpio) — optional; if missing, that one check is skipped and reported as such, everything else still runs.

GPIO && I2C diagnostics for Raspberry Pi's
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant