Enviro+ - Low Voltage on 3V3 GPIO

I’ve been working on putting together an indoor air quality sensor array using the Enviro+, PMS5003, Pimoroni SGP30, and roscoe81’s really well featured “enviro-monitor” code.

After quite a few missteps I feel like I’m very close to making this all work, but I’m stymied by what I believe to be an issue with the SGP30.

The Relevant Code (I think)

eco2_tvoc_baseline = [] # Initialise tvoc_co2_baseline format: get - [eco2 value, tvoc value, time set] set
# - [tvoc value, eco2 value]
valid_eco2_tvoc_baseline = False
from sgp30 import SGP30
import sys
def crude_progress_bar():
    sys.stdout.write('.')
    sys.stdout.flush()
# Create an SGP30 instance
sgp30 = SGP30()
display_startup("Northcliff\nEnviro Monitor\nSensor Warmup\nPlease Wait")
print("SGP30 Sensor warming up, please wait...")
sgp30.start_measurement(crude_progress_bar)
sys.stdout.write('\n')

The Python Error Message

Traceback (most recent call last):
File "/home/pi/enviro-monitor/Northcliff_AQI_Monitor_Gen.py", line 1741, in <module>
sgp30.start_measurement(crude_progress_bar)
File "/home/pi/.local/lib/python3.7/site-packages/sgp30/__init__.py", line 140, in start_measurement
self.command('init_air_quality')
File "/home/pi/.local/lib/python3.7/site-packages/sgp30/__init__.py", line 76, in command
self._i2c_dev.i2c_rdwr(msg_w)
File "/home/pi/.local/lib/python3.7/site-packages/smbus2/smbus2.py", line 658, in i2c_rdwr
ioctl(self.fd, I2C_RDWR, ioctl_data)
OSError: [Errno 121] Remote I/O error

I’ve done some reading on the “Remote I/O error” and I’m trying to understand how to apply some of that information here, but I’m a bit baffled at the moment. Perhaps a clue here, but when I measure voltage before I run the code it measures 2.9V, but after running it drops to .74V. This seems odd to me.

Here’s a picture of the wiring, but I can take any specific shots you might think would be more helpful.

Photo

Ultimately I’m out of my depth here, but I think with some helpful suggestions I can get things working. I’ve got such a cool (IMO) enclosure designed up for this that I look forward to sharing, but I can’t until this works.

Addendum: I am using the pimoroni-SGP30 python drivers.

It’s early in the AM here, so I’m not quit 100% awake. I will take another look at your post after my morning walk with my dog. In the mean time.
Be careful you didn’t miss a ground connection on the enviro +. They are all connected together on the Pi as one common ground. That’s not always the case on a Hat of pHat though. Sometimes its just to hard to route the tracks to link them all together. That is fixed when the Hat is plugged into the Pi though, they all get tied together by the wiring on the Pi. If you look here, the grounds used have a horseshoe shaped black blob on them. It is easy to miss, and I think it could be done better, it is what it is though. You may just want to hook all the grounds up and be done with it.
Enviro Plus at Raspberry Pi GPIO Pinout

On my keyboard, top left, just under the esc key is a key with a ~ and a ` on it. That second character, the one “under” the ~ can be used as code tags on this forum.

line of code here

For a single line I put one at the start and another at the end.

For a wall of code use three ``` at the top and three more at the bottom

While True:
      etc, all the indents are retained

Try running sudo i2cdetect -y 1 from a terminal Window.
For the Enviro plus you should see
49 for the ADS1015
76 for the BME280
23 for the LTR559
And the SGP30 should show up as 58.

EDIT: Just so you know, I don’t own an Enviro or Enviro+, and don’t have an SGP30 breakout. I am running Enviro code on my equivalent Breakout Garden setup. And Enviro+ code on another breakout setup.

I only hooked up one ground, but it’s easy enough to whip up a few more wires and connect all grounds. So I’ll set about getting that done here presently.

