Motion-Activated Halloween Pumpkin

Turn a 3D-printed pumpkin into a spooky, motion-activated Halloween decoration using a FireBeetle ESP32-C6, mmWave radar and a red LED.


The Idea

Halloween decorations are fun, but adding a little embedded engineering makes them even better. For this project, I turned a 3D-printed pumpkin into a motion-activated decoration that can detect when someone approaches and switch on a red LED for a spooky surprise.

The build uses a FireBeetle 2 ESP32-C6 as the controller and a DFRobot C4002 mmWave radar sensor to detect a person nearby. When the radar reports presence or motion, the ESP32 turns on the LED. When the sensor reports that no target is present, the LED switches off again.

I kept the electronics simple and compact so everything would fit inside the pumpkin without having to drill extra holes or permanently glue the components in place. That also leaves plenty of room to expand the idea later with more lighting or sound effects.

What You’ll Need

ResourceWhat it’s for
FireBeetle 2 ESP32-C6HARDWARE

The microcontroller that reads the radar sensor and controls the LED.

View →
DFRobot C4002 mmWave Radar (SEN0691)HARDWARE

Detects presence and motion in front of the pumpkin.

View →
Red LED and 330Ω resistorELECTRONICS

The LED is the pumpkin’s visible effect, and the resistor limits current through it.

Elegoo 170-point mini breadboardELECTRONICS

A compact way to assemble the circuit inside the small pumpkin.

View →
Jumper wires and pin headersELECTRONICS

For connecting the boards and LED. The pin headers need to be soldered onto the FireBeetle and radar module.

3D-printed pumpkin shellENCLOSURE

The enclosure that hides the electronics and gives the project its Halloween look.

Arduino IDE and DFRobot_C4002 librarySOFTWARE

Used to upload the sketch and communicate with the C4002 sensor.

Library →

Some hardware links may be affiliate links. Purchasing through them helps support the project at no additional cost to you.

How It Works

The C4002 is a 24GHz mmWave radar sensor that reports presence and motion over a serial connection. Unlike a simple push button, it can detect a person without needing them to touch the decoration. For this build, I configured its detection range to 0–200cm, which is plenty for a pumpkin placed near a doorway or on a table.

The FireBeetle reads the sensor’s messages through UART. When the library reports either ePresence or eMotion, the code sets GPIO 6 HIGH and the red LED comes on. When the sensor reports eNoTarget, GPIO 6 goes LOW and the LED turns off.

The C4002 also has its own status indicators. When the sensor detects a target, its output indication changes, while the separate red LED shows the state controlled by the ESP32. This gives you a quick visual way to check that the sensor is responding even before looking at the code.

Preparing the Pumpkin Shell

I started with a model from the Pumpkin Collection on Printables. The original model was too small for the components, so I brought it into Autodesk and scaled it up by roughly 1.5–1.8× until there was enough room for the electronics and mini breadboard.

The scaled pumpkin shell model prepared in CAD before 3D printing

If you don’t own a 3D printer at home, like me, you can still make your own custom enclosures using online manufacturing services. For this project, I used PCBWay’s 3D printing service to turn the scaled model into a physical pumpkin shell. You can upload your 3D model, choose from the available printing options, select your preferred material and colour, and review the quote before placing an order. It’s a straightforward way to get custom parts made for a project without needing to buy your own printer.

Uploading a custom 3D model through PCBWay's online 3D printing service

For this build, the shell was printed in orange PETG. PETG is a sturdy material, and orange was an obvious choice for a Halloween pumpkin. The choice of material and colour is worth considering when designing an enclosure, as it affects both the finished appearance and the suitability of the part for its intended use.

The final print has enough internal space for the FireBeetle, radar sensor and mini breadboard to fit snugly inside. That meant I didn’t need to drill extra mounting holes or glue the electronics to the shell, keeping the assembly simple and allowing the components to be removed if I need to change the wiring later.

Assembling the Electronics

Before wiring everything together, I soldered the pin headers onto the FireBeetle and C4002. Both boards arrived with the headers unattached, so this was the first hands-on step. Take care to keep the headers straight and avoid bridging neighbouring pins with solder.

I used an Elegoo 170-point mini breadboard because it is small enough to fit inside the scaled pumpkin. The circuit itself is simple: the C4002 communicates with the ESP32 over UART, and the red LED is controlled by one GPIO with a 330Ω resistor in series.

This is my first time soldering in a good few years - please be nice to me!

