Você está no 3DFinder
Buscamos em Thingiverse, MakerWorld e Printables ao mesmo tempo para te dar o melhor de cada uma.
Descrição
Description
Welcome to the wonderful world of ESPHome, Home Assistant, and custom home automation! Today I present a relatively simple device designed to integrate with Home Assistant and enable/disable a security camera on demand.
This could be useful in a number of ways - for example, say you have a camera in your bedroom to keep an eye on things while you're away, but want to disable it occasionally for dressing or other bedroom activities. It could also be useful for camera monitoring of older relatives - giving them the autonomy to not be observed when they don't want to be while making it very clear when the camera is active or inactive.
Features
- Enables physical, manual OFF/ON control of a security camera (or its associated privacy/recording switch) in Home Assistant.
- Visually signifies camera status using a lighted, integrated display (brightness controllable in software).
- Sounds a loud alarm when camera status is changed, either on device or in software.
- Overwrites software control of camera mode to prevent unauthorized viewing/recording.
- Fully configurable using provided ESPHome template .yaml file.
- Uses affordable and widely-available components.
- Full build instructions included - anyone with basic soldering skills can build this!
Prerequisites
- You should be familiar with Home Assistant and already have a camera setup to use this device. Ideally the camera will have an associated switch for privacy mode (the Unifi Protect integration does) or recording mode. The included ESPHome configuration simply keeps a HA switch entity in-sync with the physical switch and displays its state. You could probably modify it to entirely disable the camera feed, but it depends on your camera and how its integration works.
- Ideally you should be familiar with ESPHome and how to flash devices, but instructions are included below.
Bill of Materials
In addition to the 3D printed case, you'll need the following components. They can be purchased quite cheaply online. These are also listed in the Bill of Materials section below.
As an Amazon Associate I earn from qualifying purchases. If you click an Amazon link, Amazon might share a small portion of the purchase price with me.
As a Seeed Studio affiliate, if you click on one of their store links, you’ll get a discount, and I’ll get a small commission on the purchase. You can also use my promo code PUlHJBB. Thanks!
- 1 Seeed Studio XIAO ESP32-C3 (Seeed Studio - $5) (Amazon - $17) (AliExpress - $15 for 3)
- Theoretically any ESP32 device will work, but these instructions, the model, and the attached .yaml file are specifically designed for the XIAO ESP32-C3. If you use another XIAO ESP32 revision (such as a C6 or S3) the pinouts will likely need changed in the configuration file.
- Headers will need to be soldered to the ESP32-C3 - you can buy a pre-soldered version for an additional dollar or so.
- The included adhesive antenna generally works fine, but for additional range you could use Seeed Studio's 2.4GHz Rod Antenna (2.81dBi) for Seeed Studio XIAO by drilling an appropriately sized hole in the side of the case.
- 1 Seeed Studio Grove RGB LED Stick - 10 WS2813 Mini 3535 (Seeed Studio - $5)
- Because the Grove RGB stick (a core part of this project) is only available directly from Seeed Studio AFAIK, I recommend purchasing your ESP32-C3 there at the same time. Heck, get a few for future projects! They're way cheaper directly from Seeed.
- A Grove 4-conductor cable of sufficient length should come with the RGB stick, but if you need another one you can buy it separately.
- 1 ElectroCookie Mini PCB Prototype Board (Amazon - $8 for 6)
- This is an awesome product that combines the convenience of a breadboard with the permanence of a custom PCB.
- You could theoretically wire up everything without this and stuff it in the case, but I highly recommend using one. They're cheap and the model has standoffs specifically for it.
- 9 M2 Heat Set Threaded Inserts (Amazon - $10 for 70)
- The model is sized for ruthex brand inserts, though I suspect other brands would work.
- ruthex has custom soldering iron tips to help install their inserts. They're not necessary, but make things easier.
- The insert hole diameter is 3.2mm, the overall diameter is 5.8mm (1.3mm wall thickness), and the hole depth is 5mm.
- 9 M2x4 Screws (Amazon - $23 for 2404)
- I used the linked socket head screws (and that's what the lid is sized for), but any M2x4 screws should work.
- 1 Passive Piezo Buzzer 12MM*8.5MM 42Ω 3.3V (AliExpress - $1.50 for 10) (Amazon - $6 for 20)
- I used the linked piezo buzzers from AliExpress, but any 3.3V-compatible passive buzzer should do. Keep an eye on the resistance - if it's not 42 ohms the value will need to be adjusted in the configuration.
- This (and the resistor) are theoretically optional if you don't care about the alarm function. You'd just have to remove the associated code in the .yaml configuration.
- 1 100Ω to 330Ω Resistor
- While you can probably get away with wiring the piezo buzzer directly to the 3.3V ESP32 data line, I recommend adding a current-limiting resistor. ESP32 pins can only safely output a small amount of current (typically ~40mA). Piezo buzzers can sometimes draw more than this, and they can also generate a small amount of "flyback" voltage when they turn off. Over time, this could damage your ESP32.
- 1 20mm Rocker Switch (AliExpress - $1.50 for 5) (Amazon - $6 for 5)
- The linked AliExpress/Amazon ones are good quality with a satisfying click. Any 20mm switch should do, but try to get one with an indexing piece of plastic on the left side.
- Wire for Breadboard Connections
- We'll be shortening the cable that comes with the Grove LED strip, and you can probably get away with using that extra wire for the remaining connections. Otherwise, some generic 22 AWG wire will do the trick.
- 1 USB-C Cable (Max Diameter 4mm)
- Due to the wall-mounted nature of this controller, I elected to connect the USB-C cable internally and have it come out the bottom via a small slot.
- Electrical Tape or Heat Shrink
- The connectors on the rocker switch need to be insulated, as they'll be folded down on top of one another. Electrical tape is fine, but heat shrink is better.
- (Optional) 2 Small Zip Ties
- You can tightly attach 2 zip ties the the USB-C cable on each side of the cable slot as a form of strain relief.
- (Optional) 2 Female PCB Headers and 2 Male Dupont/Breadboard Wires
- Because the rocker switch only goes into the case one way, you theoretically need to insert it and then solder to the ElectroCookie PCB in situ. I found this annoying and instead soldered 2 female headers to the PCB and used some Dupont/breadboard wires I had laying around to connect the switch to the PCB. This has the added benefit of letting you disassemble everything without desoldering.
Printing Instructions
- I used the following filaments: Bambu Lab PLA Basic White, Black, and Cocoa Brown.
- An AMS is strongly suggested for this project, but not strictly required.
- Multiple filaments are used on the first 5 layers to create the diffused LED indicator effect, along with the OFF/ON and CAMERA CONTROL text.
- If you don't have an AMS, you can try the “(NO AMS)” print profile, along with a sharpie for the text. I've never printed this profile, so let me know how it comes out!
- Because the model is designed with a recessed threaded insert under a small overhang, I've included a manual pause on the 38th layer, right after all the bottom threaded insert holders are done. If you want, you can manually jog your z-axis down, install the bottom inserts, and then resume the print. It's possible to do after the print is completed, but difficult and you might accidentally melt something. Ask me how I know.
Electronics and Assembly Instructions
Now we're into the meat and potatoes of the project! This might seem intimidating, but with some basic soldering skills and these instructions, you can do it!
HINT: A benefit of using the ElectroCookie is that all the holes are labeled using a coordinate system. To follow along with these instructions, make sure you have the ElecroCookie and all components oriented the same way as in the provided picture, then refer to the BOLDED AND UNDERLINED hole coordinates.)
- Install the 9 M2 threaded inserts into the provided holes. There are 4 on the bottom for the ElectroCookie, 1 to secure the LED board, and 4 to secure the lid. See the note in the printing instructions for when to ideally do this, otherwise it might be difficult.
- Take the adhesive antenna that came with the ESP32 and adhere it to the bottom side of the body (not under the ElectroCookie, but the bottom wall with the cable slot).
- Solder the provided header pins to the ESP32-C3 (assuming you didn't get the pre-soldered version).
- Insert the ESP32 into the ElectroCookie as shown in the provided pictures, with the USB-C port facing right towards the middle of the board. From this perspective, the bottom-left GPIO20 pin should be at D1 and the top-right GPIO2 pin at I7. Solder in place.
- Solder a wire from J6 (GPIO3) to J17.
- Solder the 100-330Ω resistor from F17 to E17. Orientation doesn't matter.
- Insert and solder the piezo buzzer with the positive lead in B17 and the negative lead in B14.
- Solder a wire from D14 to D6.
- On the Grove 4 pin cable, cut off one of the end connectors and pull all four wires apart. Snip off the white wire at the other connector - we don't need it.
- Insert the Grove LED board at an angle into the slot. One side of the board fits into a recess in the slot hole, and the other (with the hole) rests on the threaded insert. Screw in place using an M2x4 screw.
- Temporarily put the ElectroCookie in place on the four standoffs (no need to screw in). Connect the cut Grove cable to the LED board. Cut the three remaining wires so you have enough length to attach the yellow wire to the top of the ESP32 (J row) and the red and black wires to the bottom of the ESP32 (D row). My wires are around 4.5cm.
- Remove the ElectroCookie and disconnect the fully-shortened Grove cable. Strip and solder the yellow wire to J5, the black wire to C6, and the red wire to C7.
- Solder two wires to the two connectors on the bottom of the rocker switch. These connections need to be insulated - ideally use heat shrink but electrical tape will do in a pinch. Fold the terminals down as much as you can so they are roughly 60 degrees from their initial position (this is why the insulation is important).
- Solder one of the switch wires to J4 and the other to A6.
- IMPORTANT: Insert the rocker switch into the enclosure before soldering the wires to the ElectroCookie - some force is required. See my note in the bill of materials about using female PCB headers and Dupont/Breadboard wires for this connection.
- Place the ElectroCookie into the enclosure and secure with 4 M2x4 screws. Make sure the antenna cable remains accessible and connect it to the ESP32. Don't forget to connect the antenna! Ask me how I know.
- Plug the Grove connector into the LED strip and route the cable through the small slot (otherwise the lid will pinch the wires).
- Plug a data capable USB-C cable into the ESP32 and route out of the enclosure. You can use two firmly tightened zip ties on each side of the slot for strain relief.
- Insert the lid (watching the Grove wires and routing the USB-C cable through the bottom slot), then secure with 4 M2x4 screws.
Programming Instructions
If you're not already familiar with ESPHome, it's a very cool, open-source framework that generates custom firmware for ESP8266 and ESP32 boards using simple YAML configuration files. Importantly, it's designed to natively interface with Home Assistant.
While the majority of the work has already been done for you, there are a few things you'll need to modify in the pre-made configuration file.
- First, we need to find the entity ID of the privacy/recording switch associated with the camera you want to control. The following instructions are for a Ubiquiti UniFi camera using the UniFi Protect integration.
- Click Settings, then Devices & services.
- Click the UniFi Protect integration.
- Click the camera you want to control.
- Under Configuration, click Privacy mode.
- In the top-right corner of the popup, click the Settings cog icon.
- Copy and paste the Entity ID and save it somewhere. We'll be using it later.
- Following ESPHome's excellent documentation, install and start the ESPHome Device Builder app in Home Assistant.
- In ESPHome Device Builder, make sure you have your WiFi details and other important secrets defined. Click Secrets and check to make sure you have the following defined:
- wifi_ssid - your WiFi network's name
- wifi_password - your WiFi network's password
- fallback_wifi_password - a password used to access the fallback hotspot (captive portal) should WiFi connection fail
- ota_password - a password used to authenticate OTA updates
- Click New Device + in the bottom-right corner.
- Under Create configuration, click New Device Setup.
- Under New device, name the device whatever you want - the default is “camera-controller”.
- Under Installation, click Skip This Step.
- Under Select your device type", click ESP32-C3.
- You'll be presented with an encryption key. Remember to copy and paste this somewhere - we'll use it in just a moment. Click Skip.
- Click EDIT under your newly created device.
- You'll notice that ESPHome has autogenerated an ota password and password for the fallback hotspot (captive portal). You can use these in the secrets file we mentioned earlier if you want.
- Download the attached esphome-config-yaml.txt file and open in your favorite plaintext editor. Copy and paste the code into the ESPHome Device Builder, making sure to overwrite the code that is already there.
- Under the SUBSTITUTIONS section, make the following changes:
- api_encryption_key - replace with the encryption key from earlier
- camera_controller_switch_entity_id - replace with the entity ID from earlier
- if you're using something other than an ESP32-C3, you can change the pins used for the buzzer, LED, and rocker switch
- if you'd like a different sound to play from the buzzer, you can change the RTTTL string (see comments)
- if you'd like the ESP32 to use a specific IP address, you can change it here (see comments)
- Click SAVE, then click INSTALL.
- If you're accessing Home Assistant via an https connection (normally through Home Assistant Cloud), then select Plug into this computer after, obviously, plugging the ESP32 into your computer. This is the easiest option.
- If you're accessing Home Assistant via an http connection (normally locally), then you'll want to plug the ESP32 into the server device that is running Home Assistant. Then click Plug into the computer running ESPHome Device Builder.
- Follow the instructions and wait for ESPHome to flash the new software onto the ESP32. This may take quite a while depending on the speed of your Home Assistant system. You'll know when it's done when your device reboots and shows yellow light in both OFF and ON (that indicates the device has booted but is not yet connected to Home Assistant and/or WiFi).
- In the Home Assistant sidebar, click Settings. Click Devices & services.
- In the bottom-right, click + Add integration. Search for and select ESPHome.
- Under Discovered, you should see your new device called Seeed Studio ESP32-C3 [last 6 of MAC address]. Click it and click Submit.
- Enter the Encryption key that you saved from earlier and click Submit. The device should immediately alarm and switch its LED indicator to represent the current state of your camera's privacy/recording switch.
- In the Devices created box, feel free to rename and assign an area to each device (there are two devices so that the controls for the camera controller and the underlying ESP32 node are kept separate). Click Skip and finish.
- LAST AND MOST IMPORTANT STEP: Back in Settings → Devices & services under the Integrations tab, find and click ESPHome. Find your new device and click the Settings cog to the right of the name. In the Options dialog, turn on Allow the device to perform Home Assistant actions.. Click Submit.
- Your device should now be fully functional! Try to change the rocker switch and verify: the buzzer sounds; the LED indicator switches; and the underlying switch in Home Assistant changes. Furthermore, test that manually changing the switch in Home Assistant causes the device to alarm and that the switch is immediately set back to the correct state.
Raw Model Files
Raw model files, including STL and STEP files, are attached to the project. Additionally, the full parameterized model can be accessed for free via Onshape here.
AI Usage Disclaimer
- No generative AI was used in the creation of the 3D model.
- No generative AI was used in the creation of this project description.
- The ESPHome .yaml configuration file was developed with the assistance of a generative, agentic coding assistant tool. However, the file was primarily written (and extensively reviewed) by a human.
ESPHome Camera Privacy Controller
Publicado em 11 de mar de 2026