Go Down

Topic: LED Music Visualizer Help (Read 855 times) previous topic - next topic

PatrickMW

Jul 15, 2018, 01:12 am Last Edit: Jul 15, 2018, 01:16 am by PatrickMW
Hey guys, so I'm very new to using Arduino (this is my first project), and I have a rudimentary knowledge of circuits. I'm trying to copy Devon Crawford's music visualizer, and I'm very stuck at the moment. Here's the link to the video where he creates his, although he doesn't show much of the hardware building process in the video: https://www.youtube.com/watch?v=lU1GVVU9gLU . Basically he is using a frequency to voltage converter, and inputting the voltage into the Arduino.

I'm just going to use his code for the project for now, and then learn to write in arduino and create my own code later on. In the description he links the circuit that he used: http://mathscinotes.com/2014/03/a-simple-frequency-to-voltage-converter/ .

I've attempted to build the circuit, but it's not working. I just went to an electronics store and got the diode and transistor from the schematic, and capacitors and resistors with the same properties as those in the schematic. However, I'm unsure what needs to be connected in the "Sensor interface output" part of the diagram. Right now I'm trying to connect a 3.5mm jack with stripped ends to it, but it isn't working. Any help would be so so appreciated, as I just don't know enough to complete the project.

Also, here are a couple pictures of my circuit at the moment.

https://imgur.com/zy6866M
https://imgur.com/IEWdZiu

PatrickMW

Hey guys, so I'm very new to using Arduino (this is my first project), and I have a rudimentary knowledge of circuits. I'm trying to copy Devon Crawford's music visualizer, and I'm very stuck at the moment. Here's the link to the video where he creates his, although he doesn't show much of the hardware building process in the video: https://www.youtube.com/watch?v=lU1GVVU9gLU . Basically he is using a frequency to voltage converter, and inputting the voltage into the Arduino.

I'm just going to use his code for the project for now, and then learn to write in arduino and create my own code later on. In the description he links the circuit that he used: http://mathscinotes.com/2014/03/a-simple-frequency-to-voltage-converter/ .

I've attempted to build the circuit, but it's not working. I just went to an electronics store and got the diode and transistor from the schematic, and capacitors and resistors with the same properties as those in the schematic. However, I'm unsure what needs to be connected in the "Sensor interface output" part of the diagram. Right now I'm trying to connect a 3.5mm jack with stripped ends to it, but it isn't working. Any help would be so so appreciated, as I just don't know enough to complete the project.

Also, here are a couple pictures of my circuit at the moment.

https://imgur.com/zy6866M
https://imgur.com/IEWdZiu

MorganS

Music doesn't have just one frequency. Trying to convert that to a voltage will give random results.

The circut shown in the LTSpice simulation is using an input that goes from 0V to 12V as a square wave. Not an audio signal at all.

Keep looking. There are better tutorials available.
"The problem is in the code you didn't post."

PatrickMW

I have looked, the few tutorials that I have found are even more confusing to me. this guy made it work with this circuit, and his code is there for me to use

DVDdoug

#4
Jul 15, 2018, 06:50 am Last Edit: Jul 15, 2018, 06:52 am by DVDdoug
Music contains many simultaneous frequencies.   There is no single-frequency with real world sounds.    And with music, usually the lower frequencies dominate. 

It doesn't make sense to build your own amplifier with transistors.   It's a LOT easier with an op-amp.  (Most op-amp circuits need bipolar, positive & negative, power supplies.)

I don't know how much voltage he's getting out of the frequency-to-voltage converter, but with the default 5V reference the ADC has a resolution of 5mV.    In most applications that's plenty of sensitivity so you shouldn't need an amplifier,* you simply adjust your software thresholds. 


The easiest way to get frequency information is with the MSGEQ7.   All of the filtering is done in hardware,   You just feed it the audio signal and a couple of clock signals and it puts-out the amplitude of 7 different frequency bands (multiplexed to one pin).

There is also an FFT library if you want more frequency bands.

You might start by simply reading amplitude/loudness.   If you feed-in a line-level or headphone-level signal you'll need to bias the input (2 resistors and a capacitor) because the Arduino can't directly read the negative-half of the AC audio waveform (it can be damaged by negative voltages).   

The MSGEQ7 takes care of that, and I assume the frequency-to-voltage converter also puts-out a positive voltage.

You can build the "the worlds simplest effect" by comparing the loudness to the moving-average loudness.   With this simple effect you get lots of lighting "action" because the LED is on half the time (above average) and off half the time (below average).       You can use similar techniques with all of your effects for automatic sensitivity adjustment.

If you can get the "simplest effect" to work, you can build from there.