The FireBeetle ESP32-C6, C4002 mmWave radar and red LED circuit assembled on a compact breadboard

Wiring the C4002 to the FireBeetle

Use the following signal connections. The sensor’s TX and RX are crossed over to the ESP32’s RX and TX, respectively.

C4002 pin FireBeetle 2 ESP32-C6 Purpose
TX GPIO 4 (UART RX) Sends sensor data to the ESP32
RX GPIO 5 (UART TX) Receives commands from the ESP32
GND GND Common ground
VIN 3V3 Powers the radar module

Wiring the LED

Connect the LED in series with the 330Ω resistor:

LED circuit Connection
GPIO 6 To the 330Ω resistor and then the LED’s anode (long leg)
LED cathode (short leg) To GND

.

The resistor can be placed on either side of the LED as long as it remains in series. A favourite trick of mine is to use the resistor as a bridge across the middle of the breadboard, saving space and letting the resistor be placed in a non-diagonal way. Check the LED polarity before powering the circuit, and make sure the FireBeetle, radar and LED circuit share a common ground.

Programming the FireBeetle

The sketch uses DFRobot’s DFRobot_C4002 library to initialise the radar, set its detection range and read its target state. You can install the library through Arduino IDE’s Library Manager by searching for DFRobot_C4002, or get it from the official GitHub repository.

Select the FireBeetle 2 ESP32-C6 board in Arduino IDE, connect it over USB-C, and upload the following sketch. The same USB connection can be used for programming and serial debugging before moving the pumpkin to its final position.

#include "DFRobot_C4002.h"

const int LED_PIN = 6;
const int RADAR_RX_PIN = 4;
const int RADAR_TX_PIN = 5;

DFRobot_C4002 radar(&Serial1, 115200, RADAR_RX_PIN, RADAR_TX_PIN);

void setup() {
  Serial.begin(115200);

  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, LOW);

  while (!radar.begin()) {
    Serial.println("C4002 not responding. Check wiring.");
    digitalWrite(LED_PIN, LOW);
    delay(1000);
  }

  radar.setDetectRange(0, 200);
  radar.setLightThresh(0);
  radar.setReportPeriod(5);
  radar.setTargetDisappearDelay(1);
}

void loop() {
  sRetResult_t result = radar.getNoteInfo();

  if (result.noteType == eResult) {
    eTargetState_t state = radar.getTargetState();

    if (state == ePresence || state == eMotion) {
      digitalWrite(LED_PIN, HIGH);
      Serial.println("Person detected - pumpkin ON");
    } else if (state == eNoTarget) {
      digitalWrite(LED_PIN, LOW);
      Serial.println("No person detected - pumpkin OFF");
    }
  }

  delay(20);
}

What the code does

  • Initialises the radar: If the C4002 doesn’t respond, the sketch keeps trying and prints a message to the Serial Monitor so you can check the wiring.
  • Sets the detection range: setDetectRange(0, 200) configures the sensor to report targets between 0 and 200cm.
  • Sets the reporting behaviour: setReportPeriod(5) sets a report period of 0.5 seconds. setTargetDisappearDelay(1) requests a one-second target-disappearance delay.
  • Reads the target state: The loop checks for a result message, then responds to presence, motion or no target.
  • Controls the LED: GPIO 6 goes HIGH when presence or motion is reported, and LOW when the sensor reports no target.

Putting It Together

Once the sketch was working, I placed the compact breadboard and electronics inside the pumpkin. The scaled shell gives the components a snug fit, so there was no need to glue the boards down or add extra mounting hardware. I powered the FireBeetle with a USB power bank, which makes it practical to use the finished build as a standalone decoration rather than leaving it connected to a laptop. Check out the final result in the video reel I put together below:

With the pumpkin powered on, the C4002 watches for a target in its configured range. When someone approaches, the sensor reports presence or motion and the red LED comes on. Once the sensor returns to its no-target state, the LED switches off again. It is a small effect, but it turns a static 3D print into a Halloween decoration that reacts to people walking past.

What’s Next

This version keeps the electronics simple with one red LED, but the same idea could be extended in several ways. Addressable LEDs could add colour-changing effects, while a small speaker could play a spooky sound when someone approaches. You could also experiment with the sensor’s detection range and placement to tune how close someone needs to get before the pumpkin reacts.

For now, this build is a compact example of how a microcontroller and a presence sensor can bring a little interactivity to an ordinary seasonal decoration.