Ender 3 V2

I have recently been playing around with 3D printers. I wasn’t sure if I would like them or use them enough, so I decided to start with a common basic 3D printer: Creality Ender 3 V2. I was surprised to see how much I ended up using it. I wanted to turn the printer off automatically when it completed a print, but there wasn’t anything standard. So, I researched and put together this solution for my specific setup.

A few things to mention about my setup. After my first few prints, I got tired of doing the repetitive workflow to start a print: take out the MicroSD card, plug it into the computer, copy the sliced files, plug it back in the printer, find it using the Ender UI and then start the print. I had a Raspberry Pi 4 lying around from another project, so I installed OctoPrint on it and started using OctoPrint to upload the files wirelessly (and drive the actual prints).

I also had a Switchmate Power lying around, so I decided to hook up the printer to it. Switchmate has Bluetooth Low Energy (BLE), and so does the Raspberry Pi 4, which made a good combination.

To connect it all, I installed a plugin called CooldownNotification. This plugin takes a target bed temperature and triggers a given GCODE command when the bed reaches it. Then I installed another plugin called GCode System Commands, which defines custom GCODE commands that execute command-line scripts. I finally wrote a simple `expect` script that runs the BLE commands to turn off the switch.

Below are some screenshots showing the setup and the accompanying script.

CooldownNotification plugin settings showing the custom code to run when the bed temperature reaches 35 C
GCode System Command settings showing the custom GCODE and it’s accompanying command

Finally, here is the script that sends the BLE command to turn off the 3D Printer port on the swtich.

#!/usr/bin/env expect

spawn "bluetoothctl"
expect "#"
send "connect AD:DR:ES:SX:HE:RE\r"
expect "Connection successful"
send "menu gatt\r"
expect "Menu gatt:"
send "select-attribute a22b0090-ebdd-49ac-b2e7-40eb55f5d0ab\r"
expect "service0020"
send "write 0\r"
send "read\r"
expect ":/service0020"
Back to blog...