PIC LED VU meter

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
Dan Kennedy said:
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.

There are clearly two levels at which this could be done. The simpler one is to have external rectification with the PIC simply acting as a more sophisticated level detector and display driver. This is relatively simple but definitely a lot more flexible than the current National offerings.

The harder solution is to do the lot in the PIC, rectification, ballistics and display.  It is a one chip highly flexible solution but requires a lot more development and quite possibly a more powerful (= more expensive) PIC.

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.

Is this a commercial item or something you could share with DIYers?

There are a couple of useful variations I can think off. One would be a regular VU type but with an added peak LED some preset dB above FS.  The other would be like the meters on my AKAI digital workstation that work as a bar graph but peak hold the FS and digital over LEDs. Both of these are functions it should be trivial to add to a PIC.

Cheers

Ian
 
JohnRoberts said:
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

If ruckus wants to offer pre-programmed chips using open source software provided by me/us under the GNU GPL then that's fine by me. Anyone who wants to make the extra effort can do the programming themselves.

Cheers

Ian
 
sahib said:
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.

That's a deal.

Cheers

Ian
 
JohnRoberts said:
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.

Good point about losing one bit. Can I assume your conversion time was short enough to handle 20KHz audio?

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).

Provided we stick to integer maths that should not be too much of a problem from the coding pint of view but timing might be an issue. I am keeping an open mind on 8 vs 16 bit.


Cheers

Ian
 
ruffrecords said:
sahib said:
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.

That's a deal.

Cheers

Ian


These are left overs from various display jobs that I did in the past and have been sitting on the shelf for years. Only disadvantage is that the red ones are 2.5mm wide as opposed to yellow and green which are 2mm. But all free for the forum.

led1.JPG

led2.JPG


 
ruffrecords said:
JohnRoberts said:
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.

Good point about losing one bit. Can I assume your conversion time was short enough to handle 20KHz audio?
If you perform the rectifier before the PIC you gain one more bit of resolution, but the design engineer in me says don't spend more money and more PCB real estate to do anything outside that you can do inside. The digital rectifier requires learning an AC zero and performing some simple math on a per sample basis, but this is the kind of stuff microprocessors do well. Add, subtract, even multiplies only take one clock tick, so microseconds for even a slow PIC.

I don't recali the upper conversion time limit but it is fast enough. As I mentioned elsewhere I ran into a different time issue related to the input S/H settling time. The way the PIC provides their multiple A/D inputs is to multiplex input pins between only one internal A/D convertor. Visualize sampling between a stereo pair of inputs where one channel is at full volume and the other full off. Every other input sample for the A/D is slewing from as much as full scale back to nominal zero. This could become an issue for displaying wide dynamic range (low levels). On a meter this looks like low level crosstalk between inputs, while the mechanism isn't literally crosstalk and improves with adequate input capture times.

Another technical point that may not be obvious about sampling theory, the Nyquist criteria of Fs= >2xF, is primarily to prevent aliasing the frequency information, down to a lower pitch. For amplitude detection, who cares if a signal is showing up as 22 kHz or 18kHz as long as you can read the amplitude? For significant intentional under-sampling there is probably merit in dithering the sample period so it doesn't find a dead spot and under report if people meter HF steady state tones, but IMO the PIC are more than adequate for a 2x audio meter, and for only complex audio even a fixed under sampled rate probably works fine.


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).

Provided we stick to integer maths that should not be too much of a problem from the coding pint of view but timing might be an issue. I am keeping an open mind on 8 vs 16 bit.


Cheers

Ian

There is nothing about a simple meter that can not be handled in byte wide internal paths and operation, it is just a PIA IMO so I don't want to do it. For example the 10 bit A/D result, requires two bytes to represent. Likewise the AC zero to perform internal rectification requires two bytes, and subtracting the two to rectify the result requires an several step operation, not a single clock tick operation as with 16 bit wide data and instructions. The time to crunch this is not a critical constraint for even a relatively slow PIC while it's waiting for the next A/D conversion result, but somewhat more difficult to code and keep track of. I also prefer the extra 2 bits of A/D resolution (12 bit) in the newer PIC families but if the meter is limited to a modest dynamic range the extra resolution isn't needed.

I see no reason why the meter couldn't be done in one of the 8 bit families, only I don't want to do the gymnastics.  If you do the rectification outside the PIC and only use the top 8 bits of A/D result, you could stay completely in 8 bit math. While I would still perform the time constant routine using two byte wide data (Note the 8 bit multiply gives a 16 bit result so this is not heavy lifting.).

