AirGradient PRO PCB Update Review

Definitely agree with Ken’s comment on the Schematic there.

I just realized the other day that I was mistaken. All along, I thought the OLED was powered by 5V, not 3.3V. I would strongly advocate for powering the OLED with 5V and taking the load off the LDO which might already be close to or at its current delivery limit. Because we don’t know what LDO comes with clones, it’s better to power move as much as we can to 5V.

I agree with l4ur’s concerns regarding the button. I don’t know the start-up conditions, but if you can, reverse the logical polarity of that input and just pull-up to +3.3V. Then the switch can shunt it to ground when pressed. Doesn’t add an extra component and it’s safer.

Assuming clean, within-specs USB power source, I don’t think the S8 needs any decoupling on the PCB. The S8 has internal 3.3V voltage regulators and will have it’s own set of filtering and decoupling.

I can see a path to really clean routing without the shield headers even with only 2 layers.

@ken830 Are you sure having i2c for the OLED on 5v will not impact the communication as the D1 i2c works on 3.3v and could have any unwanted implications.

Regarding the other discussion, we plan to change the following:

  • Remove breakout for D1 mini shield to simplify tracing and be able to use 2 layer board
  • Push button pulls to ground
  • Switch OLED to 5v (to be confirmed - see above)

There are only 2 points of interaction between the OLED and the microcontroller: SCL and SDA. I2C is a shared open-drain bus and the only possible interactions with the bus is to pull it low or sample its voltage, which is defined by the pull-up resistors and the voltage they are tied to. Powering the OLED with 5V or 3.3V shouldn’t make any difference in the I2C interface because the OLED has an onboard LDO that generates 3.3V which it uses to pull up the I2C lines.

If anything, it’s probably slightly better for the I2C interface to power with 5V because we don’t know the specs of the onboard LDO and all LDOs have a minimum dropout voltage – in fact, LDO = Low DropOut Regulator. That means if we power the OLED with 3.3V, the onboard LDO will likely be regulating that down to 3.2V or lower and pull the I2C bus to that slightly-lower voltage instead, slightly slowing the apparent rise times and slightly lowering your VIH margins… If you buy these OLED in large enough quantities, perhaps we could get schematics or specifications?

Since I now have two PCBs with both configurations (3.3V and 5V), I could take some measurements, but the v3.7 pre-assembled board has tape covering the backside of the OLED and it’s soldered down. I’ll have to cut away part of the tape to get to the LDO output…

Is it possible to get rid of the 4-pin PMS5003 connector, move the 8-pin to that location, and get a shorter JST cable? That would also simplify the routing by quite a bit. Or if we need to maintain the 4-pin for people to solder wire leads, then maybe squeeze the two connectors right next to each other – I assume you will use one or the other, never both.

@ken830 Thank you for clarifying the OLED i2c with 5v.

I would like to maintain the 4 pin throughole for the people that are not proficient in soldering the small pins. We often run workshops with young students and these small pins are challenging for them to solder.

The PMS cable comes with the PMS sensors and the supplier has only this cable available. Thus we would like to use it and not discard it. So the location of the current JST pin has been selected due to the cable length. Do you see any functional problem with the current location of the plug?

1 Like

Out of curiosity (and as somebody who is not an electronics expert), what are the expected benefits to this new Pro PCB version for end-users?

I skimmed through https://forum.airgradient.com/t/design-flaw-of-all-airgradient-pcbs/, and it seems like this will help improve the reliability somehow, of the readings - is that correct?

And the mentions of cable routing here - I assume that will make the internal layout and cables a bit neater, and easier to diagnose, right?

@Achim_AirGradient : Understood. I think keeping the 4-pin is fine, but moving the 8-pin JST next to it is going to be very beneficial in terms of better routing on the PCB and reducing the total length of the signal path. Since we’re removing the shield breakout, there’s no longer a reason to run the traces to that side of the PCB anymore. The same goes for the 5V rail. It would no longer have to run to that side of the board, which will simplify routing and give you a more solid ground plane. It should be okay to just fold-over the long cable a few times (and maybe zip-tie it) to prevent it from flopping around.

