dojoe / Twonkie

A USB-PD sniffer/injector/sink based on Google's Twinkie, re-designed to be manufactured by mere mortals.
354 stars 26 forks source link

Twonkie - a USB-PD sniffer based on Google's Twinkie

Twonkie is a USB-PD sniffer/injector/sink based on a Google project called Twinkie, re-engineered to be made in one-off quantities by mere mortals.

Twinkie is a great and pretty low-cost solution, and it's open-source so anyone could make their own, but unfortunately the Twinkie design uses a six-layer PCB and all BGA/wafer-scale parts - both of which are usually unavailable to the humble hobbyist.

So I designed the Twonkie, a slightly wonky sibling of Twinkie. It uses a four-layer PCB that can be manufactured cheaply by lots of services like OSHPark, and it makes a point to use only leaded parts for easier soldering (though the main microcontroller can optionally be QFN too via a dual footprint). The most difficult parts are likely the passives which are all 0402, and the USB-C connectors which are used in an unconventional way by misusing 90° upright connectors as 1.6mm straddle mounts (living up to the concept of being wonky).

What does it look like?

Lookie here!

The PCB is exactly 1 inch squared, so $10 will get you three at OSHPark. In fact, let me take care of that for you:

Order from OSH Park

(Disclaimer: I am not affiliated with OSHPark, I just love their service to bits and they've been super helpful chaps time and time again.)

The v1.0 and v2.0 Gerbers in this repo no longer need the botch wires around Q4 either, I'll update the photo as soon as I get the next board revision back.

What's changed compared to the original Twinkie?

I see there's a v2.0 now - what's different?

The 2.0 version uses a different voltage/current monitor chip compared to Twonkie v1.0, the INA237, which supports higher bus voltages and therefore makes the Twonkie hardware ready for Extended Power Range (EPR). The INA260 used by Twonkie v1.0 (and the INA231 used by Twinkie) will take damage if subjected to the up to 48V specified by EPR.

Sweet! How do I build my own?

I'm glad you asked! Get the board made via the OSH Park link above, or supply the v2.0 Gerbers in this repository to a PCB fab of your choice, get the parts from Digikey or Mouser or what have you, and follow the Assembly instructions to build the device. I recommend ordering a few extra parts: Get one more of each Type-C connector since you're going to modify them in ways that might end up with a broken connector, and generously round up the number of 0402 passives since you're going to drop some of them and you will never find them again :)

For the firmware, there are Instructions for building and flashing in the fw directory.

None of the parts are available 😭 What do I do?

Here are some ideas about replacements for some parts that are most likely to be unavailable. None of these have been tested so you're on your own!

I am a noob trying to solder and replicate the Twonkie. Got any beginner tips?

The KiCad schematic file contains the vendor part numbers and DigiKey order numbers for each part designator, and I exported the full list into a .csv file too - those are commonly called "Bill of materials" or BOM for short, and this is the one for Twonkie 2.0. You should be able to punch those part numbers into a parts supplier of your choice (I usually use DigiKey but there are plenty others) to find the parts you need. If they have parts in stock they'll happily sell you small quantities, though at an increased price. Take care to order more of most parts than you need - especially the tiny passives (resistors, capacitors...) are easy to lose during assembly.

As for reading the schematic, it probably helps to have some familiarity with USB-PD and the original project description, and then read up on the device datasheets to understand which part does what.

Having said all that, please be warned that the Twonkie is not exactly a noob project - unless you're already familiar with hand-soldering fine pitch SMT parts you may be in for a frustrating experience. Don't let that keep you from trying, but you should know what you're signing up for :)

TODOs

Similar projects

Licenses

Hardware (as found in the hw subdirectory)

The hardware design of Twonkie by Joachim "dojoe" Fenkes is licensed under CC BY 4.0

Firmware (as found in the fw subdirectory)

The source code for the Twonkie's firmware is licensed under the 3-clause BSD license, see its LICENSE file.