You could simplify the code even further if you perform the rectify and time constants outside the PIC too, but the design engineer in me is screaming don't do that. 

JR

PS: also check the pricing, Don't assume the older byte wide stuff is cheaper, IIRC the newer 16b processor I changed to was a little cheaper too. While the comparison is  new PIC + LED latch vs. old PIC.
 
> what would one google

"log ratio amplifier"?

See Fig 9 or 10 in TI's LOG1xx datasheets.
 
PRR said:
> what would one google

"log ratio amplifier"?

See Fig 9 or 10 in TI's LOG1xx datasheets.

That TI log chip looks interesting, perhaps to do some log domain crunching for a VCA based compressor gain control. I wish they sold that part a few decades ago. I had to roll too many of my own similar circuits using transistor arrays or whatever.

For a micro based meter, even if providing dB output thresholds, there is generally no need to do a real time log conversion or calculation. Compute the meter thresholds in advance for any desired ratios, and crunch the real time data linearly. 8 bit is only 48 dB dynamic range and perhaps marginal for a wide range meter, but a few extra bits or perhaps double precision (2 bytes) is more than adequate. Perhaps adding this log conversion between a linear front end and the micro would increase the dynamic range of the on chip A/D, but this seems academic since the analog circuitry in front of the log conversion would need extremely high precision.

JR
 
I have a prototype of a VU meter using an AVR microprocessor but it is still being tweeked.  For some of the reasons that PRR quoted earlier, I probably will only have boards for it when I have another circuit (preamp) for it to be used with.

I like using an analog front end since it is easy for a DIY builder to mod to suit his application, by changing gain, decay times, etc.  In production for a specific device, I'd probably go with John's plan of handling it all digitally.

regards, Jack
 
PRR said:
> 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.

Now that is interesting. I have seen PIC program architectures that even allow entire subroutines to be swapped out but this requires some software overhead and complexity in advance.  DIY users would probably be more than happy just loading custom meter thresholds, time constants, and the like, but this could be expanded to do much more.

Another option that would kill less brain cells is to publish working source code, with adequate documentation to direct individuals about how to alter the fixed meter thresholds in the source code, to whatever constants they want. The basic development tools to convert this source code to working hex files are generally free, to promote chip use.

The remaining unfinished link in this chain is an interface dongle to connect between the part to be programed and a PC or MAC (most use PCs these days). Right now there is no "really" cheap commercial product that does this, but there is nothing about the hardware that couldn't be handled with a USB port and a few cheap parts.

It will probably never be practical to displace a LM3915 with a PIC  for 1x build, but I could imagine coming up with multiple applications to do simple processor tricks, with customizable software, so once the user gets dongled up, they can get repeat utility out of it.

Of course if one is to invest the effort to merchandize low cost dongles, it might be worth throwing that effort into coding up an quasi operating system that can be updated via a simple serial com port.  This could be made pretty soft, and flash size is relatively cheap so this basic part could come loaded with lots of stock functions that the user selectively turns on/off or customizes as desired.

I have more than enough work to keep me much  too busy to pursue something like this, and perhaps people already are doing something similar, but this seems doable and the softer you make the product, the wider the potential market. 

It would probably be worth Microchip's while to sell a truly low cost programming dongle to attract even more of the DIY community.

For programming 28 pin thru hole parts this is probably as cheap as we get ($25) but the cost seems like it could be even lower if there was any volume (and/or they decided to pursue the hobby market).

130680-1.bmp


JR
 
We just need to get one of those chinese ebay sellers to have a million of them made, then the cost would go down to about 3 bucks.


or would something like this work for the PIC needed? http://www.jdm.homepage.dk/newpic.htm
 
There were several on the WWW involving little more than a serial com jack and maybe one cheap logic part.

The flash based micros have the firmware onboard to burn their onboard memory themselves so all we need to provide is the right combination of clock data and control in the right format.

I've never bother to look into doing this cheap, since I have several dongles around that for my purposes are already cheap enough.
------

I guess we could also consider an interactive 'learn" mode, where we could input meter thresholds one at a time. Once we tell the PIC what we want, we can save that threshold and move on to the next. When happy with all the new thresholds we can tell it to burn those into flash memory and it will come up with those saved thresholds, every future time it powers up. Unless we decide to change them again. 

This is unacceptably time intensive for commercial use, but for a one off DIY it might work.

JR

 
I think if one will be using a microprocessor for a VU, I would rather utilize it to it's full potential, rather than just lighting up LEDs and being a direct replacement for a 391x. 

This is what I'm working on, on and off when I have some free time.