Thanks for the tip on the code. I tried using the forum “preformatted” text which indicated that you only needed to indent 4-spaces over, but that didn’t seem to work at all.

I did run the i2cdetect and I’m relieved to say all four show up in that. Out of curiosity, how does one acquire the knowledge of what the device number is?

I’ll report back once I get all the grounds connected.

The address used Is marked on the Pimoroni Breakouts, and listed on their product pages.
I got the Enviro + addresses from that pinout page I linked too. It’s in the Details section.

It’s actually hard to post how to use that code tag, if I put two in the same sentence it makes it code and doesn't show the.

Okay, I see it now and yes, that’s very handy information. I just wasn’t putting those pieces together until now. I feel a bit sheepish admitting this now, but I was actually using that very page for the wiring pinouts.

That is really an impressive site as far as a reference goes.

Don’t feel bad, a lot of us here learned as we went.
The rule of thumb is no two devices on i2c can have the same address. That causes a conflict. That’s why a lot of the breakouts have a jumper to set an alternate address. If you want to use two of the same breakouts, one has to use the alternate address.
You can also hit this issue with different breakouts, there are only so many addresses to use. It’s why they list what address is used.
You’ll like this page.
pHAT Stack Configurator (pinout.xyz)
You don’t even have to have one to use that page. Just select the two hats or phats you want to use together and it will flag any pin conflicts.
I do believe Phil Howard @gadgetoid did both the pinout site and the phat stack page.

Okay, I got all the ground wires connected and ran the Python script again, but the failure is the same.

I checked the i2cdetect routine again and this time the SGP30 (58) is not showing up, which I think makes sense if it’s not getting enough voltage to run (reading 0.74v).

So it seems like as soon as I run this program the voltage to the SGP30 drops below it’s ability to function. Which could explain the remote I/O error, but I’m firmly in hypothesis territory at this point. If that were the case then I would expect something in the code to be dropping that value somehow. I just don’t know.

I’m kind of wondering if the driver might be playing a role here. Because that, I would think, is telling the SGP30 what it should do, where the “enviro-monitor” program isn’t really setting anything it’s just looking to harvest data from the sensor.

The orange wire going to SCL at the SGP30 end looks like its kinked or maybe cut / nicked? Did you modify that cable in any way?
I had an issue with my three displays running off of 3.3V. I was getting weird flickering and artifacts. I switched all three to +5V and no issues after that. The 3.3V on the Pi is derived from the +5V via an onboard regulator. There is a limit on how much current you can draw from the 3.3V bus. I can’t remember what it is at the moment though. I think it’s somewhere in the neighborhood of 200 ma or something?
If you use 5V your only limit is what your power supply can supply and what the tracks on the Pi can handle. I’m not saying this is your issue, just giving some info to mull over.

It is kinked, I did a crummy job making that particular cable. I should redo it right just to make sure I haven’t created a problem there. I do get point-to-point connectivity with it though.

The SGP30 board does indicate it can accept a range of voltages from 2-6V so maybe that’s worth a shot. So I’ll redo that cable and point the power to the 5V supply instead.

I’ll report back once I’ve got that done.

The one thing I haven’t found yet, but I believe would be helpful is a quick diagram showing exactly how one would wire the SGP30 to the Enviro+. I thought it seemed pretty straight forward given the pin arrangement.

Quick Question: what does the A3V3 (analog 3.3V?) mean on the SGP30? How is that different than the 3V3 output? Bonus, what’s the ADC for?

I still plan on using the 5V output, but I was curious.

So far, other than my LCD breakouts, all my Pimoroni breakout garden breakouts are running off of 3.3V. And seem fine that way.

