Установка klipper на планшет
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These instructions assume the software will run on a Raspberry Pi computer in conjunction with OctoPrint. It is recommended that a Raspberry Pi 2 or Raspberry Pi 3 computer be used as the host machine (see the FAQ for other machines).
Klipper currently supports Atmel ATmega based micro-controllers, Arduino Due (Atmel SAM3x8e ARM micro-controller), Smoothieboard (ARM LPC176x), and Beaglebone PRU based printers.
Prepping an OS image
Start by installing OctoPi on the Raspberry Pi computer. Use OctoPi v0.14.0 or later - see the octopi releases for release information. One should verify that OctoPi boots and that the OctoPrint web server works. After connecting to the OctoPrint web page, follow the prompt to upgrade OctoPrint to v1.3.7 or later.
After installing OctoPi and upgrading OctoPrint, it will be necessary to ssh into the target machine to run a handful of system commands. If using a Linux or MacOS desktop, then the "ssh" software should already be installed on the desktop. There are free ssh clients available for other desktops (eg, PuTTY). Use the ssh utility to connect to the Raspberry Pi (ssh pi@octopi -- password is "raspberry") and run the following commands:
The above will download Klipper, install some system dependencies, setup Klipper to run at system startup, and start the Klipper host software. It will require an internet connection and it may take a few minutes to complete.
Building and flashing the micro-controller
To compile the micro-controller code, start by running these commands on the Raspberry Pi:
Select the appropriate micro-controller and review any other options provided. Once configured, run:
Finally, for common micro-controllers, the code can be flashed with:
When flashing for the first time, make sure that OctoPrint is not connected directly to the printer (from the OctoPrint web page, under the "Connection" section, click "Disconnect"). The most common communication device is /dev/ttyACM0 - see the FAQ for other possibilities.
Configuring OctoPrint to use Klipper
The OctoPrint web server needs to be configured to communicate with the Klipper host software. Using a web browser, login to the OctoPrint web page, and navigate to the Settings tab. Then configure the following items:
Under "Serial Connection" in "Additional serial ports" add "/tmp/printer". Then click "Save".
Enter the Settings tab again and under "Serial Connection" change the "Serial Port" setting to "/tmp/printer". Navigate to the "Behavior" sub-tab and select the "Cancel any ongoing prints but stay connected to the printer" option. Click "Save".
From the main page, under the "Connection" section (at the top left of the page) make sure the "Serial Port" is set to "/tmp/printer" and click "Connect". (If "/tmp/printer" is not an available selection then try reloading the page.)
Once connected, navigate to the "Terminal" tab and type "status" (without the quotes) into the command entry box and click "Send". The terminal window will likely report there is an error opening the config file - that means OctoPrint is successfully communicating with Klipper. Proceed to the next section.
The Klipper configuration is stored in a text file on the Raspberry Pi. Take a look at the example config files in the config directory. The example.cfg file contains documentation on command parameters and it can also be used as an initial config file template. However, for most printers, one of the other config files may be a more concise starting point.
Arguably the easiest way to update the Klipper configuration file is to use a desktop editor that supports editing files over the "scp" and/or "sftp" protocols. There are freely available tools that support this (eg, Notepad++, WinSCP, and Cyberduck). Use one of the example config files as a starting point and save it as a file named "printer.cfg" in the home directory of the pi user (ie, /home/pi/printer.cfg).
Alternatively, one can also copy and edit the file directly on the Raspberry Pi via ssh - for example:
Make sure to review and update each setting that is appropriate for the hardware.
After creating and editing the file it will be necessary to issue a "restart" command in the OctoPrint web terminal to load the config. A "status" command will report the printer is ready if the Klipper config file is successfully read and the micro-controller is successfully found and configured. It is not unusual to have configuration errors during the initial setup - update the printer config file and issue "restart" until "status" reports the printer is ready.
Klipper reports error messages via the OctoPrint terminal tab. The "status" command can be used to re-report error messages. The default Klipper startup script also places a log in /tmp/klippy.log which provides more detailed information.
In addition to common g-code commands, Klipper supports a few extended commands - "status" and "restart" are examples of these commands. Use the "help" command to get a list of other extended commands.
After Klipper reports that the printer is ready go on to the config check document to perform some basic checks on the pin definitions in the config file.
Contacting the developers
Be sure to see the FAQ for answers to some common questions. See the contact page to report a bug or to contact the developers.
Обращаем Ваше внимание, что установка самого Linux, как и его детальная настройка не входит в объемы данной статьи. Детальные руководства по установке Linux на Вашу аппратную составляющую поможет найти Яндекс, Google или Bing.
Данная статья влючает в себя общие этапы для большинства вариантов установки, но при этом не разбирает каждый из вариантов установки детально. В статье используются допущения: например считается что Вы в состоянии установить Linux и настроить его сетевую подсистему. Так же статья расчитана на то, что Вы готовы читать документацию и понимать прочитанное.
Помните, бездумное копирование команд или участков файлов конфигураций - приводит к ошибкам, попытайтесь понять что содержит в себе тот или иной участок копируемого текста.
Для использования программного комплекса Klipper, Вам потребуется:
- Компьютер, с процессором не менее 1Ггц, 512 мб оперативной памяти, а так же один свободный USB порт.
- 8 гб свободного места на диске или другом энергонезависимом носителе, например флешка.
Под это требования подходят почти все одноплатные компьютеры семейства Raspberry Pi, Orange Pi, Banana Pi, Khadas Vim3, Radxa, старые ноутбуки, iMac mini и многое многое другое. В рамках данной статьи будут рассматриваться только одноплатные компьютеры семейства Raspberry Pi а именно:
- Raspberry Pi 3b+
- Raspberry Pi 4b
- Raspberry Pi Zero W
Одноплатный компьютер семейства Orange Pi:
А так же установка на х86 совместимый компьютер:
Установка на другие устройства принципиально не отличается от устройств рассмотренных ниже, но если Вы устанавливаете Linux в первый раз , то настоятельно рекомендуется использование одноплатных компьютеров семейства Raspberry Pi 3b+/4b. Лучше сразу потратить чуть больше денег на беспроблемный одноплатный компьютер, чем потратить кучу времени на то, чтобы заставить его правильно работать. Но этот выбор делает каждый из Вас самостоятельно.
Среди программного обеспечения потребуется (данные программы рекомендуются, но возможно Вы сможете заменить их аналогами).
¶ Настройка sudo
sudo (Substitute User and do, дословно «подменить пользователя и выполнить») — программа для системного администрирования UNIX-систем, позволяющая делегировать те или иные привилегированные ресурсы пользователям с ведением протокола работы. Основная идея — дать пользователям как можно меньше прав, при этом достаточных для решения поставленных задач. Программа поставляется для большинства UNIX и UNIX-подобных операционных систем.
В большинстве случаев грамотная настройка sudo делает небезопасную работу от имени суперпользователя ненужной. Все действия оказываются выполнимы из-под аккаунта пользователя, которому разрешено использовать sudo без ограничений. Имеется возможность запрещать и разрешать определённым пользователям или группам выполнение конкретного набора программ, а также разрешить выполнение определённых программ без необходимости ввода своего пароля.
По умолчанию, команда sudo запрашивает пароль на каждый свой вызов, в случае если вы четко осознаете что вам такое поведение команды sudo избыточно, можно перевести ее в режим без запроса пароля, для этого выполняем следующую команду:
Installing Klipper
¶ для Windows
- Текстовый редактор (например: Notepad++ или VSCode)
- Программа для создания загрузочных дисков (например Rufus)
- Программа для подключения по SSH (например Putty)
- Программа для копирования файлов по FTP (например WinSCP)
¶ Raspbian
Установка данного образа возможна ТОЛЬКО на одноплатных компьютерах семейства Raspberry Pi
Перед установкой образа, его необходимо скачать с сайта Raspberry Pi OS образ прошивки Raspberry Pi OS Lite, либо запустить Raspberry Pi Imager и выбрать в программе этот образ, который она скачает и зальет на карточку сама.
Данный образ содержит в себе минимально необходимый пакет программного обеспечения для запуска операционной системы Linux, его в последствии необходимо будет вносить дополнительные настройки, а так же устанавливать дополнительные пакеты.
Klipper Configuration File
In service start file we show printer.cfg file location in /home/pi. Copy the sample config file to "/home/pi/printer.cfg" and make it readable by any user so that octoprint can read it
If you unplug and plug usb, sometimes serial connection changes from TTYUSB0 to TTYUSB1 (like below picture) so it is better to connect to device by its id.
Enable virtual-sdcard from scratch so that you could start printing from lcd screen, and it works faster since klipper is directly sending commands not octoprint to klipper and klipper to printer.
¶ Armbian
Установка данного образа возможна на почти все одноплатные компьютеры семейств Raspberry Pi, Orange Pi, Khadas и другие.
Перед установкой образа, его необходимо скачать с сайта Armbian OS
На примере Orange Pi Zero 2 Выбираем Buster на ядре 4.9
Данный образ содержит в себе минимально необходимый пакет программного обеспечения для запуска операционной системы Linux, его в последствии необходимо будет вносить дополнительные настройки, а так же устанавливать дополнительные пакеты.
¶ Образ FluiddPi
При установке сборки FluiddPi в данном разделе нас интересует файл fluiddpi-wpa-supplicant.txt.
В типовом для большинства случаев, подключение будет производиться по сети WiFi c использованием пароля.
Открываем данный файл с помощью Notepad++ (Открытие данного файла программами Word, Wordpad и им подобными приведет к повреждению файла настроек). В данном файле нас интересуют строки:
Для примера WiFi сеть будет называться: Klippernet, пароль: SecretPassw0rd2021 - тогда файл конфигурации будет выглядеть следующим образом
Users who have contributed to this file
- Open with Desktop
- View raw
- Copy raw contents Copy raw contents
Copy raw contents
Copy raw contents
These instructions assume the software will run on a Raspberry Pi computer in conjunction with OctoPrint. It is recommended that a Raspberry Pi 2, 3, or 4 computer be used as the host machine (see the FAQ for other machines).
Klipper currently supports a number of Atmel ATmega based micro-controllers, ARM based micro-controllers, and Beaglebone PRU based printers.
Prepping an OS image
Start by installing OctoPi on the Raspberry Pi computer. Use OctoPi v0.17.0 or later - see the OctoPi releases for release information. One should verify that OctoPi boots and that the OctoPrint web server works. After connecting to the OctoPrint web page, follow the prompt to upgrade OctoPrint to v1.4.2 or later.
After installing OctoPi and upgrading OctoPrint, it will be necessary to ssh into the target machine to run a handful of system commands. If using a Linux or MacOS desktop, then the "ssh" software should already be installed on the desktop. There are free ssh clients available for other desktops (eg, PuTTY). Use the ssh utility to connect to the Raspberry Pi (ssh pi@octopi -- password is "raspberry") and run the following commands:
The above will download Klipper, install some system dependencies, setup Klipper to run at system startup, and start the Klipper host software. It will require an internet connection and it may take a few minutes to complete.
Building and flashing the micro-controller
To compile the micro-controller code, start by running these commands on the Raspberry Pi:
Select the appropriate micro-controller and review any other options provided. Once configured, run:
It is necessary to determine the serial port connected to the micro-controller. For micro-controllers that connect via USB, run the following:
It should report something similar to the following:
It's common for each printer to have its own unique serial port name. This unique name will be used when flashing the micro-controller. It's possible there may be multiple lines in the above output - if so, choose the line corresponding to the micro-controller (see the FAQ for more information).
For common micro-controllers, the code can be flashed with something similar to:
Be sure to update the FLASH_DEVICE with the printer's unique serial port name.
When flashing for the first time, make sure that OctoPrint is not connected directly to the printer (from the OctoPrint web page, under the "Connection" section, click "Disconnect").
Configuring OctoPrint to use Klipper
The OctoPrint web server needs to be configured to communicate with the Klipper host software. Using a web browser, login to the OctoPrint web page and then configure the following items:
Navigate to the Settings tab (the wrench icon at the top of the page). Under "Serial Connection" in "Additional serial ports" add "/tmp/printer". Then click "Save".
Enter the Settings tab again and under "Serial Connection" change the "Serial Port" setting to "/tmp/printer".
In the Settings tab, navigate to the "Behavior" sub-tab and select the "Cancel any ongoing prints but stay connected to the printer" option. Click "Save".
From the main page, under the "Connection" section (at the top left of the page) make sure the "Serial Port" is set to "/tmp/printer" and click "Connect". (If "/tmp/printer" is not an available selection then try reloading the page.)
Once connected, navigate to the "Terminal" tab and type "status" (without the quotes) into the command entry box and click "Send". The terminal window will likely report there is an error opening the config file - that means OctoPrint is successfully communicating with Klipper. Proceed to the next section.
The Klipper configuration is stored in a text file on the Raspberry Pi. Take a look at the example config files in the config directory. The Config Reference contains documentation on config parameters.
Arguably the easiest way to update the Klipper configuration file is to use a desktop editor that supports editing files over the "scp" and/or "sftp" protocols. There are freely available tools that support this (eg, Notepad++, WinSCP, and Cyberduck). Use one of the example config files as a starting point and save it as a file named "printer.cfg" in the home directory of the pi user (ie, /home/pi/printer.cfg).
Alternatively, one can also copy and edit the file directly on the Raspberry Pi via ssh - for example:
Make sure to review and update each setting that is appropriate for the hardware.
It's common for each printer to have its own unique name for the micro-controller. The name may change after flashing Klipper, so rerun the ls /dev/serial/by-id/* command and then update the config file with the unique name. For example, update the [mcu] section to look something similar to:
After creating and editing the file it will be necessary to issue a "restart" command in the OctoPrint web terminal to load the config. A "status" command will report the printer is ready if the Klipper config file is successfully read and the micro-controller is successfully found and configured. It is not unusual to have configuration errors during the initial setup - update the printer config file and issue "restart" until "status" reports the printer is ready.
Klipper reports error messages via the OctoPrint terminal tab. The "status" command can be used to re-report error messages. The default Klipper startup script also places a log in /tmp/klippy.log which provides more detailed information.
In addition to common g-code commands, Klipper supports a few extended commands - "status" and "restart" are examples of these commands. Use the "help" command to get a list of other extended commands.
After Klipper reports that the printer is ready go on to the config check document to perform some basic checks on the pin definitions in the config file.
Contacting the developers
Be sure to see the FAQ for answers to some common questions. See the contact page to report a bug or to contact the developers.
Klipper Installation And Update Helper
📋 Please see the Changelog for possible important information !
📢 Disclaimer: Usage of this script happens at your own risk!
🛠️ Instructions:
For downloading this script it is necessary to have git installed.
If you haven't, please run sudo apt-get install git -y to install git first.
After git is installed, use the following commands in the given order to download and execute the script:
🧰 Functions and Features:
Core Functions:
- Installing Klipper to your Raspberry Pi or other Debian based Linux Distribution.
- Installing of the Moonraker API (needed for Mainsail, Fluidd and KlipperScreen)
- Installing several web interfaces such as Mainsail, Fluidd, Duet Web Control or OctoPrint including their dependencies.
- Installing of KlipperScreen (OctoScreen but for Klipper!)
- Updating of all the listed installations above excluding OctoPrint. For updating OctoPrint, please use the OctoPrint interface!
- Removing of all the listed installations above.
- Backup of all the listed installations above.
Also possible:
- Build the Klipper Firmware
- Flash the MCU
- Read ID of the currently connected MCU
- and more .
For a list of additional features please see: Feature List
❗ Notes:
- Tested only on Raspberry Pi OS Lite (Debian 10 Buster)
- Other Debian based distributions can work
- Reported to work on Armbian too
🌐 Sources & Further Information
For more information or instructions to the various components KIAUH can install, please check out the corresponding repositories listed below:
¶ Образ Raspbian
При установке образа Raspbian необходимо выполнить следующие действия:
¶ Учетная запись
Если вы устанавливали образ без использования Raspberry Pi Imager с указанием имени и пароля пользователя ОБЯЗАТЕЛЬНО выполните этот пункт.
Необходимо создать файл userconfig.txt
в нем записываем следующее:Это создаст пользователя pi с паролем rapberry, если у Вас свое мнение на имя и пароль пользователя, то пароль можно сгенирировать на другом Linux выполнив команду:
Вывод команды будет следующим:
где $6$LO5u.gPSv76ARHS/$TMZRDknmB9iqFDppxqsunpEhyemRyezbBCQrKJxDu6VhYSnw7VzHZa3/VDsXAOXV2RJfVvjwSh9tuqWfNFsNq/ - искомый пароль пользователя, в данном случае rapberry.¶ Настройка сети
В типовом для большинства случаев, подключение будет производиться по сети WiFi c использованием пароля.
Создаем текстовый файл wpa_supplicant.conf в появившемся разделе Boot и открываем его текстовым редактором Notepad++, и вносим в него следующую информацию:Для примера WiFi сеть будет называться: Klippernet, пароль: SecretPassw0rd2021 - тогда файл конфигурации будет выглядеть следующим образом:
Кроме того, так же в разделе Boot необходимо создать пустой файл с именем ssh, обращаю внимание что у него не должно быть никакого расширения. Данное файл в этом разделе сообщает системе Raspbian что при загрузке необходимо активировать и запустить SSH Server.
¶ FluiddPi
Установка данного образа возможна ТОЛЬКО на одноплатных компьютерах семейства Raspberry Pi. Данный образ является предсконфигурированным образом, в нем УЖЕ установлен Klipper, Moonracker, Fluidd. Таким образом данный образ позволяет начать пользоваться Klipper'ом максимально быстро. Но как и у всех решений, данное имеет свои нюансы: версия программного обеспечения на нем актуальна на дату формирования образа. Вы вполне можете получить неработоспособную сборку с используемым принтером или отдельными частями конфигурационного файла, так как поддержка принтера или новых возможностей Klipper вышла позже. Даже для данной сборки рекомендуется использование инструмента KIAUH.
Скачиваем актуальную версию образа FluiddPi
¶ Установка на одноплатные компьютеры
Flashing Firmware to Mainboard
To flash klipper to printer, you need determine the serial connnected port by its id. First determine the id:
Klipper On Android - Galaxy S3 - Ender 3 Pro
I've succesfully installed klipper on my old phone Galaxy S3. If you haven't read first part of this topic "Octoprint on Android" please read it, cause i'm assuming you already accomplished the tasks below:
¶ Образ Armbian
При установке образа Armbian необходимо выполнить следующие действия.
После вышеописанных действий отключаем подключенный MicroSD и вставляем его в одноплатный компьютер и включаем его. На этом установка образа системы завершена.
Для установки на прочие, а именно х86 совместимые устройства, рекомендуется выбрать Linux дистрибутив либо Debian, либо Ubuntu LTS.
На сайте Debian расположена достаточно подробная инструкция.
Кроме того в разделе 6.4. Загрузка отсутствующих микропрограмм описан процесс загрузки драйверов для сетевых карт.В процессе установки нужно обратить внимание на:
- Hostname - имя машины в сети;
- Domain name - имя домена, как правило пустое, а если вы не знаете что это, то и подавно пустое;
- Root password - Если поставить данное поле пустым, вы не сможете войти под ученой записью root в консоли, а только через обычного пользователя с использованием su, рекомендуется установить пароль;
- Username - имя пользователя под которым будете работать в дальнейшем (регистр имеет значение!);
При выборе пакетов, следует выбрать:
- SSH Server
- Standard system utilites
По окончанию установки, компьютер перезагрузится. В рамках данной статьи не будет разбираться установка и настройка сетевых интерфейсов, считаем что они работают сразу правильно, даже если они не работают.
На этом этап установки базовой системы Linux завершен.
Binding Octoprint to Klipper
- klipper and octoprint services are running (above)
- Octoprint is connected to klipper
Next action is changing firmware of your printer and if klipper & octoprint does not work you will loose time either finding the problem or converting your printer back to Marlin.
¶ для Mac
- Текстовый редактор VSCode
- Программа для создания загрузочных дисков BalenaEtcher или Raspberry Pi Imager для заливки образа на SD-карту
- И стандартный набор консольных утилит ssh и scp для копирования файлов.
Ни в коем случае не надо пользоваться стандартным Блокнотом или WordPad! Так как спец символы разметки (пробел, табуляция, конец строки и тп.) обрабатываются по разному для операционных систем Windows и Linux.
¶ Разворачивание образа
Ставим MicroSD в кардридер и подключаем его к компьютеру.
Запускаем программу для прошивки образов, в данном случае используется Rufus:
В графе Устройство выбираем MicroSD. Потом нажимаем на кнопку ВЫБРАТЬ и выбираем скаченный ранее образ.
Нажимаем кнопку СТАРТ и ждем пока завершится процесс.При использовании Raspberry Pi Imager следует выбрать из списка Raspberry Pi (other) > Raspberry Pi OS Lite;
Обязательно в настройках выбрать пользователя и указать ему пароль.Setting Klippy-Env Python Version
Klipper needs newer python like octoprint as Debian Jessie is too old. Klipper creates a "klippy-env" folder when installing it, so creating a virtual-env and changing python version in advance helps overcoming problems:
Temporary Files
If temporary files uses too much space, at the end your 4gb image could fill and octoprint/klipper might stop working. Keep an eye on the octoprint main page, under upload file menu you could see the.
- /home/pi/.octoprint/logs/*
- /tmp/*
- /var/log/*
PYTHON SCRIPT
I created a python script that clears all log files, restarts klipper and then change the permission of "/tmp/printer" links. ("sudo nano /home/pi/printer.py")
I also recommend a Tplink smartplug and its octoprint plugin to remotely power on/off your printer (red thunder icon).
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3 contributors
¶ Постнастройка одноплатного компьютера
По окончанию процесса записи образа на MicroSD в проводнике появится новый раздел Boot.
Compiling Klipper for Mainboard
If you can not succeed compiling klipper on a phone, you could do it on a linux and then you could copy the "klipper" folder to your phone. If you don't compile it you won't have the necessary dictionaries etc. and you will have problems. In my case it seems like it was working but when i checked "/tmp/klippy.log", i saw errors of missing build.dict logs.
You need to compile klipper according to your printer board, which for my case ATMEGA 1284P 16Mhz for Ender3 Pro standart board (not the quiet one)
So if everything up to here is successful, start klipper and check for logs whether it works without any warning logs etc. Below commands clear log file, restart klipper and check it's status and log files:
Prerequisites
- Android with printer serial driver installed (ch341 serial driver for Ender3 Pro).
- Debian installed on Android (using Linux Deploy)
- Always on phone (Check my other posts for an always on phone
Fixing Permissions
Читайте также: