Bladeren bron

started writing about 3d printing stuff. not all pages filled yet.

Thomas Buck 5 jaren geleden
bovenliggende
commit
0a5cffa26e

+ 21
- 0
input/projects/3d-printing.md Bestand weergeven

@@ -0,0 +1,21 @@
1
+title: 3D Printing
2
+description: Reports of my different endeavours in 3D printing
3
+parent: projects
4
+position: 5
5
+---
6
+
7
+# {{ page.title }}
8
+
9
+In 2016 I've started experimenting with 3D printers.
10
+In the meantime, I've modified my printers quite a bit and also written about it.
11
+Here are all the articles that are part of my 3D printing series:
12
+
13
+<!--%
14
+mpages = [p for p in pages if p.get("parent", "") == "3d-printing" and p.lang == "en"]
15
+mpages.sort(key=lambda p: int(p["position"]))
16
+for p in mpages:
17
+    print "  * **[%s](%s)**" % (p.title, p.url) # markdown list item
18
+%-->
19
+
20
+If you're interested in my 3D print designs, take a look [at my Thingiverse account](https://www.thingiverse.com/xythobuz/designs) or my [Git Repository](https://git.xythobuz.de/thomas/3d-print-designs).
21
+

+ 28
- 0
input/projects/3d-printing/ctc-i3.md Bestand weergeven

@@ -0,0 +1,28 @@
1
+title: CTC i3 Pro B
2
+description: My modifications for the CTC i3 Pro B
3
+parent: 3d-printing
4
+position: 20
5
+comments: true
6
+flattr: true
7
+---
8
+
9
+<span style="font-size: small;">[...back to 3D-Printing overview](3d-printing.html)</span>
10
+
11
+# {{ page.title }}
12
+
13
+**More content coming soon!**
14
+
15
+* Power Supply Replacement
16
+* Heatbed Replacement
17
+* MOSFET for Heatbed
18
+* Y-Axis Replacement
19
+* Y-Carriage Replacement
20
+* Y-Carriage Webcam Mount
21
+* X-Axis Replacement
22
+* X-Carriage Replacement
23
+* Experiments with Dual Extrusion
24
+* Z-Axis Top Fix
25
+* Frame Braces
26
+* Raspberry Pi Addon
27
+* Power Button
28
+

+ 25
- 0
input/projects/3d-printing/fabrikator-mini.md Bestand weergeven

@@ -0,0 +1,25 @@
1
+title: Fabrikator Mini
2
+description: My modifications for the TinyBoy Fabrikator Mini
3
+parent: 3d-printing
4
+position: 10
5
+comments: true
6
+flattr: true
7
+---
8
+
9
+<span style="font-size: small;">[...back to 3D-Printing overview](3d-printing.html)</span>
10
+
11
+# {{ page.title }}
12
+
13
+**More content coming soon!**
14
+
15
+* Z-Axis wobble fix
16
+* X, Y, Z axis fans
17
+* Part Fan
18
+* Feet
19
+* Display mount
20
+* Spool mount
21
+* Webcam Mount
22
+* Raspberry Pi mount, powersupply
23
+* Heatbed Mod
24
+* Relais board mount
25
+

+ 14
- 0
input/projects/3d-printing/ikea-lack.md Bestand weergeven

@@ -0,0 +1,14 @@
1
+title: Ikea Lack Table DIY
2
+description: Another iteration of the DIY Ikea Lack 3D printer shelves
3
+parent: 3d-printing
4
+position: 40
5
+comments: true
6
+flattr: true
7
+---
8
+
9
+<span style="font-size: small;">[...back to 3D-Printing overview](3d-printing.html)</span>
10
+
11
+# {{ page.title }}
12
+
13
+**More content coming soon!**
14
+

+ 208
- 0
input/projects/3d-printing/octoprint.md Bestand weergeven

