Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Pedro52
Published © GPL3+

Arduino with 4x6 NeoPixel Level Indicator in 3D-Printed Case

Level Indicator for watering system with 5 steps (0%, 25%, 50%, 75%, 100%) for water and moisture levels, in a 3D-printed housing.

IntermediateFull instructions provided1,414
Arduino with 4x6 NeoPixel Level Indicator in 3D-Printed Case

Things used in this project

Hardware components

WS2812B Non-Waterroof 5050 RGB LED Strip Light Individual Addressable DC 5V 60 Led/m
24 LEDS
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

The STL files for the Diplay Housing components

Can be used for 3D printing

Outer part

Used for printing the outerpart

the back frame

Used for printing the back frame

The text designed with Inkscape

To be printed on Photo quality paper

Schematics

This is the complete wiring

just 3 wires between the ESP32 and the display (Gnd, +5V and data from GPIO 16)

Code

Level_Display_test.ino

Arduino
This is the code used for testing the Display
/*
  This is a code for testing a level indicator Display developed and produced by Pierre Pennings (June 2019)
  The display uses a strip of 24 WS2812 LEDs powered with 5V
  The display housing is made with a Creality CR10S pro 3D printer (stl files can be found on Thingiverse under the title: 4 * 6 Neopixel Level Display  
  The display has 4 columns of 6 LED's each
  The display is made as part of a bigger project for an on line plant watering system
  The display shows the water level in a container at 5 different levels (1%, 25%, 50%, 75%, 100%)
  and the Moisture levels measured by 3 different sensors (also at 5 different level)
  The top LED indicates the nature of the level that is indicated
  The levelindicators have a color that runs from Red, orange, yellow, blue or green depending on the level.
  The display is connected to an ESP32 but this could very well be an ARDUINO UNO
  The 24 LEDs are controlled from one ESP 32 pin (GPIO 16) working at 3.3 V levels, whereas the LED strip is powered with 5 V taken from the USB port
  This code is licensed under GPL3+ license.
*/

#include <Adafruit_NeoPixel.h>
#define PIN       16   // pin connected to the Neopixel strip
#define NUMPIXELS 24   // number of Neopixels
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 200  // Time delay in milliseconds

byte color_scheme[] = {
  200, 0, 0,                // red
  250, 150, 0,              // orange
  100, 200, 0,              // yellow
  0, 0, 200,                // blue
  0, 200, 0                 // green
                      };

//                 c  r         0  1  2  3  4  5       // level
byte DISPLAYarray [4][6] = {  { 0, 1, 2, 3, 4, 5,},    //WATERlevel ,column 0 
                              {11,10, 9, 8, 7, 6,},    //MOISTlevel1,column 1
                              {12,13,14,15,16,17,},    //MOISTlevel2,column 2
                              {23,22,21,20,19,18,},    //MOISTlevel3,column 3
                            };

int level = 0;              // Variable of the Level: 1%, 25%, 50%, 75%, 100%
int y = 0;                  // Variable of led number indicating the level (1%, 25%, 50%, 75%, 100%)

int redVal = 0;
int greenVal = 0;
int blueVal = 0 ;

void setup() {
  strip.begin();                                    // Initialize all LEDs to "off"
  strip.show();
}

void loop() {
 for (int c = 0; c < 4 ; c++)                     // for testing the 4 colomns headers on the display 
  {
    int z = DISPLAYarray [c][5];
    strip.setPixelColor(z, 100, 100, 100);        // turn on the LED of the Level Indicator (WATER, MOIST1, MOIST2, MOIST3)
    strip.show();
   
   for (int level = 0; level < 5 ; level++)      // Set the Level Indicator LED with pixel number (y) with a color defined in the Array color_scheme
   {
      y = DISPLAYarray [c][level];
      redVal = color_scheme[level*3];
      greenVal = color_scheme[level*3 + 1];
      blueVal = color_scheme[level*3 + 2];
      strip.setPixelColor(y, strip.Color(redVal, greenVal, blueVal) ); 
      strip.show();
      delay(DELAYVAL);                            // Pause before next pass through loop      
    }
      strip.setPixelColor(z, 0, 0, 0);            // turn off the LED of the Level Indicator (WATER, MOIST1, MOIST2, MOIST3)
      for (int x = 0; x < 5 ; x++)
      {
        strip.setPixelColor(DISPLAYarray [c][x], 0, 0, 0);  // turn off the 5 LEDs of the relevant Level Indicator 
      }
  }
}

Credits

Pedro52

Pedro52

6 projects • 47 followers

Comments