I²C Detective / Stage 3 of 3
Compare bus changes
Add one voltage-compatible device at a time and record differences.
Compiled 2026-10-19 (historical) · electrical review required
Download stage 3 PlatformIO projectRead code & run steps ↓
What changes now?
Add one voltage-compatible device at a time and record differences.
Expected after hardware review: Before/after address sets identify which connection added a responder.
Builds on stage 2: Distinguish errors.
What you need
Check availability and exact module markings before starting.
Connections / current hardware gate
Before connecting power. No peripheral wiring map is supplied for this scanner. Verify the device supply and bus pull-ups before attaching a device; the program stops until electrical review is complete.
- Use the Mega target and confirm its SDA/SCL connections against the actual board.
- Check the peripheral supply, common ground and idle bus voltage before power. Add one compatible peripheral at a time, with power removed while changing wiring.
- An address response identifies a responder, not its chip or a working display.
Conditional connection table and full module facts
No connection rows are authored for this selection. This does not establish safe wiring; use the current hardware gate and confirm the actual module before making connections.
Access describes the source of a requirement. Check availability, the exact revision and the complete power/driver/harness system before starting. Inventory quantities are expected purchase/BOM quantities, not live stock.
- ELEGOO Mega 2560 R3 boardClub-owned
product family verified · preflight required
Use this complete project
Target: megaatmega2560 · Environment: checkpoint3 · Stage branch: DISPLAY_STAGE=3
- Open the complete project. Download the stage ZIP, extract it and open the folder containing
platformio.iniandsrcin VS Code. Keep its supporting headers and libraries together. - Build stage 3. Select
checkpoint3in PlatformIO Project Tasks → General → Build, or use a PlatformIO terminal:
A successful Build compiles the program; it does not upload it or approve electrical connections.pio run -e checkpoint3 - Stop at the hardware gate. The supplied electrical-review flag remains false. Have a qualified reviewer complete the actual module, wiring and power checks before using an approved configuration for hardware operation.
As supplied, Serial at 115200 baud reports
Review bus voltage/pull-ups first.and initialization stops.
After electrical review: Upload and Monitor
Only with the actual setup reviewed and the configuration explicitly approved, choose this stage's Upload task. Close any monitor using the board first.
pio run -e checkpoint3 -t uploadOpen the matching Monitor at 115200 baud, then compare the expected result with what actually happens.
pio device monitor -b 115200Record Build, Upload and physical observations separately.
Complete source
The viewer starts at src/main.cpp. Use Source file for the board profile, PlatformIO configuration and supporting code. Keep the complete ZIP together.
workspaces/i2c-detective/src/main.cpp
#include <Arduino.h>
#include <Wire.h>
#include "board_profile.h"
bool ready=false;uint32_t lastScan=0;
void setup(){Serial.begin(115200);if(!kElectricalReviewComplete){Serial.println("Review bus voltage/pull-ups first.");return;}Wire.begin();ready=true;}
void loop(){if(!ready||uint32_t(millis()-lastScan)<3000)return;lastScan=millis();unsigned count=0;
for(uint8_t address=8;address<120;++address){Wire.beginTransmission(address);const uint8_t result=Wire.endTransmission();
if(result==0){Serial.print("ACK at 0x");if(address<16)Serial.print('0');Serial.println(address,HEX);++count;}
#if DISPLAY_STAGE >= 2
else if(result!=2){Serial.print("Bus error ");Serial.print(result);Serial.print(" at ");Serial.println(address,HEX);}
#endif
}Serial.print("Responding addresses: ");Serial.println(count);
#if DISPLAY_STAGE >= 3
Serial.println("Record before/after adding one verified peripheral; an ACK is not chip identification.");
#endif
}
Source integrity · SHA-256
132b64ed2033693f8e862d80b70d38b798193e834918e56967c004ee9d8aa73eRaw downloads and standalone ZIPs retain the canonical bytes and supporting files. Copy follows the selected Comments setting.
Check the result
Before/after address sets identify which connection added a responder.
As supplied, the false electrical-review flag prevents this hardware result. After qualified review, record what actually happens; the text above is an expected result, not a bench transcript.
Original verification checklist
- Build the exact selected environment; distinguish dependency resolution from source compilation.
- Observe the stated output and record actual behavior; expected result is not an observed transcript.
- Test the named failure mode before proceeding.
Troubleshooting
Nothing responds
Check power and common ground, then measure idle SDA/SCL against the device’s permitted logic rail. Verify Mega D20/D21 rather than transferring Uno A4/A5 wiring.
Many unexpected responses
Disconnect peripherals one by one. A held-low line, wiring error or faulty module can invalidate a scan; do not accept a crowded address list as successful discovery.
ESP32 adapter planned
Use the correct board-specific Wire pin setup and a 3.3 V-safe bus. A 5 V pull-up on a carrier can damage a 3.3 V host.
Technical explanation / original guide
Read the complete original stage guide
Original source/research wording is preserved. The stage's dated build evidence above supersedes earlier blanket compile-status wording; no physical results are implied.
Build it
Add one voltage-compatible device at a time and record differences.
Open workspaces/i2c-detective in VS Code/PlatformIO. Select checkpoint3 and run pio run -e checkpoint3. This is FIRMWARE_SOURCE_AUTHORED with embedded compilation unverified. Review the electrical flag and canonical conditional wiring before any upload.
Understand it
Wire is supplied by the selected board framework, so there is no separate external lib_deps entry for it. beginTransmission queues the address and endTransmission attempts the transaction. Result zero is an ACK and result two is an address NACK in this use; other results are reported as failures requiring further investigation. The scanner runs periodically to avoid an uninterrupted flood of Serial messages. Its blocking sweep is appropriate as a standalone diagnostic, not a task to insert into an animation loop every frame.
Expected result and verification
Before/after address sets identify which connection added a responder.
This is expected after a correct build and electrical review, not a captured bench transcript.
Check the selected source branch and named failure conditions. Record actual build or software output separately from future physical observations.
Likely failures
Nothing responds: Check power and common ground, then measure idle SDA/SCL against the device’s permitted logic rail. Verify Mega D20/D21 rather than transferring Uno A4/A5 wiring.
Many unexpected responses: Disconnect peripherals one by one. A held-low line, wiring error or faulty module can invalidate a scan; do not accept a crowded address list as successful discovery.
ESP32 adapter planned: Use the correct board-specific Wire pin setup and a 3.3 V-safe bus. A 5 V pull-up on a carrier can damage a 3.3 V host.
Build evidence, target and remaining verification
Original status: unverified.
Successful checkpoint3 build recorded 2026-10-19 for megaatmega2560; 4 warnings recorded.
No compile was attempted in this pass under the user's testing limit. Upload and physical bench observation remain untested.
atmelavr@5.1.0 · arduino