PIC LED VU meter

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

ruffrecords

Well-known member
GDIY Supporter
Joined
Nov 10, 2006
Messages
14,944
Location
Norfolk - UK
There are quite a few chips that can be used for various types of LED based audio meter, but you can only have what the manufacturers provide in terms of number of LEDs and steps between them. So I was wondering about a possible project to develop a PIC micro-controller based sort of Universal Audio LED Driver where you could select different dB steps and/or ranges just by jumpers?

Has this been done already or is it something worth thinking about?

Cheers

Ian
 

JohnRoberts

Well-known member
Staff member
GDIY Supporter
Moderator
Joined
Nov 30, 2006
Messages
24,669
Location
Hickory, MS
ruffrecords said:
There are quite a few chips that can be used for various types of LED based audio meter, but you can only have what the manufacturers provide in terms of number of LEDs and steps between them. So I was wondering about a possible project to develop a PIC micro-controller based sort of Universal Audio LED Driver where you could select different dB steps and/or ranges just by jumpers?

Has this been done already or is it something worth thinking about?

Cheers

Ian

I did one commercial design based on a PIC and I own the software so I have though about the possibility of perhaps offering pre-programmed PICs that could be customized with option pins and glue circuitry. I have given this a lot of thought and will share my thinking on how something like this "could" work.

There are modern low cost PIC families with multiple 10 or 12 bit A/D convertors built in. The commercial meter I did easily handled 6 audio streams but i would probably standardize on a x2 meter chip set.  The cheaper low voltage family of PIC is not comfortable directly driving LEDs, but there are nice dedicated LED driver ICs (available in x8 or x16 LED capability, or more cascaded in series) that accept serial communication and are also modest cost.

Detecting both peak and average are relatively simple inside a microprocessor, and it is even possible (but not as easy) to compute RMS, while I haven't found that justified yet for metering complex audio. it might make a bigger difference for metering individual instruments in say a large console.

It would be reasonably simple with programming pins to select between dot or bar, peak or ave (or both, my favorite), linear or log meter scales. Further with all the spare A/D inputs some of those spare inputs could be used to program a user customized linear step size, or a custom dB step size for the log scale.  For example to make a log meter with -3dB steps, send a voltage equal to .707x of the processor supply. That will be interpreted as a - 3dB ratio between each step reading down from full scale.  

Sending serial data to the LED drivers with smallest threshold first, means you could push out 32 or more bits of data, and string multiple LED drivers in series, then just use a x8 or x16 latch to grab the top 8 or 16 data thresholds. In the linear scale the number of outputs would not go on forever and depend on the step size. There it may be worth standardizing on 8 or 16 evenly spaced linear thresholds, and scale with your input divider.

The two chip solution, PIC and LED driver could be close to the cost of the LM3915/15 but far more powerful. However I fear the economy of scale means there would be a premium to buy PICs in small quantity and program them independently.

OTOH, for a simpler modest number of LEDs meter, it is possible to use one older 8 bit PIC family that could drive LEDs directly, but I am not enthusiastic about the only 10 bit A/D , or dealing with 8 bit math (i hate 8 bit after getting used to 16 bit), or multiplexing the LEDs to use less drive lines, but perhaps making more noise inside an audio product.

Then there is the issue of TH vs. SMT... I don't know if the better LED drivers even come in TH, so perhaps the play is to make a small PCB with PIC and LED drivers already populated, that the user connects the led output lines to his custom display application.

I would be willing to work with somebody on this, but I am really not interested in getting back into the kit business after a few decades. I actually owned a kit business back in the 70-80 and lost faith in the business model (due to automation and lower cost manufacturing).  Note: I haven't generated the specific code to read step size but it is not very heavy lifting for a micro. This would obviously take a back burner to my more pressing projects I have going.  
 
Any interest? I think I have asked about this before to mostly silence. Probably not a huge demand.  

JR

PS: I haven't come up with a good way to cover fully custom random scales, but I'm open for suggestions.  There are enough spare A/D inputs that the log output could be programmed to accept different step sizes for multiple zones, or not
 

gemini86

Well-known member
Joined
Sep 22, 2008
Messages
2,477
Location
Eugene, OR USA
Just a thought I've had for a while. Would it be useful to have a "universal" vu / gr meter that could be switched between input, output, and a gr reading based off the difference between the pre and post gr element signals, rather than based off the control voltage? This would allow one to implement gr metering on any compressor circuit without doing a bunch of math and calibration to get an accurate metering. Would this be useful or is it even possible? I figured a pic would be the only way to achieve this. I don't know anything about them but they're on my to do list.
 

