FluxBench.AIShared project · read-only

555 Astable LED Blinker

ESP32 DevKit (WROOM-32)·Arduino C++·Updated Jul 27, 2026·by FluxBench TeamIncludes Lab + Schematic + PCB

Classic NE555 astable multivibrator blinking a red LED, fully simulated on the Lab breadboard. Drag the RA trimpot to sweep the blink rate live (≈4.8–9 Hz) and drag the CTRL-pin trimpot to bend frequency and duty via pin-5 modulation. Bundled schematic and a routed PCB included — fork it and make it yours.

sketch.ino
// 555 Astable Design Calculator + companion blinker
// The breadboard in the Lab tab runs a real NE555 astable:
//   RA = 10 kΩ trimpot (rheostat), RB = 10 kΩ, C = 10 µF
// Drag the RA trimpot to sweep the blink rate live, and drag the
// CTRL-pin trimpot to bend the frequency/duty via pin 5 modulation.
// This sketch mirrors the math on the ESP32 and blinks GPIO 2 at the
// nominal design frequency so you can compare.

#define LED_PIN 2

float RA_K = 5.0;   // kΩ (trimpot mid-position)
float RB_K = 10.0;  // kΩ
float C_UF = 10.0;  // µF

float freqHz(float raK, float rbK, float cUF) {
  // f = 1.44 / ((RA + 2·RB) · C)  with kΩ and µF -> Hz
  return 1440.0 / ((raK + 2.0 * rbK) * cUF);
}

float dutyPct(float raK, float rbK) {
  return 100.0 * (raK + rbK) / (raK + 2.0 * rbK);
}

void setup() {
  Serial.begin(115200);
  pinMode(LED_PIN, OUTPUT);
  Serial.println("NE555 astable design table (RB=10k, C=10uF):");
  Serial.println("RA(k)   f(Hz)   duty(%)");
  for (float ra = 0.0; ra <= 10.01; ra += 2.5) {
    Serial.print(ra, 1);
    Serial.print("     ");
    Serial.print(freqHz(ra, RB_K, C_UF), 2);
    Serial.print("    ");
    Serial.println(dutyPct(ra, RB_K), 1);
  }
  Serial.print("Nominal (RA mid = 5k): ");
  Serial.print(freqHz(RA_K, RB_K, C_UF), 2);
  Serial.println(" Hz");
}

void loop() {
  // blink at the nominal design frequency
  float f = freqHz(RA_K, RB_K, C_UF);
  float periodMs = 1000.0 / f;
  float tHighMs = periodMs * dutyPct(RA_K, RB_K) / 100.0;
  digitalWrite(LED_PIN, HIGH);
  delay((int)tHighMs);
  digitalWrite(LED_PIN, LOW);
  delay((int)(periodMs - tHighMs));
}

Built with FluxBench.AI — the AI workbench for embedded projects.