Can you also elaborate on what the the Ext connector is and what the extra rows of pins are. I can kind of guess for OLED #0, but not entirely sure. Are you trying to support some legacy configurations?

Also, if you add some through-hole (not nearly as good as surface mount, but keeps it DIY-friendly) capacitors at each of the module’s power pins, we can decide later if they are needed or not, but having a footprint there will keep the option available.

I’ve been thinking about the USB Type-C connector a lot. It would be very nice to get a data connection so that we don’t have to take apart the case to re-program the D1 Mini. Unfortunately, I was not able to find a vertical USB Type-C connector with the data pins that is through-hole. The closest I could find is this one: https://gct.co/connector/usb4145

Unlike most surface-mount connectors, it has surface-mount leads that protrude out the side making it feasible for hand-assembly. Obviously, it will still be more difficult compared to the current through-hole-only connector. Another thing is the height profile is only 7.46mm compared to the ~10.5mm profile of the current connector. This means that it won’t protrude far enough to make plugging in cables possible with the case on. I think to solve both of these problems, we could add this secondary connector and located it in the center of the larger hole in the case. That means it would be optional and the larger hole will allow plugging in the cable without interference from the case.

With the Dp and Dn data pins on this secondary connector, we can figure out how to connect that to the D1 Mini. At first, I though a header, but I couldn’t find a simple USB Type-C to header cable. Then, I thought we could find a USB-C Male connector breakout board with 0.1" pin pitch spacing, but I couldn’t find anything. This one would be perfect, but it’s a female receptacle:

Perhaps we could still use this along with a male-to-male adapter (something like this):

But the problem is the length of the adapter would affect where the header is located on the PCB. I guess the easiest would be to just use a male breakout like one of these and just wire up to a header on the PCB:


Another option is to design our own breakout board – a small PCB with a USB C male connector and a spot to solder in header pins that will match the header on the PCB. We could use the space where the OLED cutout is, and just have it snap off, so it won’t cost any extra to manufacture and will give people an option. I understand this is a bit more complex logistically, though.

It would look something like this:
Mock-up

On the PCB, the extra header will look something like this:

1 Like

@victorhooi Others may have a different opinion, but I don’t think the reliability of the current design is a problem. I’ve worked through the rebooting issue (exception 0 crash caused by a breaking change in the SoftwareSerial library v7) and the serial timeout issue (caused by a bug in an older version of SoftwareSerial library). The I2C instability is likely because of the slow rise times that are MUCH too slow for operating at I2C fast mode (400kHz). I gave instructions on how to set this to standard mode (100kHz). The rise time is plenty fast for standard mode and there’s no down-side. I’ve analyzed the power at the SGP sensor based on concerns raised in that thread and it looks acceptable to me. The 3.3V LDO regulator on the D1 Mini clone PCBs may be undersized for our application, but that’s not clear since we don’t have exact part number to look up the specs. That will be improved if this new version of the PCB moves the OLED over to the 5V rail.

The breakouts at the top are for custom extensions of the board and OLED#0 in case somebody want to plug in an OLED display for debugging purposes (then no need to turn the board around all the time).

Regarding the USB plug, I think it’s important to keep the design clean and simple. For temporary debugging, one could plug in the cable into the D1 and then lead it through the square cutout in the enclosure to the outside,

If we use the ESP32-C3 module in the future, it will be easier to feed out the debug signal and flash it through the standard USB plug (we designed it that way on the outdoor kit).

I got burned by the USB-C port not doing data just a few days ago when I thought I had killed my board, but finally plugged in with the Micro-USB on the D1 and got it running.

If you are doing away with the D1 Shield pins, is there still a recommended way of adding a battery shield to the D1 itself or will it be too tight of a fit? I haven’t added one yet, but was thinking about it.

We will still keep the breakouts for G and 5V/VIN so you should be able to connect a charge controller.

@Achim_AirGradient - The display that was supplied with my PRO kit failed in a matter of a few weeks. I tried to find a replacement on Amazon USA and 99% of my options had 3V3 and GND pins inverted. The only display that I found that had the 3v3/GND/SCL/SDA pinout was 3x more expensive (>$15) than all my other options and isn’t positioned perfectly (probably about 1mm to high up).

