Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsTap a button in Morse and watch the board work out which letters you sent, purely from how long you held it. Decoding is the generator run backwards, and it is harder, because the board has to judge intent from timing alone. Two stopwatches run: one measures how long the key is held, the other how long it has been idle. A press shorter than the dot-dash boundary is a dot, longer is a dash. A silence longer than the letter gap means the symbol is finished, so the collected dots and dashes are looked up; a longer silence still means the word has ended. Everything hinges on choosing those two boundaries sensibly.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin.
Every part for this build comes in the Geekobot Titan Kit box, a Geekobot exclusive, together with the parts for all 120 projects, from a first blinking LED to a smart fan and a reaction game. The wiring below is the kit's own wiring.
Tick anything you already have and the total updates.
ESP32 DevKit V1 (38-pin): the brain of every Titan Kit project, with Wi-Fi and Bluetooth
Male-to-female and female-to-female leads for the modules
LEDs from the kit's red, green, yellow and blue packs
220 ohm resistors: one in series with every LED
ESP32 expansion board from the kit: every GPIO has its own S, V, G header
Follow the colours: red is power, dark grey is ground, blue is a signal.
titan_kit_035_morse_code_decoder.inoVerify & upload in Electrolarkint keyPin = 13;
int led = 33;
int buzzer = 32;
int unit = 200; // Your dot length in ms
int dashThreshold = unit * 2; // Longer than this is a dash
int letterGap = unit * 3;
int wordGap = unit * 7;
const char* morse[36] =
{
".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....",
"..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.",
"--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-",
"-.--", "--..",
"-----", ".----", "..---", "...--", "....-",
".....", "-....", "--...", "---..", "----."
};
const char letters[37] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
String symbol = "";
unsigned long pressStart = 0;
unsigned long releaseStart = 0;
bool wasDown = false;
bool wordEnded = true;
char decode(String pattern)
{
for (int i = 0; i < 36; i++)
{
if (pattern == morse[i])
{
return letters[i];
}
}
return '?';
}
void setup()
{
pinMode(keyPin, INPUT_PULLUP);
pinMode(led, OUTPUT);
pinMode(buzzer, OUTPUT);
Serial.begin(9600);
Serial.println("Tap the key in Morse");
releaseStart = millis();
}
void loop()
{
bool isDown = (digitalRead(keyPin) == LOW);
if (isDown && !wasDown)
{
pressStart = millis();
digitalWrite(led, HIGH);
tone(buzzer, 700);
wasDown = true;
}
if (!isDown && wasDown)
{
unsigned long held = millis() - pressStart;
digitalWrite(led, LOW);
noTone(buzzer);
if (held < dashThreshold)
{
symbol = symbol + ".";
}
else
{
symbol = symbol + "-";
}
releaseStart = millis();
wasDown = false;
wordEnded = false;
}
if (!isDown && symbol.length() > 0 && millis() - releaseStart > letterGap)
{
char decoded = decode(symbol);
Serial.print(decoded);
if (decoded == '?')
{
Serial.print("(");
Serial.print(symbol);
Serial.print(")");
}
symbol = "";
}
if (!isDown && !wordEnded && symbol.length() == 0 &&
millis() - releaseStart > wordGap)
{
Serial.print(" ");
wordEnded = true;
}
}
Use a micro-USB data cable (some cables only charge), install the CP210x or CH340 driver if no port appears, pick Tools > Board > ESP32 Dev Module and hold the BOOT button on the board until the upload starts.
Turn it round: the long leg (anode) goes to the GPIO side through the 220 ohm resistor, the short leg to GND.
The sketch uses INPUT_PULLUP, so one leg goes to the GPIO and the other to GND. Use two legs on opposite sides of the button.
This project needs the passive buzzer (the one that plays notes), not the active one.
Decoding is the generator run backwards, and it is harder, because the board has to judge intent from timing alone. Two stopwatches run: one measures how long the key is held, the other how long it has been idle. A press shorter than the dot-dash boundary is a dot, longer is a dash. A silence longer than the letter gap means the symbol is finished, so the collected dots and dashes are looked up; a longer silence still means the word has ended. Everything hinges on choosing those two boundaries sensibly.
Tap short-short-short and pause: the Serial Monitor prints S. Tap long-long-long and pause: it prints O. A longer pause inserts a space between words.
Yes. It is project 35 of 120 in the Geekobot Titan Kit, in level 7 (Binary and code). Every part on the list comes in the kit box, and you can also buy the parts one by one from the list above.
No. Every Titan Kit project is wired on the ESP32 expansion board and the breadboard with jumper wires.
9 parts: ESP32-WROOM-32 38-Pin Development Board, USB Cable, Solderless Breadboard, Dupont Jumper Wires (40 pcs), Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), Tactile Push Button Switch, Buzzer Module 3.3–5V and ESP32 38-Pin Expansion Board. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 30 minutes. The build on this page has 6 steps.
About ₹736 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Timing to string decoding; Measuring press and release durations separately; Choosing thresholds that separate intent; Searching a lookup table for a match.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin.
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Press to roll: the pips tumble and slow down before landing on a number.
Wait for the light, hit the button: how many milliseconds can you beat?
A bright 4-digit clock that keeps time through power cuts.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.