Just Use QWIIC Already

An INA219 board with a QWIIC connector and "female barrel jack to male barrel jack" cable soldered on. the qwiic end is plugged into the side of the Blepis PDA, with the screen showing a device found on the 0x40 address

Years ago, I wrote an article describing different I2C-on-a-connector ecosystems, explaining their strengths, weaknesses, and implementation details, as well as piling on a heap of fun stories. Looking back at it, it’s a great reference article, if I do say so myself. In particular, I highlighted QWIIC, which is a Sparkfun-borne standard for putting 3.3 V I2C on a JST-SH (or compatible) 4-pin connector.

I’ve since implemented a fair bit of QWIIC, and grew to like it so much more. I’m here to explain to you why you ought to be putting those JST-SH connectors in everything you design that touches I2C, all the cool things they let you do, where to buy a lot of cheap cables at once, and all the references you could need. I will also tell you about my USB pinout for QWIIC, something you should definitely know about.

In2ispensable Interconnect

There’s myriads of devices that speak I2C, and all of them are incredibly useful. Environmental sensors, GPIO expanders, ADCs, PWM chips, motor drivers, LED drivers, small displays, GPS and LoRa chips, voltage and current sensors, memory chips, TPMs, touchpads, NFC readers… You can go to any hobbyist storefront, search for QWIIC compatible sensors, and find gadgets most fitting to a project of yours.

I’m not making an argument that you should buy QWIIC devices for everything, even if it’s convenient, because this is not Buy-a-Day. I haven’t intentionally bought anything branded QWIIC to date, either. Instead, standardize on QWIIC for your I2C expansion slots, and use it wherever possible – turns out that it makes things incredibly easy. Standardizing on QWIIC has helped me make development, debugging, and wireup of all of my I2C-powered devices a breeze.

In short, I’ve found QWIIC to be a great solution to lots of I2C-shaped (and USB-shaped!) problems. Here’s just a few things I’m able to do, for a start.

I2C Debug Port

In a similar vein, this ZPUI businesscard is now my favourite QWIIC-connectable debug tool

Again, I didn’t start with buying any QWIIC peripherals – I simply started putting the port onto my boards because it seemed like the right thing to do, and why not have an expansion connector? Turns out it’s a perfect logic analyzer connector when you’re figuring out some I2C code.

Using one of those cheap but dangerous reverse-pinout-ends cables I accidentally bought a bunch of, I put together a simple logic analyzer adapter, and now it’s one of the first things I pull out when anything I2C on my boards misbehaves. Plug it all in, launch Pulseview, and I can zone in on any I2C mishaps as soon as I notice them.

I typically only put one QWIIC connector on my things, so for in-system logic analysis, I need a splitter doohickey with three connectors in parallel, incidentally, I have built a few of those before, back in 2018. Nevertheless, as long as I take care to add QWIIC connectors to all my I2C buses, it lets me observe workings of my onboard devices and external devices alike, reverse-engineer drivers, and quickly pinpoint issues by looking at the bus directly.

One of the best purchases I made last year – 100 of these ends, each 20cm long.

More Modularity More Better

This year, I’ve bought a hundred one-end-terminated JST-SH cables from LCSC for peanuts, and it’s been one of the greatest improvements to my I2C device tinkering – because now I solder them on every I2C device I come near. I’ve also pre-assembled a bunch of quick and dirty JST-SH breakouts for adding QWIIC into my devices on a whim. Here’s how it works.

The solar box in question, as I was testing the I2C connection

Recently I helped someone build a solar-powered node with Meshtastic, and naturally, we wanted to add voltage/current monitoring to both the battery and the solar panel. We got INA219 boards from Amazon, and soldered them to the power monitoring pins on the boards directly, avoiding terminal blocks with their subpar contacts. But, how to connect I2C to the Heltec board? A QWIIC-pinned JST-SH cable and a JST-SH socket breakout, no questions about it.

First off, I was able to test outside of Meshtastic firmware, plugging it into a nearby, already QWIIC-adorned, Raspberry Pi-based gadget and scanning the I2C bus. With that, I could know that the addresses matched what I’d expect, that I didn’t confuse the wiring in any way, and set the ADDR pins correctly, too. This would be impossible to do from the Meshtastic UI, but with QWIIC, it was a matter of replugging the cable.

Having installed everything, this made for a much cleaner setup. It also avoided soldering to the Heltec board, which would create a non-detachable tie between the mesh node and the solar battery system, everything other part of the system being equipped with connectors. Now, we also don’t need to worry about current loops when powering the node down, because everything can be detached, and we can also quickly swap the node at any time without soldering, in case something on the node burns out for whatever reason.

