Klipper expansion

Hi, since the rasberry pi and other mini PCs are very expensive, the clipper has become popular on thin client devices. One of the downsides that affects me personally the most is the lack of GPIO. I decided to design an additional PCB with STM32F103 to which I could connect an additional display, ADXL345, fans, LEDs, housing temperature sensors, etc. I am in the process of designing a schematic. I would like to ask those more experienced for some advice, will everything work as it should? Did I forget anything worth adding?


Great idea! I took a quick look over the schematic, I couldn’t see any problems. What is the max current of the +5V rail? The neopixels can get quite hungry for current, so the max current will limit the amount of individual LEDs.

If you have 3 spare PWM outputs on the MCU, you might consider adding a port for simple RGB LED strips such as W2812B etc, but that’s about the only thing I can think of. Also, that would mean adding a +12V rail, so it may not be worth it

I’m using a HP T510 thin client, with 4GB RAM and a 16GB SSD, and it runs fine. My mainboard (Fysetc Spider) covers most of the functions you have added, except that I use a USB ADXL345, however if you want a hand testing the unit, i’d be happy to help. Also, if you want a hand programming the STM32, I can help there too.

In any case, good luck with it, it’s a really good idea and I’m looking forward to seeing your implementation :slight_smile:

EDIT: Is the reset pin for the MCU pulled high internally? If not, you might want to pull it high.

Interesting although I’m not sure why the rPi supply chain issues are a driver for this project.

A few comments about the design:

  1. USB should have TVS protection diodes. I use the TPD3E001DRSR
  2. I don’t think that your “mini12864” connector is complete when I look at FYSETC Mini12864 Panel
  3. I’m not intimately familiar with the STM32F but I would expect a couple larger power caps that range from 1uF to 2.2uF to minimize any noise that can come through to the MCU
  4. Wouldn’t the optimal MCU programming solution be an FTDI programming module for loading the bootloader? Along with that, to put the STM32 in programming mode, I recommend a jumper rather than a switch. Switches get flipped at the most inconvenient time
    4.1. I’m not sure of the value of the SWDIO interface when you’ll most likely be using a prebuilt bootloader and system generated Klipper image
  5. I would recommend a transistor inverter that uses the 24V input as the base/gate control with a pullup on the collector/drain that is passed to a STM32 DI pin so the MCU so indicate if there is no 24V power available. It may never be used but it’s a cheap monitor to make sure power is getting to the PCB’s peripherals and is available

The biggest problem will be determining what are the right IOs to have. Having a small board that can monitor controller space temperatures and operate fans as well as a display sounds good. With that, I would suggest that the “MOSFET OUT” drivers should be relabled as “FAN OUT” drivers.

Again, interesting project - good luck and keep us up to date on how it goes.


As the OP said, many people (like me) have, due to the RPi shortage, resorted to using a thin client to run klipper, they are cheap and readily available. I paid under $AUD50 for mine, and it works great. Mine has 6 USB2 ports, but no other IO. So if you are using a thin client with a fairly basic printer mainboard, then adding things like Neopixel LEDs, accelerometers, extra fan outputs etc is pretty much out of the question. The project proposed by OP attempts to address the shortcomings of that kind of setup. I think it’s a great idea, I hope that he sees it through :slight_smile:

BTW, some excellent electronics advice there

I guess it’s a matter of personal philosophy - I am reluctant to use an rPi for the kind of IO operations that Ay is proposing in his design.

I’ve always found *nix GPIO software programming to be somewhat non-optimal as it can be somewhat complex and, depending on the driver, execution can be quite slow and often take as much as 100s of ms for a state change to take effect (which means bit banging operations, including PWMs and UART communications, are essentially out of the question). The *nix GPIO drivers are great for having somebody demonstrate how to turn on an LED or poll a button, but I’m reluctant to consider it for anything else. Here is a pretty good tutorial outlining what needs to be done for rPi GPIO programming: GPIO Linux Device Driver Basic – Linux Device Driver Tutorial Part 35. I know that sometimes you have to bite the bullet and use them, but not for critical timed functions.

ADCs, timers/PWMs, I2C, SPI and UARTs are a different story as the rPi and other *nix drivers are generally quite good and efficient to use in an application.

My current personal approach to architecting the electronics in a printer right now is to use a general-purpose controller in the base of the printer for movement with a print head controller for the extruder, nozzle heater, fans and Z axis (I’m waiting on the BTT controllers with the built in ADXL345) leaving quite a bit of IO on the movement controller for fans, temperature sensing and LEDs (the functions that this board is providing).

This approach makes the IO capabilities of the rPi redundant and that’s why I was questioning the need for this board.

Thanx for the explanation.

A board that does this has been around for a few years now. It’s called the Klipper Expander. You could also just use an old controller board like a RAMPS.

Okay, I corrected the diagram according to your instructions, added TVS protection on usb, a transistor checking the presence of 24v voltage connected to the PA15 input, a jumper instead of the BOOT0 button, and a pull-up resistor on the reset line. I changed the naming of the outputs from MOSFET OUT to FAN OUT, in that diagram they differed only in the output connector (the output of the fans had a JST connector, while those marked as MOSFET OUT had an ARK connector).

