How to use 1452 or 1701 make a signal level detector to make LED has different brightness while signal strength change?

Hi,

I want to use 1701 and 1452 to make a level detector to detect the signal strength,

but I don't know how to use blocks to make led brightness will follow the signal strength.

The led brightness level will follow the signal strength, if signal is stronger the led will more bright, the other side, the lower signal level will cause lower led brightness

(I think this may use the PWM to make led bright level)

any tips for making this function?

Thanks!

BR.

Parents
  • +1
    •  Super User 
    on Apr 16, 2019 3:28 PM over 1 year ago

         Hello Alvis,

         PWM can be done by comparing the signal in question to a ramp or triangle waveform.  The example shown below performs this function.  Incoming audio passes through a DC Block Filter to remove residual DC caused by the A/D converters -- use this filter anytime you're making level measurements; otherwise this DC, which typically measures about -45 dB, shows up with no input.  Peak Envelope blocks measure the left and right signal levels.  The Sawtooth Oscillator's output goes from -1 to +1; taking its absolute value provides a 1 KHz triangle wave spanning 0 to +1.  The two ABCD Comparatorsperform the PWM -- I show their logic inverted simply to make the schematic appear neater, and re-using the level signal for the logic "high"  level saves a DC source.  The GPIOs accept any nonzero input as a logic "high."  The attached project runs on a ADAU1701MINIZ board.

         Best regards,

         Bob

    PWM-1701-Level.zip

  • Hello there,
    If I want to make a signal light and a peak light, use two IO ports to connect a two-color LED. When there is a signal, one IO port outputs high. When the signal reaches a certain level, the other IO port outputs high. At this time, the signal LED output Low level? Note that I don't need PWM.
    thank you very much!

  • 0
    •  Super User 
    on Apr 24, 2019 3:08 AM over 1 year ago in reply to zlb898

         Hello,

         Your desired circuit features three output states -- No signal, both outputs Low, LED dark.  A normal signal drives the "green" output High.  An excessive signal drives the "red" output High and the "green" output Low, reversing the LED polarity so it lights red.  One way to perform this logic is shown below:

         Taking the Absolute Value of the Left and Right signals rectifies them into peak levels.  The Max block selects the higher of the two.  The Peak Envelope block stretches the peaks into a smooth envelope.  Sharing this block instead of using one for each channel saves about 15 instructions.  Comparator ABCD1 lights the red LED for a level of -3 dB or higher, set by source DC3.  Comparator ABCD2 does the same for the green LED, except its output is allowed High only if the Clip output is low -- this is accomplished by ZeroComp1 and Fb1.

    Level-Clip_LEDs.zip

         Best regards,

         Bob

         

  • Hello.

      Thank you very much for your prompt reply. I forgot to explain that I am using the ADAU1451. I know that these settings are basically similar, but there are still some differences. The main reason is DC. I don't know what format to set. What is the value?
      Also, when I use the ADAU1451, I want to adjust the EQ, treble and bass through the ADC port. Using the same method as 1701 does not work at all. Please advise again, I am grateful!

  • 0
    •  Super User 
    on Apr 25, 2019 12:40 AM over 1 year ago in reply to zlb898

         Hello zlb898,

         Since the -1451 is more powerful, there's several differences to be aware of:

         Number Formats -- The ADAU1451 handles 32-bit numbers compared to 28 bits for the -1701.  Thus the integer format is 32.0, akin to the 1701's 28.0 format.  Audio signals are in a 8.24 format.  Compared to the -1701's 5.23 format, you get one more bit after the decimal point and three before. This provides twice the resolution in the audio signal range where +/- 1.0 is still full scale, and a whopping +/- 128 for internal calculations.  To recap, your "analog" format is 8.24, and your "bit" format is 32.0.

         Auxiliary ADC -- The ADAU1701's aux ADCs resolve to eight bits and convert to a 5.23 format analog signal.  A full-scale input provides a 1.0 decimal output.  The ADAU1451's auxiliary ADCs operate much differently.  They have ten bit resolution, converting to an integer result (0 -- 1023 in 32.0 format). This turns out to be more convenient when you're having the Aux ADC driving an index filter or a standard lookup table -- both of which working with integer inputs.  For example, if your Aux ADC is driving a 33 value lookup table, multiply the Aux ADC output by (32 / 1023  =  0.03128).

         The LED level sensing is the same as the ADAU1701 example, except for the number formats.  The bass control shown operates with the Aux ADC's 0-1023 integer output -- since the ADAU1452MINIZ board has no pots, I tested it with a DC source instead.  Hope this helps...

    1452-AuxADC.zip

         Best regards,

         Bob

  •  Hello Bob,

       I have verified all of this, the DSP works very well, thanks again for your support, the current product can meet the requirements. But I want to know more about RAM information, DM0 and DM1, I look at the compiled output, DM1 is allocated a lot, DM0 is very small, even if I increase the delay amount, DM1 overflow will not be automatically assigned to DM0, how can I manually assign these ?

    Best regards,

    Liangbin

Reply
  •  Hello Bob,

       I have verified all of this, the DSP works very well, thanks again for your support, the current product can meet the requirements. But I want to know more about RAM information, DM0 and DM1, I look at the compiled output, DM1 is allocated a lot, DM0 is very small, even if I increase the delay amount, DM1 overflow will not be automatically assigned to DM0, how can I manually assign these ?

    Best regards,

    Liangbin

Children