PMS5003 I2C power control in Python?

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
dr_glenn
 
Posts: 15
Joined: Sun Apr 04, 2021 4:40 pm

PMS5003 I2C power control in Python?

Post by dr_glenn »

I have the PMS5003 with Stemma connector (same as I2C). I know that PMS5003 with serial interface also has a SET control pin that can be used to put the device in sleep (or is it power off?) mode. How would I do that with the I2C interface, using the Adafruit Python package?

User avatar
blnkjns
 
Posts: 963
Joined: Fri Oct 02, 2020 3:33 am

Re: PMS5003 I2C power control in Python?

Post by blnkjns »

The set pin is available on the board. Just connect it to another GPIO pin and set it manually high or low:
PIN10
SET
Set pin/TTL level @3.3V, high level or suspending is normal working status, while low level is sleeping mode.
Not sure if it works, but worth the try. The datasheet is rather vague.

User avatar
dr_glenn
 
Posts: 15
Joined: Sun Apr 04, 2021 4:40 pm

Re: PMS5003 I2C power control in Python?

Post by dr_glenn »

Ah, thank you for pointing that out! It would be nice if SET functionality was available thru Stemma interface, but that could only work if there are smarts in the device itself that take commands and are able to toggle the SET line. So I guess I'll just run another wire from the computer to the SET line, but still use Stemma for data.

User avatar
dr_glenn
 
Posts: 15
Joined: Sun Apr 04, 2021 4:40 pm

Re: PMS5003 I2C power control in Python?

Post by dr_glenn »

I decided to bypass the Stemma connection and directly wire it to a Pi-Zero so that I could use the SET pin.
Now I'm confused about voltage. Should I wire it to 3.3V, 5V or both? Since I'm using a Pi, I've wired it to 3.3V only.
Currently I'm getting readings that are far lower than nearby PurpleAir sesnors - 2 to 4 times lower. So that's why I'm wondering about voltage.

FYI, I also have a BME280 with Stemma connection and I plugged that into the PMS5003. As hoped, it does work, even though the PMS is hard wired to the Pi. This is relly not a surprise, after all the Stemma wiring is simply I2C in a more convenient form.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: PMS5003 I2C power control in Python?

Post by adafruit_support_mike »

The PMS5003 needs 5V power, but its data signals use 3.3V.

You can connect SDA and SCL directly to a RasPi’s GPIO pins, but connect 5V to VIN.

User avatar
dr_glenn
 
Posts: 15
Joined: Sun Apr 04, 2021 4:40 pm

Re: PMS5003 I2C power control in Python?

Post by dr_glenn »

Thanks, but that leads to additional questions.
The PMSA003i with Stemma says it has voltage converters:
The breakout board has a 5V mini boost circuit so you can power it from 3.3V and 5V and the motor will run just fine.
If I use the Stemma connector, I presume it supplies 3.3V and not 5V, and therefore the boost circuit is employed.
But what if I wire directly to the headers and only supply 3.3V? Is the boost circuit still inline? Or should I instead supply 5V? Or both 3.3 and 5?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: PMS5003 I2C power control in Python?

Post by adafruit_support_mike »

It will work, but will be inefficient. The 3V to 5V boost circuit is a charge pump, which is 50% efficient by default.

User avatar
dr_glenn
 
Posts: 15
Joined: Sun Apr 04, 2021 4:40 pm

Re: PMS5003 I2C power control in Python?

Post by dr_glenn »

Ahh, the questions continue!
The PMSA003I with Stemma + breakout is not completely documented.
The PMSA003I has both Vin and 3.3V connections on the breakout board.

1. If using the breakout connections, what is Vin for?
2. Should I power it with 5V to Vin or 3.3V to Vin?
3. Is it permissible to hookup 5V to Vin and 3.3V to the 3.3V breakout connection?