JohnRoberts

Well-known member
Staff member
GDIY Supporter
Moderator
Joined
Nov 30, 2006
Messages
24,669
Location
Hickory, MS
gemini86 said:
Just a thought I've had for a while. Would it be useful to have a "universal" vu / gr meter that could be switched between input, output, and a gr reading based off the difference between the pre and post gr element signals, rather than based off the control voltage? This would allow one to implement gr metering on any compressor circuit without doing a bunch of math and calibration to get an accurate metering. Would this be useful or is it even possible? I figured a pic would be the only way to achieve this. I don't know anything about them but they're on my to do list.

In fact yes, it would be possible to make a micro (PIC) based meter that reads both the input and output audio levels, calculates the dB level of both and displays the difference. This would not be smart enough to ignore the fixed gain often added to output side of compressors, but you could code in a trim or auto-zero button.

This seems a pretty specialized even lower volume application than generic level meters.

Using a micro you can do all kinds of tricks.

JR
 

ruffrecords

Well-known member
GDIY Supporter
Joined
Nov 10, 2006
Messages
14,944
Location
Norfolk - UK
Hi John,

Thanks for your comprehensive post. In reply here are my thoughts:

Their relative low cost plus built in 10bit AtoD was what attracted me to the PIC.

I think two channels per PIC will be quite adequate.

I am pleased that detecting both peak and average is relatively simple within the micro as this allows ballistics to be included in software rather than hardware.

I personally would prefer a single chip solution based on the older 8 bit PICs driving LEDs directly but that is because I have been programming 8 bit micros since the late 1970s.

I like the idea of using spare analogue inputs as a multi-level option selector - very pin efficient.

I think a through hole solution would be preferable for DIYers.

I am not interested in commercialisation. I am retired and build not for profit tube mixers in my spare time (of which I am pleased to say there is plenty). I would be happy to create the code with some guidance and release it into the wild under a GNU like licence.

Cheers

Ian
 

Dan Kennedy

Well-known member
Joined
Jun 5, 2004
Messages
279
Location
Inver Grove, MN.
The meters on the GR stuff is PIC, 16F886, built thousands of them.

Just a simple set of precision rectifiers, everything else in the micro.

We do a short scale, just 6 LEDs per meter, but I've also done one with
the same PIC driving two 24 LED strings, with the LED driving being done
with 74HC573's.

It's a good project, ideal for these size chips.
 

ruckus328

Well-known member
Joined
Apr 14, 2010
Messages
906
Location
Philadelphia, USA
John Roberts, I might be interested in getting involved with making this a reality.  I'll shoot you an email tonight/tomorrow so we can discuss.
 

sahib

Well-known member
Joined
Aug 19, 2006
Messages
3,603
Location
Glasgow - UK
Here is a promise,

Ruff releases the code as freeware for the community. I give away thousands of LEDs in various colours and shapes free. I'll post the photographs of what I have.
 

gemini86

Well-known member
Joined
Sep 22, 2008
Messages
2,477
Location
Eugene, OR USA
JohnRoberts said:
gemini86 said:
Just a thought I've had for a while. Would it be useful to have a "universal" vu / gr meter that could be switched between input, output, and a gr rpreading based off the difference between the pre and post gr element signals, rather than based off the control voltage? This would allow one to implement gr metering on any compressor circuit without doing a buupnch of math and calibration to get an accurate metering. Would this be useful or is it even possible? I figured a pic would be the only way to achieve this. I don't know anything about them but they're on my to do list.

In fact yes, it would be possible to make a micro (PIC) based meter that reads both the input and output audio levels, calculates the dB level of both and displays the difference. This would not be smart enough to ignore the fixed gain often added to output side of compressors, but you could code in a trim or auto-zero button.

This seems a pretty specialized even lower volume application than generic level meters.

Using a micro you can do all kinds of tricks.

JR

Yeah I guess if you have some sort of varimu comp you would need to compensate for gain but an opto or fet element could be read directly. Anybody have a good beginner pic programming site they can recommend?
 

JohnRoberts

Well-known member
Staff member
GDIY Supporter
Moderator
Joined
Nov 30, 2006
Messages
24,669
Location
Hickory, MS
ruckus328 said:
John Roberts, I might be interested in getting involved with making this a reality.  I'll shoot you an email tonight/tomorrow so we can discuss.

