USB-C PD DEEP DIVE

USB-C charging in portables is just awesome, though it is a bit more involved than traditional charging methods. I’ll walk you through how you too can enjoy this awesome feature.

The STUSB4500 is a nice little IC for power-delivery negotiation. It requires few additional components to get working and it runs autonomously with little software intervention on our part. This chip is ideal for a battery powered, space limited, portable application.

Note: USB-C PD only negotiates a higher VBUS voltage, it can not be used to directly charge the batteries, you will also need a lithium-ion smart charging circuit.

stusb4500

This application schematic provides everything you need to get the chip started. If we want an internal usb drive accessible over the USB-C port, we’ll need to do some more work.

  1. USB-C PD can source up to 20V on VBUS, we’ll need a VBUS to 5V step-down regulator for powering the USB drive. Make sure the buck regulator can do 100% PWM in case the VBUS is only negotiated to 5V.
  2. A USB 2.0 data multiplexer for switching the USB drive data lines between the Wii and the USB cable. You might need a small linear regulator for powering this IC so the data lines can still be switched when the portable is turned off.
  3. A power multiplexer for switching power to the USB drive between the VBUS step-down, and the 5V regulator already in the Wii portable. This is required because the USB drive needs to be powered when the portable is off and when the USB cable is plugged in.

usb

Note: I chose to power the 3.3V LDO from the 5V power multiplexer so it will be powered when the portable is off (cable plugged in). If you’re confident that the multiplexer can be put into a low power mode, then it might be possible to power it from our battery system voltage and skip the LDO entirely.

The VBUS step down converter I chose might have been a little overkill (it has a maximum input voltage of 36V!). If I redesign this schematic, I’d probably go with one that has a smaller PCB footprint. Though it proves to work fine.

pd

The layout can be condensed pretty small! I did make one minor mistake in this, the silkscreen for C10 is backwards, oops. I just have to remember that when I assemble it. Also the labels for the input pads aren’t exactly correct, the pad labeled 3v3 actually needs to go to the battery system voltage. The IO core of the STUSB4500 needs to share the same I2C voltage as our microcontroller. Lastly “S”, the multiplexer select is chosen to be wired to any of our system voltage regulators so that way the USB drive is always connected to the Wii when the portable is turned on.

This PCB will work as is, that is if you are fine with negotiating to the maximum power the charger you plug in can provide. My battery charger can only accept an input voltage max of 14V, if we use a 20V USB charger, this will not do. We will need a microcontroller to program the Power Delivery Objects (PDO) through the I2C registers.

regstusb

Here are the necessary register addresses of the STUSB4500 taken from the datasheet. The values to set them are not so clear, but it is possible to figure it out by piecing it together from the example code they provide. I had some help from my buddy Aurelio, who guided me through setting the registers.

The key is that the PDO voltage and current are 10-bit parameters stored in 8-bit registers in little endian format.

stusbcode1

STUSB_Write(), is a function I wrote to condense the basic I2C commands for setting the STUSB4500 to output either 12V, 9V, or 5V.

20190122_145437.jpg

It even works with the Nintendo Switch charger, Nice!

WiiBoy rev3 Progress

20190210_145143

To prepare for getting the casing casted, I thought it would be a good idea to build up a functional prototype for testing. I’m starting to feel the WiiBoy magic.

20190210_113543

Even though this model only uses 2 battery cells, there is not too much empty space. I even had to sand the USB drive down to fit.

20190210_121015

Using only 2 battery cells also has its advantage that the Wii doesn’t have to be trimmed so small, improving the reliability.

Notice the small bead and blue wire on the Wii? It’s a temp sensor probe. I added thermal protection in the firmware which shuts the console down if the temperature rises above 75C. It shouldn’t ever get close to that in normal conditions but in the situation where the console accidentally turns on in a bag (or during shipping), it’ll prevent it from melting down.

20190211_111224

But perhaps the greatest improvement from a small sacrifice of the battery size are the improved shoulder buttons. They are in the perfect spot when you hold it.

Well it looks like the WiiBoy is mostly done? Nope, this is just a thorough prototype. The real fun will begin soon..

PCBs, PCBs, PCBs

20190122_222756

Pictured above is all the PCBs for my new shiny WiiBoy I’ve been working on. I ordered them from JLCPCB (which has been a really great service so far). I used a solder template and placed the components by hand before using a hot air station to reflow it.

The most exciting pcb (in my opinion), is the one on the very top, it’s a USB-C Power Delivery and Data Multiplexer. In other words, it allows me to charge the batteries and use an internal usb drive all through the one USB-C port. I haven’t tested all the functions yet but I did successfully negotiate 15v out of a USB-C charger so I consider that success for now.

usbc.png

It’s a 4 layered PCB which I’ve had to do a few times now so I’m starting to get the hang of it.

solidworks.png

Well the design is going great so far. Hopefully the testing of the PCBs will go smoothly. On track for an MGC release…

A Brief History of the WiiBoy

Some would argue that the WiiBoy first began as far back as 2013 during my very first GameCube portable called the “DMG Cube”. Fitting a GameCube in a DMG housing was no easy walk in the park even without internal batteries. The DMG Cube was sold and has past through various owners over the years. Believe it or not, it’s still in excellent working condition after it popped up for sale on Ebay earlier this year.

dmgcube.png

Moving on, the WiiBoy is one of my oldest and on-going projects. Taking root in April 2016 for the BitBuilt Summer 2016 modding competition, the WiiBoy would be a Wii inside a DMG gameboy housing with batteries.

