View previous topic :: View next topic |
Author |
Message |
programmista123
Joined: 31 Jan 2018 Posts: 140
|
Posted: Fri Jun 17, 2022 9:10 am Post subject: Audio spectrum analyzer. |
|
|
Hello
I would like to share with you my newest project - audio spectrum analyzer which use DSP and AVR.
Background.
When I was younger I sow on the YouTube "The Fastest Acoustic Spectrum Analyzer on AVR M8 - new V2 !" and it was enough to create in my mind words: I want this!
During few years I have had a lot of concepts due to one thing: audio accuracy - frequencies and levels. I was thinking about 16 bandpass filters etc. but it may generate a lot of problems and 0 flexible of design.
Where Am I now?
I'm using AVR128DB28, ADAU1401, PCF8574 and 2x24 LCD.
ADAU1401 is responsible for create bandpass filters and create RMS value. This value is reading by AVR via I2C.
PCF8574 is responsible for driving LCD.
It works.
However....
Because HW was created in one day just as a proof of concept a few of my hunch comes true.
1. I2C busload.
I have only 2,5 ms free slot. It's creating a conflicts sometimes when I'm trying to update DSP's parameters from PC SW. Additional code to distable I2C was added (controled by GPIO).
2. ADAU1401 out of memory.
ADAU1401 is simple DSP which is running at 50 MHz and is able to proceed 1024 instructions per audio sample. In this case I'm able to create only 11 filtered frequencies. In plan I have 2x LCD = 48 bands.
How it works right now?
Below you can see link.
https://youtu.be/RKCdFkkeQZo
2nd bar is not correctly adjusted (and all of them - not optimal ). Each bar can configured in terms of frequency, gain, bandwidth etc.
What next?
1. Use AVR128DB64 to drive two LCDs directly.
2. Data from DSP will be read via SPI not I2C
3. DSP need to be changed from ADAU1401 to ADAU1452 (300 MHz, 6144 instructions).
4. Think about optimized code, especially for LCD.
5. Change master clock from 12.288 MHz to 24.576 MHz
Regards!
Przemek |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Fri Jun 17, 2022 10:12 am Post subject: |
|
|
great project !
i have little knowledge about DSP. i did however looked into spectrum analyzers (when i was building RF transmitters).
I remember the audio equipment in the 80's or 90's had colorful LED for the equalizer. but that were just toys.
you are doing the real deal.
using i2c to control LCD is no good for this application.
i assume you use OLED ?
in any way you need an LCD (or 2) that have little to no delay for the controller.
And a driver that either controls in 4 bit or 8 bit bus mode.
i think these drivers exist but i can always help you out.
thanks for the YT video. it gave a good impression.
and yes there is always a new improved version
i hope it come to the stage where you can post the complete project. _________________ Mark |
|
Back to top |
|
|
programmista123
Joined: 31 Jan 2018 Posts: 140
|
Posted: Fri Jun 17, 2022 11:16 am Post subject: |
|
|
Thanks Mark!
Yeah, when I'm typing "audio spectrum analyzer", 90% of them (excluding ProAudio) are blinking toys
In this case I'll have indicator based on pure and real data.
LCD: 2x24 with HD44780 compatible driver. Based on description data bus is 4 bit and I would like to use this config for next version.
I was thinking about VFD displays also. Right now prices are too high. Prophylactically I'll add heating resistors - to attach them to LCD frame just to have better liquidity of pixels
I'm creating list with my concerns right now so it's one step further.
BTW. My post about 8bit PWM and AVR128DB28 was wrote when I was not able to generate negative voltage for LCD bias
Regards,
Przemek |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Jun 20, 2022 11:57 am Post subject: |
|
|
PWM : good that you discovered that.
LCD : there are drivers that handle 2 LCD in 4 bit mode. and an existing one could be modified.
but the most important thing : that the write lcd instruction does not use too much time. you can look that up in the datasheet. often only the initialize procedure takes relatively much time and the writing is quick.
but best to check it. the oled types were not that expensive, only when you plan to make a lot of them
quality comes with a price. on the other hand, the human eye can not follow the quick change of the display. so maybe it is not that important. you know better i think. _________________ Mark |
|
Back to top |
|
|
programmista123
Joined: 31 Jan 2018 Posts: 140
|
Posted: Wed Sep 21, 2022 6:10 pm Post subject: |
|
|
Hello,
I have some "free" time and I would like to ask you about the best possible solutions for connecting 2x LCD to AVR.
As I mentioned I would like to use AVR128DB64.
Port C - 3V3 power domain to connect with DSP
Port B and Port E can be used for LCDs. I sow library for LCD with 2 chip enable so in this case only one group of the port should be enough (common data lines for 2x LCDs).
Of course I can prepare version which is able to deal with both solutions however I would like to have opinion from PROgrammers
Thanks!
Przemek |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed Sep 21, 2022 7:00 pm Post subject: |
|
|
there are few things to consider. cost of course.
but also when the LCD must be real fast, you best use 8 bit mode. that way you can write data at once not by nibble.
the LCD itself need to be able to show this info in that speed too.
the delay of the LCD or how fast it can process a write instruction. if it is 'slow' you do not need to use 8 bit too.
some OLED LCD are probably fast as well. most text lcd have compatible processor. but some are faster than others. you need to check some data sheets. _________________ Mark |
|
Back to top |
|
|
programmista123
Joined: 31 Jan 2018 Posts: 140
|
Posted: Wed Sep 21, 2022 9:33 pm Post subject: |
|
|
1. In this case budget is clearly defined: LCD, no VFD I think this is the main and most important cost. I don't count the time (but maybe I should? ( ).
2. It's really hard to get LCD HD44780 with 8 bit bus. Everyone is looking for cost-reduction so 4 bit controllers are in 99% available on the market.
Before LCD I thought about LED bar. Nevertheless it's more complicated, power consumption is much more etc.
In this case, I'm preparing design with both possibilities (1 port 2x EN and 2x port 1x EN per LCD)
Thanks,
Przemek |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Oct 13, 2022 2:52 pm Post subject: |
|
|
how many will you make? i probably have some 8 bit lcd for you.
but when the goal is to start a mass production, that would not be enough.
i think most lcd have 8 bit bus. at least the ones i have here.
but it does not hurt to design for both 4 and 8 bit. the driver i can help (write to support) in fact some exist already.
you also might consider graphical lcd with SPI (driver from O-Family) it is very fast. maybe worth a test? _________________ Mark |
|
Back to top |
|
|
JC
Joined: 15 Dec 2007 Posts: 584 Location: Cleveland, OH
|
Posted: Thu Oct 13, 2022 4:35 pm Post subject: |
|
|
You might still want to look at an LED display.
The "old" LED bargraphs are a bit expensive, and use a lot of I/O pins.
You can purchase LED Matrix displays modules, complete with a Max7219 driver chip, for less than you can buy the chip or the LEDs alone!
This link, from Banggood Electronics, has 4 modules cascaded together, and cost only $5.40 USD.
It uses a single SPI interface to drive the display.
Link: https://usa.banggood.com/MAX7219-Dot-Matrix-Module-4-in-1-LED-Display-Module-p-1072083.html?cur_warehouse=CN&rmmds=search
Good luck with your project!
JC
|
|
Back to top |
|
|
programmista123
Joined: 31 Jan 2018 Posts: 140
|
Posted: Thu Oct 13, 2022 6:04 pm Post subject: |
|
|
Hello!
Mark,
I thought about 2 PCs so 4 LCD are needed.
Regarding LCD bus - your answer made me to double check what I wrote.
I'm using LCDs from AVDisplay : http://www.artronic.com.pl/o_produkcie.php?id=824?
Based on block diagram it can be: SPLC780 or S6A0069. Both are 4 or 8 bit capable. On PCB traces are routed.
As I remember somewhere I sow clear statement: 4bit bus. I'm not able to find it again... .
Nevertheless in this case I have 8 bit LCD displays Thanks for proposition!
JC,
I was thinking about LEDs but with different style:
MAX7219 - good to know it. However the current consumption will be much higher in compare to LCD or OLED.
Thank you!
Best regards,
Przemek |
|
Back to top |
|
|
programmista123
Joined: 31 Jan 2018 Posts: 140
|
Posted: Fri Mar 31, 2023 8:11 pm Post subject: |
|
|
Hello,
I received new PCB with changes - AVR128DB28 to AVR128DB64 and ADAU1401 to ADAU1452.
LCDs are connected directly to AVR.
RJ45 is for power supply, enable and stereo analog input. Optical S/PDIF is also present.
I'm checking HW right now and both LCDs are working but with standard lib for 1 LCD.
Can anyone help me with lib (4 or 8 bit) for 2 LCDs?
PD3 LCD_RS
PD4 LCD_E1
PD5 LCD_E2
PD6 LCD_RW
PE0 LCD_D0
PE1 LCD_D1
PE2 LCD_D2
PE3 LCD_D3
PE4 LCD_D4
PE5 LCD_D5
PE6 LCD_D6
PE7 LCD_D7
Thank you!
Przemek |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Sat Apr 01, 2023 12:05 pm Post subject: |
|
|
i will make it as promised earlier. _________________ Mark |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Sat Apr 01, 2023 12:23 pm Post subject: |
|
|
attached the lib.
it is specific for your port settings.
use this in bascom :
Code: |
$lib "lcd8-2en-rezemek.lib" 'specify lib
Config Lcd = 16x2 'kind of lcd used
Config Lcdmode = Port 'specify port mode
Config Lcdbus = 8
Dim Blcd As Byte 'use this byte to control the enable1 or enable2 or both
'a value nee to be 1, 2 or 3 for both lcd
Initlcd
Blcd = 3 'both lcd
Cls
Lcd "test" 'Both Display Same data
Waitms 1000
Blcd = 1 : Cls : Lcd "one"
End
|
seems i forgot a letter of your name. but you get the idea.
this lib can send data to both lcd, or one of them.
it is not tested with real hardware.
also, there is no busy flag checking. so this lib could be optimized. instead of waiting, the flag could be checked. _________________ Mark |
|
Back to top |
|
|
programmista123
Joined: 31 Jan 2018 Posts: 140
|
Posted: Sat Apr 01, 2023 12:39 pm Post subject: |
|
|
Haha,
Thank you Mark!
I remember times when I played a lot online with Hungarians and all the time they called me in the same way as filename (without lcd8-2en- and .zip)
I will check it and share progress in the upcoming days
Regards,
Przemek |
|
Back to top |
|
|
|