Show Posts
Pages: [1] 2
1  Community / Exhibition / Gallery / Re: LED Graphic Equalizer Table Using MSGEQ7 EQ chip and arduino on: February 06, 2011, 05:48:04 pm
It's actually one big table. That is just a dividing strip of wood in the center. It's set up so each side is a different channel (left side of the table is left channel, right side is right).  It's pretty fancy when you have music playing where things fade from one speaker to another!
2  Community / Exhibition / Gallery / LED Graphic Equalizer Table Using MSGEQ7 EQ chip and arduino on: February 06, 2011, 02:27:32 pm


Tell me what you think!

This took about 4 months of tinkering in my spare time.
3  Forum 2005-2010 (read only) / Syntax & Programs / Re: A few random coding questions - if else statement on: December 28, 2010, 05:42:56 pm
Thanks everyone for the tips on shortening this code and other help! You guys are awesome.
4  Forum 2005-2010 (read only) / Syntax & Programs / Re: A few random coding questions - if else statement on: December 28, 2010, 03:59:27 pm
Thanks for the tips. Once again, I'm new here so I don't have a lot of experience with this webpage, or Arduino coding.  I'm not sure how to make my code shorter as of yet. Im just trying to get it to work, but i've been having problems.

Here is a link to the EQ chip i'm using:

https://www.sparkfun.com/datasheets/Components/General/MSGEQ7.pdf

From this i'm running into a shift register array to power an 8x7 grid of LEDs.



I'm going to do a test of the code (I also added more comments):
Code:
int analogPin = 0;              // read from multiplexer using analog input 0
int strobePin = 2;               // strobe is attached to digital pin 2
int resetPin = 3;               // reset is attached to digital pin 3

int dataPin = 6;              // The Serial Data Pin to the Shift Register

int latchPin = 7;             // The Latch Pin to the Shift Register

int clockPin = 8;             // The Clock Pin to the Shift Register

int value1 = 0;
int value2 = 0;
int value3 = 0;
int value4 = 0;
int value5 = 0;
int value6 = 0;
int value7 = 0;
int option1 = 0;
int option2 = 0;
int option3 = 0;
int option4 = 0;
int option5 = 0;
int option6 = 0;
int option7 = 0;


void setup()
{
  
  pinMode(analogPin, INPUT);     //analogPin is an input
  pinMode(strobePin, OUTPUT);    //strobePin is an output
  pinMode(resetPin, OUTPUT);    //resetPin is an output
  analogReference(DEFAULT);     //sets analogReference to default
  pinMode(dataPin, OUTPUT);    // Configure Digital Pins
  pinMode(latchPin, OUTPUT);  // Configure Digital Pins
  pinMode(clockPin, OUTPUT);  // Configure Digital Pins
  digitalWrite(resetPin, LOW);     // reset off
  digitalWrite(strobePin, HIGH);   // holds multiplex out in one spot until the start.

 
}

void loop()
{
  digitalWrite(resetPin, HIGH);   //resets EQ chip
  digitalWrite(resetPin, LOW);    //reset off

  digitalWrite(strobePin, LOW);   // When strobe goes low, outputs multiplexed value to arduino analog in
    delayMicroseconds(30); // to allow the output to settle
    value1 = analogRead(analogPin);


if(value1 < 128)
   option1 = 1;
else if(value1 < 257)
   option1 = 3;
else if(value1 < 385)
   option1 = 7;
else if(value1 < 512)
   option1 = 15;
else if(value1 < 640)
   option1 = 31;
else if(value1 < 768)
   option1 = 63;
else if(value1 < 896)
   option1 = 127;
else if(value1 < 1024)
   option1 = 255;

  digitalWrite(strobePin, HIGH);
  digitalWrite(strobePin, LOW);
    delayMicroseconds(30); // to allow the output to settle
    value2 = analogRead(analogPin);


if(value2 < 128)
   option2 = 1;
else if(value2 < 257)
   option2 = 3;
else if(value2 < 385)
   option2 = 7;
else if(value2 < 512)
   option2 = 15;
else if(value2 < 640)
   option2 = 31;
else if(value2 < 768)
   option2 = 63;
else if(value2 < 896)
   option2 = 127;
else if(value2 < 1024)
   option2 = 255;


  digitalWrite(strobePin, HIGH);
  digitalWrite(strobePin, LOW);
    delayMicroseconds(30); // to allow the output to settle
    value3 = analogRead(analogPin);


if(value3 < 128)
   option3 = 1;
else if(value3 < 257)
   option3 = 3;
else if(value3 < 385)
   option3 = 7;
else if(value3 < 512)
   option3 = 15;
else if(value3 < 640)
   option3 = 31;
else if(value3 < 768)
   option3 = 63;
else if(value3 < 896)
   option3 = 127;
else if(value3 < 1024)
   option3 = 255;


  digitalWrite(strobePin, HIGH);
  digitalWrite(strobePin, LOW);
    delayMicroseconds(30); // to allow the output to settle
    value4 = analogRead(analogPin);


if(value4 < 128)
   option4 = 1;
else if(value4 < 257)
   option4 = 3;
else if(value4 < 385)
   option4 = 7;
else if(value4 < 512)
   option4 = 15;
else if(value4 < 640)
   option4 = 31;
else if(value4 < 768)
   option4 = 63;
else if(value4 < 896)
   option4 = 127;
else if(value4 < 1024)
   option4 = 255;


  digitalWrite(strobePin, HIGH);
  digitalWrite(strobePin, LOW);
    delayMicroseconds(30); // to allow the output to settle
    value5 = analogRead(analogPin);


if(value5 < 128)
   option5 = 1;
else if(value5 < 257)
   option5 = 3;
else if(value5 < 385)
   option5 = 7;
else if(value5 < 512)
   option5 = 15;
else if(value5 < 640)
   option5 = 31;
else if(value5 < 768)
   option5 = 63;
else if(value5 < 896)
   option5 = 127;
else if(value5 < 1024)
   option5 = 255;


  digitalWrite(strobePin, HIGH);
  digitalWrite(strobePin, LOW);
    delayMicroseconds(30); // to allow the output to settle
    value6 = analogRead(analogPin);


if(value6 < 128)
   option6 = 1;
else if(value6 < 257)
   option6 = 3;
else if(value6 < 385)
   option6 = 7;
else if(value6 < 512)
   option6 = 15;
else if(value6 < 640)
   option6 = 31;
else if(value6 < 768)
   option6 = 63;
else if(value6 < 896)
   option6 = 127;
else if(value6 < 1024)
   option6 = 255;


  digitalWrite(strobePin, HIGH);
  digitalWrite(strobePin, LOW);
    delayMicroseconds(30); // to allow the output to settle
    value7 = analogRead(analogPin);


if(value7 < 128)
   option7 = 1;
else if(value7 < 257)
   option7 = 3;
else if(value7 < 385)
   option7 = 7;
else if(value7 < 512)
   option7 = 15;
else if(value7 < 640)
   option7 = 31;
else if(value7 < 768)
   option7 = 63;
else if(value7 < 896)
   option7 = 127;
else if(value7 < 1024)
   option7 = 255;




digitalWrite(latchPin, LOW);                       // Pull latch LOW to send data

shiftOut(dataPin, clockPin, MSBFIRST, option1);    
shiftOut(dataPin, clockPin, MSBFIRST, option2);    
shiftOut(dataPin, clockPin, MSBFIRST, option3);    
shiftOut(dataPin, clockPin, MSBFIRST, option4);    
shiftOut(dataPin, clockPin, MSBFIRST, option5);    
shiftOut(dataPin, clockPin, MSBFIRST, option6);    
shiftOut(dataPin, clockPin, MSBFIRST, option7);    



delay(50);

digitalWrite(latchPin, HIGH);                      // Pull latch HIGH to stop sending data

}
5  Forum 2005-2010 (read only) / Syntax & Programs / A few random coding questions - if else statement on: December 28, 2010, 01:11:19 pm
I'm looking to do an "if else" statement.  The arduino will be picking up an analog number from 0-1024 then converting this into another number that I can use as an output.

ie.  If the input is less than 128, then the output is 1
     If the input is between 129 and 256 then the output is 3
    if the input is between 257 and 512 then the output is 7

How can I turn that statement into code?

Thanks a lot in advance. I'm a newbie at programming!!


Here is what I have now:



 value1 = analogRead(analogPin);

