// Simplest possible custom 7-segment display using NeoPixel strip, Arduino UNO and 3D printed enclosure. No soldering required. See video for details.
// created by upir, 2024
// youtube channel: https://www.youtube.com/upir_upir
// YouTube video: https://youtu.be/_pNuaVKABN4
// Source files: https://github.com/upiir/simplest_7segment_display
// Links from the video:
// Do you like this video? You can buy me a coffee ☕: https://www.buymeacoffee.com/upir
// BambuLab A1 Mini Combo 3D Printer: https://shareasale.com/r.cfm?b=2420414&u=3422904&m=138211&urllink=&afftrack=
// Arduino UNO screw shield: https://s.click.aliexpress.com/e/_DEYq6YJ
// Arduino UNO screw shield smaller: https://s.click.aliexpress.com/e/_DCY9kPH
// Arduino UNO R3: https://s.click.aliexpress.com/e/_AXDw1h
// Arduino breadboard prototyping shield: https://s.click.aliexpress.com/e/_ApbCwx
// NeoPixel strip (48D): https://s.click.aliexpress.com/e/_DlXZNSB
// Translucent acrylic sheets: https://s.click.aliexpress.com/e/_DBCYJQR
// NeoPixel connectors: https://s.click.aliexpress.com/e/_DDf6swj
// NeoPixel strip cables: https://s.click.aliexpress.com/e/_DdhesSb
// Adafruit NeoPixel documentation: https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-use
// Related videos:
// Fusion and 3D printing: https://youtu.be/HcP48uCBzDQ
// NeoPixels: https://youtu.be/1NI-I1Lpdqo
// Segmented Displays: https://youtu.be/jz01j1TpM84
#include <Adafruit_NeoPixel.h> // used Adafruit library (see documentation above)
#define LED_PIN 6 // to which pin on Arduino UNO is connected the data pin from the NeoPixel strip
#define LED_COUNT 22 // number of LEDs = 7 segments * 3 LEDs per segment + 1 extra LED outside that is not used (required for easy bending of the strip)
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); // initializing of the NeoPixel strip
void setup() {
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
}
void loop() {
unsigned int hue = random(65535); // set random hue for the color
// the code below will toggle between digits 0-9 in random colors
// the individual segments on the 7-segment display are as follows:
//
// ┌───────────┐
// │ A │
// ├┬─────────┬┤
// ┌──┴┤ ├┴──┐
// │ │ │ │
// │ F │ │ B │
// │ │ │ │
// └──┬┤ ├┬──┘
// ├┴─────────┴┤
// │ G │
// ├┬─────────┬┤
// ┌──┴┤ ├┴──┐
// │ │ │ │
// │ E │ │ C │
// │ │ │ │
// └──┬┤ ├┬──┘
// ├┴─────────┴┤
// │ D │
// └───────────┘
//
// digit 0
hue = random(65535); // set random hue for the color
strip.clear(); // Set all pixels in RAM to 0 (off)
/*a*/ strip.setPixelColor( 7, strip.ColorHSV(hue)); strip.setPixelColor( 8, strip.ColorHSV(hue)); strip.setPixelColor( 9, strip.ColorHSV(hue)); //a
/*b*/ strip.setPixelColor( 4, strip.ColorHSV(hue)); strip.setPixelColor( 5, strip.ColorHSV(hue)); strip.setPixelColor( 6, strip.ColorHSV(hue)); //b
/*c*/ strip.setPixelColor(19, strip.ColorHSV(hue)); strip.setPixelColor(20, strip.ColorHSV(hue)); strip.setPixelColor(21, strip.ColorHSV(hue)); //c
/*d*/ strip.setPixelColor(16, strip.ColorHSV(hue)); strip.setPixelColor(17, strip.ColorHSV(hue)); strip.setPixelColor(18, strip.ColorHSV(hue)); //d
/*e*/ strip.setPixelColor(13, strip.ColorHSV(hue)); strip.setPixelColor(14, strip.ColorHSV(hue)); strip.setPixelColor(15, strip.ColorHSV(hue)); //e
/*f*/ strip.setPixelColor(10, strip.ColorHSV(hue)); strip.setPixelColor(11, strip.ColorHSV(hue)); strip.setPixelColor(12, strip.ColorHSV(hue)); //f
///*g*/ strip.setPixelColor( 1, strip.ColorHSV(hue)); strip.setPixelColor( 2, strip.ColorHSV(hue)); strip.setPixelColor( 3, strip.ColorHSV(hue)); //g
strip.show(); // Update strip to match
delay(500); // delay
// digit 1
hue = random(65535); // set random hue for the color
strip.clear(); // Set all pixels in RAM to 0 (off)
///*a*/ strip.setPixelColor( 7, strip.ColorHSV(hue)); strip.setPixelColor( 8, strip.ColorHSV(hue)); strip.setPixelColor( 9, strip.ColorHSV(hue)); //a
/*b*/ strip.setPixelColor( 4, strip.ColorHSV(hue)); strip.setPixelColor( 5, strip.ColorHSV(hue)); strip.setPixelColor( 6, strip.ColorHSV(hue)); //b
/*c*/ strip.setPixelColor(19, strip.ColorHSV(hue)); strip.setPixelColor(20, strip.ColorHSV(hue)); strip.setPixelColor(21, strip.ColorHSV(hue)); //c
///*d*/ strip.setPixelColor(16, strip.ColorHSV(hue)); strip.setPixelColor(17, strip.ColorHSV(hue)); strip.setPixelColor(18, strip.ColorHSV(hue)); //d
///*e*/ strip.setPixelColor(13, strip.ColorHSV(hue)); strip.setPixelColor(14, strip.ColorHSV(hue)); strip.setPixelColor(15, strip.ColorHSV(hue)); //e
///*f*/ strip.setPixelColor(10, strip.ColorHSV(hue)); strip.setPixelColor(11, strip.ColorHSV(hue)); strip.setPixelColor(12, strip.ColorHSV(hue)); //f
///*g*/ strip.setPixelColor( 1, strip.ColorHSV(hue)); strip.setPixelColor( 2, strip.ColorHSV(hue)); strip.setPixelColor( 3, strip.ColorHSV(hue)); //g
strip.show(); // Update strip to match
delay(500); // delay
// digit 2
hue = random(65535); // set random hue for the color
strip.clear(); // Set all pixels in RAM to 0 (off)
/*a*/ strip.setPixelColor( 7, strip.ColorHSV(hue)); strip.setPixelColor( 8, strip.ColorHSV(hue)); strip.setPixelColor( 9, strip.ColorHSV(hue)); //a
/*b*/ strip.setPixelColor( 4, strip.ColorHSV(hue)); strip.setPixelColor( 5, strip.ColorHSV(hue)); strip.setPixelColor( 6, strip.ColorHSV(hue)); //b
///*c*/ strip.setPixelColor(19, strip.ColorHSV(hue)); strip.setPixelColor(20, strip.ColorHSV(hue)); strip.setPixelColor(21, strip.ColorHSV(hue)); //c
/*d*/ strip.setPixelColor(16, strip.ColorHSV(hue)); strip.setPixelColor(17, strip.ColorHSV(hue)); strip.setPixelColor(18, strip.ColorHSV(hue)); //d
/*e*/ strip.setPixelColor(13, strip.ColorHSV(hue)); strip.setPixelColor(14, strip.ColorHSV(hue)); strip.setPixelColor(15, strip.ColorHSV(hue)); //e
///*f*/ strip.setPixelColor(10, strip.ColorHSV(hue)); strip.setPixelColor(11, strip.ColorHSV(hue)); strip.setPixelColor(12, strip.ColorHSV(hue)); //f
/*g*/ strip.setPixelColor( 1, strip.ColorHSV(hue)); strip.setPixelColor( 2, strip.ColorHSV(hue)); strip.setPixelColor( 3, strip.ColorHSV(hue)); //g
strip.show(); // Update strip to match
delay(500); // delay
// digit 3
hue = random(65535); // set random hue for the color
strip.clear(); // Set all pixels in RAM to 0 (off)
/*a*/ strip.setPixelColor( 7, strip.ColorHSV(hue)); strip.setPixelColor( 8, strip.ColorHSV(hue)); strip.setPixelColor( 9, strip.ColorHSV(hue)); //a
/*b*/ strip.setPixelColor( 4, strip.ColorHSV(hue)); strip.setPixelColor( 5, strip.ColorHSV(hue)); strip.setPixelColor( 6, strip.ColorHSV(hue)); //b
/*c*/ strip.setPixelColor(19, strip.ColorHSV(hue)); strip.setPixelColor(20, strip.ColorHSV(hue)); strip.setPixelColor(21, strip.ColorHSV(hue)); //c
/*d*/ strip.setPixelColor(16, strip.ColorHSV(hue)); strip.setPixelColor(17, strip.ColorHSV(hue)); strip.setPixelColor(18, strip.ColorHSV(hue)); //d
///*e*/ strip.setPixelColor(13, strip.ColorHSV(hue)); strip.setPixelColor(14, strip.ColorHSV(hue)); strip.setPixelColor(15, strip.ColorHSV(hue)); //e
///*f*/ strip.setPixelColor(10, strip.ColorHSV(hue)); strip.setPixelColor(11, strip.ColorHSV(hue)); strip.setPixelColor(12, strip.ColorHSV(hue)); //f
/*g*/ strip.setPixelColor( 1, strip.ColorHSV(hue)); strip.setPixelColor( 2, strip.ColorHSV(hue)); strip.setPixelColor( 3, strip.ColorHSV(hue)); //g
strip.show(); // Update strip to match
delay(500); // delay
// digit 4
hue = random(65535); // set random hue for the color
strip.clear(); // Set all pixels in RAM to 0 (off)
///*a*/ strip.setPixelColor( 7, strip.ColorHSV(hue)); strip.setPixelColor( 8, strip.ColorHSV(hue)); strip.setPixelColor( 9, strip.ColorHSV(hue)); //a
/*b*/ strip.setPixelColor( 4, strip.ColorHSV(hue)); strip.setPixelColor( 5, strip.ColorHSV(hue)); strip.setPixelColor( 6, strip.ColorHSV(hue)); //b
/*c*/ strip.setPixelColor(19, strip.ColorHSV(hue)); strip.setPixelColor(20, strip.ColorHSV(hue)); strip.setPixelColor(21, strip.ColorHSV(hue)); //c
///*d*/ strip.setPixelColor(16, strip.ColorHSV(hue)); strip.setPixelColor(17, strip.ColorHSV(hue)); strip.setPixelColor(18, strip.ColorHSV(hue)); //d
///*e*/ strip.setPixelColor(13, strip.ColorHSV(hue)); strip.setPixelColor(14, strip.ColorHSV(hue)); strip.setPixelColor(15, strip.ColorHSV(hue)); //e
/*f*/ strip.setPixelColor(10, strip.ColorHSV(hue)); strip.setPixelColor(11, strip.ColorHSV(hue)); strip.setPixelColor(12, strip.ColorHSV(hue)); //f
/*g*/ strip.setPixelColor( 1, strip.ColorHSV(hue)); strip.setPixelColor( 2, strip.ColorHSV(hue)); strip.setPixelColor( 3, strip.ColorHSV(hue)); //g
strip.show(); // Update strip to match
delay(500); // delay
// digit 5
hue = random(65535); // set random hue for the color
strip.clear(); // Set all pixels in RAM to 0 (off)
/*a*/ strip.setPixelColor( 7, strip.ColorHSV(hue)); strip.setPixelColor( 8, strip.ColorHSV(hue)); strip.setPixelColor( 9, strip.ColorHSV(hue)); //a
///*b*/ strip.setPixelColor( 4, strip.ColorHSV(hue)); strip.setPixelColor( 5, strip.ColorHSV(hue)); strip.setPixelColor( 6, strip.ColorHSV(hue)); //b
/*c*/ strip.setPixelColor(19, strip.ColorHSV(hue)); strip.setPixelColor(20, strip.ColorHSV(hue)); strip.setPixelColor(21, strip.ColorHSV(hue)); //c
/*d*/ strip.setPixelColor(16, strip.ColorHSV(hue)); strip.setPixelColor(17, strip.ColorHSV(hue)); strip.setPixelColor(18, strip.ColorHSV(hue)); //d
///*e*/ strip.setPixelColor(13, strip.ColorHSV(hue)); strip.setPixelColor(14, strip.ColorHSV(hue)); strip.setPixelColor(15, strip.ColorHSV(hue)); //e
/*f*/ strip.setPixelColor(10, strip.ColorHSV(hue)); strip.setPixelColor(11, strip.ColorHSV(hue)); strip.setPixelColor(12, strip.ColorHSV(hue)); //f
/*g*/ strip.setPixelColor( 1, strip.ColorHSV(hue)); strip.setPixelColor( 2, strip.ColorHSV(hue)); strip.setPixelColor( 3, strip.ColorHSV(hue)); //g
strip.show(); // Update strip to match
delay(500); // delay
// digit 6
hue = random(65535); // set random hue for the color
strip.clear(); // Set all pixels in RAM to 0 (off)
/*a*/ strip.setPixelColor( 7, strip.ColorHSV(hue)); strip.setPixelColor( 8, strip.ColorHSV(hue)); strip.setPixelColor( 9, strip.ColorHSV(hue)); //a
///*b*/ strip.setPixelColor( 4, strip.ColorHSV(hue)); strip.setPixelColor( 5, strip.ColorHSV(hue)); strip.setPixelColor( 6, strip.ColorHSV(hue)); //b
/*c*/ strip.setPixelColor(19, strip.ColorHSV(hue)); strip.setPixelColor(20, strip.ColorHSV(hue)); strip.setPixelColor(21, strip.ColorHSV(hue)); //c
/*d*/ strip.setPixelColor(16, strip.ColorHSV(hue)); strip.setPixelColor(17, strip.ColorHSV(hue)); strip.setPixelColor(18, strip.ColorHSV(hue)); //d
/*e*/ strip.setPixelColor(13, strip.ColorHSV(hue)); strip.setPixelColor(14, strip.ColorHSV(hue)); strip.setPixelColor(15, strip.ColorHSV(hue)); //e
/*f*/ strip.setPixelColor(10, strip.ColorHSV(hue)); strip.setPixelColor(11, strip.ColorHSV(hue)); strip.setPixelColor(12, strip.ColorHSV(hue)); //f
/*g*/ strip.setPixelColor( 1, strip.ColorHSV(hue)); strip.setPixelColor( 2, strip.ColorHSV(hue)); strip.setPixelColor( 3, strip.ColorHSV(hue)); //g
strip.show(); // Update strip to match
delay(500); // delay
// digit 7
hue = random(65535); // set random hue for the color
strip.clear(); // Set all pixels in RAM to 0 (off)
/*a*/ strip.setPixelColor( 7, strip.ColorHSV(hue)); strip.setPixelColor( 8, strip.ColorHSV(hue)); strip.setPixelColor( 9, strip.ColorHSV(hue)); //a
/*b*/ strip.setPixelColor( 4, strip.ColorHSV(hue)); strip.setPixelColor( 5, strip.ColorHSV(hue)); strip.setPixelColor( 6, strip.ColorHSV(hue)); //b
/*c*/ strip.setPixelColor(19, strip.ColorHSV(hue)); strip.setPixelColor(20, strip.ColorHSV(hue)); strip.setPixelColor(21, strip.ColorHSV(hue)); //c
///*d*/ strip.setPixelColor(16, strip.ColorHSV(hue)); strip.setPixelColor(17, strip.ColorHSV(hue)); strip.setPixelColor(18, strip.ColorHSV(hue)); //d
///*e*/ strip.setPixelColor(13, strip.ColorHSV(hue)); strip.setPixelColor(14, strip.ColorHSV(hue)); strip.setPixelColor(15, strip.ColorHSV(hue)); //e
///*f*/ strip.setPixelColor(10, strip.ColorHSV(hue)); strip.setPixelColor(11, strip.ColorHSV(hue)); strip.setPixelColor(12, strip.ColorHSV(hue)); //f
///*g*/ strip.setPixelColor( 1, strip.ColorHSV(hue)); strip.setPixelColor( 2, strip.ColorHSV(hue)); strip.setPixelColor( 3, strip.ColorHSV(hue)); //g
strip.show(); // Update strip to match
delay(500); // delay
// digit 8
hue = random(65535); // set random hue for the color
strip.clear(); // Set all pixels in RAM to 0 (off)
/*a*/ strip.setPixelColor( 7, strip.ColorHSV(hue)); strip.setPixelColor( 8, strip.ColorHSV(hue)); strip.setPixelColor( 9, strip.ColorHSV(hue)); //a
/*b*/ strip.setPixelColor( 4, strip.ColorHSV(hue)); strip.setPixelColor( 5, strip.ColorHSV(hue)); strip.setPixelColor( 6, strip.ColorHSV(hue)); //b
/*c*/ strip.setPixelColor(19, strip.ColorHSV(hue)); strip.setPixelColor(20, strip.ColorHSV(hue)); strip.setPixelColor(21, strip.ColorHSV(hue)); //c
/*d*/ strip.setPixelColor(16, strip.ColorHSV(hue)); strip.setPixelColor(17, strip.ColorHSV(hue)); strip.setPixelColor(18, strip.ColorHSV(hue)); //d
/*e*/ strip.setPixelColor(13, strip.ColorHSV(hue)); strip.setPixelColor(14, strip.ColorHSV(hue)); strip.setPixelColor(15, strip.ColorHSV(hue)); //e
/*f*/ strip.setPixelColor(10, strip.ColorHSV(hue)); strip.setPixelColor(11, strip.ColorHSV(hue)); strip.setPixelColor(12, strip.ColorHSV(hue)); //f
/*g*/ strip.setPixelColor( 1, strip.ColorHSV(hue)); strip.setPixelColor( 2, strip.ColorHSV(hue)); strip.setPixelColor( 3, strip.ColorHSV(hue)); //g
strip.show(); // Update strip to match
delay(500); // delay
// digit 9
hue = random(65535); // set random hue for the color
strip.clear(); // Set all pixels in RAM to 0 (off)
/*a*/ strip.setPixelColor( 7, strip.ColorHSV(hue)); strip.setPixelColor( 8, strip.ColorHSV(hue)); strip.setPixelColor( 9, strip.ColorHSV(hue)); //a
/*b*/ strip.setPixelColor( 4, strip.ColorHSV(hue)); strip.setPixelColor( 5, strip.ColorHSV(hue)); strip.setPixelColor( 6, strip.ColorHSV(hue)); //b
/*c*/ strip.setPixelColor(19, strip.ColorHSV(hue)); strip.setPixelColor(20, strip.ColorHSV(hue)); strip.setPixelColor(21, strip.ColorHSV(hue)); //c
/*d*/ strip.setPixelColor(16, strip.ColorHSV(hue)); strip.setPixelColor(17, strip.ColorHSV(hue)); strip.setPixelColor(18, strip.ColorHSV(hue)); //d
///*e*/ strip.setPixelColor(13, strip.ColorHSV(hue)); strip.setPixelColor(14, strip.ColorHSV(hue)); strip.setPixelColor(15, strip.ColorHSV(hue)); //e
/*f*/ strip.setPixelColor(10, strip.ColorHSV(hue)); strip.setPixelColor(11, strip.ColorHSV(hue)); strip.setPixelColor(12, strip.ColorHSV(hue)); //f
/*g*/ strip.setPixelColor( 1, strip.ColorHSV(hue)); strip.setPixelColor( 2, strip.ColorHSV(hue)); strip.setPixelColor( 3, strip.ColorHSV(hue)); //g
strip.show(); // Update strip to match
delay(500); // delay
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
rgb1:VDD
rgb1:DOUT
rgb1:VSS
rgb1:DIN
rgb2:VDD
rgb2:DOUT
rgb2:VSS
rgb2:DIN
rgb3:VDD
rgb3:DOUT
rgb3:VSS
rgb3:DIN
rgb4:VDD
rgb4:DOUT
rgb4:VSS
rgb4:DIN
rgb6:VDD
rgb6:DOUT
rgb6:VSS
rgb6:DIN
rgb7:VDD
rgb7:DOUT
rgb7:VSS
rgb7:DIN
rgb8:VDD
rgb8:DOUT
rgb8:VSS
rgb8:DIN
rgb9:VDD
rgb9:DOUT
rgb9:VSS
rgb9:DIN
rgb10:VDD
rgb10:DOUT
rgb10:VSS
rgb10:DIN
rgb11:VDD
rgb11:DOUT
rgb11:VSS
rgb11:DIN
rgb12:VDD
rgb12:DOUT
rgb12:VSS
rgb12:DIN
rgb13:VDD
rgb13:DOUT
rgb13:VSS
rgb13:DIN
rgb5:VDD
rgb5:DOUT
rgb5:VSS
rgb5:DIN
rgb14:VDD
rgb14:DOUT
rgb14:VSS
rgb14:DIN
rgb15:VDD
rgb15:DOUT
rgb15:VSS
rgb15:DIN
rgb16:VDD
rgb16:DOUT
rgb16:VSS
rgb16:DIN
rgb17:VDD
rgb17:DOUT
rgb17:VSS
rgb17:DIN
rgb18:VDD
rgb18:DOUT
rgb18:VSS
rgb18:DIN
rgb19:VDD
rgb19:DOUT
rgb19:VSS
rgb19:DIN
rgb20:VDD
rgb20:DOUT
rgb20:VSS
rgb20:DIN
rgb25:VDD
rgb25:DOUT
rgb25:VSS
rgb25:DIN
rgb26:VDD
rgb26:DOUT
rgb26:VSS
rgb26:DIN