The light on the board
A red LED and a 1 kΩ resistor sit on SIGNAL, so the LED lights whenever SIGNAL is HIGH: while the button is down, with no code involved. About 3 mA from 5 V, about 1.3 mA from 3.3 V, and a way to tell a wiring fault from a sketch fault at a glance.
Two paths to ground
With the button down, SIGNAL is at VCC and current has two ways back to ground. One is the 10 kΩ pull-down. The other is R3, 1 kΩ, and the red LED after it. Both paths only carry current while the button is down, so the LED is a direct picture of SIGNAL: lit is HIGH, dark is LOW.
The current for both comes from the block's VCC pin, through the switch. Your microcontroller's input pin supplies none of it.
How bright
The LED is red, and its exact part is not recorded, so the arithmetic below takes the typical drop of a red 0805 LED: about 2.0 V, somewhere between 1.8 and 2.2 V. It is worked out rather than measured, and the currents are approximate:
from 5 V: (5.0 V - 2.0 V) / 1 kΩ = about 3 mA
from 3.3 V: (3.3 V - 2.0 V) / 1 kΩ = about 1.3 mAFrom 3.3 V the LED is a little dimmer. The reason is the same as for the TK01's blue LED, and why it is dimmer on 3.3 V works it through.
A test that needs no code
The LED lights from the wiring alone, so it splits every fault in two before you open the sketch:
- Press and the LED lights. VCC, GND and the switch are fine, and SIGNAL went HIGH. If the sketch still sees nothing, the fault is between SIGNAL and your code: the pin number, or the SIGNAL wire.
- Press and the LED stays dark. The block has no supply. Check VCC, then GND, then that the cable is not one pin over.
When a press does nothing starts from exactly this split.
When it does not work
Normal. A red LED takes about 2.0 V before it conducts, and 3.3 V leaves about 1.3 V for its 1 kΩ resistor: roughly 1.3 mA. On a 5 V Uno the same LED gets about 3 mA and is plainly brighter.
No. The LED's current comes from VCC, through the switch, not from your pin. Your pin is an input: it only measures the voltage on SIGNAL and supplies nothing. The block's current comes out of your board's 3V3 or 5V pin.
Not from code. It is wired to SIGNAL, so it lights whenever the button is down and VCC is connected. That is the point of it: it shows the hardware is working even when the sketch is not.
No. Pressed, the switch holds SIGNAL at VCC whatever the LED draws. Released, the LED passes nothing at 0 V, so it cannot lift SIGNAL off LOW. The pull-down alone decides the released level.
Edit this page — content/books/push-button/the-light-on-the-board.mdx
Questions about this product
See what other owners have asked, and read their solutions.
Push Button
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.