Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP32-Based Battery-Powered Hyperhidrosis Treatment Device with OLED Display and RTC

View and Edit Project In Cirkit DesignerImage of ESP32-Based Battery-Powered Hyperhidrosis Treatment Device with OLED Display and RTC

Circuit Documentation

Summary

This document provides a detailed overview of a circuit designed for a hyperhidrosis treatment device. The circuit includes an ESP32 microcontroller, an OLED display, a real-time clock (RTC), a rotary potentiometer, a pushbutton, a LiPoly battery, a TP4056 battery charger, an AMS1117 voltage regulator, and an LM2596 voltage regulator. The device is programmed to control current flow to electrodes based on user input and display relevant information on the OLED screen.

Component List

  1. 0.96" OLED

    • Pins: GND, VDD, SCK, SDA
    • Description: OLED display for visual output.
  2. TP4056

    • Pins: OUT-, B-, B+, OUT+, IN-, IN+
    • Description: Lithium battery charger module.
  3. LiPoly Battery (1300mAh)

    • Pins: positive, negative
    • Description: Power source for the circuit.
  4. RTC DS3231

    • Pins: 32K, SQW, SCL, SDA, VCC, GND
    • Description: Real-time clock module.
  5. LM2596

    • Pins: IN, OUT
    • Description: Buck converter for voltage regulation.
  6. ams1117 3.3

    • Pins: VIN, OUT, GND
    • Description: 3.3V voltage regulator.
  7. Rotary Potentiometer

    • Pins: leg1, wiper, leg2
    • Description: Adjustable resistor for user input.
    • Properties: Resistance: 10000 Ohms
  8. Red Pushbutton

    • Pins: Pin 2, Pin 1, Pin 3, Pin 4
    • Description: User input button.
  9. Aluminum Sheet

    • Pins: -, +
    • Description: Electrode for current flow.
  10. ESP32 Mini

    • Pins: GND, GPIO27, GPIO25, GPIO32, TDI, GPIO4, GPIO0, GPIO2, SD1, CLK, RXD, TXD, GPIO22, GPIO21, GPIO17, GPIO16, VCC, TD0, SD0, RST, SVP, GPIO26, GPIO18, GPIO19, GPIO23, GPIO5, 3.3V, TCK, SD3, NC, SVN, GPIO35, GPIO33, GPIO34, TMS, SD2
    • Description: Microcontroller for processing and control.

Wiring Details

0.96" OLED

TP4056

LiPoly Battery (1300mAh)

RTC DS3231

LM2596

ams1117 3.3

Rotary Potentiometer

Red Pushbutton

Aluminum Sheet

ESP32 Mini

Code Documentation

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <RTClib.h>

// Pin Definitions
#define POT_PIN 34
#define BUTTON_PIN 0
#define ELECTRODE_PIN_POS 25 // Positive electrode
#define ELECTRODE_PIN_NEG 26 // Negative electrode
#define BATTERY_PIN 35

// OLED Display
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

// RTC
RTC_DS3231 rtc;

// Variables
int sessionTime = 600; // 10 minutes session
int currentFlow = 0;
bool sessionActive = false;
unsigned long startTime;
unsigned long currentTime;

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

  // Initialize OLED
  if (!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;);
  }
  display.display();
  delay(2000);
  display.clearDisplay();

  // Initialize RTC
  if (!rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }

  // Initialize Pins
  pinMode(POT_PIN, INPUT);
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  pinMode(ELECTRODE_PIN_POS, OUTPUT);
  pinMode(ELECTRODE_PIN_NEG, OUTPUT);
  pinMode(BATTERY_PIN, INPUT);

  // Setup PWM channels
  const int freq = 5000;
  const int ledChannel =