D0 and D1 always have 4.7 V using the Shield Shield?

Greetings Makers,

I am using the Shield Shield and Photon for a home automation project and have 2 PIR’s attached to D0 and D1 (A4 and A5 respectively on the Shield Shield). My live project is thinking the PIR’s are always being triggered even though they are not - due to 4.72 V being displayed on those pins - checked with my multimeter. When the PIR’s are triggered, the pins read 4.81 V, so they are seeing the event.

I was hoping these pins would be 0 and 4.8 V so the PIR’s would track motion properly (HIGH or LOW). Am I missing something here?

Will D0 and D1 always have 4.72 V across them?

Appreciate the help!

-Brad

I guess this has to do with the level shifters on the shield when the pin is floating.
You may need an external pull-down resistor of 2k2 to counteract that.

@BDub/@mohit I have tested with this code on an empty Particle Shield Shield v3.0.1 …

void setup() {
  pinMode(D0, INPUT_PULLDOWN);
  pinMode(D1, INPUT_PULLDOWN);
}

void loop() {
  Serial.printlnf("D0: %d, D1: %d", digitalRead(D0), digitalRead(D1));
  delay(1000);
}

… and D0/D1 are always HIGH unless I use a pull-down of 2k2. 4k7 was too weak and I didn’t have a 3k3 at hand :blush:
Is this expected?

Great questions!

https://docs.particle.io/datasheets/particle-shields/#shield-shield

The new version of the Shield Shield (v3.x.x) uses dedicated MOSFET based voltage translation on the I2C lines.

This is due to the fact that the auto level shifters tend to oscillate on fast moving signals with longer lead lengths.

If your PIR on D0 and D1 are the OUTPUTs of the PIR and they are active HIGH and LOW, I would think that these level shifters wouldn’t affect them. If you are trying to power the PIR sensor with these lines, that won’t work if they are current hungry as the only power they will receive is from the D0/D1 output through the body diode of the MOSFET. So that’s 3.3V - Vf of the body diode. In my experience, I’d say a PIR should typically be powered with the VIN pin (or 5V) for best operation.[quote=“bharbert, post:1, topic:31030”]
due to 4.72 V being displayed on those pins - checked with my multimeter
[/quote]

Are you seeing this voltage on the PIR output or D0/D1 pins? Should not be the D0/D1 pins since they are level shifted to 0-3.3V. If not D0/D1, what do you see on D0/D1 when the PIR output is HIGH? I would expect 3.3V.

Oh and is this the new Shield Shield or older one? Older one should work ok if you keep the leads short.

Thanks for the help Gentlemen!

The voltage that I am checking is actually on A4 and A5 of the Shield Shield. I only say D0 and D1 since they map to A4 and A5 and assume that they would be the same. The PIR’s are powered of the V+ on the shield and I am using A4 and A5 as digital input pins to signal any motion being triggered.

In my scenario, A4 and A5 should be 0 unless the PIR’s are triggered. Unfortunately, they currently always have some voltage across them so the PIR’s are never seen as LOW.

In the meantime, I guess I will try to find some other 0V pins to use for this unless you have a better work-around.

Thanks again!
-Brad

I am assuming this is the newest Shield Shield as I received it about 2 weeks ago…

In your code you need to use the Photon pin names.
When you state Arduino pin names (printed on top of the shield) and Photon pin names (printed on the bottom of the shield), could you please always explicitly add “Photon style” or “Arduino style” to remove any doubt.

1 Like

No Problem, here is the update to my previous comment:

Thanks for the help Gentlemen!

The voltage that I am checking is actually on Arduino:A4 and Arduino:A5 of the Shield Shield. I only say Photon:D0 and Photon:D1 since they map to Arduino:A4 and Arduino:A5 and assume that they would be the same. The PIR’s are powered of the Arduino:V+ on the shield and I am using Arduino:A4 and Arduino:A5 as digital input pins to signal any motion being triggered.

In my scenario, Arduino:A4 and Arduino:A5 should be 0 unless the PIR’s are triggered. Unfortunately, they currently always have some voltage across them so the PIR’s are never seen as LOW.

In the meantime, I guess I will try to find some other Arduino:0V pins to use for this unless you have a better work-around.

Thanks again!
-Brad

1 Like

PIR outputs are usually push-pull meaning they drive high and low and should easily overcome the 10k pullup resistor on the level shifter.

What does the PIR output do if you remove the shield from the shield shield and power it separately?

I think you have all the tools you need now to figure this out, but keep asking questions and taking measurements and you’ll figure it out :slight_smile:

2 Likes