Here I'm just testing my draw routines to see how fast the LCD can respond (generating random numbers to simulate audio levels). It's not actually connected to an audio source.... yet. I'm planning on just using the micro's built-in AD converter, with maybe a precision full wave DC rectifier in front.

http://www.youtube.com/watch?v=MLD7PPRdlJU

I incorporated a "peak level" which freezes temporarily (user defined duration), and then slowly climbs down, until it gets pushed up again. (saw this on some 80s hi-fi equipment)
 
owel said:
I think if one will be using a microprocessor for a VU, I would rather utilize it to it's full potential, rather than just lighting up LEDs and being a direct replacement for a 391x. 

This is what I'm working on, on and off when I have some free time.

Here I'm just testing my draw routines to see how fast the LCD can respond (generating random numbers to simulate audio levels). It's not actually connected to an audio source.... yet. I'm planning on just using the micro's built-in AD converter, with maybe a precision full wave DC rectifier in front.

http://www.youtube.com/watch?v=MLD7PPRdlJU

I incorporated a "peak level" which freezes temporarily (user defined duration), and then slowly climbs down, until it gets pushed up again. (saw this on some 80s hi-fi equipment)

FWIW it is even possible to use the lowly LM391x to more of it's potential. I made a bench unit where I multiplexed a single 3916 between Dot and Bar graph mode, while i simultaneously multiplexed the input between Peak and VU (ave). This worked to make my simultaneous peak/VU, but I never found the LM391x worth using in a commercial design. Better cheaper ways to skin that cat even in all analog.

Your display looks a little too fast to mimic a VU ballistic , but you said it wasn't reading music.

i've posted this before but this is what I have in mind. http://www.johnhroberts.com/Candy.wmv

Dot is representing fast attack peak level, Bar represents slower changing VU level. I have a hold on the highest peak LED, but didn't want to add too much clutter. When I first started developing these dual characteristic meters back in the '70s this was too much information for many people who preferred the simplicity of only one characteristic displayed at a time.  Since then the world of information display has evolved to the point that you can't watch TV without all kinds of nonsense (little people) being displayed in the margins. Eventually they'll take commercial breaks to show the actual program.   

JR
 
> I wish they sold that part a few decades ago.

I thought it had been around for 30 years? Perhaps from a different company, maybe a different number. Possibly at a silly-high price, or only for special customers.

The classic implementation uses a silicon resistor for tempco. For audio monitoring in a studio, the tempco is not a problem; for precise measurements or oil-well/aircraft work you'll want that frill.

> For a micro based meter, even if providing dB output thresholds, there is generally no need to do a real time log

Of course. But someone "figured a pic would be the only way....". How quickly we forget the old ways.
 
John, yes saw that video the first time you posted it. Very cool. Multiplexing, great idea. I like it.

Your display looks a little too fast to mimic a VU ballistic , but you said it wasn't reading music.

No, I just have an infinite loop, generating some random number (0 to 100), and then trying to display the "vu" on the LCD, then loop again. That's why it was fast. It was mostly a test to see how fast I can send commands to the LCD and how fast the LCD can execute those commands.
 
PRR said:
> I wish they sold that part a few decades ago.

I thought it had been around for 30 years? Perhaps from a different company, maybe a different number. Possibly at a silly-high price, or only for special customers.

The classic implementation uses a silicon resistor for tempco. For audio monitoring in a studio, the tempco is not a problem; for precise measurements or oil-well/aircraft work you'll want that frill.

> For a micro based meter, even if providing dB output thresholds, there is generally no need to do a real time log

Of course. But someone "figured a pic would be the only way....". How quickly we forget the old ways.

The part may have been around but I don't recall seeing that inner schematic. On reflection since most of my logging applications required more than one pair of junctions, using two of these chips probably would have been even more cost prohibitive compared to a cheap and widely available 5 transistor array, with a few glue opamps.

Yes, real time analog logging circuits are still widely used today but usually embedded inside a THAT chip set.

JR

 
Just reviving a very old thread...

Was this project ever finished?
I am asking this because I need 16 (peak) meters to monitor the input level of a mixer.
While looking around, I found this very nice PK16 meter , but unfortunately there are only 10 pieces available. Also the price is a bit higher than I would expect.
If you could make them with a PIC processor, I think the price could be around $5 per channel...
Maybe I will start with something myself and share the information if this is still interesting.
 
I saw those PK16s also. I have the same issues, I need more than 10 (40 actually) and at that price it is prohibitive.

I would be in for some if it happened. 5~10 dollars a channel would be ideal.
 

Latest posts

Back
Top