Argon Alternate I2C Pins

Argon's datasheet and the online documentation indicate that there are two sets of I2C pins:

  • D0 and D1 are SDA and SCL
  • D2 and D3 are SDA1 and SCL1

The wire library does not seem to have a way to specify which set to use. For a separate Arduino ESP32 project I'm using the Adafruit_AHTX0 library (for AHT21 temperature / humidity sensor). The Arduino wire library has a TwoWire class with this function override:
void begin(int sda, int scl);
so you can specify the SDA and SCL pins.

I tried to use the same library with my Argon project and it uses the spark_wiring_i2c library, which I believe is embedded in the firmware. I looked at the source code and don't see a way to specify the pins for SDA and SCL. Is there some way to do this?

Why do I want to know? Because my Argon system is already running inside a crowded septic panel control box and am using D0 for something else. Rerouting the wiring was annoying but I was able to rewired things so I can use D0 and D1. And the sensor worked flawlessly the first time (that never happens!) but now I'm curious whether there is a way to use D2 and D3.

Background: My original (outdoor) septic control panel was badly corroded from moisture and H2S. When the septic pump wore out, the septic tank overflowed because the corroded control panel malfunctioned and didn't sound the alarm. So my new control panel has an Argon inside monitoring for clogged filter, high liquid level alarm, panel temperature and humidity, and pump current (too high or low means pump is fubar). I'm using webhooks to send warning alerts to my phone and Alexa so no more surprises.

Anyway, thanks in advance for any advice you can give me.


@LordFitzy, Particle uses Wire and Wire1 for the two I2C channels. The Adafruit_AHTX0 library has a begin() function to which you pass the Wire channel you want to use:

  bool begin(TwoWire *wire = &Wire, int32_t sensor_id = 0,
             uint8_t i2c_address = AHTX0_I2CADDR_DEFAULT);

By default, Wire is used. To specify Wire1, you would simply pass the address to Wire1, leaving the other arguments as defaults with:

  Adafruit_AHTX0 aht;


Thank you, sir! I had looked in spark_wiring_i2c.h and saw these definitions:
#define Wire __fetch_global_Wire()
#define Wire1 __fetch_global_Wire1()
but I didn't really understand it. I couldn't find what __fetch_global_Wire() was actually doing. But now it makes perfect sense.

In my similar Arduino project using the Adafruit_AHTX0 library, I just called begin() on the global Wire object:
Wire.begin(dataPin, clockPin, deviceAddress); // this override not available in Particle TwoWire class
and passed its address to aht.begin(), the same way you recommend.

Thanks again @peekay123

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.