Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsCount upwards and show each value in decimal, binary and hexadecimal at once, so the three number bases can be compared side by side. Hexadecimal is base 16, so it needs sixteen digit symbols, 0 to 9 then A to F, where A is ten and F is fifteen. Its real appeal is that one hex digit is exactly four binary bits. Watch the LEDs as the count passes 0F to 10: the right-hand four LEDs roll over from 1111 to 0000 while the next group ticks up by one, which is exactly what the printed hex value does. That is why memory addresses and colour codes are always written in hex.
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_033_hexadecimal_counter.inoVerify & upload in Electrolarkint ledPins[8] = {13, 12, 14, 27, 26, 25, 33, 32};
int stepButton = 23;
int resetButton = 19;
int count = 0;
String toHex(int value)
{
char digits[] = "0123456789ABCDEF";
String result = "";
result = result + digits[(value / 16) % 16]; // High nibble
result = result + digits[value % 16]; // Low nibble
return result;
}
String toBinary(int value)
{
String result = "";
for (int i = 7; i >= 0; i--)
{
result = result + String(bitRead(value, i));
if (i == 4)
{
result = result + " "; // Space between the two nibbles
}
}
return result;
}
void showCount()
{
for (int i = 0; i < 8; i++)
{
digitalWrite(ledPins[i], bitRead(count, 7 - i));
}
Serial.print("DEC ");
Serial.print(count);
Serial.print("\tHEX 0x");
Serial.print(toHex(count));
Serial.print("\tBIN ");
Serial.println(toBinary(count));
}
void setup()
{
for (int i = 0; i < 8; i++)
{
pinMode(ledPins[i], OUTPUT);
}
pinMode(stepButton, INPUT_PULLUP);
pinMode(resetButton, INPUT_PULLUP);
Serial.begin(9600);
showCount();
}
void loop()
{
if (digitalRead(resetButton) == LOW)
{
count = 0;
showCount();
delay(300);
}
if (digitalRead(stepButton) == LOW)
{
count = (count + 1) % 256;
showCount();
delay(350); // First step is deliberate
while (digitalRead(stepButton) == LOW)
{
count = (count + 1) % 256; // Held down - count quickly
showCount();
delay(120);
}
}
}
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.
Hexadecimal is base 16, so it needs sixteen digit symbols, 0 to 9 then A to F, where A is ten and F is fifteen. Its real appeal is that one hex digit is exactly four binary bits. Watch the LEDs as the count passes 0F to 10: the right-hand four LEDs roll over from 1111 to 0000 while the next group ticks up by one, which is exactly what the printed hex value does. That is why memory addresses and colour codes are always written in hex.
Press step and the Serial Monitor prints DEC 1 HEX 0x01 BIN 0000 0001. Hold the button and the count runs upward. At 15 the display reads HEX 0x0F BIN 0000 1111.
Yes. It is project 33 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.
8 parts: ESP32-WROOM-32 38-Pin Development Board, USB Cable, Solderless Breadboard, Dupont Jumper Wires (40 pcs), 8 × Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), 2 × Tactile Push Button Switch 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 45 minutes. The build on this page has 5 steps.
No. This page has the complete, tested code (titan_kit_033_hexadecimal_counter.ino).
About ₹821 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Base-16 number systems; Why one hex digit equals four binary bits; Extracting nibbles with / 16 and % 16; Indexing a character array to convert a value to a symbol.
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.