Introduction: Simple RGB Notification Bar

About: I build projects using arduino nano / esp32 / arduino micro and also arduino mkr1010

Previously we have seen how to make a portable application to control an Arduino
Control Arduino with a portable App

Let's see how to use this to make your own rgb led notification bar using a small led strip.
To keep it simple, we will only be able to choose between 6 colors.

  • First, we will make our led strip
  • Then we will test it with uled application / Serial Monitor
  • Finally, we learn new tips to build a GUI on python tkinter.

As always, all the documentation/code are available on github in english/french
http://github.com/pigetArduino/uled

You will need the following components:

  • Arduino nano CH340G: 2€
  • 30 leds WS2812B (Neopixel clone) : 4.50€ ( 5 leds :0.75€)
  • Resistor pack 400pcs (3€) (1 resistor: 0.0071€)
  • Total : 9.5€ (2.75€)

Step 1: Upload Arduino Code

Let's upload uled to our arduino, so we can test our project, as soon as it is soldered (The led will turn white when plugged).

How does it works?

We are going to use FastLed to manage our led strip
With FastLed, you can change the color using HSV,RGB,HEX color or HTML web color.
https://github.com/FastLED/FastLED/wiki/Pixel-reference

In our example we will use web color.

  • Setup leds
const int NUM_LEDS = 5; 
CRGB leds[NUM_LEDS]
void setup() {
   FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}
  • Change LED 3 to Red
leds[3] = CRGB::Red;
  • Update LED

The color won't change until you update them.

FastLED.show();

Step 2: Make It

Wiring

Our arduino is ready to be test, let's wire the led strip.

  • D6 --> RESISTOR (470 Ohm) DI
  • +5V --> 5V
  • GND --> GND

Do not used more than 5 leds without a dedicated power supply to avoid damaging its.
Each led can draw up to 60ma at full brightness
An Arduino can provided up to 500ma (on 5v/Gnd pin)

5 leds = 5x60ma = 300ma

Source: https://learn.adafruit.com/adafruit-neopixel-uber...

3D Printed Case

We will use an all purpose case for arduino nano projects made by Olivier Sarrailh
You can find it with the source code in the folder 3D/

  • Print UL_A.stl and UL_B.stl
  • Fill a hole for the led strip (see video for more info)

Step 3: Test

Let's test our leds with the Arduino Serial Monitor and uled!

Arduino Serial Monitor

Baudrate : 115200 / No Line Ending

  • ULed : Check if device is correct (turn off all led)
  • X:Y : (Where X is the led and Y the color)
  • 1:3 : (led 1 Green)

Color

  • 0 : OFF
  • 1 : White/ON
  • 2 : Red
  • 3 : Green
  • 4 : Blue
  • 5 : Yellow
  • 6 : Orange
  • 7 : Purple

ULed

It should automatically connect to your arduino and turn off the leds when connected.

Step 4: Some New Tips for Tkinter

As for utest, we used python/tkinter to make this application.
Check out this tutorial for more information : https://www.instructables.com/id/UTest-Make-USB-De...

Let's learn some new tricks with tkinter.
Look at the code ul.py (github)

Window

  • Change Window Title
root.title("Title of the windows")
  • Change Window Background color
root.configure(background="WHITE") #Background color name or hex color ("#f3f3f3")
  • Change Icon
root.iconbitmap('ul.ico') #Icon
  • Execute a function when application is closed
root.protocol("WM_DELETE_WINDOW", quit_callback)

Buttons

  • Generate buttons with a function

We need to make a lot of buttons, which will execute different actions,
I used partial() to do this.
Source: Stack Overflow

from functools import partial
def function_name(arg1,arg2):
    print("Button clicked")
    print(arg1)
    print(arg2)
def generate_buttons(arg1,arg2):
    Button(text="TextHere",command=partial(function_name,arg1,arg2)).pack()

Step 5: To Be Continued ...

You have all the basis to make your own applications for your notification bar.
Next time, we will see how to control a LCD 16x2 screen and make an installer (drivers included) using innosetup

So don't forget to follow me for more tutorials!