Introduction: RGB LED VUMeter Python Library

Picture of RGB LED VUMeter Python Library

This is an adaptation from my previous instructable: Addressable RGB LED Arduino VUMeter GUI

After doing it I realised I needed to make a library for the VUMeter to control it in a much better and easier way.

In the following step is all the information.

Step 1: Download

Picture of Download

The library is on my github page here. It includes an example.

Step 2: How to Use

Picture of How to Use

First initiate the class and pass some variables as parameters. Most of them are mandatory.

  • totalLeds: the total amount of Leds
  • VRLeds: Vertical Right Leds (used as the "right" channel in the VUMeter)
  • VLLeds: Vertical Left Leds * HRLeds: Horizonal Right Leds (not used in the VUMeter).
  • HLLeds: Horizontal Left Leds
  • HVLeds: Horizontal Leds
  • direction (default 1): Establishes the wiring's direction. If 0 then the CLK and DATA wires go from the Arduino to the left Leds. If 1 then these wires go from the Arduino to the right Leds.
  • ledChip (default 0): Establishes the Led's chip. If 0 then the chip is LPD8806. If 1 then it is WS2801.

After that you can either return the instant VUMeter or turn the leds off. For the first option you can call the returnInstantVUM() method, which includes the following parameters:

  • green (default 0)
  • red (default 127)
  • blue (default 0)
  • rmsMaximum (default 20000): This is the sound sensivity in RMS. Change it to the value that best fits your audio input.
  • stereoMode (default 0): Establishes the channels displayed. If 0 then it is in stereo mode. If 1 then it is in left (mono) mode. If 2 the it is in right (mono) mode. Be aware that, if you are using some VRLeds in left mode or viceversa both the left and right leds will be turned on. If you want to use a mono setting, then add the VRLeds to the HRLeds, HVLeds or HLLeds.
  • peakVuMeter (default True): Enables or disables the peak led. If you want to call the offLeds() method, you don't need to specify any parameter. The last two methods (returnInstantVUM() and offLeds()) both return a string ready to be sent over the serial port. If you have any problem with this, force it with the "str()" method.

NOTE: totalLeds MUST be equal to the sum of VRLeds, VLLeds, HRLeds, HVleds and HLLeds.


That's all! If you have any questions or want to report a bug do it here o in github.

Comments

About This Instructable

477views

12favorites

License:

More by Nicolas Britos:RGB LED VUMeter Python LibraryLPD8806 VUMeter with PC & Arduino + GUIDIY Arduino 3D IR Gesture Sensor
Add instructable to: