Automated Christmas Lights - not working as expected

So I replicated the following project off an Instructable site but mapped it out on a breadboard and used mechanical relays instead of digital. But otherwise, I used all the same components.

Everything seems to be connected correctly and appears to be working, but the LED array isn't operating as expected from the instructable.

Here's what I'm seeing...

It seems to be related to Pin "A0"... when I pull it, the display works as expected, but the potentiometer does nothing.

Any thoughts on what I should look for?

is now and then named "destructables" due failuring projects.

Please post schematics and code here. No helper enjoys plowing through entire projects.

      int spectrumRead = analogRead(msg7DCout);

Please print the value of this variable to the serial monitor. This is the value read in from A0 which is then mapped to the equaliser display.

I suspect that the Analog signals are too strong... and therefore you are always hitting the top of the range.

When you unplug A0, I suspect it is getting a stray signal from the relay wires sitting just above it. If you disconnect the relays completely do you still get the same behaviour?

If this is the case the easiest solution is to firstly see what actual range of analog values you get, and them map the signal to msgValue[] accordingly, or you could add another potentiometer on the input to A0 to reduce the signal strength.

post a close up of the pot.

what is the source of power for the pot, does the source of power share a ground with the MCU? What is the pot source volts?

The breadboard has a break in the center


that needs to be bridged.

A "simple" analog read might give you some clues but you need to initialize the MSGEQ7 so you know what frequency band you are reading.

Real audio data is pretty random so for troubleshooting I suggest you make some test tones at the MSGEQ7 center frequencies You can generate tones and make WAV files with Audacity. (You can create 7 different WAV or MP3 files.)

Then since it probably still won't work you'll probably need to write or find a MSGEQ7 program that sends the readings to the serial monitor. I think you can find code for that but I don't have a link. That will tell you if the input is working.

You can also work on your outputs separately. You should be able to control the relays and LED display completely with software without worrying about the audio input.

Once you can read the audio and control the lights it shouldn't be too hard to add the software to connect the input & output parts.

Railroader...
Fair point. Attached is a hand sketched schematic of my breadboard arrangement.

And the code here:

/*
 * Muscial Lights Controller V2
 * Just Barran 2021
 * project video At
 * www.youtube.com/c/justbarran
 * Like Share Subscribe
 */

#include "LedControl.h"

#define msg7RESET 13
#define msg7Strobe 9
#define msg7DCout A0


#define maxDataIn 10
#define maxLoad 11
#define maxCLK 12

#define led1 2
#define led2 3
#define led3 4
#define led4 5

#define led5 6
#define led6 7
#define led7 8

#define TRIM_POT A1

#define LED_LOW LOW  //Switch the output depending on Relays
#define LED_HIGH HIGH  

#define CYCLE_DELAY 50 // Time lights remain on for  
 
LedControl lc=LedControl(maxDataIn,maxCLK,maxLoad,1);

/* we always wait a bit between updates of the display */
unsigned long delaytime=100;
byte ledPins[7]= {led1,led2,led3,led4,led5,led6,led7};
byte level[8]=   {B10000000,B11000000,B11100000,B11110000,B11111000,B11111100,B11111110,B11111111};
byte setlevel[8]={B10000000,B01000000,B00100000,B00010000,B00001000,B00000100,B00000010,B00000001};
unsigned int valueMSG[7];
unsigned int potValue=0;
byte potSet = 0;

void setup() {
  /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
   */
  pinMode(msg7RESET, OUTPUT);
  pinMode(msg7Strobe, OUTPUT);
  
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
  pinMode(led6, OUTPUT);
  pinMode(led7, OUTPUT);
  
  digitalWrite(msg7Strobe, HIGH);
  digitalWrite(msg7RESET, LOW);
  digitalWrite(led1, LED_LOW);
  digitalWrite(led2, LED_LOW);
  digitalWrite(led3, LED_LOW);
  digitalWrite(led4, LED_LOW);
  digitalWrite(led5, LED_LOW);
  digitalWrite(led6, LED_LOW);
  digitalWrite(led7, LED_LOW);

  
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,5);
  /* and clear the display */
  lc.clearDisplay(0); 
}

