{"id":31642291,"url":"https://github.com/chepo92/printandgo","last_synced_at":"2025-10-07T03:58:04.410Z","repository":{"id":314378846,"uuid":"1051816095","full_name":"chepo92/PrintAndGo","owner":"chepo92","description":"Turn your router, rpi, pc in a 3D printer host with wifi functionality","archived":false,"fork":false,"pushed_at":"2025-09-12T04:17:51.000Z","size":240,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"beta","last_synced_at":"2025-09-12T05:51:29.609Z","etag":null,"topics":["3d","3d-printing","3dhost","golang","marlin-firmware","octoprint","octoprint-mimic","openwrt","raspberrypi"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chepo92.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-06T19:23:41.000Z","updated_at":"2025-09-12T04:17:54.000Z","dependencies_parsed_at":"2025-09-12T05:51:34.791Z","dependency_job_id":"a59cdff9-a480-481d-8282-cac20e6eb463","html_url":"https://github.com/chepo92/PrintAndGo","commit_stats":null,"previous_names":["chepo92/printandgo"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/chepo92/PrintAndGo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chepo92%2FPrintAndGo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chepo92%2FPrintAndGo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chepo92%2FPrintAndGo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chepo92%2FPrintAndGo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chepo92","download_url":"https://codeload.github.com/chepo92/PrintAndGo/tar.gz/refs/heads/beta","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chepo92%2FPrintAndGo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278717449,"owners_count":26033542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d","3d-printing","3dhost","golang","marlin-firmware","octoprint","octoprint-mimic","openwrt","raspberrypi"],"created_at":"2025-10-07T03:57:59.091Z","updated_at":"2025-10-07T03:58:04.388Z","avatar_url":"https://github.com/chepo92.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PrintAndGo\n\n3D printer host written in Go language\nConvert any router with a USB port in a 3D printer host, with an Octoprint-like API\nPrintAndGo is a lightweight and simple web based program written in Go to feed gcode to a 3d printer (aka gcode sender, 3d printer host)\nIt offers a convenient webinterface and mimics Octoprints upload API, meaning that common slicer software will be able to directly upload gcode to PrintAndGo.\n\nIt's based in the code of [Takoprint](https://git.sr.ht/~adrian-blx/takoprint) by[Adrian](https://github.com/adrian-bl)\n\n## Features\n\n- Written in Go and Multiplatform: Compile from source for your target device or use the release binaries, run it in your host device. Compatible with Windows and Linux operating systems. Compatible with many target hardware, if your target is supported in Go, it should be compatible \n- Aimed for lightweight: PrintAndGo doesn't need a lot of resources is only a 12MB binary (still not optimized)\n- Low hardware resource requirement: Will work well even on older/or low specs hardware\n- Can run in OpenWRT. This means you can use almost any router with usb port that supports OpenWRT or even in the Creality Wifi Box\n- Compatible with any 3D printer with usb port that has some version of Marlin firmware (or accepts standard gcode over serial)\n- Octoprint emulation: Mimics the basic Octoprint API allowing for direct Gcode upload from various slicers (Cura, PrusaSlicer)\n- Custom hooks: PrintAndGo can execute custom scripts after your print is finished (eg. to turn off your printer).\n- Simple: Web User interface with just the minimum required operations for printing\n- OctoPrint minimal API implementation: Send custom Gcode, and upload file for inmediate printing\n\n- Brief story: this project is related to [OctoWrt](https://github.com/shivajiva101/OctoWrt), and the addition of the Creality WifiBox (WB01) in [OpenWRT](https://github.com/openwrt/openwrt/pull/19686). OctoPrint is a great sofware and tool, but not very optimized, as is written in python, which is also great but nowadays requires more resources than when it first started, I believe that current code will barely run in a raspberry pi 3 (which was the original target hardware as far as I know). I had previously contributed in a Octoprint-like (or mimic) firmware for embedded devices as ESP8266 or ESP32 see [WirelessPrinting](https://github.com/probonopd/WirelessPrinting), but there was missing sofware solution for the intermediate hardware between embedded devices and mini-pc (like a Raspberry pi). So it needed some leverage, then I found [Takoprint](https://git.sr.ht/~adrian-blx/takoprint), and connected everything together\n\n\n## Screenshots\n\n![webinterface](/img/printandgo_home_gui.png)\n\n![webinterface](/img/printandgo_upload.png)\n\n![webinterface](/img/printandgo_printing.png)\n\n![webinterface](/img/printandgo_done.png)\n\n## Build (Win/Linux)\n\nA reasonably recent version of the Go compiler is required to build PrintAndGo (v1.25+) as September 2025\n\n```shell\n$ git clone https://url.to.this/repo\n$ cd PrintAndGo\n$ go build -o ./builds/PrintAndGo.exe .   # in case of windows\n$ go build -o ./builds/PrintAndGo .       # in case of linux\n```\n\nIf you want to cross compile :\n\n```shell\n$ GOOS=linux GOARCH=amd64 go build -o ./builds/PrintAndGoLinux . # Example for a raspberry Pi 3\n$ CGO_ENABLED=0 GOARCH=arm64 go build . # Example for a raspberry Pi 3\n$ GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -o ./builds/PrintAndGo . # Example for MIPS Little Endian\n```\n\n## Build with docker (usually for dev and cross compile)\n\n1. First build the docker image configured in the docker file, this will build the PrintAndGo code too\n`docker build -t go-builder-linux-img:1.0 .`\n\n2. After first time build, can be run\n\n`docker run --rm -v ./:/usr/src/app -w /usr/src/PrintAndGo -e GOOS=linux -e GOARCH=mips -e GOMIPS=softfloat go-builder-linux-img:1.0 go build -v`\n\n3. After first run, can be re-started, with interactive terminal\n`docker start -a -i go-container`\n\n4. In the interactive terminal \n`go build -o ./builds/PrintAndGo .`\n\n5. Once build, copy files back to host (eg. after cross compile, get the binaries)\n`docker cp go-builder:/app/builds/PrintAndGoLinux ./builds/PrintAndGoLinux`\n\n6. If you need to update the source, copy files from host to container (eg. developed new code and need to compile in docker), better to delete previous files if made a lot of changes\n`docker cp ./ go-builder:/app/`\n\n\n### Cross compile\n\nGo can be cross compiled\nExample for MIPS Little Endian\n`GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build .`\n\n1.Build docker image with updated files, no cache if anything changed (for dev), dockerfile and docker image can be modified with cross compile commands\n`docker build --no-cache -t go-dev-linux-img:1.0 -f ./Dockerfile_builder .`\n\nExamples\n`docker run --rm -v ./:/usr/src/app -w /usr/src/PrintAndGo -e GOOS=linux -e GOARCH=mips -e GOMIPS=softfloat go-builder-linux-img:1.0 go build -v`\n\nExamples\n`docker run -d -it --name go-builder go-dev-linux-img:1.0`\n\n### Virtual printer\n\nThere is a virtual printer code used for testing in /util from the original Takoprint repo. \n\n\n## Run \n\n### Run in host machine\n\nIn a shell in windows or linux\n```\n./PrintAndGo  -tty \u003chost_device_path\u003e\n```\n\nExamples:\n```\n./PrintAndGo -tty COM3\n./PrintAndGo -tty /dev/ttyUSB0\n```\n\nPrintAndGo is configured via flags. By default, PrintAndGo will listen on\n`127.0.0.1:5001` and expect a printer on `/dev/ttyUSB0`:\n\n```shell\n$ ./PrintAndGo -h\nUsage of ./PrintAndGo:\n  -baud int\n        baud rate of -port (default 115200)\n  -gcode string\n        file containing gcode\n  -listen string\n        ip:port to bind to (default \"127.0.0.1:5001\")\n  -shutdown-script string\n        script to execute to shutdown the printer (default \"/usr/lib/printandgo-shutdown.sh\")\n  -storage string\n        path to store gcode in (default \"/tmp/printandgo\")\n  -tty string\n        tty to use (default \"/dev/ttyUSB0\")\n```\n\nNote that PrintAndGo only listens on `127.0.0.1` by default. You can tell PrintAndGo to listen on\nall interfaces by running it via:\n\n```\n$ ./printandgo -listen ':5001'\n```\n\n\n### With docker\n\n1. After build, first time run the container, run detached and interactive terminal\nYou need to configure Map the usb device from host to container --device=\u003chost_device_path\u003e:\u003ccontainer_device_path\u003e\n`docker run -p 5001:5001 -d -it --device=/dev/ttyUSB0:/dev/ttyUSB0 --name go-container go-builder-linux-img:1.0`\n\nNote: Mapping usb devices from windows as host to linux involves configuring WSL2, not the aim of this guide\nFor dev or other purposes can be run without mapping usb device\n`docker run -p 5001:5001 -d -it --name go-container go-builder-linux-img:1.0`\n\n2. Run PrintAndGo\n`docker exec -it go-container /app/PrintAndGo -tty /dev/ttyUSB0 -listen 0.0.0.0:5001`\n\nNote: PrintAndGo uses default ip 127.0.0.1 which is local only (cannot access from outside container), on the other hand docker uses 0.0.0.0 for exposing ports and services outside container, so we specify `-listen 0.0.0.0`, the port 5001 is the default of octoprint and can be changed (but need to change the docker file if you want another port)\n\n### Other commands: \n\nStart a previously run container, with interactive shell (useful for build/running commands in the container)\n`docker start -a -i go-container`\n\ninteractive shell access\n`docker exec -it go-container bash`\n\nExcecute command in container \n`docker exec -it go-container /app/myapp -tty /dev/ttyUSB0`\n\nRun in OpWRT\n`./PrintAndGo -tty \u003cUSBdevice\u003e -listen \u003clocalip:port\u003e`\nExample\n`./PrintAndGo -tty /dev/ttyUSB0 -listen 192.168.8.155:5001`\n\n### Webcam\n\nWebcam support is WIP, but should mostly work - as long as your webcam shows up on `/dev/video0`.\n\nNote that certain webcams are extremely power hungry and can cause stability issues on RBPI hardware:\n\nThe excessive power draw of some webcams can cause issues to the USB controller, resulting in 'lost gcode' replies\nwhich will cause the print to stall. This is *not* a bug in PrintAndGo: If you suffer from this issue, get a better\npower supply or/and replace your webcam (or find other ways to feed power to it, like using an active USB hub).\n\nNote that PrintAndGo has an escape hatch for stalled prints: Sending a `USR1` signal to PrintAndGo TTY subprocess\nshould resume the print in most cases:\n\n```shell\n$ ps -ef|grep :serial-pipe   # first, find the subprocess\ntakopri+   351   301  0 09:01 ?        00:00:00 PrintAndGo -tty /dev/ttyUSB0 -baud 115200 :serial-pipe\n$ kill -USR1 351  # send SIGUSR1\n```\n\n### Post print Script\n\nPrintAndGo can be configured to run a command after the print finished. Eg. Automatic shutdown\nBy default, `/usr/lib/takoprint-shutdown.sh` will be executed (can be configured using the `-shudtown-script` flag).\n\nThe script could then execute a command to turn off a 'smart' power plug.\nI'm using a Sonoff device running [TASMOTA](https://tasmota.github.io/docs/) in my setup with the following shutdown script:\n\n```shell\n$ cat /usr/lib/takoprint-shutdown.sh\n#!/bin/bash\n\n# retry 3x as my wifi connection can be crappy:\nfor x in 1 2 3 ; do\n        until wget -O - -q \"http://192.168.2.230/cm?cmnd=Power%20OFF\"\n        do\n                echo \"retry poweroff...\"\n                sleep 3\n        done\n        sleep 1\ndone\n```\n\n# Octoprint API Coverage\n\nPrintAndGo implements the minimum required for printing of the Octoprint [API](https://docs.octoprint.org/en/main/api/index.html)\nSome are just the endpoint with hardcoded response and no logic or validation. \nThe endpoints are coded in [webapi.go](/webapi/webapi.go) and implemented in [octoapi.go](/webapi/octoapi.go)\n\n# Autostart \n\nAcording to [instructions](https://openwrt.org/docs/guide-developer/procd-init-scripts), there is an example file included in the repo to make the script autostart at boot as a service. See: [PrintAndGo-srv](/PrintAndGo-srv), modify it acordingly to your configuration and ip.\n\n\n# Planned features/idea\n\n- [ ] Telegram Notification integration\n- [ ] Homeassistant integration\n- [x] Send custom commands\n- [ ] WebCamStream\n- [ ] Implement other OctoPrint API endpoints\n- [ ] Update serial library\n- [ ] Spread the word\n      - [ ] Hackaday\n      - [ ] Instructables\n\n# Licence\n\nGPLv3. See [licence file](/LICENSE.txt)\n\n\n# Acknowledgement\n\nAdrian Ulrich - Takoprint\nhttps://git.sr.ht/~adrian-blx/takoprint","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchepo92%2Fprintandgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchepo92%2Fprintandgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchepo92%2Fprintandgo/lists"}