We can talk, but if Ian is willing to code a 8 bit direct drive solution, that sounds like this small market may already be getting crowded.

We'll see how it goes.

JR
 

JohnRoberts

Well-known member
Staff member
GDIY Supporter
Moderator
Joined
Nov 30, 2006
Messages
24,669
Location
Hickory, MS
ruffrecords said:
Hi John,

Thanks for your comprehensive post. In reply here are my thoughts:

Their relative low cost plus built in 10bit AtoD was what attracted me to the PIC.
Keep in mind if you do the rectification inside the digital domain you give up one bit of resolution so 10B A/D turns into 9b rectified. On paper this is enough for most modest meters (54 dB). I used 12 bit A/D and my resolution floor was limited by settling time of A/D input S/H, but I was multiplexing more than two input signals.
I think two channels per PIC will be quite adequate.

I am pleased that detecting both peak and average is relatively simple within the micro as this allows ballistics to be included in software rather than hardware.
Relatively simple. I model a one pole time constant by calculating the difference between the immediate sample and the accumulated average. If the immediate sample is above  the accumulated average, I multiply this difference by the attack time constant factor or coefficient that simulates the charging current in the R of an RC and add this charge current to the running average. If the immediate sample is below the accumulated average, the difference is multiplied by the release time constant coefficient and subtracted from the running average. Several one clock tick operations per sample, but not killer at least with 16B PIC running at 7 MHz. With byte wide I don't know if we run into resolution issues for coefficient, or accumulation registers, but you can double precision with some increase to code complexity (I ASSume).

I actually give both the peak and average different attack time constants, but similar release timeconstants.

Another nice thing about doing this in the digital domain is no diode drops in the attack/release circuitry. 
I personally would prefer a single chip solution based on the older 8 bit PICs driving LEDs directly but that is because I have been programming 8 bit micros since the late 1970s.
Cheapest one chip solution is probably older 5V PIC driving LEDs multiplexed (5x5, 6x6 ?). I drove something like 40 LEDs in my first generation drum tuner that way (using 18F PIC).  I don't love multiplex for sensitive audio products but if loop area of current is kept small and/or meter shielded it should be manageable.
I like the idea of using spare analogue inputs as a multi-level option selector - very pin efficient.

I think a through hole solution would be preferable for DIYers.
yup PIC can still be had TH
I am not interested in commercialisation. I am retired and build not for profit tube mixers in my spare time (of which I am pleased to say there is plenty). I would be happy to create the code with some guidance and release it into the wild under a GNU like licence.

Cheers

Ian

Let me introduce you to Mr Rukus...  I'll be glad to advise from a distance, like usual.

I wouldn't code anything in 8bit these days. IMO too much of a PIA dealing with a real world that comes in more than 256 flavors. But you are free to spend your time any way you want. . 

JR
 

PRR

Well-known member
Joined
Jan 30, 2010
Messages
11,144
Location
Maine USA
> a gr reading based off the difference between the pre and post gr element signals....
> I figured a pic would be the only way to achieve this.


Nah. Analog divider. (Multiplier inside a loop.) Iffn you like dB readings, maybe a LOG function (though traditional tube limiters used non-loggy metering). Actually a LOG-ratio scheme is cheaper and gives loggery directly.

That assumes analog readout. But analog meters are going out. And a PIC is as cheap as an LM3915, and not THAT much harder to program (unless you grew up reading LM3915 plans).

> Universal Audio LED Driver

IMHO: the market is small, fragmented, opinionated, and largely ignorant of the language. You can't please everybody, and you may not be able to find a niche worth the trouble to support.

As for step size and other options.... at some point you may as well put a USB jack on it, and a PC/iFone app to upload a table of thresholds, knee-size, pin assignment (avoid wiring crossovers), blink, etc. And of course code versions when you spin-out something new after product is in the field.
 

gemini86

Well-known member
Joined
Sep 22, 2008
Messages
2,477
Location
Eugene, OR USA
PRR said:
Nah. Analog divider. (Multiplier inside a loop.) Iffn you like dB readings, maybe a LOG function (though traditional tube limiters used non-loggy metering). Actually a LOG-ratio scheme is cheaper and gives loggery directly.

That assumes analog readout. But analog meters are going out. And a PIC is as cheap as an LM3915, and not THAT much harder to program (unless you grew up reading LM3915 plans).

...trying not to ruin this thread, but what would one google to research this further, you've perked my curiosity.
 
Top