A touchpad to reverse-engineer? Soldering a JST-SH wire onto it is a great start.

This is just one story. Every time I use QWIIC in a project, I find unexpected benefits like these – and that’s not all.

Great In Most Situations

In a way, QWIIC here worked as a test connector, too. Want to flash some bytes into an onboard I2C memory chip? QWIIC works. If your board depends on I2C enough, QWIIC could be your test jig interface if you let it.

QWIIC doesn’t really work for devices that absolutely require an INT pin – this part is clunky, for sure. Most devices don’t absolutely require an INT pin, though. You can add a tiny cheap digital compass or OLED screen or a GPIO expander to any of your projects without ever touching an INT pin, and so many things can be polled without noticeable loss of CPU time.

QWIIC and STEMMA QT JST-SH footprint and symbol
KiCad symbol: Conn_01x04_MountingPin; footprint: JST_SH_SM04B-SRSS-TB_1x04-1MP_P1.00mm_Horizontal

JST-SH is a keyed connector with no shortage of clones driving the price down, it’s incredibly tiny yet easy to plug/unplug with just your fingers. There’s both a horizontal and a vertical version – although you should take care because you must flip the pinout when switching to the vertical connector, I’ve learned the hard way by having to hotglue a bunch of those vertical ports shut last minute on freshly made boards for a workshop! Other than that, QWIIC is impossible to plug in reverse, hard to destroy, and easy to replace.

Push It Further

How about three JST-SH’s, for three different interfaces, at three different voltages?

Every great standard needs its deviations, and in this episode of Jackass, I’m putting USB onto the I2C pins, because why wouldn’t I? USB badly requires a tiny standardized connector that’s not FFC, after all.

Same GND and 3.3 V location, of course – the goal isn’t to ensure devices don’t burn up when accidentally plugged into QWIIC, or vice-versa. USB does 3.3 V signaling, so data lines can be freely swapped; SDA for D+ and SCL for D-, no reason why that specifically. You can add in an ESD diode, I’d recommend it, in fact. Well, you could add it onto your QWIIC with I2C, too, it’s just that USB tends to go longer off-board and gets more sensitive to electrostatic discharge. Maybe I can call this all QWUSB?

Even though I didn’t initially plan this as a backup, a QWIIC footprint for a USB uplink port helped me make nicer thinner USB cables for a batch of Blepis boards

I’ve made a semi-cursed addition on top of QWUSB on some of my boards – switchable voltage between 3.3 V and 5 V. Sadly, some USB devices can’t function on 3.3 V – even if most can. There’s a low-Vf red LED from the switch output to 3. 3V – when the switch is set to 5 V, the LED lights up red, indicating a dangerous voltage. On less cursed devices, I tend to put SY6820 as overcurrent and backflow protection on my QWIICs, no matter if 3.3 V-only or 5 V-capable.

When I have a bit of free time, I’ll definitely be converting my bare-wires laptop webcams to QWUSB. Until then, it has already allowed me to connect cool things together in a pinch, and I know there will only be more of this in the future.

Small Sturdy Cables For Everything

QWUART, anyone?

With I2C as standard and USB as my own spin, QWIIC has let me cable things together that I didn’t know I could easily cable together. QWIIC has turned my breakouts from “ugh, I still need to solder to this” to “looks great as-assembled, now I cable these together and test immediately!”

If you work with I2C at least some of the time, you should put QWIIC on your boards – and if you don’t yet, make sure you don’t miss out on the opportunity. If there’s anything I hope for, it’s that Raspberry Pi finally caves and adopts QWIIC – they already put JST-SH on their new boards, how bad could it be? The new Arduino Uno Q already has joined in on the fun, and it’s undeniably better off for it.