13244670_1322048521143277_7534326495399545897_n

Rev1 was finished in about 3 months but I wasn’t entirely satisfied with it. Still time left in the competition, I began the WiiBoy rev2 taking into account what I learned from the first model to improve the heatsink and overall quality.

DSC_0047_zpsa2skdcy3.JPG

Rev2 was cleaner all around and after accomplishing the “LMAO” Wii trim, it had room for double the batteries of the first one.

IMG_20160720_225234856_HDR_zpsq6eoym4w

The WiiBoy rev2 was voted first place in the 2016 Summer competition, a time where custom pcbs were still nonexistent in the modding community. Oh the times have changed.

January 2018, In preparation for my MGC (Midwest Gaming Classic) display, I decided to make an appearance with a brand new WiiBoy rev3. This one was designed again from the ground up utilizing 3D printing and custom pcbs. My modding buddy Chris Downing was nice enough to lend me his fancy Form 2 SLA printer to attempt and achieve an OEM looking console. With only a few weeks left before the convention, I rushed out the pcbs and threw together a prototype WiiBoy rev3. It wasn’t perfect by any means but it definitely caught some eyes at MGC.

20180413_151257.jpg

The WiiBoy rev3 at MGC alongside the PiiWii Pocket, GS2, and an N64 portable I have not yet unveiled for some reason.

MGC came and went and I could not get the amazing quality of the Form 2 out of my head so I purchased the new AnyCubic Photon resin printer. Boy I had no idea what I had gotten myself into. Turns out low power resin has awful warping qualities on large prints and after throwing money at various different resin brands, I failed at getting any passable case from the investment. The printer had failed the WiiBoy although it was still a great learning experience and I certainly don’t regret it.

20180324_180008.jpg

The WiiBoy continuously challenges me and for that it holds a special place in my heart. There is no doubt it will be seen again, maybe even at MGC 2019…

 

Last commissions of the year completed!

20181209_152418.jpg

It’s been a busy few weeks to get these 2 PS2 portable commissions completed and shipped for Christmas. It helps that they are both the same unit but the case work painting was intensive on both of them. Anyway they turned out really slick and clean, possibly my best units so far.

20181207_183844.jpg

20181209_141414.jpg

The wiring is very dense but I tried to keep it as neat as possible. It’s wired in a way so that I can bend the motherboard over to access both sides of it. Same for the battery, it can be moved out of the way to wire the next part. The result keeps it neat and manageable to repair if ever needed. I hope the customers enjoy them!

Improving the “Improved PS2 Portable”

One of the reasons why I don’t do many completely unique commissions anywhere is because sticking with the same design gives you the opportunity to make iterations and really fine tune your design into a solid product.

About a year ago I came out with my “flagship” PS2 portable for commissions. Since then, I’ve built several of them and I am now starting my 3rd iteration of the design for my latest commission.

Most of the changes are minor internal changes for mechanical strength like the new screw posts. The previous models used screw pegs that extrude from the top half of the device all the way to the back of the device. I’ve changed it for a buried screw type post. The post uses the strength of the case instead of relying on a tall screw peg that can snap in half if over tightened. ps2screw

Looking at the front half of the assembly, everything is now mounted with screws which are far cleaner and less likely to fail than various glues. There is simplicity in a build with no custom PCBs. I’m enjoying it while it’s still acceptable to do because it drastically decreases the development time and complexity. Besides, it is a tried method and very unlikely to fail without the additional electronics.

ps2top

Finally, I have made one external aesthetic change, swapping the start/select controller buttons from the buttons from an actual PS2 controller. It gives it a more Sony vibe. Now it’s time to get building. There are a few more improvements to it but I’ll talk about those if I can have this one wrapped up in a few weeks.

ps2outside

New Synthesizer in the works

20181002_212204

With all the hype around polysynths this week, I thought it would be a good time to share that I’ve started my own analog polysynth project a few weeks ago. This is something I’ve been wanting to do for a while but have put it off because I know it will take a lot of time and be expensive to finish. I think I’m up to the challenge!

I’ve planned out most of the synthesis architecture. 2 VCOs, a filter, and plenty of VCAs for control. The envelope generators, LFOs, and other modulation will be done in software. My first goal is to work towards an SPI programmable monophonic analog synth voice. Then to make it polyphonic, I’d tie a few of them together with a master SPI unit that gathers preset data from the control panel, keyboard, and other inputs.

An early model showing all the routing options. I will be adding onto it and revising it when I create the schematic for the voice card.

20181002_212758.jpg

What I think makes this architecture interesting is that VCO1 will be a triangle core, and VCO2 a sawtooth core. This allows me to implement two different oscillator syncs that work differently for each core. When synced, the sawtooth core is reset to 0v, but the triangle core output is reversed. It is a subtle effect, but I think it will be cool and there is a lot of variety I can do with this approach while keeping the part count down.

I’ve borrowed the waveshaping circuit from the Micromoog, I think it is very clever! It allows a continuously variable waveshape from saw to square to narrow pulse using just a transistor and 3 op-amps!

20181002_212516.jpg

And here’s the triangle wave going through the same wave shaping circuit. The outputs look good so far.

20181002_212719.jpg

After breadboarding a basic LM13700 VCA circuit, here is a sawtooth wave whose amplitude is modulated by a triangle wave, it works!

20181002_212034.jpg

A lot of work to be done. That’s all for now.