The real secret to developing a project (or product) is to work on one thing at a time.   Work on reading the input and "print" your results to the serial monitor.

Work on the output (controlling the LEDs) separately under software control with no audio input.


When you an control the LEDs and you are getting useful numbers from the input, you can put them together.





* If you're using a microphone you need a preamp.

Grumpy_Mike

#5
Jul 15, 2018, 08:31 am Last Edit: Jul 15, 2018, 08:33 am by Grumpy_Mike
Cross post with https://forum.arduino.cc/index.php?topic=558138.msg0#new
Reported to moderators.https://forum.arduino.cc/index.php?topic=558138.msg0#new

Cross posting looses you a lot of sympathy here.

Coding Badly


Grumpy_Mike

I have looked, the few tutorials that I have found are even more confusing to me. this guy made it work with this circuit, and his code is there for me to use
This guy is an idiot. Who owns an oscilloscope and strip's wire with a knife? Who so misunderstands a problem that he comes up with that soloution?

ReverseEMF

#8
Jul 15, 2018, 07:17 pm Last Edit: Jul 15, 2018, 08:12 pm by ReverseEMF
The main reason why this circuit probably isn't working for you, it there probably isn't enough amplitude coming out of that 3.5mm jack [i.e. the voltage peak s aren't high enough].  So, you need some amplification, there.  

So, more than likely, what you need to do is amplify that signal [from the 3.5mm jack].  And, if that doesn't work, then there may be something wrong with your implementation.   Here's a stab at adding a "preamp":


[You'll probably need to download that to read it (sorry about that)]

This is the Frequency To Voltage Converter circuit with a ~10x gain amplifier attached , along with a volume control [VR1].  Increasing R2 will increase the voltage gain [Voltage Gain ~= R2/R3], but if you change R2, R1 will, likely, need to change -- in fact, the higher the gain, the more the value of R1 becomes critical -- to keep the bias point centered in the active region, to prevent clipping.  

And if this still doesn't get it working, then consider doing the math described at:
http://mathscinotes.com/2014/03/a-simple-frequency-to-voltage-converter/

OR, consider the goodol' LM2907/2917, still available at Mouser: https://www.mouser.com/ProductDetail/Texas-Instruments/LM2917N-NOPB?qs=sGAEpiMZZMuYYilu8wI%252bZ503wqoZUD%252bUBmCahB%252bAxKM%3d

Here's a link to a datasheet: http://www.ti.com/lit/ds/symlink/lm2907-n.pdf

Note: It really helps to have a scope when doing this kind of engineering!  

This whole thing harkens back to the days of the Color Organ of the 70's and 80's.  Using op amps configured as band pass filters, a music signal is separated into frequency bands, ala mixer, and the separate signals, then rectified and used to modulate different colored lights.

Here's a typical example of a modernized version:

https://makezine.com/2010/10/18/circuit-skills-led-color-organ-spon/

BUT, the goal is a little different, here: A single channel of running color/intensity keyed to music.


Quote
Music contains many simultaneous frequencies.
Sure, yes, Music is composed of many frequencies, but that's not a problem here.  Those "many frequencies" combine into one waveform [otherwise, how does it get displayed as a squiggly line on a scope?!?].  And, the idea is to, basically, smooth out those changes into an average, with a low enough frequency for an Arduino to follow.

Another way of looking at this is as a low pass filter.  Basically a Color Organ, with only one channel.  And, basically, what is depicted in the YouTube video, is a running history of past variations -- kind of a ticker tape of low frequency content.

"It's a big galaxy, Mr. Scott"

Please DON'T Private Message to me, what should be part of the Public Conversation -- especially if it's to correct a mistake, or contradict a statement!  Let it ALL hang out!!

Grumpy_Mike

Quote
This whole thing harkens back to the days of the Color Organ of the 70's and 80's
Cough cough.

I was making theses in the mid 60s. And on the way "invented" opto isolators to control mains lights with the filter outputs, using flashlight bulbs and light dependant resistors in a light proof tube.

And also we had the output of filters driving solenoids that moved a lens in the light path.

PatrickMW

this guy was probably the most helpful ^

ReverseEMF

Cough cough.

I was making theses in the mid 60s. And on the way "invented" opto isolators to control mains lights with the filter outputs, using flashlight bulbs and light dependant resistors in a light proof tube.

And also we had the output of filters driving solenoids that moved a lens in the light path.
HA!  Awesome!!  That's why I didn't even consider the 60's -- because it was all so primitive back then ;)  

[Respectful bow!!]
"It's a big galaxy, Mr. Scott"

Please DON'T Private Message to me, what should be part of the Public Conversation -- especially if it's to correct a mistake, or contradict a statement!  Let it ALL hang out!!

Go Up