The current efficiency of the +5v line depends on the converter used, I did not want to add an additional transformer/power supply, but use the +24v line available in almost every 3d printer. With the current LM2596S-5.0 it is 3A, however, using it from Chinese sources, I would not exceed 2.5A. In fact, all the +5v power (Not VUSB) is only used to power the LEDs and for EXP device if used.

Another modification I made was to remove the display connector, practically every motherboard of the printer has an EXP1 connector to which you can connect the 12864 display, the clipper does not support other displays anyway. Instead, I added a second SPI2 connector, and an EXP output with more microcontroller ports to handle, for example, a door opening sensor or relays.

I’ve seen the “Klipper expander” project before, I even followed it a bit, but I didn’t like the lack of an ADXL sensor output, No dc-dc converter for LEDs and a small number of additional GPIO ports (1 if I remember correctly)

1 Like

When you talk about the +5V SMPS chip supplier, I’m guessing you’re looking at sourcing it from UMW rather than TI as UMW is about half the price of TI’s LMR2596.

Could I suggest that you consider TI’s LMR33630:

It’s cheaper than UMW’s LMR2965 and is quite a bit more efficient. As a bonus, you can use the Power Good line as the 24V power sensor and ditch the transistor buffer circuit. Supply of the chip is a bit spotty right now but should be improving significantly by February (in time for your PCBs to come in).

As for the expansion connector - sorry for getting hung up and being pedantic about the Mini12864 specification.

One last suggestion - you might want to add the ability to select the Vin to U3 between VBUS and +5V using jumpers. There may be a situation where you want to program the STM32 with a stand alone application (ie monitor case temperatures and turn on fans when it gets too hot) and there’s no reason to connect to USB.

The more I look at this, you’ve got quite an intriguing little board here. I look forward to seeing one in the flesh.

It’s much more convenient in my experience to use a $4 Pi Pico to run an ADXL345 when necessary. I leave ADXL345 attached to a Pico and when I want to tune input shaper I plug it into USB, uncomment the necessary config section in Klipper, and attach the sensor to the toolhead.

Thanks for the suggestions on the voltage stabilizer. I studied the catalog note, the IC seems to be interesting (I like the PG option, it’s the first time I see something like that), but from what I see it is not (and was) available directly in any Polish store, and the shipping prices from e.g. Digikey will kill me (taxes…). It’s not even available on aliexpress, at least not at the regular price. The main advantage of the LM2596S-5.0 is the availability, you can buy the entire ready-made converter on aliexpress (no need to order an additional coil, capacitors - just desolder from the board).

If I manage to design a working prototype, and LMR2965 deliveries to Poland will be at normal prices, nothing stands in the way of replacing the system by making another PCB revision.

Jumpers on the input of the 3.3V stabilizer are a good idea - I added them. Thanks for the suggestions.

As for the ADXL system, the Pi Pico solution seems to be quite convenient, while the Pi Pico + clipper expander duo you sent in the previous link will require 2 USB ports. My solution seems to be just as simple, just plug the ADXL into the jst connector, to be honest it’s a matter of habit/preference. I personally am a minimalist and like to have everything in one place, in this case on one PCB.

If there are no more suggestions, I’ll start designing the PCB prototype.


Initial version of the pcb, it took me a while, but I had other things to do. pcb has dimensions of 88x45, I tried to make it as small as possible, but also relatively easy to solder by hand, so the smd elements used are 0805. If anyone has any ideas what could be improved or arranged differently, I am asking for suggestions, because as you can see, i’m not a pcb artist :wink:

Looks good.

You’ve added a fuse to your power input. I’m surprised you aren’t putting real USB connector on - do you have a source for wired USB connectors to a JST connector?

Some people might say you’re light on your ground stitching, but I would have to see the backside to comment.

Nice job!

I thought that the jst connection would take up less space than a full USB connector with a plug, such a cable can be easily made by simply cutting the usb and crimp jst connector.
Back of the PCB below:

1 Like

I would recommend putting in the USB connector - it may be a bit more space but I think you’ll find that a lot more people will be interested in your board if they don’t have to make (and debug) a custom cable.

Backside looks good.

I modified the PCB, I made a mistake during the selection of elements. I chose an inductor that probably can’t handle the current drawn by the leds. I made room for a larger 12x12 inductor. I modified the power paths, changed them to solid copper.

I added a usb connector to the board and completed the missing silkscreen.

What do you think?

1 Like

I like it. I can think of a couple of things I’d use it for.

Let us know how the PCBs come out!

PCB ordered, if anyone would be interested I created a page on github. The instructions and description are not very detailed, because I didn’t have much time, but I think that everyone interested will manage.


is there a firmware for it? and what to write in the configuration?

The PCB can be used in two ways - one of them is to install the klipper software. In this case, the installation looks the same as in any other case of klipper installation on the second microcontroller. The installation process is quite well described by Timmit99, to which I refer. I will probably write an instruction and config specifically for my board, but I need a little more time, and probably practical tests. There is also a video on youtube describing the installation process of the klipper on the STM32 Blue Pill, the process should be identical, because it is the same microcontroller used in my project.

The second way is to use the board as a separate microcontroller, in this case you need to write a program from scratch, e.g. in the Arduino IDE.

Regarding the configuration, I plan to write in the future, but for now you can use the configuration of e.g. motherboards with STM32F103C6T6A, changing the inputs and outputs accordingly (using my diagram).

Hi, you can make firmware for flash a RTk.GPIO ?

Is very economic!