Here's something I've been working on for a while,

fastled-showtell
gplus
(Reko Meriö) #1

Here’s something I’ve been working on for a while, effects are pretty much finished up and now I’m waiting on receiving ESP32 and some longer LED strip

(Andrew Tuline) #2

Code is always a good thing. :smiley:

(Reko Meriö) #3

@Andrew_Tuline https://github.com/K9260/Arduino/blob/master/VU-meter/VU-meter/VU-meter.ino
I will share it here, though I do hope if someone decides to use the code and makes youtube video about it, he will at least mention my youtube channel name :slight_smile:

(Yves BAZIN) #4

@Reko_Merio great job !! I love it

(Will Tatam) #5

Interesting output and nice code. Can you provide some info on the audio hardware/circuit?

(Reko Meriö) #6

@Will_Tatam Thanks! The schematic is quite simple. I have arduino uno and MAX4466 microphone connected to it.
You simply connect microphone data pin to one of the arduino analog inputs (defined as A0 in code), vcc to 3.3v and ground to ground obviously. Then the led strip to digital pin 2 in my case.

(manny miller) #7

Hey Reko… great job, some nice new effects. would love to see what you come up with using the esp32. I have a few sitting around and it has been a common request for my vu meters. ( cine-lights )

(Reko Meriö) #8

@manny_miller My plan currently with ESP is that I will have one ESP sending microphone data, and then one or more receiving ESP’s with LED strip connected to it that will then turn the data to visualisation of that sound as seen on my video. That way you can insert the VU-meter to almost anywhere in your house, and you can have multiple of them very easily. Maybe also button to change the effect on the sending unit

(manny miller) #9

Reko… This idea i like. I came across this video a while back and loved the idea. My first vu meter i made using a mic, but then so many people requested a line in version. You do get better sound reaction using line in. so my idea was to use the code from this video as a starting point and add to it., and instead of using a push button, either use the wifi option, or add bluetooth. Link to video : https://www.youtube.com/watch?v=yninmUrl4C0&t=259s I have told myself i do need to finish my half completed projects first before i start any new ones.

(Reko Meriö) #10

@manny_miller I saw that video too and thats where I got the idea of making data transfer wireless :smiley:
I need to try how line input works

(Andrew Tuline) #11

Have been re-factoring Reko’s source code above, and have broken major functions/display sequences into separate .h files similar to my own:

Changes also include removing the delay() functions and changing that over to a variable EVERY_N_MILLIS_I() function. Also putting FastLED.show() into the loop instead of each display sequence.

Am now working to understand the fscale and the maxVol functions, as I only use integer math in my own routines.

His original code didn’t work on my Nano very well and my re-factoring is not yet working, but I’ll eventually sort that out.

(Reko Meriö) #12

@Andrew_Tuline maxVol is useful for the VU meter effect as you can tell your target height in the strip. If you want the leds to light up around half the strip on average when music is on, just put NUM_LEDS / 2, and if it is less than that, the value used for scaling how many leds to light up is lowered, which means they will light up more easily. Then you will set target_top, that means if more than your target_top amount of leds are on, the opposite will be done to previous. I dont know if I you can understand what I’m saying, I’m not the best person at naming my functions and variables :smiley: fscale function is not made by me and there is explanation for it if you google it, but basically it has (original min, original max, new min, new max, value to scale from, and some multiplier)

(Reko Meriö) #13

If you look at vu function, you might understand the idea behind maxVol. I tested it on some other functions as in “brush” and I can see if it is confusing for other people. The values dont really have any logical explanation in that, that’s just something I noticed to work and I might change it to my older average sampling function once I do some more testing

(Andrew Tuline) #14

@Reko_Merio I’m hoping to understand it and eventually integrate/re-write the display sequences I like. In my case, I just take a sample, find the mid point, chop off the noise, perform crude peak detection and in lines 29–32, I maintain a rolling average for the past 64 samples as found at:

(Reko Meriö) #15

@Andrew_Tuline I took some inspiration from your code as in calculating averages and found a better way for it now. My sound detection is now faster and better and I scrapped maxVol completely. Will add the new version to github in a while, after I do a little bit more testing :stuck_out_tongue:

(Andrew Tuline) #16

@Reko_Merio Interesting, as I’ve been experimenting with fscale and MaxVol today and they’re starting to grow on me . . Feel free to email me at atuline@gmail.com, as you might be interested in some of the changes I’ve been making to your code (still a work in progress) and I’d be happy to pass that along.

(Andrew Tuline) #17

Looking forward to your update. Am starting to look at your ripple struct and code and seeing how I can convert it over. Am not a fan of floats (for performance reasons), so it may take some time.

(Reko Meriö) #18

@Andrew_Tuline Still waiting on my led strip that has been sitting in my country for 2 weeks now, but it hasnt made any progress since then. I’m starting to wonder if post office has lost it. There could be some room for optimizing with those structs, maybe by combinining them into a one since all of them are quite similar. I probably wont have any interest doing that myself as I dont yet run into problems with memory :smiley:

(Reko Meriö) #19

Well, received the strip today and tried to test it on my arduino, but now all memory is gone! I didn’t realize bigger num of leds means more memory usage, so now I will have to work on the code a lot more :smiley:

(Andrew Tuline) #20

Yep, 3 bytes per LED. It can really add up. If you want to exchange any work in progress code, again, feel free to email me. Today, I’m going to be working on getting bubble and trails running in my code, however I haven’t taken floats out of any of the structs yet.