Capsicum

๐Ÿซ‘ A retrofitted wired audio doorbell with added WiFi connectivity ๐Ÿ””

power 16340
wireless WiFi
mcu ESP32-C3
ongoing since Oct 2023

Minimum example with breadboard and dev board

esp32c3 push button bell deep sleep easy

Press the push button to wake up the ESP32-C3 from deep sleep, sound the bell, and go back to sleep.


Details

This example uses minimal code and hardware components to demonstrate the doorbell function.

The ESP32-C3 is in deep sleep mode most of the time, consuming very little power. When the push button is pressed, the ESP32-C3 wakes up, sounds the bell, and goes back to sleep.

Troubleshooting

Initially, the doorbell was vibrating and not sounding. The 3V3 power supply was used from the output of the deb board, which was not sufficient to drive the bell. The 3V3 and GND was connected to the power supply. Then connected to the doorbell directly, and the bell started to sound.

Research

If your doorbell speaker is vibrating but not producing sound, here are some potential reasons:

  1. Insufficient Voltage or Current:
    • The 3.3V power supply might not be sufficient to drive the speaker at an audible level. Check the speakerโ€™s specifications (e.g., voltage and current requirements).
  2. Damaged Speaker:
    • The speaker might be defective or partially damaged, leading to vibration without proper sound.
  3. Connection Issues:
    • Loose or poor connections to the speaker may result in insufficient power or signal transmission.

Serial console

Serial output from the firmware.

Schematic

Wire up the hardware accordingly

 setup

Code

Download code
// #define LED 3  // for the PCB
#define LED LED_BUILTIN  // for the breadboard with PCB

#define BELL_PIN 7
#define WAKEUP_INTERRUPT_PIN 4
RTC_DATA_ATTR int bootCount = 0;

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

  Serial.println("Boot number: " + String(bootCount));

  // ring the bell
  Serial.println("Ringing the bell");
  pinMode(BELL_PIN, OUTPUT);
  digitalWrite(BELL_PIN, HIGH);
  delay(1000);
  digitalWrite(BELL_PIN, LOW);

  // blink the LED 10 times to indicate that the device is awake
  pinMode(LED, OUTPUT);
  for (int i = 0; i < 10; ++i) {
    digitalWrite(LED, HIGH);
    delay(1000);
    digitalWrite(LED, LOW);
    delay(1000);
  }

  // go to deep sleep
  Serial.println("Going to deep sleep now");

  esp_deep_sleep_enable_gpio_wakeup(1 << WAKEUP_INTERRUPT_PIN,
    ESP_GPIO_WAKEUP_GPIO_HIGH);
  esp_deep_sleep_start();
}

void loop() { }

Makefile

# Uncomment for PCB
BOARD?=esp32:esp32:esp32c3:CDCOnBoot=cdc
PORT?=/dev/cu.usbmodem1410*

# Uncomment for breadboard with PCB
# BOARD?=esp32:esp32:esp32c3
# PORT?=/dev/cu.SLAB_USBtoUART*

BUILD=build

.PHONY: default lint compile flash clean

default: lint compile flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright,-runtime/int *.ino

compile: clean lint
	arduino-cli compile --fqbn $(BOARD) --output-dir $(BUILD) ./

flash:
	arduino-cli upload --fqbn $(BOARD) --port $(PORT) --input-dir $(BUILD)

clean:
	rm -rf build

References