I'm smartifying my Prusa MK4 enclosure!
I recently acquired a very nice Original Prusa MK4 with its enclosure (which was quite the labor to put together!).
Prusa MK4 printers are fully compatible with Home Assistant — they have their own built-in integration that allows limited control of prints, and lets the user see the status + a preview of the printout. On that basis, I've already made a dashboard for myself, so I can monitor printing time and state.
Since I'll be printing filaments that emit styrene and other noxious gases, in addition to the enclosure I also ordered the advanced filtration system (and its requisite base board + power supply). The base board and supply can also power and control an LED strip (24 volts), and the board includes a two-push-button front panel to turn the light and the fan on and off (not depicted here).
What does "a smart enclosure" mean?
To me, it means:
- Things that need to happen must be automatic:
- I shouldn't have to push a button to run the fan.
- If the filament I've set the machine to print with is not one of the known non-toxic filaments, the fan shouldn't run needlessly. However, in any other case, the fan should run for the entire duration of the print, and keep going 15 minutes after the printer.
- Then, the fan should be quiet.
- Functionally and aesthetically, it should remain "stock":
- "Digital buttons" notwithstanding, the push buttons on the base board (which attaches to the front panel) should operate correctly, allowing me to manually start and stop both enclosure light and filtration fan as I please.
- Aesthetically, it should look as close to an unmodified Original Prusa enclosure plus the add-ons Prusa Research sells.
- Stretch goal: video dashboard!
- There should be a camera (ideally a device like an ESP32-CAM) filming, that allows me to view what's going on through my Home Assistant office dashboard.
- When the camera is filming, the enclosure light should automatically come on. This should be pretty easy to accomplish with Home Assistant, since an automation can turn the light on when the camera begins streaming, and the light can then be turned off when streaming stops.
The technical parts can be done with an ESPHome-programmed ESP32 device. The aesthetic and functional parts can be done with a little care.
Check out my blog post to learn about this ongoing saga, and maybe copy the techniques for yourself!
RE: I'm smartifying my Prusa MK4 enclosure!
I was thinking about this very idea just this weekend! I've started to always run my fan in the enclosure because I noticed that VOCs still spike in the room the printer is in even when printing with PETG. Since I've been running the fan, it still bumps up, but it's been a lot lower levels.
Are you relying on WiFi for all the ESP and printer connections, or are you using Ethernet?
RE:
FIXME: put final device here (after testing ESP CAM cameras) and insert picture.
To save you some time I recommend esp32-wrover-e boards - they have enough pins to connect camera and additional devices, pure esp32-cam has limited pins unfortunately to connect anything else and in addition it has worse specifications such as memory size or cpu clock.
Another option is to use two boards or i2c multiplexer.
Another idea is to use SSR for relays.
See my GitHub and printables.com for some 3d stuff that you may like.
RE:
Project update!
I have almost completely settled on the final bill of materials. No longer are we going to use relays — instead, MOSFETs will be what powers the high-voltage side of things. I'll be testing a Freenove board and OV5640 camera to go with it; if it works well within the thermal envelope of the case, then that'll be our choice of ESP..
Furthermore, it's likely that we can control the fan speed, and possibly tie the speed to the amount of volatile organic compounds in the case; I will soon be testing both hypotheses to see if they can be factored into the final project.
I'm also half of the way to finishing the design of the 3D-printed enclosure for the electronics. The electronics case is going to look almost completely stock, and almost completely invisible.
Some steps are now concrete, such as the modification of the base board and the fan connector.
The blog post has been updated to include these changes.
Keep your ideas coming!
RE: I'm smartifying my Prusa MK4 enclosure!
You mean just MOSFET or something packed in a more convenient package such as SSR?
BTW I'm doing my own enclosure + smartyfing it and right now I'm testing some sensors such as:
PMSA003 - particulate
SGP41
BME680
ENS160+BME280
For now with PETG and open space it does not show any major changes (well, when I enter the room then there is more change than while printing), so I guess I must finish enclosure to make the fumes more dense inside 😀
See my GitHub and printables.com for some 3d stuff that you may like.
RE: I'm smartifying my Prusa MK4 enclosure!
MOSFET module (as you can see in the blog post).
When it's all done, it will be conveniently packaged up in a triangular corner case that will vanish within the edge of the enclosure.
Keep us posted on the results of the sensors! I think both particulates and VOC values need a close look at.
RE: I'm smartifying my Prusa MK4 enclosure!
BME680
I have one of those in my enclosure and it's a really great device. Trivially integrated with a NodeMCU module and ESPHome into Home Assistant and extremely useful!
Sadly, I have no idea how to interpret the air quality sensor properly. If anyone should have a solution for that, I'd love to hear it. 🙂
RE: I'm smartifying my Prusa MK4 enclosure!
I don't have one of those sensors (yet), I am still using BME280s. But there is an example for interpreting the sensor values on this page (at the bottom of the page):
https://esphome.io/components/sensor/bme680.html
RE: I'm smartifying my Prusa MK4 enclosure!
Huh, I somehow overlooked that one. I guess I'll have to update my ESPHome script to include that.
RE: I'm smartifying my Prusa MK4 enclosure!
Truly awesome. I wonder if I could route the cable to the sensor so I can place the sensor right at the input of the fan (where the filter is), get measurements of the pre-filtered air to see when the fan should stop.
Please keep us posted with measurements and I'll see how I can integrate that exact sensor into the build. I'm thinking there'll be a fan control exposed to home assistant that lets the user select between "auto" (meaning run until the air is clean) and "manual". Suggestions welcome.
RE:
quick update: looks like pmsx003 provides most usable info regarding to the air quality in the enclosure - it noticeably goes up during print.
I need to test other ones tomorrow, because I had to change esp32 devices, one was really having poor signal quality, and when it gets reset then under esphome there is no option (I guess) to restore state that was processed after hours of work for the sensor in the same spot (that is changing/resetting esp32 will drop data device gathered over the period of time to calibrate itself)
The graphs are total mess now (due the fact I changed devices), so expect some base 'nothing happens' vs 'I print PETG' example tomorrow in the evening (24h since posting this post)
See my GitHub and printables.com for some 3d stuff that you may like.
RE:
Quick morning test, sensors about 5cm in front of the Prusa Mini+ front and just a bit under the bed surface.
50min PETG print, below is a last 6h,
- 08:30 - I entered the room and we can see CO2 going up slowly
- 09:35 - I started printing with 09:40 noticeable increase in the graphs.
- 10:30 - print ended and there is a short peak in temps because fan on the hotend was no longer spinning.
- 11:00 - I left the house, windows closed
- 12:25 - I returned to the house and the room.
See my GitHub and printables.com for some 3d stuff that you may like.
RE: I'm smartifying my Prusa MK4 enclosure!
second print, the same model; now it's time to air vent the room 🙂
See my GitHub and printables.com for some 3d stuff that you may like.
RE:
Interactive graphs https://snapshots.raintank.io/dashboard/snapshot/zHSfgfqIpEOFIXw662qDkFKIUwfDIHAM
one more note, on the second print I placed sensors in the upper part of the enclosure (close to ceiling), so it looks like particulate likes to float there with hot air.
See my GitHub and printables.com for some 3d stuff that you may like.
RE:
Good news! I've obtained the Freenove ESP32-S3-WROOM, an OV5640 camera with 120 degree angle, and some heat sinks for the camera. The blog post has been updated with instructions on how to put together the camera and the heat sinks. Slow progress, but here we go anyway!
Here is the Freenove device running within Home Assistant. I get 2.5 FPS at 640x480 and 1.5 at 1024x768 when viewing the video through Home Assistant, and three to four times that when streaming the video using the MJPEG web camera stream ESPHome component.
RE:
Further good news! As documented now in the blog post, I have managed to change the connector on the fan to a JST XH 4-pin connector.
Not documented, but done: I have reverse-engineered the PWM and tachometer signals from the fan. This has allowed me to adjust the speed of the fan as well as write code that can detect if the fan is dead when it shouldn't be.
RE:
Guess what's in the mail...
That's right! The circuit board is complete. It's designed to be soldered using through-hole components so anyone can build it at home. The bill of materials is almost ready to be published.
Once assembled and tested, with proper instructions written, I will release the CAD and PCB files.
RE:
The PCB arrived. I put everything together. Buttons worked fine, but the fan refused to start on-PCB. Doing some circuit analysis with my multimeter (stupidly, with the supply power connected), I accidentally bridged 24 volts fan to ESP32 input pin, frying the ESP32 in the process. Oh well...
I have to do some more testing to figure out what went wrong with the fan, but I suspect a faulty solder point . I also ordered a second revision of the PCB with larger through-holes to make inserting of certain components and soldering easier. Finally, I'm waiting on more ESP32 devices as well as a BME688 air quality sensor for the project, since the SEN54 I had planned to use... no one is shipping (and it's also more expensive than the SparkFun package).
The project page has been updated with the new information.
RE: I'm smartifying my Prusa MK4 enclosure!
The project is almost completely done. All we're missing is documentation and the testing section!
It's working! The fan is automatic using a BME688 sensor, the lights work, and the camera works as well.
Check the page out again — all instructions are complete.