Wi-Fi IoT ESP32 USB Controller Box

Small 3d-printable enclosure and mini-guide for a Wi-Fi controlled 2-port USB enclosure
3
10
1
304
updated June 7, 2023

Description

PDF

The BambuLab community has created some really cool add-ons to the printers, one being the wirelessly powered BentoBox and the other being various LED add-ons.

I saw a guide to that goes through how to automate some DC barrel ports using a D1 mini ESP32 controller but I didn't like the aesthetics of it and furthermore I wanted to use USB ports since a lot of things now power via a USB port.

The STL files are for printing the enclosure.  You'll need the following items to put this together into something that actually works.  Links to what I bought included (non-referral):

  1. D1 mini (ESP32 controller board) (3PCS Type-C USB D1 Mini WiFi Dev Board,Mini NodeMcu Lua 4M Bytes WLAN WiFi Internet Development Board Base on ESP8266 ESP-12F for Arduino, 100% Compat)
  2. 2x M3x4.0mm, OD4.6mm Threaded Insert (in-saiL 100pcs/lot M3x4.0mm, OD4.6mm Heat Staking Threaded Insert Quik-Tek Brass C3604: Amazon.com: Industrial & Scientific
  3. 2x M3x(3-5mm) hex socket hex bolts (I'm sure you have some lying around!!)
  4. 1x DC buck converter w/ 5v output (UCTRONICS DC 6V 9V 12V 24V to DC 5V 5A Buck Converter Module, 9-36V Step Down to USB 5V Transformer Dual Output Voltage Regulator Board [2 Pack])
  5. 2x 3.3 optocoupler relay (Songhe DC 1 Channel Optocoupler 3V/3.3V Relay High Level Driver Module Isolated Drive Control Board 3V/3.3V Relay Module for Arduino (Pack of 5))
  6. 3x Wago 5-conductor coupler (221-415 | WAGO Lever-Nuts® Splicing Connector | for Solid and Stranded Conductors | 5-Conductor with Operating levers | 24-12 AWG | Transparent housing | [Box of 25 Pieces]: Amazon.com: Industrial & Scientific)
  7. 1x DC Barrel female for power input (Amazon.com: 10pcs Female 5.5 x 2.1 mm Panel Mount DC Power Barrel Jack Plug Connector - Threaded Female DC Pigtail Barrel Plug Connector Socket Adapter with Dustproof Plug for CCTV, Car Audi etc. by MILAPEAK : Electronics)
  8. Hot glue gun to affix things in place
  9. Various 22-24 gauge wire
  10. Soldering iron to put headers on things
  11. Dupont or JST headers

In order to automate the ESP32 controller to turn on/off accessories, you'll want to read up on MQTT and the BambuLab printers, ESPHOME, HomeAssistant, and Node-Red.  I will leave this part out since it requires a lot of explanation but if you're good with searching you'll be able to find a guide or two.  I will try to put one together myself at some point because I felt that the existing guides were not very clear.  However, I think there's value for the reader in learning this content area by exploration and to stumble through/make mistakes.  You will gain better mastery of it!

Steps to Make:

  1. Print the enclosure cover and bottom.  Lay the print flat on the broadest face.  Use supports if your printer has trouble bridging the DC input.
  2. Set the 2 heat set inserts.
  3. Put all the parts as pictured in the picture where no wires have been connected.
  4. Connect wires as pictured--generally speaking + to +, - to -.  Everything in here is 5v.  On the controller, only two GPIO headers are used to control the two 3.3v relays.  If you're more handy with electronics you probably could simplify the design quite a bit but the way it is now, is hopefully easy to understand how things connect together.
  5. Apply hot glue to secure things in place.  Usually easier after everything is wired.  Make sure that you don't glue the D1 mini in a way that you can't plug in a cable into it for the initial setup.

Steps to Use:

  1. Read up at esphome.io
  2. Look for guides on BambuLab 3d printers and MQTT
  3. Flash the D1 mini with esphome
  4. Set up your home assistant instance.  It will detect the esp32 controller and then allow you to toggle the two usb ports. Alternatively learn how to interact with the controller without home assistant.
  5. Follow up on #2 and find a way for home assistant to detect the Bambu Lab printer activity via MQTT.  Alternatively set up a MQTT broker (mosquitto) and use NodeRed to rewrite Bambu Lab printer activity into an easier to understand format.

Tags



Model origin

The author marked this model as their own original creation.

License