24 thoughts on “Just Use QWIIC Already”

  1. Wait till I tell you guys I2C/TWI was meant for intra board communication, not inter board!

    I still prefer TPs for debugging needs but I do agree that having an extra port that taps into a bus (SPI, I2C, CAN, whatever) is super handy to attach your logic analyzer to it.

      1. Poor Grant, he didn’t deserve to die so young. Unlike all the other presenters his work was actually fun, interesting and mostly scientific.

        This was a fun show up to season 2007, maaaaybe also some 2008 episodes. Then it got quite lame with non-stop “C4 explosions detcord boom” and became pretty much unwatchable after the cannonball fiasco, when they started catering to gamers and social media “audience”.

        1. I remember the day he died very well. In 2020 I took two weeks off work and went on my first big road trip, with the intent to go all across my country, visiting both most major cities and some other less known places.

          14th July 2020 was a very nice, warm and sunny day.

          In the morning I drove from Gdansk where I was staying at the hotel, to the Vistula Spit. I spent most of the day there, sightseeing, playing on the beach, swimming in the sea and so on. In the evening, just before coming back to Gdansk I decided to discover the place where Vistula river meets the Baltic Sea. It was just a short 2500m walk from car park across the river bank, but I was already pretty tired and the route led through very soft, beach-like sand so going was slow.

          After seeing the sea, taking some photos and marveling at the views for a while I decided to go back to my car and return to hotel. It was getting dark so it must’ve been around 10 PM already. On the way back I met that kayaker dude whom I’ve seen before when he was swimming across the river.

          Turns out he decided to camp for the night in a nearby forest. We had some pretty long and interesting conversation on how from 1889 to 1895 the German Empire constructed an artificial channel east of Danzig (Gdansk). By diverting much of the Vistula’s flow straight north to the Baltic Sea they wanted to try and stop recurrent flooding. The perfectly shaped granite blocks they laid back then to reinforce the riverbanks are still there, guiding the water straight into the sea. Nice example of proper German engineering!

          When I finally came back to the hotel it must’ve been around 1 AM. I took a quick shower. Before going to sleep I still wanted to see if there’s something important in the news. I was way too tired to open my laptop and type a pretty long TrueCrypt password so I used browser on my phone instead. When I opened English Wikipedia I saw “Grant Imahara” in “Recent deaths” section.

          At first I was like “WTF? That Grant Imahara? No way, that must be a mistake.” But it was true. He’s gone. Overall it was a very enjoyable day, but just before going to bed I actually shed a tear when I read about his sudden death.

          Now when I sometimes re-visit the place where Vistula meets the sea I always stop and think of Grant for a while, about his robots and how fragile all our lives are.

  2. nobody said it so i will: what makes qwiic suck is that it is on 1mm centers, not 2.54 millimeter centers like America’s founding fathers prefer. almost every application i have for I2C requires manual soldering of through-hole pin connectors. it’s possible with 1mm centers, but not easy. i have standarized on a layout and a spacing for my standard I2C connections, and it’s all about through-hole 2.54 mm-cadence pins that fit Dupont connectors.

    1. If qwiic doesn’t meet your requirements, use another connector. The 1mm pin connector is great when you’re size constrained, but not everyone is designing high-density PCBs.

      The key takeaway from the article isn’t to “always use qwiic”, it’s to “always break out the buses, your software guy needs them!” I had to repeat that on nearly every project to a hardware engineer I worked with a couple decades ago, because hardware bringup is ten times harder when you have to rely on tiny wires soldered to equally tiny IC pins just to debug a critical issue. I once spent a full day repeatedly reattaching a wire to a tiny bit of exposed copper on the side of a QFN! I’ve been lucky not to need to go fishing under a BGA package yet, but I’m sure the day will come.

    2. Mostly Agree!

      Dupont connectors perfectly fit a breadboard. A male dupont can press right into a breadboard just as easily as it does a female dupont. I think for the hacker/maker crows that ought to pretty much end the conversation right there.

      Also… if you don’t have the connector you need but you do have one with extra pins… in a pinch you can just let it hang over the side and it works. Or… you can use multiple connectors with fewer pins each. ex) 2 2-conductor female dupont connectors will slide right onto a 4-pin header no sweat.

      JST does have some advantage when you want to ensure it’s connected the right way around or if you really need to conserve every last millimeter of space. But that’s stuff you can leave for a final version of a prodcuct you intend to mass produce, not a necessity for a hobbyist or prototype project.

      If you are really worried about connecting it backwards use 5 pins. power in the middle, ground on both sides of power, signal and clock on the ends. Worst case you swap signal and clock. It doesn’t work but it doesn’t let the magic smoke out. Just turn it around.

      Might want to check with Thomas Jefferson on the founding fathers thing though. He tried to switch us to metric.

      1. I will accept 100mil pitch, but do you have to call it “mil”? Mil is short for millimetre. “Milli-inch” is trying to have your cake and eat it too. You want imperial measurements, fine. But if imperial measurements are so good, you don’t need to steal our metric prefixes.

        Obligatory internet disclaimer, I am not actually cross with you :-)

  3. Qwiic is one of those standards that looks like a minor convenience until you have a drawer full of JST-SH cables and stop soldering headers altogether. The point about the second I2C bus caught my attention – on boards with two buses the 4-pin keying gives you no hint, so labelling is still on you. Cheap bulk cables plus a couple of Qwiic-to-header adapters have covered every sensor I’ve thrown at it.

  4. wow! i had no idea that touchpads these days were often i2c! i just retired a laptop so it’s on my mind. who knows, maybe some of its components will find an after-life after all.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.