The Pimoroni breakout garden breakouts are setup so they line up with pins 1,3,5,7 and 9 of the Pi’s GPIO header. You can solder on the included female header and just plug them right into the Pi GPIO header. Those 5 pins are basically power and i2c. Pin 7, GPIO 4 is optional and only used on some breakouts.
Those same 5 pins are brought out to the front of the Enviro+, it’s just an extension of the same GPIO pins. The other pins like the A3.3v I would think go to the onboard ADC.
My guess is that info is in here,
Getting Started with Enviro+ - Pimoroni Yarr-niversity
or maybe here
An outdoor air quality station with Enviro+ and Luftdaten - Pimoroni Yarr-niversity

You’re a wealth of information my good sir, thank you.

I think I’m actually going to redo all the wiring, but I want to make sure this works for the SGP30 first. I got a good bit of practice crimping the end connectors making the first set, plus, uh, I might have made them a bit too short so they’re not going to physically work as desired in the enclosure. {heck}

I usually use these,
Jumper Jerky - Rainbow Coloured Jumper Strips – Pimoroni
I just take the single shells off and replace them with a multi pin shell matching the number of pins on the breakout. No crimping or soldring

I just recently bought a couple of these, haven’t put them to use yet though.
Jumper Wire - 0.1", 6-pin, 12" – Pimoroni

I have several of these on the go. You can plug a Phat like the enviro on one set of pins and use the other for addons or a second pHat. It will also work with one full sized hat.
Mini Black HAT Hack3r – Pimoroni
I put a 90 degree female header on a Pi Zero and plug it in where the ribbon cable goes. The Pi is orientated with the jacks all pointing up.

It’s the pHat Stack in this picture but you get the idea.
In my case its Pi, Breakout Garden mini i2c, Breakout Garden Mini i2c SPI.
Oh, and no heat transfer from the Pi to mess with temperature readings etc.

Making jumper wires is definitely a drag. I ordered some silicone covered wire because I need them to be really flexible to work. Even the PVC wire I had before was really not compliant enough. So I’ll have to wait until Monday or Tuesday to proceed. Once I get that done hopefully it just works, but I’ll be sure to report in.

I like how you’ve set that up in the picture, that would really have been a lot easier and I probably would have just designed up a basic enclosure versus what I did for my setup. Having those slot-edge connections are super nice.

Happy New Year by the way.

My Pi project pictures are here if you want to have a look see. It’s my public OneDrive folder.
https://1drv.ms/u/s!AjOYwiwlwDtpgUMsp2qnevKpGEHb?e=cymlNQ
Check out the weather clock folder. =)
The new build is now finished and soldered up on a Proto Board, just have to get some new pics.

The Breakout Garden setup is just for proof of concept. It’s great in that you don’t have to solder any headers on to test it all out. I can verify my code works, then go to a more permanent setup. I use a lot of Proto hats
Adafruit Perma-Proto HAT for Pi Mini Kit – Pimoroni
I used this on the 3 LCD build
Adafruit Perma-Proto 40-Pin Raspberry Pi Breadboard PCB Kit - with 2x2 – Pimoroni
The Pi Zero is plugged in where the ribbon cable would be, its got a 90 female header instead of the stock male header.

The multiple displays are awesome. I wish I would have thought of trying that, although judging from your work, I’m betting it wasn’t exactly straight forward.

No, it took a fair bit of work to modify the Enviro+ all-in-one-mini.py file to do that. The original just switched between one of the three graphs when you waved your hand in front of the distance sensor. I also changed the sampling rate, its every 5 seconds for temp and humidity, and every 45 seconds for pressure. That gets me about 13 minutes of plots for temp and humidity, and 2 hours for pressure. The pressure trend up or down is the one I wanted the most. It changes so slowly that you need a long plot of an extended period to see if its going up or down. The python file is there if you want to have a look see.

I also went with SPI1 instead of SPI0, as SPI1 has 3 chip selects by default. It made the coding and wiring a “little” bit easier.

Huzzah! I think it’s working, no more errors from the SGP30 at least. Although I’m still bothered about why the voltage to the 3V3 pin is brought low.

I’ve got some new errors though, but they look mostly configuration based. So I’ll work through those. If all goes well, I hope to show of my assemblage of parts inside the container I made for them soon.