#transcript #sensorbox #made-with-layers #youtube # I made it easier to measure your 3D printer's emissions! — Made with Layers YouTube's manually-uploaded English captions (yt-dlp, `en` subs — not auto-generated, so names and punctuation are clean), collapsed into ~30–40 s paragraphs. Distilled in [[Sensorbox V2 Build Video Notes]]; project note: [[Sensorbox V2]]. Source: https://www.youtube.com/watch?v=OzFAtCZh_fM · Made with Layers (Thomas Sanladerer) · uploaded 2024-11-19 · 17:10 # Links from the description - Print files, parts list, PCB order files: https://www.printables.com/model/1079858-3d-printer-emission-sensor-array-sensorbox-v2 - Home Assistant setup: https://www.home-assistant.io/installation/ - ESPHome setup in Home Assistant: https://esphome.io/guides/getting_started_hassio.html - JLCPCB (sponsor): https://jlcpcb.com/?from=TSPCB # Transcript **[0:00](https://youtu.be/OzFAtCZh_fM?t=0)** This is my next-generation sensorbox for  monitoring 3D printer emissions and general air quality in your home. You can kit it out  with sensors for particles, VOCs, formaldehyde, carbon monoxide and dioxide, and this one,  I’ve optimized to be as easy as possible to build and to use the cheapest possible  parts that still give you good measurements and help you quantify how safe or unhealthy your  environment is. And the best part: The button I put on top has the most satisfying click ever. This dims the screen if you want to put it in your bedroom - but everything about this  is totally customizable! This is simply **[0:41](https://youtu.be/OzFAtCZh_fM?t=41)** a better version of the box I used in  my video measuring printer emissions, and in this video, I’ll show you every step  for how to build one yourself and also, how the software works that runs this box  and how it then logs it all for you to dig through the data or automate alerts or turn  on ventilation units and air filters based on thresholds you set. Spoiler: It’s Home  Assistant, which makes everything super easy. And to build this Sensorbox, I’m using  a custom PCB from today’s sponsor, JLCPCB! I love designing PCBs - for me, they  make electronics projects a whole lot easier, and the final product feels so much more  professional and finished vs. chucking a **[1:22](https://youtu.be/OzFAtCZh_fM?t=82)** breadboard in there or soldering up a proto PCB.  I considered doing a tutorial for building this sensorbox for both the new version with a  PCB, and the old version with jumper cables, but ordering five of these PCBs with shipping  costs less than five bucks from JLCPCB, so there’s literally no reason not to build the nicer version  using a PCB. This is a simple two-layer PCB, but JLCPCB right now also has a special offer for  six-layer PCBs with free tenting for Via-in-Pad to optimize your routing efficiency and electrical  performance. JLCPCB checks all 6-layer PCBs with a **[2:00](https://youtu.be/OzFAtCZh_fM?t=120)** full 4-wire test, and you can get your own designs  or the one for this project made within 48 hours, starting at just $2 plus shipping. Thanks again  to JLCPCB, check them out at the link below. Okay, so first of all, this is a project  based on an ESP32 microcontroller, and instead of using pure Arduino code to talk  to each of the components and analyze the data, I’m using the ESPHome framework. ESPHome  comes with drivers for tons of sensors, inputs, outputs and makes it super simple  to then do something useful with that data, be it just displaying it on a screen or  controlling something like a relay output **[2:39](https://youtu.be/OzFAtCZh_fM?t=159)** based on sensor thresholds. But ESPHome is  also a part of the Home Assistant project, so it’s really well integrated into that as well.  HomeAssistant is basically a self-hosted smart home hub that can connect with many of the “smart”  devices in your home, and then lets you monitor and control them through the same interface, no  matter what manufacturer or interface they use. So for example, you could have a Hue bulb flash  red when the air quality sensor detects unsafe particle levels in your printer room, but only  when you’re home. When you’re not home, you can **[3:13](https://youtu.be/OzFAtCZh_fM?t=193)** have a Zigbee Smoke detector trigger an alarm on  your phone. I also have it controlling my basement dehumidifiers with a simple smart plug, so that  they only turn on when my SMA solar inverters report there is enough solar power available. Also, HomeAssistant automatically logs all the data it receives and you can view  that with graphs and statistics. It’s just a super neat system, it doesn’t lock  you into yet another proprietary cloud service, so whether or not you’re building a Sensorbox,  if you have any sort of smart devices, I’d absolutely recommend installing Home  Assistant and playing around with it. Just **[3:52](https://youtu.be/OzFAtCZh_fM?t=232)** grab a spare Raspberry Pi or set it up in a  VM on your NAS - I run mine in a VM on Unraid. Also, for this project, I found it’s overall the  best way to set up and manage the sensorbox with the ESPHome addon right inside Home Assistant. There are plenty of excellent tutorials on getting started with Home Assistant, so I’m not  going to go into details here, but in any case, make sure you do get the full Home Assistant  OS, if you just run it in a Docker container, you don’t quite get the full functionality. I’m  going to link a good tutorial in the description below. Once the basic Home Assistant setup is  done, you can grab the ESPHome addon inside **[4:29](https://youtu.be/OzFAtCZh_fM?t=269)** Home Assistant, link below as well, and we’re  ready to get to the Sensorbox hardware itself. For this, you’ll need: The printed parts for the case The main PCB The main components, like the ESP, display, a DC-DC converter,  a button, headers, and a couple of screws and of course, the set of  sensors that you want to use Let’s start with the printed parts: You’ll end  up with a controller puck that is fully built and functional, and that then simply  slides into the outer shell. This made everything easy to assemble and easy to  print. The shell gets printed upside down, **[5:04](https://youtu.be/OzFAtCZh_fM?t=304)** it doesn’t need any support material and you can  print it from any material and color you like. The other parts are the spacers for the screen  and the shelf for mounting the wired sensors, and both of those are also simple prints  that any printer should be able to handle. Next, the main PCB. Ordering these online  is super simple, you just upload the zip file with the design, select the lead-free  option, and with the cheapest shipping, for less than five bucks you’ll have five  of these PCBs in your hands in just about two weeks time - which is how long the rest of  parts will take as well if you order them from Aliexpress. You don’t have to fully populate  all the sensors, so you can use the rest of **[5:42](https://youtu.be/OzFAtCZh_fM?t=342)** the boards for simpler setups that just monitor  basic air quality - more on that in a second. Then, the basic components for the electronics  build. The video description will have the full list in there with all the details, but in  short, you’ll need an ESP32-S2, these are usually about two bucks, a simple DC-DC converter  to support the 3.3V supply, a standard button, a couple pin headers and sockets, a few screws,  and an LCD screen. The standard 2.8” LCD screen is cheap and pretty large, though it doesn’t  have the greatest viewing angles. I found it’s the best compromise for now, and this is what  the software is set up for out of the box, **[6:22](https://youtu.be/OzFAtCZh_fM?t=382)** but the PCB also has headers for a smaller,  but surprisingly crisp 1.3” IPS screen, and a 2.13” e-ink panel, so if you want to use one  of those, the hardware fully supports them. And lastly, the sensors. There are four  different classes of sensors that we’re using here - temperature and humidity, which  is just generally useful information, but also, some other sensors need that info for reference. Then, a CO2-specific sensor, which is super useful for knowing when your indoor air is “used up” from  just living and breathing in there, but not useful at all for measuring 3D printer emissions. If  your printer emits CO2, it’s literally on fire, **[7:02](https://youtu.be/OzFAtCZh_fM?t=422)** and I think a classic smoke detector would  do a much better job at alerting you to that. Then, a particle sensor, which is  the largest, most expensive sensor, but also the one that gets you the most meaningful  data for measuring FDM 3D printer emissions and for general air quality degradation from  things like fires and combustion heaters. And lastly, the gas and VOC sensors, which  I’ve found to not be super necessary for FDM, but highly useful for resin printing. The PCB allows you to plug in a whole range of sensor boards so that you can mix and match as  you’d like. All these sensors work with ESPHome and are available as cheap plug-and-play breakout  boards. I’ve ordered all of mine from Aliexpress, **[7:40](https://youtu.be/OzFAtCZh_fM?t=460)** they tend to be the cheapest there with all the  sales and discounts they’ve always got going on, but you can also find most of them on Amazon  or on one of the many Arduino- or Raspberry Pi specialized shops. Some have subtle  variations in the versions you can get, and again, the components list  has the details on which ones to get. Here are the sensor loadouts I would  recommend for the different applications. For FDM printing, get an AHT20 + BMP280 board for  basic temperature, humidity and pressure data, then add an SGP30 for overall VOC measurement,  and finally, a PMS5003 for particle counts. For resin printing, again, AHT20 + BMP280, then  the SGP30, but instead of the particle sensor, **[8:23](https://youtu.be/OzFAtCZh_fM?t=503)** get a ZE-08 formaldehyde-specific  sensor. General VOC sensors also have some sensitivity to formaldehyde, and the ZE-08  will also show some response to other VOCs, but having the two different sensors will  help with determining whether you’ve just got some ethanol fumes in the air, which standard  VOC sensors are generally very sensitive to, or some more nasty stuff like formaldehyde,  which the ZE-08 will show more clearly. And lastly, for a setup for general home  air quality monitoring, AHT20 with BMP280, and combined with something like the  SGP30 will be a pretty decent approximate **[8:59](https://youtu.be/OzFAtCZh_fM?t=539)** air quality indicator. If you live in an area  with lots of wood-burning fireplaces or live near a busy road and want to keep an eye on pollution  from that, particle counts are pretty relevant, so add a PMS5003, and if you want to a  precise indicator of CO2 for indoor air, add an SCD40 CO2 sensor. Of course, you can use or leave out whatever combination you want,  but this is just what I find most effective. The PCB also has optional headers for  plugging in a couple of more specialized sensors. There’s a header for connecting  a modified MQ-7 carbon monoxide sensor, **[9:36](https://youtu.be/OzFAtCZh_fM?t=576)** which can be useful for monitoring open  fireplaces, or gas furnaces, but isn’t really useful for 3D printing. Maybe for laser cutting? Then, you can plug in an ENS160 VOC sensor, which is a low-cost sensor that doesn’t always produce  repeatable VOC measurements, so when I used it, I had two of them plus another type to verify.  These usually come with an AHT20 temperature and humidity sensor on the same board, but  the readings from that are not very helpful because the ENS160 tends to heat up the entire  board. But the ENS160 has one quite useful feature - it’s very cheap, and it reports an  approximate CO2 level based on its readings, **[10:13](https://youtu.be/OzFAtCZh_fM?t=613)** similar to what the SGP30 does. And that estimated  level is, I mean, not always perfectly accurate, but surprisingly often it’s close enough to the  true CO2 levels that if you only need a rough good or bad indicator, it can certainly  do that job for a fraction of the cost of what a “real” CO2 sensor like the SCD40 costs. And also, you can swap in an SGP41 instead of the SGP30 - that’s a different and newer sensor, but  with ESPHome, the SGP41 only reports sort of a VOC index instead of an actual concentration in ppm,  so for now, I would say the SGP30 is more useful. **[10:51](https://youtu.be/OzFAtCZh_fM?t=651)** I’ve also put a spare header for the I2C bus onto  the board, so if you want to modify the config and use your own sensors, for example for something  like a combined SEN55, you can plug them in there. There’s a header for addressable LEDs like  the WS2812, and the spare GPIOs from the ESP32 S2 also broken out, so solder a pin header onto  those and use them for whatever you can dream of. Alright, let’s get to building. You should start  by flashing the ESP32-S2. The easiest way to do that is to plug the ESP into a computer, and then  using a Chrome-based browser and the ESPHome Web **[11:28](https://youtu.be/OzFAtCZh_fM?t=688)** Flasher. Get the ESP into the bootloader mode by  holding the “0” button while plugging in, then select the serial port and flash the basic ESPHome  firmware. If it fails to connect, leave it plugged in, then hold the “0” button again, briefly tap  “RST”, and finally let go of the “0” button. Once the firmware is flashed, unplug and replug  the ESP, connect one more time and use the web flasher to connect the ESP to your WiFi. Now, if you head over to the ESPHome addon in Home Assistant, it will automatically find  and show the new ESP. Click adopt, and then head up here into the “secrets” menu and fill  out your WiFi name and password. Yes, I know, **[12:07](https://youtu.be/OzFAtCZh_fM?t=727)** we just did that, but this is just extra insurance  to make sure things go smoothly. Hit “save”, then for the new ESP, edit the config and replace  it with the sample config for the sensorbox and use the “Install” button to flash it over WiFi.  This will take a minute or two, and if you ever want to make changes to the config, you can simply  edit it here, and reflash it the exact same way. Finally, to get the sensors to show up in Home  Assistant, head over to the Home Assistant settings, and again, it should show up  automatically as a new device. If not, head back to the ESPHome tab, and open up the logs  for your new ESP. Note the IP address it received, then head over to Settings - Devices and  Integrations - Add Integration - ESPHome, **[12:48](https://youtu.be/OzFAtCZh_fM?t=768)** and fill in the IP address of your new  ESP. This will create a new device in Home Assistant that will hold all the sensor  readings that the Sensorbox collects. Alright, the rest of the build is  easy, and that’s the hardware. We got all of the firmware work out of the way  first, because once everything is assembled, the ESP is going to be a little bit inaccessible. So, let’s get the PCB assembled. There are two components that get soldered directly to the PCB,  and the rest plugs into headers. Start with the pushbutton up top, make sure it sits flush all  the way pushed against the PCB, and then add the DC-DC converter the right way around, there’s a  bit of a graphical layout help on the silkscreen. **[13:25](https://youtu.be/OzFAtCZh_fM?t=805)** Then, it’s on to adding the headers for  the sensors you’re going to use. You can either populate just the ones you’ll be  using, or fill in everything for maximum flexibility. When you’re soldering the headers  for the ESP, it helps to plug in the ESP board into the headers to keep everything aligned.  The headers on the left side for PMS, ZE08, addressable LEDs and so receive pins, all the  others get sockets. Then install sockets for the display from the opposite side. There are also two spots for adding an electrolytic capacitor, one for 5V and  one for 3.3V. If you end up having trouble with random reboots or instability, adding  capacitors can often help in fixing those. **[14:03](https://youtu.be/OzFAtCZh_fM?t=843)** Next up is soldering the pins to the  sensor PCBs. These come unsoldered, and the PCB is laid out so that all  of the carrier PCBs are oriented with the sensor element facing away from the  main PCB. When you’re soldering these, try to cover up the sensor element with something  so that you don’t get any flux splatter on them. The ZE-08 formaldehyde sensor and the PMS5003  particle sensor come with a ribbon cable and, my recommendation is crimping some  simple “Dupont” style connectors to them, but if you don’t care much for crimping, **[14:36](https://youtu.be/OzFAtCZh_fM?t=876)** you can also just take a shortcut and solder the  wires directly to the PCB, then add some hot glue for strain relief. Here is the pinout for  hooking up the ZE-08 and for the PMS5003. When you’ve plugged in all the sensor boards  and the ESP, you can add the printed frames. You should be able to screw an M3 or similar-sized  screw directly into the screen spacer. Use a 25mm screw from the sensor side to sandwich the PCB  between the rear shelf and the screen spacer, then mount the wired sensors you’re using onto  the shelf. So that would be the ZE-08, PMS, or MQ-7, if you want to use one of those.  There’s not a lot of spare height here, **[15:12](https://youtu.be/OzFAtCZh_fM?t=912)** so try to get them pretty flush onto the spacer. Then, on the other side, plug in the screen, and the holes should line up just about  perfectly. Finally, make sure you’ve got a USB-C cable plugged in to the ESP to supply  power, then carefully slide the assembled sensor block into the outer shell. Use M3x10  countersink screws, or whatever you have on hand, to fix the electronics unit in place in the outer  shell. These will sandwich the screen between the outer shell and printed screen spacer and pull  it tight towards the front. Finally, you can use a small zip for some strain relief on the USB  cable, and with that, the Sensorbox is complete! Some of the sensors take about a day of runtime  to fully settle in and produce plausible readings, **[15:54](https://youtu.be/OzFAtCZh_fM?t=954)** so just leave the Sensorbox plugged in for  a bit. The screen on the sensorbox itself will show the current readings of each sensor,  but they’re more useful inside Home Assistant. To get a feel for things, create a new dashboard, and try adding a new “statistics diagram”  card for one of the sensors. Boom, Graph! And for turning air cleaners on or off, of  course, you’d also need something like a smart plug connected to Home Assistant, you can simply  create a new automation that gets triggered every time your sensor reading changes, then as an  action, checks whether that sensor reading is above your threshold, if yes, we turn on the  smart plug, and otherwise, we turn it off. **[16:32](https://youtu.be/OzFAtCZh_fM?t=992)** But that’s really just the simplest  possible way to make use of the data we’re collecting - Home Assistant lets  you do so much with it, and hopefully, it’ll help you stay aware and  healthy around your machines. Again, all the stuff you need  to build one is linked below, and I want to give a huge shoutout to everyone  who’s supporting the channel and allowing me to give all this stuff away for free. Thank  you, and thank you to everyone for watching, keep on making, and I’ll see  you all in the next one. Bye!