====== Octoprint ====== There are three ways to install OctoPrint on a Raspberry Pi: 1.Our Customized OctoPi 2.guysoft/OctoPi 3.Install OctoPrint from source on a Raspberry Pi. ===== Our Customized OctoPi ===== This is the easiest way to use OctoPrint on a Raspberry Pi ==== 1.Download Image ==== [[https://github.com/WEEDO3DTECH/OctoPi/releases/download/v1.8.6/2022-09-22-raspios-bullseye-armhf-lite-eww.xz|Download our custom version of OctoPi]] . ==== 2.Install image tool ==== Download the latest version of [[https://www.raspberrypi.com/software/|Raspberry Pi Imager]] and install it. ==== 3.Flash image ==== Then: * Connect an SD card reader with the SD card inside. * Open Raspberry Pi Imager and choose the Customized OctoPi. {{ :tina2:0flash.png?direct&400 |}}{{ :tina2:1flash-image.png?direct&400 }} * Choose the SD card you wish to write your image to. * Review your selections and click on the Write button to begin writing data to the SD Card. ==== 4.Connect Printer ==== Select TINA2 from the “Printer Profile” settings, and connect the printer with 1000000 baud rate. {{ :tina2:3flash-image.png?direct&400 }} ===== guysoft/OctoPi ===== The latest version of [[https://github.com/guysoft/OctoPi|OctoPi]] is 0.18.0 released on Jan 25, 2021. This version of OctoPi needs to update the serial driver of ch340/ch341. ==== 1.Install Image ==== Unzip the guysoft/OctoPi image and install it to an sd card according to the installation instructions of guysoft/OctoPi. ==== 2.Login ==== Log into your pi via SSH or other means {{ :tina2:3flash.png?direct&400 |}} ==== 3.Delete the older ch340/ch341 serial driver ==== Check if the ch340/ch341 serial driver already exists: ls /lib/modules/$(uname -r)/kernel/drivers/usb/serial/ Delete it: sudo rm /lib/modules/$(uname -r)/kernel/drivers/usb/serial/ch341.ko {{ :tina2:4flash.png?direct&400 |}} ==== 4.Build the newer serial driver and install it: ==== === a)Install the Linux kernel header file: === The Linux kernel version of OctoPi V0.18.0 is 5.4.79, so we download the corresponding header file installation package. wget http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel-headers_1.20201126-1_armhf.deb (If your Linux kernel version is not 5.4.79, download the corresponding one from [[http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/|http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/]] ; \\ Use this command to check which version of your Linux kernel is: **uname -r** ) \\ \\ Install the header file : sudo dpkg -i ./raspberrypi-kernel-headers_1.20201126-1_armhf.deb {{ :tina2:5flash.png?direct&400 |}} === b)Download the CH340/CH341 serial driver source code and unzip it === wget http://www.weedo3dprinter.com/lib/exe/fetch.php/firmware/ch341ser_linux-kernel5.4.79.zip unzip ch341ser_linux-kernel5.4.79.zip {{ :tina2:6flash.png?direct&400 |}} === c)Build it: === cd ch341ser_linux-kernel5.4.79 && make {{ :tina2:6build.png?direct&400 |}} === d)Install it: === sudo cp ch34x.ko /lib/modules/$(uname -r)/kernel/drivers/usb/serial/ sudo depmod {{ :tina2:7copy.png?direct&400 |}} ==== 5.Change OctoPrint source file ==== === a)Test Connection === {{ :tina2:tina2-octoprint-test-connected.png?direct&400 |}} **If you can connect the printer**,skip to section 6. {{ :tina2:tina2-octoprint-test-connection.png?direct&400 |}} **If you can not connect the printer**, you need to change the serial communication python file. === b)change the serial communication python file === Open the serial communication python file. \\ Its path seems like this: /home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py If your python version is not python3.7, just replace “python3.7” with your real version. \\ Write this code after opening the serial port and save it: #set default serial_obj.setDTR(False) serial_obj.setRTS(False) serial_obj.oopen() # force reboot printer time.sleep(0.1) serial_obj.setDTR(True) serial_obj.setRTS(True) time.sleep(1) serial_obj.setDTR(False) serial_obj.setRTS(False) # wait time.sleep(3) (**Be careful**, the OctoPrint source file uses spaces as indent.) {{ :tina2:tina2-octoprint-change-py.png?direct&400 |}} ==== 6.Reboot your Raspberry Pi and Connect the printer with its baud rate ==== === a)Reboot your Raspberry Pi, then add tina2 settings to the profile. === {{ :tina2:tina2-octoprint-settings_1_.png?direct&400 |}}\\ {{ :tina2:tina2-octoprint-settings_2_.png?direct&400 |}}\\ {{ :tina2:tina2-octoprint-settings_3_.png?direct&400 |}} === b)Connect printer with 1000000 baud rate === {{ :tina2:tina2-octoprint-connection.png?direct&400 |}} ===== Install OctoPrint from source on a Raspberry Pi ===== This installation method is a bit complicated, if you do not have programming skills, we do not recommend you to use this method ==== 1.Install OctoPrint ==== Install OctoPrint following the [[https://community.octoprint.org/docs|OctoPrint community documents]]. \\ \\ **If you can connect the printer by baud rate 1000000**, skip to section 4. \\ \\ **If you can not connect the printer with OctoPrint**, continue with section 2 to update the serial driver of CH341: ==== 2.Update serial driver ==== === a)Update your Linux kernel === sudo apt-get update sudo apt-get install raspberrypi-bootloader raspberrypi-kernel sudo reboot === b)Install your Linux kernel header package === sudo apt install raspberrypi-kernel-headers === c)Download the CH340/CH341 serial driver source code and unzip it === wget http://www.weedo3dprinter.com/lib/exe/fetch.php/firmware/ch341ser_linux-kernel5.4.79.zip unzip ch341ser_linux-kernel5.4.79.zip {{ :tina2:5download-source.png?direct&400 |}} === d)Build it: === cd ch341ser_linux-kernel5.4.79 && make {{ :tina2:6build_1_.png?direct&400 |}} === e)Install it: === sudo cp ch34x.ko /lib/modules/$(uname -r)/kernel/drivers/usb/serial/ sudo depmod {{ :tina2:7copy_1_.png?direct&400 |}} ==== 3.Change OctoPrint source file ==== === a)Test Connection === {{ :tina2:tina2-octoprint-test-connected_1_.png?direct&400 |}} **If you can connect the printer**,skip to section 4. {{ :tina2:tina2-octoprint-test-connection_1_.png?direct&400 |}} **If you can not connect the printer**, you need to change the serial communication python file. === b)change the serial communication python file === Open the serial communication python file which is usually placed in the site-packages of the python directory. {your python installed directory}/site-packages/octoprint/util/comm.py Write this code after opening the serial port and save it: time.sleep(0.5) serial_obj.setDTR(False) serial_obj.setRTS(False) (**Be careful**, the OctoPrint source file uses spaces as indent.) {{ :tina2:tina2-octoprint-change-py_1_.png?direct&400 |}} ==== 4.Reboot your Raspberry Pi and connect the printer with its baud rate ==== === a)Reboot your Raspberry Pi, then add TINA2 settings to the profile. === {{ :tina2:tina2-octoprint-settings_1_.png?direct&400 |}} {{ :tina2:tina2-octoprint-settings_2_.png?direct&400 |}} {{ :tina2:tina2-octoprint-settings_3_.png?direct&400 |}} === b)Connect the printer with 1000000 baud rate === {{ :tina2:tina2-octoprint-connection_1_.png?direct&400 |}}