100%
klipper_nano_expander Klipper nano expander view
Description

Imported from GitHub: orobardet/klipper_nano_expander · commit 85bafc8 · license MIT

Description

Klipper Nano Expander, an Arduino Nano Shield to be used as an auxiliary Klipper MCU

README

Klipper Nano Expander

An Arduino Nano Shield to use with Klipper 3D printer firmware, as a auxiliary MCU.

Features

  • Only require an Arduino Nano
  • +5V optional external power supply with fuse
    • Connected to the Arduino Nano 5V
    • Only required if you need more than 500mA power, else the Nano power supply should be enough
  • x4 temperature sensors (or any analog device as input)
  • x3 PWM mosfet driven port (or any PWM controlled device as output)
  • x1 Neopixel (external 5V power supply needed)


Source files:

  • Kicad 6 project, schematic, PCB and library
  • CAD files, including .STEP and Fusion 360 source

Why

  • Adds more temperature sensors and fan controllers
  • Drives 5V fans
  • Drives a 5V Neopixel without a level shifter
  • Arduino nano are cheap
  • Arduino nano are easy to source
  • A lot of people (including me) have some in their drawers
  • This board only have simple components easy to find
  • Small footprint
  • Does not need any hardware interaction to flash (no boot jumper or boot button to press)

How to build

production directory contains Gerber file and BOM + Position file for JLCPCB assembly.

If you use JLC PCB to produce and assemble your board, configure PCBA for the bottom side, where most of the SMD component are placed.
You'll have to solder by yourself the power indicator LED on the front of the board. It's a 0805, that can be soldered by hand.
However this LED is not mandatory for the board to work, you can skip soldering it if you want.
You'll also have to source and solder all the other non-SMD components:

  • x2 15 pins female dupont header for the Arduino Nano (or directly the male pin of the Nano, which is not recommended)
  • x1 Keystone 3544-2 mini fuse holder
  • x7 2 pins JST connector (FANx and THx headers)
  • x1 3 pins JST connector (Neopixel headers)
  • x1 screw terminal pitch 5.08mm for power in

BOM

RefQtyValueDescriptionSolderingFootprintLCSC Ref
C1, C8210uFUnpolarized ceramic capacitorPCBA0805C17024
C2, C320.1uFUnpolarized ceramic capacitorPCBA0805C49678
C4, C5, C6, C744.7uFUnpolarized ceramic capacitorPCBA0805C1779
Q1, Q2, Q33IRLML6344TRPBFMOSFET N-CH 30V 5A SOT23PCBASOT-23C20917
R111KResistorPCBA0805C17513
R3, R6, R9, R154100ResistorPCBA0805C17408
R4, R7, R10310KResistorPCBA0805C17414
R11, R12, R13, R1444.7KResistorPCBA0805C17673
D31Any colorLEDPCBA0805C84256
A11Arduino Nano v3.xHand-soldered
A1-a, A1-b215 pins female dupont header + 15 mins mal dupont headerHand-solderedP2.54
F11FuseMini fuse holder + 2A or 5A mini fuseHand-soldered3544-2_FuseHolder
J11Screw terminal 2 pins P5.08mmHand-solderedP5.08mm
FAN0, FAN1, FAN23JST 2 pins P2.54mmHand-solderedP2.54
T0, T1, T2, T34JST 2 pins P2.54mmHand-solderedP2.54
Neopixel1JST 3 pins P2.54mmHand-solderedP2.54

How to use

ONLY use 5V power supply! The Vin of the bord is connected to the 5V of the Arduino Nano, with no protection:
any power >5V may fry your Nano, and any power <5V may fry you power supply.

