D0 & D1 always read high

I’m working with some of the getting started tutorials - Step 5: digitalRead (https://docs.particle.io/guide/getting-started/tinker/photon/). It shows a jumper wire between D0 and 3V3 (I have the Photon connected to the Photon Power Shield and placed on a breadboard. All connections appear to be placed correctly. However, even after resetting the pins in the app, D0 & D1 always read HIGH, regardless if the jumper wire is connected or not. Of course, I can do a digitalWrite and set them to LOW, but that’s not how I believe it’s supposed to work in this example. Am I missing something here??

Thanks!

@stevefister, the Photon Power Shield uses I2C to communicate with its onboard battery monitor. As such, there are pull-up resistors on both D0 and D1 lines since they also serve as the I2C SDA/SCL lines. :wink:

1 Like

Ahh, thanks for that info! Didn’t see that anywhere.

1 Like

@peekay123 Does that mean that the I2C SDA/SCL lines are always taken up by the power shield?

I am using D0 & D1 to read sensor data (Adafruit Compass sensor), and I m about to order power shields for the Photon, but if that compromises the sensor communications, I might need another power solution.
(Sorry if it’s a really basic question.)
Thank you.

In general, you can connect multiple devices to an I2C bus. The only caveat is all of the devices need to run at the same voltage (3.3V or 5V) and the devices need to have different IDs or addresses. The IDs are only 7 bits wide, so conflicts can occur.

The Particle Power Shield uses a MAX17043 I2C Fuel Gauge, which is address 0x6C.
There are a couple Adafruit compass boards, but if it’s the HMC5883L, it uses 0x3C/0x3D.

And both devices are 3.3V, so you should be fine combining those two devices connected to the I2C port on D0/D1, but keep in mind that I haven’t actually tested it.

Thank you @rickkas7! I’ll test it and report back.

@rickkas7, I'm not sure about this.
It is true that all the pull-ups (which should actually only be one set) have to pull-up to the same level (otherwise you'd draw current between from 5V to 3.3V across two sets of pull-ups.
But the active part of the communication of each sensor is pulling LOW to common ground, and letting go of the line to the one level of the single set of pull-ups.
So IMHO you can have 3.3V & 5V sensors mixed as long as they don't come with their own sets of pull-ups (providing the sensor's input stage is built 5V tolerant on SCL/SDA, but this might require a look into the datasheets to confirm).