void loop()
{ 
  digitalWrite(msg7Strobe, HIGH);  
  digitalWrite(msg7RESET, HIGH);
  delayMicroseconds(1); //Reset Pluse Width 100nS Min
  potValue = analogRead(TRIM_POT);
  potSet = map(potValue, 0, 1023, 0, 8);  
  lc.setRow(0,7,setlevel[potSet]);  
  
  digitalWrite(msg7RESET, LOW);
  delayMicroseconds(100); // Reset to Stobe Delay 72uS min
  
  for (int x = 0 ; x < 7 ; x++)
    {
      digitalWrite(msg7Strobe, LOW);      
      delayMicroseconds(40); //Output settling time 36us Min
      //Read MSG Value
      int spectrumRead = analogRead(msg7DCout);
      valueMSG[x] = map(spectrumRead, 0, 1023, 0, 8);
      lc.setRow(0,x,level[valueMSG[x]]);
      digitalWrite(msg7Strobe, HIGH);
      delayMicroseconds(40); //Strobe to Strobe 72uS Min
      //Set Lights 
      if(valueMSG[x]>=potSet)
      {
        digitalWrite(ledPins[x], LED_HIGH);
      }
      else
      {
        digitalWrite(ledPins[x], LED_LOW);
      }
    }
    delay(CYCLE_DELAY); //Allow them to be on or off for a bit of time 
}

void test()
{
  lc.setRow(0,0,level[0]);
  lc.setRow(0,1,level[1]);
  lc.setRow(0,2,level[2]);
  lc.setRow(0,3,level[3]);
  lc.setRow(0,4,level[4]);
  lc.setRow(0,5,level[5]);
  lc.setRow(0,6,level[6]);
  lc.setRow(0,7,level[7]);
  delay(1000);
  lc.clearDisplay(0);
  for(int i = 0; i<8;i++)
  {
    lc.setRow(0,0,level[i]);
    delay(500);
  }

}

Post #3... what values are you getting ????

red_car... good idea. I tried disconnecting the relay but the LED Matrix still post a 7x7 lit grid.

I can't connect anything to the Aduino so I can't read the serial Monitor. I uploaded my code by using my Aduino UNO. I'm kinda driving blind here.

Connect the Tx and GND of the Mini to the Rx and GND of the Uno... then run the following on the Uno to forward the Serial received from the Mini to the monitor of the Uno.


void setup()
{
  Serial.begin (115200);
}


void loop()
{  
  while (Serial.available() > 0)
   Serial.write(Serial.read());
}

red_car:
OK Awesome... Thanks. I'll try this tomorrow.
I'm three beers in and ready for bed.
I'll report back with my findings later tomorrow.

So I this is what I'm getting...
Also, the relays were still disconnected and no music playing.

Thoughts?

Looks to me like your input signal is too high - I say that because the indestructible shows a 220k resistor on the input circuit , yours looks different and only 22k resistors

hammy:

Just double checked and I have a 220k ohm resistor on line 8 of the MSGEQ7. just as the data sheet specifies. Any other ideas?

I've swapped the arduino pro mini with another... thinking perhaps I mis-soldered one when assembling it, but I have the same issue with the swapped pro mini. So my issue doesn't seem to be the arduino.

I retested my voltage on the buck converter and I'm steady at 5V, so thats good too.

I swapped the potentiometer, no difference, so its not the potentiometer.

I rechecked my wiring and it looks correct to me.

The only thing I can't check or swap out is the MSGEQ7. Is there a way to test the MSGEQ7?

OK... I might be on to something here. The MSGEQ7 chip I have I got off Amazon and has an ID number printed on it as 1902... and according to the following thread, this has been a known issue.
[Help with MSGEQ7 test - #12 by nguyendanglamtd]

I'm going to order another chip off of spark fun and get the 1908 version as recommended on that thread. Fingers Crossed... I'll keep you posted.

You sure you have 115200 as the baud rate from the Mini?

Yes, i had it set correct. My baudrate can be seen in the video.

Is it set correctly in the code running on the Mini?

Red_car:

I received the new MSGEQ7 chip and it works loads better. There's still some very minor noise that its picking up, seems to be the breadboard connections, because when I wiggle a resistor or capacitor the signal gets better/worse. Also, connecting an audio cable to the jack adds more noise to the system - which kinda sucks. So I think my next step it to put this onto a solderable prototype board in hopes this reduces tome of that noise.

But, going back to your question on post #3. I still want to print the value of the variable to the serial monitor, but Its not clear to me on how you do that. Do I just add this line to my code?

      int spectrumRead = analogRead(msg7DCout);

Because I did this, but nothing was populating in the serial monitor. Don't I have to do something like this...

void setup() {
  Serial.begin(115200)
  int spectrumRead = analogRead(msg7DCout);
...

void loop() {
  // print labels
  Serial.print(msg7DCout); 

or something like that?