All posts

A docking station built into my desk

A docking station set into your desktop. From one spot you charge your phone, switch your computer on or off and control the LED strip, which turns on and off with the computer.

A black docking station built into a desktop: a phone in a recess, a small screen, an illuminated power button, a rotary knob and three USB ports.
Built into the desk: phone slot, screen, power button, knob and USB.

What you need

  • A 5V illuminated push button (angel eye)
  • A small OLED screen
  • An ESP8266 board (Wemos D1 mini)
  • A USB hub
  • A right-angled USB-C adapter and a USB to USB-C cable
  • A rotary encoder with push button
  • Female Dupont wires
A hand placing a phone into the docking station’s slot, onto the USB-C plug.
The USB-C plug is spring-mounted, so the phone slides in easily.

Software

The docking station is driven by a small microcontroller with Wi-Fi. Another board works too, such as an ESP32. You flash the firmware with a micro USB cable; there’s an opening for it at the top of the enclosure.

I wrote the firmware in PlatformIO, but any development environment that supports Arduino code will do. The code is in main.cpp, in the download at the end of this post.

The top of that file lists which pins are used for what. If you want to use different pins, change them there. Also check NUM_LEDS: the number of LEDs on your strip. I use a strip with the WS2812B chip; if yours is different, change that at the top as well.

The firmware switches the LED strip on or off based on two things:

  • the signal from the computer (PC_STATUS);
  • the rotary knob.

When the strip is on, turn the knob left or right to change the brightness.

Enclosure

Exploded 3D design of the docking station: the tray with cut-outs, the lid and separate holders for the USB adapter and buttons.
The 3D design, in separate parts.

I printed the enclosure in black PLA, but other materials work too. The STL files are in the download.

The main parts are screwed together, into threaded inserts that I melted into the plastic with a soldering iron. The smaller parts are glued on, so nothing needs to be printed on supports. Fix the electronics in place with hot glue, for example.

The USB-C adapter sits in its own printed housing. A small spring (from a pen, for example) keeps it in place while still letting it move up and down a little.

Electronics

Connect everything to the microcontroller like this:

  • D0 → the LED header on the motherboard (computer status). My computer outputs 5V there, so I converted it to 3.3V.
  • D3 → the knob’s push button (10k resistor to the supply)
  • D5 → pin A of the knob (10k resistor to the supply)
  • D6 → pin B of the knob (10k resistor to the supply)
  • SDA → SDA of the OLED screen
  • SCL → SCL of the OLED screen
Wiring diagram: the Wemos board wired to the OLED screen, the rotary knob with resistors and an LED strip.
The wiring diagram.

The power button. This depends on the type of button. With mine, I could connect the LED’s plus and minus straight to the motherboard, and the NC contact directly to the motherboard’s power switch header.

The USB hub. I removed its casing and used only the small board with the USB ports. A USB cable on it plugs straight into your computer.

The connection to the computer. I glued two female headers into the enclosure, one with 3 pins and one with 4. A cable from the motherboard plugs into the 4-pin header. The 3-pin header carries power and the data signal for the LED strip.

The underside of the docking station, opened: wiring, the board, resistors and a white USB cable in the black tray.
From below: all the wiring in the tray.

Video and download

Got an idea of your own?

Tell me what you’d like to make. A sketch or a few sentences is enough to get started.