Could you kindly consider adding solder pads to allow inverting polarity? While I don’t like cutting traces, you could have the traces default to your preferred pinout and allow users to invert polarity by cutting the bridges and making new ones by soldering? I prefer 0 ohm resistors as I find it to be cleaner.

Found this on the web that shows what I mean:

Also, I put an ESP32 in mine but the bottom left edge of the board interferes with the plastic molding. If the board were moved as much as possible to the right, it would allow more options (in the picture below I filed the board to make it fit… no traces harmed). It would also be great if there were solder holes, or the pins were routed to the shield location to enable adding additional hardware. I added touch sensors that work through the plastic case (green wires go to copper tape) to control the display which now defaults to off. I was limited to 2 GPIO if I tried to source them from the shield header even though my ESP32 mini has lots more.

Excuse my crude breadboarding :slight_smile:

Our main focus with the redesign at the moment is to increase the stability of the board and reduce complexity so at this point in time we would like to focus on the changes discussed above.

Having said that, regarding your issues:

  1. OLED display pin sequence. Feel free to contact us and we can send you a replacement. Additionally these modules are available on AliExpress, e.g. here: https://www.aliexpress.com/item/32787898780.html

  2. Using an ESP32: You can use some of the newer ESP32 modules that have exactly the same size like the D1 ESP8266 module, e.g. : https://www.wemos.cc/en/latest/c3/c3_mini.html or S2 mini — WEMOS documentation

We do plan a major redesign of the board in the coming months, especially for the pre-soldered version and moving to an ESP32-C3. Main objective is to reduce the dependency on the D1 MCU modules that have caused a variety of issues in the past. The C3 has more I/Os which will then be broken out and accessible for custom developments.

1 Like

@Achim_AirGradient The OLED display you pointed me to has an estimated delivery of 2 months. Amazon USA is packed with a large number of displays that fit BUT the pinout has the power supply inverted. It leads to believe that the pinout you are using is the least popular one. It would be of great help to be able to switch polarity on the display even if using the cut trace and solder ball method which I assume does not add cost to the PCB. Please consider it. Inability to get spare parts in reasonable time or cost is a major drawback to an otherwise great design!

As for the S2 Mini, I tried one but could not get the UART to work. I use ESPHome and am not sure the S2 Mini is fully supported yet or there is some other issue. It is sometimes hard to figure out how to declare the board so that ESPHome knows how to use it… maybe that was my issue even though I use that board in other projects without issues. The one I ended up using is too large but with a couple modifications I got it to fit and most importantly, it worked perfectly immediately.

The shield header removal makes sense given there are very few usable pins (2 GPIO on PCB v3.3 in my case) but I hope you will add it back when you implement the ESP32 with more GPIO (please the 4 row pin version with more IO!) as it makes it much easier to add custom circuitry as I did (see image above).

I understand that the current focus is to increase stability, Achim, we hear you! :slight_smile:
I will stay say it, for future reference: the question about the pinouts for shields could be easily solved if the case had a little more space above the D1 (or C3 in the future). Any shield could then go piggyback on top of the D1/C3.

You can select faster shipping options in AliExpress. By default it shows the slowest and cheapest. Click on the shipping options and you can see faster ones.

We will also experiement with the C3 or S2 board as a D1 replacement and I will inform if we get it running.

The new design is already submitted for production but I made a note of better placement for the MCU to allow shields on top in one of the next updates.

We are currently making a sample production with a new version that incorporates the following changes:

  • ground plane
  • improved tracing
  • removed D1 shield
  • added capacitors (optional) on 3v3 and 5v
  • moved JST plug closer to MCU
  • button pulls to ground
  • OLED display is on 5v

Many thanks for the feedback, especially @ken830 and @l4ur for reviewing the schematics.

I should receive the new PCB next week for testing and will then give an update.

Could you send updated KiCad files for review?

Here are the new files: https://drive.google.com/file/d/1z6g0-oY6amFZzEOuNfQ8zrduPmo9SX5o/view?usp=share_link
Many thanks for reviewing.