if (value1 < 128)
{
  value1 == 1
}
else if (value1  ???  
{
 value1 == 3
}


6  Forum 2005-2010 (read only) / Troubleshooting / Program freezing after a few seconds of running on: November 12, 2010, 08:09:08 pm
I built the table that can be seen at http://sites.google.com/site/aaroncrum  


Now i wanted to get the table to run with just an ATMega328 chip, instead of using my Duemilanova board.

I'm using a 16Mhz resonator instead of a crystal. Could this cause any problems?

For whatever reason, I can get a simple standalone blink program to work, but when i try to do the random pattern, it freezes up after about 5-10 seconds.

Any ideas?

Thanks
7  Forum 2005-2010 (read only) / Troubleshooting / Re: Problems Uploading - Contains My Verbose on: November 12, 2010, 11:37:45 am
Hey everyone, the problem has been solved! It turns out that there was no bootloader installed on the new Sparkfun chips I received.  (Even though I ordered the ones that were supposed to have it preinstalled)...

You can visit my other forum where I have more info on how I solved the problem:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1289360368/7#7

Good luck everyone
8  Forum 2005-2010 (read only) / Troubleshooting / Re: Problems Uploading - Contains My Verbose on: October 27, 2010, 08:39:17 pm
The standard one that comes with these chips. I'm honestly not sure what it is. Like I said, I got these chips from sparkfun.com and plugged them right in without any modification.
9  Forum 2005-2010 (read only) / Troubleshooting / Re: Problems Uploading - Contains My Verbose on: October 27, 2010, 07:13:30 pm
Good news and bad news:

The good news is:

After reinstalling the arduino (21) software, I can now get my original chip to work just fine.

The bad news:

My new chips still won't work.

What is weird is that normally, when you hit the reset button, the light on pin 13 blinks. With the new chips, they don't.

Anyone know why this is?
10  Forum 2005-2010 (read only) / Troubleshooting / Re: Problems Uploading - Contains My Verbose on: October 27, 2010, 06:57:25 pm
I'll try going back to the original boards.txt

How do you perform a loopback test?

The new chips were from sparkfun.com. They were the ones with the bootloader preinstalled.
11  Forum 2005-2010 (read only) / Troubleshooting / Re: Problems Uploading - Contains My Verbose on: October 27, 2010, 10:54:24 am
Yea, I changed the board.txt file to change the baud rate.

Anyone have any clue what to do next?
12  Forum 2005-2010 (read only) / Troubleshooting / Re: Problems Uploading - Contains My Verbose on: October 26, 2010, 10:29:27 pm
Just to clarify:  Have tried Baud 9600, 19200. Nothing but the usb cable is plugged in (nothing in the pin ports). The LED on pin 13 blinks when i hit reset.
13  Forum 2005-2010 (read only) / Troubleshooting / Problems Uploading - Contains My Verbose on: October 26, 2010, 10:25:05 pm
Binary sketch size: 1010 bytes (of a 30720 byte maximum)
C:\Users\Aaron\Downloads\arduino-0021\arduino-0021\hardware/tools/avr/bin/avrdude -CC:\Users\Aaron\Downloads\arduino-0021\arduino-0021\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P\\.\COM9 -b19200 -D -Uflash:w:C:\Users\Aaron\AppData\Local\Temp\build7714888388997126453.tmp\sketch_oct26a.cpp.hex:i

avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "C:\Users\Aaron\Downloads\arduino-0021\arduino-0021\hardware/tools/avr/etc/avrdude.conf"

         Using Port            : \\.\COM9
         Using Programmer      : stk500v1
         Overriding Baud Rate  : 19200
avrdude: ser_open(): setting dtr
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: Send: Q [51]   [20]
avrdude: Recv:
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

avrdude done.  Thank you.



I have tried just about everthing posted on other boards and can't figure out the problem.

I have the Arduino Decimilanova board and i just purchased new ATMega328 chips and switched out the chips. None of my chips work, old or new.

I am just trying to upload the Blink program.
14  Forum 2005-2010 (read only) / Troubleshooting / Re: No pin 13 lighting after pushing reset button on: November 12, 2010, 11:34:49 am
Not really... The instructions on that page are very well detailed. Keep in mind you will want to download all of the files at the top of the page FIRST.

Also, if you are adding a bootloader to an ATMega328 chip, you will want to click on the link for ATMega328P instructions (towards the bottom). They have different fuse hex codes.

If you (or anyone else) has any questions about doing this install, post away and I should respond soon!
15  Forum 2005-2010 (read only) / Troubleshooting / Re: No pin 13 lighting after pushing reset button on: November 12, 2010, 11:20:20 am
Thanks everybody! Problem has been solved.

After you guys telling me it's a sign of not having a bootloader, i went to the following page:

http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html

The instructions are tedious!!  After finishing up installing the bootloader, everything is working just fine!!

As a note to anyone else who needs to do this:  After installing the bootloader, you will have the pin13 LED flash on and off once a second or so. This is a sign of a newly installed bootloader.  

Also, after installing the bootloader, you will want to disconnect your arduino from the computer, then shut down your arduino program and start it up fresh.  You may even want to restart your computer. For whatever reason, the arduino program couldn't find my Duemilanova board until I had restarted the arduino software.

Good luck to anyone else experiencing this problem!
Pages: [1] 2