Powering on Vin with an external 5V power supply is only necessary if you device draw more current than the Nano can provide (800mA theorically, but with so many Nano clone out there it's safer to stick to 500mA max).

  • If you only plug temperature sensors, the Nano power supply should be enough
  • If you drive a fan, I'd better power the board with external power supply (most fan draws more then 500mA when they start)
  • If you drive an neopixel, powering the board with external power supply is highly recommended

In doubt, power the board. You should already have a 5V power source if you use Klipper, to power the Pi.

FANx header are mosfet PWM output, driving the ground:

  • You can use them for anything else than FAN, like LED, heater, etc. Just stick to 1A per output max.
  • If the fan or whatever you drive is not 5V, just connect its ground to the Klipper Nano Expander, and its +V to any compatible power source, but ensure that other PSU's ground is connected to the board ground!.

Software configuration

Once built and connected to your Klipper host, use the provided Klipper config file.

You need at least to set the serial path in the [mcu ...] of the provided klipper configuration file.
To find the serial of your Arduino Nano:

  • BEFORE connecting the Nano with USB on the Raspberry Pi, connect to the Pi using SSH and run the command ls /dev/serial/by-id/. Note the result.
  • Connect the Nano with USB on the Pi, wait a few seconds for the Pi to detect the USB device, and re-run the same command as before.
  • A new "file" should be there, looking like usb-1a86_USB2.0-Serial-if00-port0: it represents your Arduino Nano
  • Change the serial setting value in the Klipper configuration using the full path to the serial file. e.g.: serial: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0

Here is the pin mapping for reference:

  • TH0: PC0
  • TH1: PC1
  • TH2: PC2
  • TH3: PC3
  • FAN0: PB1
  • FAN1: PD5
  • FAN2: PD3
  • Neopixel Data: PD6

The configuration file must be included in some way into the main printer.cfg config filr of Klipper.

Flashing firmware

To flash the firmware, you do not need to have the configuration file ready, but you need:

  • The Nano connected to the Raspberry Pi
  • The path of the serial representing the Nano on the Pi (see previous section)
  • Klipper installed on the Pi
  • AVR compilation package installed on the Rapsberry Pi hosting Klipper: sudo apt install gcc-avr avr-libc avrdude binutils-avr

To flash the Nano with Klipper:

  • Connect to the Pi using SSH.
  • Create a klipper_config directory in you home directory, if it not exists already: mkdir -p ~/klipper_config.
  • Go the the directory containing klipper (usually: cd ~/klipper).
  • Run make clean KCONFIG_CONFIG=~/klipper_config/config.arduinonano.
  • Run make menuconfig KCONFIG_CONFIG=~/klipper_config/config.arduinonano and configure as followed, and then save'n'quit:
    • Enable extra low-level configuration options: NOT checked
    • Micro-controller Architecture: Atmega AVR
    • Processor model: atmega328p
  • Run make KCONFIG_CONFIG=~/klipper_config/config.arduinonano to build the firmware.
    Note: If the firmware compilation fails with errors like '.data' is not within region 'data', you may sufffer a known bug with AVR toolchain on Debian Bullseye (check your linux distribution codename with lsb_release -a). If so, you can try a workaround describe here to install a previous and non-buggy AVR toolchain. Once installed, re-roll the current procedure from the make clean step (a reboot of the Pi may be usefull between new toolchain installation and the retry).
  • Stop Klipper if it's running (usually: sudo systemctl stop klipper)
  • Run make flash KCONFIG_CONFIG=~/klipper_config/config.arduinonano FLASH_DEVICE=/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0, replacing the FLASH_DEVICE= value with the full path of you Nano on your Pi! This will flash the firmware to the Arduino Nano.
  • Start Klipper (usually: sudo systemctl start klipper)

If no error occurs, Klipper's firmware is now loaded into the Arduino Nano.
You can now configure Klipper to use the Nano Expander.

Mounting

x2 3D printable mounts are provided (STL files):

Both mounts require x4 M2x3mm screw to secure the board to the mount.

Compatibility

Aside from Arduino Nano and its clone, this board may be compatible with other MCU boards using the same form factor than the Arduino Nano, and a compatible pinout.

  • Cytron Maker Nano RP2040: flashing the firmware is a bit different, as it is based on the Raspberry Pi RP2040 MCU rather than an ATMega MCU.

Credit

Inspired by STM32-Klipper-Expander by Voron Design Team.
Temperature sensors and FAN output of Klipper Nano Expander are a copy of those of STM32-Klipper-Expander.
The Cytron Maker Nano RP2040 config is a contribution of tehmaze (#2).

Comments
Sign in to comment

No comments yet. Be the first to ask about this board.