I had connected Vin to 3.3V from the Pi. Then I started thinking maybe I should have connected Vin to 5V from the Pi. So I did that.
Well, I have 2 Pi-Zero and each has a PMSA003I + BME280 hooked up to the Stemma connector on the PMSA003I.
Now bear with me:
#1: One Pi Zero has the PMS powered by 5V to Vin and I do not connect it to Pi using Stemma.
#2: The other has the PMS powered by Stemma, therefore it gets 3.3V.
These two are sitting next to each other. The BME280 temperature readings are 1.5 to 2 degrees C higher on #1.
I think the BME280 on #1 is perhaps being powered by 5V and doesn't like it.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: PMS5003 I2C power control in Python?

Post by adafruit_support_mike »

dr_glenn wrote:1. If using the breakout connections, what is Vin for?
It's where you connect 5V for the internal heater. It's also the upstream power connection for the onboard 3.3V regulator.
dr_glenn wrote:2. Should I power it with 5V to Vin or 3.3V to Vin?
Use 5V.
dr_glenn wrote:3. Is it permissible to hookup 5V to Vin and 3.3V to the 3.3V breakout connection?
When the breakout has power connected to Vin, the 3.3V pin is an output from the onboard voltage regulator. You can use it to supply power to associated circuits near the breakout.

Connecting an external 3.3V power supply to the 3.3V pin under those conditions won't hurt anything, but doesn't do anything particularly useful.
dr_glenn wrote:#1: One Pi Zero has the PMS powered by 5V to Vin and I do not connect it to Pi using Stemma.
#2: The other has the PMS powered by Stemma, therefore it gets 3.3V.
These two are sitting next to each other. The BME280 temperature readings are 1.5 to 2 degrees C higher on #1.
I think the BME280 on #1 is perhaps being powered by 5V and doesn't like it.
That's probably a combination of production variation between the two sensors (spec'd at up to 0.5C) and a real temperature difference based on the difference in supply voltages between the two setups.

It's incredibly hard to get uniform temperatures in the real world. The rate of thermal transfer is proportional to the difference between temperatures, so the smaller the difference gets, the longer it takes to balance the remaining difference. Gradients of 1C stick around for a long time. In metrology labs, it's common to say that the best results come from the team with the best thermostat.

A 5V system dissipates about 50% more power than the 3.3V system, and power dissipation equals heat. The strongest thermal connection between any IC and the world outside its package is the connection through the GND pin, which usually goes to the metal pad the chip is bonded to on the leadframe, so it's natural to see thermal connections through power lines.

User avatar
dr_glenn
 
Posts: 15
Joined: Sun Apr 04, 2021 4:40 pm

Re: PMS5003 I2C power control in Python?

Post by dr_glenn »

The difference between the two BME280 is my stupidity! One of the systems was in a closed box with two 3/8" vent holes (one for the PM25 sensor). The system in the closed box consistently registered the higher temperature. I took the lid off and set the two side by side and measurements are now the same within typical variance.

So this tells me that the project that inspired my build is flawed. The computer (I use Pi-Zero-W) generates heat. The BME280 needs to be located in a separate box from the computer. A small box with a screen cover facing downward (to keep rain from entering), perhaps attached to the bottom of the main box.

I think this should be the last post here. I hope this has been useful for others.

User avatar
dr_glenn
 
Posts: 15
Joined: Sun Apr 04, 2021 4:40 pm

Re: PMS5003 I2C power control in Python?

Post by dr_glenn »

Our first winter rain arrived and humidity hit 100%. The plastic case has a clear cover and when my environmental system stopped delivering data, I could see a great deal of condensation inside. I brought it inside and dried it out. But my code kept on aborting when it tried to initialize the PMS5003. A closer look showed me some gunk on some of the components on the PMS, near the connectors. I cleaned it off with alcohol, but still no go.
So the project as described here: https://learn.adafruit.com/diy-air-quality-monitor, has three flaws:

1. The outdoor box can get a lot of condensation inside at 100% humidity, since there must be an opening for the air quality and temperature/humidity sensors.
2. The components may not operate and may even fail at high humidity.
3. The temperature/humidity sensor should be in a separate box, otherwise heat from the computer will skew the readings.

So these are the limitations of hobbyist projects. I'll have to work on some real engineering for this.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”