@@ -0,0 +1,208 @@
1
+title: OctoPrint Setup
2
+description: Setting up OctoPrint and some common improvements
3
+parent: 3d-printing
4
+position: 30
5
+comments: true
6
+flattr: true
7
+---
8
+
9
+<span style="font-size: small;">[...back to 3D-Printing overview](3d-printing.html)</span>
10
+
11
+# {{ page.title }}
12
+
13
+All my 3D printers are connected to a Raspberry Pi running [OctoPrint](https://octoprint.org/).
14
+For ease of use, I suggest downloading and installing a pre-made [OctoPi image](https://octoprint.org/download/).
15
+Here on this page I describe some common steps and improvements I do on each of them.
16
+
17
+### Controlling a Power Supply
18
+
19
+To turn the power for the 3D printer on and off from within OctoPrint, there are different methods available depending on the setup of your 3D printer.
20
+If you are using a standard fixed-voltage brick power supply, you can use a cheap relais board to switch the power between your supply and the printer.
21
+If however you are using an ATX power supply, you can not only power the Raspberry Pi from the 5V standby rail, you can also turn the rest of the power supply, and therefore the printer, on and off using the corresponding signal of the ATX supply.
22
+By default, the purple cable will carry the 5V standby power, and the green cable needs to be pulled low to turn the supply on.
23
+
24
+I've decided to simply use the GPIOs at the top of the Raspberry Pi pinheader normally used for I2C, as they already contain pullup resistors.
25
+
26
+[Here are some hints on how to use a relais board with the Raspberry Pi](https://github.com/foosel/OctoPrint/wiki/Controlling-a-relay-board-from-your-RPi#modify-the-5v-relay-board-to-run-off-of-rpi-33v-gpio-pins-sainsmart-5v-relay-from-amazon).
27
+
28
+[Here are the instructions to add commands for controlling the printer power](https://github.com/foosel/OctoPrint/wiki/Controlling-a-relay-board-from-your-RPi#manual-way). I'd suggest using this way of adding some system actions to OctoPrint, as these can also be used from the Telegram Plugin for example. This is not the case when using the PSU Control Plugin in OctoPrint.
29
+
30
+### Automatically Connect to Printer
31
+
32
+[Bernd Zeimetz has a great writeup on how to auto-connect to the serial port](https://bzed.de/post/2017/11/octoprint_autoconnect_printer/) of your 3D printer. Here is the very brief version of it:
33
+
34
+Create the script `/home/pi/connect_octoprint.py` with the following contents:
35
+
36
+<pre class="sh_python">
37
+#!/home/pi/OctoPrint/venv/bin/python
38
+
39
+OCTOPRINT_URL = 'http://localhost:5000/api/connection'
40
+API_KEY = 'AAABBB000YOURAPIKEYHERE000BBBAAA'
41
+BAUDRATE = 115200
42
+
43
+import requests
44
+import sys
45
+
46
+port = sys.argv[1]
47
+headers = {'X-Api-Key': API_KEY}
48
+json = {
49
+  "command": "connect",
50
+  "port": port,
51
+  "baudrate": BAUDRATE,
52
+}
53
+
54
+r = requests.post(
55
+        OCTOPRINT_URL,
56
+        json=json,
57
+        headers=headers
58
+)
59
+
60
+if (r.status_code == 204):
61
+    sys.exit(0)
62
+else:
63
+    print(r)
64
+    sys.exit(1)
65
+</pre>
66
+
67
+Make sure to replace the API Key from your OctoPrint user settings page.
68
+Also change the baudrate if needed.
69
+
70
+Now create the file `/etc/systemd/system/octoprint_connect@.service` with the following contents:
71
+
72
+    [Unit]
73
+    Description=Connect printer to OctoPrint automatically
74
+    BindsTo=dev-%i.device
75
+    After=dev-%i.device
76
+
77
+    [Service]
78
+    Type=oneshot
79
+    User=pi
80
+    RemainAfterExit=yes
81
+    ExecStart=/home/pi/connect_octoprint.py /dev/%I
82
+
83
+To make the new service usable:
84
+
85
+<pre class="sh_sh">
86
+sudo systemctl daemon-reload
87
+</pre>
88
+
89
+Find out the USB Vendor and Product ID of the 3D printer serial port:
90
+
91
+<pre class="sh_sh">
92
+lsusb -v | grep -iE ‘(^bus|idvendor|idproduct)’
93
+</pre>
94
+
95
+Then create the file `/etc/udev/rules.d/3dprinter.rules` and modify its contents with the IDs you got from the previous step:
96
+
97
+    KERNEL=="tty*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", \
98
+        TAG+="systemd", ENV{SYSTEMD_WANTS}="octoprint_connect@%k.service"
99
+
100
+That should be it. If it doesn't work, there's some debugging hints in the article linked above.
101
+
102
+### Physical Power Button
103
+
104
+Besides controlling eg. an ATX power supply or a relay connecting the printer to the power supply, I also wanted a push-button connected to the Raspberry Pi that can toggle the power supply using the aforementioned connection on the Pi.
105
+This can be solved using a simple Python script.
106
+For this, we also need to install a small dependency:
107
+
108
+<pre class="sh_sh">
109
+sudo apt-get install python3-rpi.gpio
110
+mkdir ~/button-script
111
+vim ~/button-script/power.py
112
+</pre>
113
+
114
+and enter something like this:
115
+
116
+<pre class="sh_python">
117
+#!/usr/bin/env python3
118
+
119
+import time
120
+import RPi.GPIO as GPIO
121
+
122
+sleep_timeout = 1000
123
+sleep_toggle = 5.0
124
+pin_button = 5
125
+pin_power = 3
126
+
127
+GPIO.setmode(GPIO.BOARD)
128
+GPIO.setwarnings(False)
129
+
130
+GPIO.setup(pin_button, GPIO.IN)
131
+GPIO.setup(pin_power, GPIO.IN)
132
+GPIO.setup(pin_power, GPIO.OUT, initial=GPIO.input(pin_power))
133
+
134
+while True:
135
+    channel = GPIO.wait_for_edge(pin_button, GPIO.FALLING, timeout=sleep_timeout)
136
+    if channel is not None:
137
+        GPIO.output(pin_power, not GPIO.input(pin_power))
138
+        time.sleep(sleep_toggle)
139
+
140
+GPIO.cleanup()
141
+</pre>
142
+
143
+Of course, you may need to adjust the pin numbers or the logic if you're not using an active-low switch.
144
+Make the script executable and create a bootup-script to autostart it:
145
+
146
+<pre class="sh_sh">
147
+chmod a+x ~/button-script/power.py
148
+sudo vim /etc/init.d/octopi-power-button
149
+</pre>
150
+
151
+And enter the following:
152
+
153
+<pre class="sh_sh">
154
+#!/bin/sh
155
+/home/pi/button-script/power.py &
156
+</pre>
157
+
158
+Now also make this script executable, register it for execution on boot, and run it for the current session:
159
+
160
+<pre class="sh_sh">
161
+sudo chmod a+x /etc/init.d/octopi-power-button
162
+sudo update-rc.d /etc/init.d/octopi-power-button defaults
163
+sudo /etc/init.d/octopi-power-button
164
+</pre>
165
+
166
+Now every time you press the button (with a 5s debounce delay afterwards) the printer power will be toggled.
167
+
168
+### Automatic Photo Upload
169
+
170
+As you may have seen, all my 3D printer are [uploading a photo every 5 minutes](printer.html) to this webserver.
171
+Achieving this is very simple.
172
+First, you have to ensure that you can do a passwordless key-based ssh login from your Raspberry Pi running OctoPrint to your webserver. For this, you may need to generate an ssh key on your Pi:
173
+
174
+<pre class="sh_sh">
175
+ssh-keygen
176
+</pre>
177
+
178
+For the prompts just press enter, the defaults are fine.
179
+Then, copy the contents of the newly generated public key in `~/.ssh/id_rsa.pub` to your webserver into the `~/.ssh/authorized_keys` file.
180
+Test the connection and accept the prompt when connecting for the first time, in my case:
181
+
182
+<pre class="sh_sh">
183
+ssh thomas@xythobuz.de
184
+</pre>
185
+
186
+Now, create a new script somewhere:
187
+
188
+<pre class="sh_sh">
189
+mkdir ~/foto-script
190
+vim ~/foto-script/upload.sh
191
+</pre>
192
+
193
+and fill it with the following contents:
194
+
195
+<pre class="sh_sh">
196
+#!/bin/bash
197
+wget -O printer.jpg http://127.0.0.1:8080/?action=snapshot
198
+scp printer.jpg thomas@xythobuz.de:/var/www/xythobuz/printer.jpg
199
+rm printer.jpg
200
+</pre>
201
+
202
+Of course, you may need to adjust the destination path on your webserver.
203
+Finally, add the script as a cronjob using `crontab -e`:
204
+
205
+    */5 * * * * sudo -u pi /home/pi/foto-script/upload.sh >/dev/null 2>/dev/null
206
+
207
+And that's it. An updated photo will appear on your webserver every 5 minutes.
208
+

Laden…
Annuleren
Opslaan