PD trigger/Setting the voltage/07. Why a lever is a number
Setting the voltage · 07 of 11

Why a lever is a number

A 10 kΩ resistor upward, a lever downward, and a pin that is never disconnected from anything. Once you can see that circuit, the 0s and 1s on the back of the board stop being arbitrary.

The pin is never disconnected

The instinct is that a switch connects or disconnects, and that an open switch leaves a pin with nothing on it. That is not what happens here, and it is not what you want to happen — a pin with nothing on it picks up whatever is nearby and reads as noise.

What one lever does
lever at 0
The lever
Pin
0.0 V
Reads
0
Through the resistor
0.33 mA
Closed is 0, and it costs a third of a milliamp. With the lever down, the pin is tied to ground and the 10 kΩ just leaks 0.33 mA from VDD. Ground wins, so the chip reads 0. Either way the pin is never floating, which is the whole reason those three resistors are on the board: the CH224K has no pull-ups of its own.

Each configuration pin has two things attached: a 10 kΩ resistor up to the chip's 3.3 V rail, and a lever down to ground. One of them is always winning.

  • Lever closed. The pin is tied straight to ground through a piece of metal. The 10 kΩ cannot fight that, so it just leaks about a third of a milliamp from VDD to ground, and the pin reads 0.
  • Lever open. Nothing pulls down. The resistor takes the pin up to 3.3 V, no current flows at all, and the pin reads 1.

That is the whole mechanism. A switch that only ever connects a pin to ground, with a resistor supplying the other state, is the standard way to make a mechanical input into a digit — it is the same arrangement as a button on a microcontroller, and there is a fundamentals article on it.

Why the resistors are on the board at all

Many chips have pull-ups built in and need no help. The CH224K does not — its own datasheet lists exactly that as one of the differences between it and its successor — so if those three resistors were missing, an open lever would leave the pin floating and the chip would ask for an unpredictable voltage.

They also have to go to VDD and not to VBUS. Two of the three configuration pins are rated to VDD plus half a volt, which is under four volts. Pulling them up to a VBUS that can be 20 V is not a stronger logic 1; it is a dead chip. The one pin that is rated to 8 V is CFG1, and the board pulls that up to VDD as well because there is no reason not to.

What it costs

A closed lever costs 0.33 mA, and there are at most three of them. Even with all three down the board's configuration circuit takes about a milliamp, against the sixteen or so that the 1 kΩ resistor is already passing into the chip's shunt at 20 V. None of it is worth thinking about unless you are running this from a battery, in which case the board's idle draw is worth measuring rather than estimating.

When it does not work

Why does an open switch read 1 and not nothing

Because something else is still connected to the pin. Each configuration pin has a 10 kΩ resistor to the chip's 3.3 V rail, so with the lever open that resistor is the only thing deciding, and it takes the pin up to 3.3 V. Without it the pin would float and the chip would read whatever the nearest wire was doing.

Could I use a jumper wire instead of the switch

Electrically yes — grounding a configuration pin is exactly what the lever does. In practice the pins are 1 mm apart on a chip on the underside and there is nothing to clip onto, which is why the switch is there. Use the levers.

Why is the pull-up to 3.3 V and not to VBUS

Because CFG2 and CFG3 on this chip are rated to VDD plus half a volt. A pull-up to VBUS would put up to 20 V on a pin rated for under 4 V, which destroys the chip rather than reading as a 1. The board's three pull-ups all go to VDD for that reason.

Where this goes next

The output starts at 5 V and then jumps to whatever the levers were already asking for. That order matters more than it sounds like it should.

Set it before you plug it in

Edit this page — content/books/pd-trigger/why-a-lever-is-a-number.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

USB-C PD Trigger, 100 W Decoy 5–20 V, 12-Pack

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum