Show Posts
Pages: [1] 2
1  Development / Other Software Development / Re: Documentation correction on: January 11, 2013, 12:30:11 am
But.....this is where the suggestions link from the examples point. "Corrections, suggestions, and new documentation should be posted to the Forum."
 smiley-razz
Along those lines,
Clarification could be added to:
http://arduino.cc/en/Reference/AttachInterrupt
It mentions that the Due calls the interrupt pins differently, but doesn't specify which board the example code is written for.  Do you use "int.0" for the "interrupt" argument of the attachInterrupt function on the boards other than the Due?  Or would just "0" be acceptable for either?  (using the pin 0 on the Due, and pin 2 on the others)
2  Using Arduino / General Electronics / Re: Soldering iron question on: August 20, 2011, 01:05:43 pm
Thanks for the advise, but to clarify, I know what kind of station I'm going to get, I was looking for advise for the size of tip.
3  Using Arduino / General Electronics / Re: Soldering iron question on: August 19, 2011, 08:58:12 pm
I'm getting a Hakko FX951.  Been saving for it for a bit now, was gonna get a FX888, but decided to make a long term investment as I will be doing a lot of soldering from here on out.
4  Using Arduino / General Electronics / Soldering iron question on: August 19, 2011, 08:02:54 pm
I'm getting a new soldering iron and it does not come with a tip, so I have to get one separate.  Every soldering iron I've used has had pointed tips and I've heard that chisel tips are better.  What I'm wondering is what size chisel is a good one for a general purpose applications.  I can only afford one so what would be the best size for me to get?  The options are from .08mm to 5.0mm wide chisels and from 0.5mm to 1.2mm thick respectively.  I'm leaning towards a 1.6mm wide by .5mm thick chisel.  I'll be soldering IC's and other standard through hole stuff not too much smd stuff.  I have my older 60w iron for any big stuff like connector mounts.   
5  Using Arduino / Motors, Mechanics, and Power / Re: 24VDC supply making 7805 too hot. on: August 05, 2011, 11:32:51 pm
Got the V7805-1000 and it works great, provided you don't put it in backwards. smiley-red  The diagram I was looking at on the data sheet was apparently a top down footprint drawing and I smoked a Atmega328 and a 7404 in one shot.  Oh yeah and as the white smoke was rolling out of the 7404 I noticed the dot on the package.  Of course it would be on a Friday and absolutely no one locally stocks them.  I have a spare 128 and several 7404's but I needed the extra EEPROM.  RTFDS (thoroughly)!
6  Using Arduino / Motors, Mechanics, and Power / Re: 24VDC supply making 7805 too hot. on: August 02, 2011, 02:07:19 pm
It's the TO-220 package and the heat sink is wimpy, I scavenged it off a old satellite TV board.   I found this: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=102-1715-ND which isn't too pricey and it is a drop in for the 7805 TO-220 so I wont have to modify the board layout (done that way too much in the past week, hand rerouting is getting tedious) and I really need to get these board gerbers sent out to get them back in time to be able to solder up hundreds of components.  (70+ per board * 5 boards, ugg).  Sure do wish I could use some type of 7805 TO-220 though, would save $9 per board.
7  Using Arduino / Motors, Mechanics, and Power / 24VDC supply making 7805 too hot. on: August 02, 2011, 01:10:44 pm
The project I'm working on requires 24VDC to drive pneumatic solenoids.  I have a 24VDC regulated power supply rated @ 1.9A which should be enough to drive all the solenoids and the BBB arduino.  I am using the standard 7805 to regulate the 5v for the arduino and that dude is getting real hot.  I measured the current going to the circuit beyond the 7805 hovering around 200mA when all the components that can be engaged at once are under load.  I figure with the  19 volt drop @ .2A it would be dissipating 3.8 watts in heat.  I'm not sure what this would work out to in degrees but with a heat sink bolted to the 7805 it gets hot enough to sizzle when I lick my finger and touch it. (no comments on the safety of that please.. lol)  I checked the datasheet on the 7805 and see that it can take up to a 35v input and source up to 1A which I am well within.  I was thinking about dropping the voltage with a 7812 then going to the 7805 and bolting them to the same heatsink, but am not sure if that will solve the problem (either way it's got to dissipate 3.8w right?).   I was reading here: http://arduino.cc/forum/index.php/topic,61557.0.html that I could use a different type of 7805 that is capable of sourcing 2A but don't know if that would help either.  I also found this: http://www.dimensionengineering.com/DE-SW050.htm but it's kinda expensive and I am trying to keep costs down as much as possible because I'll be building several of these units.
I really don't want to have 2 separate supplies for the project as outlet space is valuable in it's environment.
I'm hitting a brick wall at the 11th hour here and cant use a fan because it would put me too close to the current limitation of the supply and make the project box too big.  If anyone has any suggestions it would be greatly appreciated.  It would be real nice if I could plug mains 110 into the thing and transform the voltage with internally, but don't really have alot of experience with that yet. 
8  Using Arduino / Programming Questions / Re: Recording switch press sequences problem on: July 11, 2011, 10:59:48 am
Ah, Ok.  I misunderstood what was going on there.  Sorry, I should have read that page I linked a bit closer.. "There are times when you may need an array of strings which will never be modified."   smiley-red 
I'll probably be back with more dumb questions later..  Thanks Paul.
9  Using Arduino / Programming Questions / Should I store into Flash or EEPROM? on: July 11, 2011, 10:35:07 am
The array that I store the sequence in is a 100x3 2D unsigned long array.  This needs to be stored into non-volatile memory so the board can be turned off and it still remembers the sequence when turned back on.  I don't see this sequence being rewritten over 1000 times at max so I'm not worried about exceeding the rewrite limits of either the flash or EEPROM.  At 100x3 it will have to be cut down a bit to (75x3 maybe) to fit into the EEPROM but I don't think I'll have to cut it down to fit into the flash as the program itself shouldn't use more than about 8K. 
For the EEPROM, I kinda understand Halley's templates here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1234477290/3#11
But for writing to flash I am having a harder time understanding how to implement the example here: http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_rom_array as it seems that you have to know the contents of the array when setting up the global constants. 
Any help would be appreciated.
10  Using Arduino / Programming Questions / Re: Recording switch press sequences problem on: July 10, 2011, 04:18:44 pm
I fixed it and its running great.  For those interested, here's the code:

Code:
#include <Bounce.h>
// Program: Programmable Controller

//  Date: 7-10-2011
//  Version: 1.6


// I/O pin varible config
const int button[] = {
  2,3,4,5};
const int trig1= 6;  
const int rec  = 7;
const int LEDoutput[] = {
  8,9,10,11};
const int pla_lite = 12;
const int rec_lite = 13;
bool show_pres = false;
unsigned long  show_seq[100][3];
Bounce button1 = Bounce(button[0],5);
Bounce button2 = Bounce(button[1],5);
Bounce button3 = Bounce(button[2],5);
Bounce button4 = Bounce(button[3],5);
Bounce recbutton = Bounce(rec,5);
Bounce trigbutton = Bounce(trig1,5);


//========SETUP=============
void setup(){
  //pinMode config
  pinMode(rec,INPUT);
  pinMode(trig1,INPUT);

  for (int i = 0; i < 4; i++){
    pinMode(button[i],INPUT);
  }

  for (int i = 0; i < 4; i++){
    pinMode(LEDoutput[i],OUTPUT);
  }

  pinMode(rec_lite,OUTPUT);
  pinMode(pla_lite,OUTPUT);

}


//============Main Loop===============
void loop(){
  int rval;                                                         //
  int tval;


  for (int i = 0; i < 4; i++){                                      //Make sure outputs are low
    digitalWrite(LEDoutput[i], LOW);
  }

  //------------Trigger Show Button------------
  trigbutton.update ( );

  tval = trigbutton.read();                                        //Read Trigger State

  if (tval == LOW && show_pres == true){                           //Trigger show if one is recorded
    playShow();
  }

  //------------Record Show Button------------
  recbutton.update ();

  rval = recbutton.read ();                                          //Read REC button state

  if (rval == LOW){           //Record show
    recordShow();
  }

}


//=============Record Show===========
void recordShow(){                                                  
  delay(250);
  bool isrec = true;                                                //Variable to keep recording until REC is pressed again
  memset(show_seq, 0, sizeof(show_seq[0][0])*100*3);                //Clear show
  int counter = 0;                                                  //Counter for show_seq indexing
  digitalWrite(rec_lite,HIGH);                                      //Turn on REC light
  unsigned long start_time = millis();                              //Log time recording starts
  unsigned long now = 0;
  unsigned long prev = 0;
  while (isrec == true){                                            //Keep looping until REC is pressed again

    //----------Button 1-------------
    button1.update ();

    int but1state = button1.read ();
    if (but1state == LOW){                                         //Is button pressed?
      digitalWrite(LEDoutput[0], HIGH);                            //Echo button press on output
      show_seq[counter][0] = LEDoutput[0];                         //Register the button pressed in 1st column
      now = millis();
      if (counter == 0){
        show_seq[counter][1] = millis() - start_time;              //Register time until button is pressed from start if first button press 2nd column
      }

      else{
        show_seq[counter][1] = millis() - prev;  //Register time since last button press
      }

      while (digitalRead(button[0])==0){                           //Wait until button is released
        delay(10);
      }                                                          
      show_seq[counter][2] = millis() -  now;     //Register time button is held 3rd column
      digitalWrite(LEDoutput[0], LOW);
      prev = millis();
      counter++;
    }


    //---------------Button 2----------------
    button2.update ();

    int but2state = button2.read ();
    if (but2state == LOW){  
      digitalWrite(LEDoutput[1], HIGH);                            
      show_seq[counter][0] = LEDoutput[1];                        
      now = millis();

      if (counter == 0){
        show_seq[counter][1] = millis() - start_time;              
      }

      else{
        show_seq[counter][1] = millis() - prev;  
      }

      while (digitalRead(button[1])==0){                          
        delay(10);
      }                                                          
      show_seq[counter][2] = millis() -  now;    
      digitalWrite(LEDoutput[1], LOW);
      prev = millis();
      counter++;
    }      

    //---------------Button 3----------------
    button3.update ();

    int but3state = button3.read ();
    if (but3state == LOW){  
      digitalWrite(LEDoutput[2], HIGH);                            
      show_seq[counter][0] = LEDoutput[2];                        
      now = millis();

      if (counter == 0){
        show_seq[counter][1] = millis() - start_time;              
      }

      else{
        show_seq[counter][1] = millis() - prev;  
      }

      while (digitalRead(button[2])==0){                          
        delay(10);
      }                                                          
      show_seq[counter][2] = millis() -  now;    
      digitalWrite(LEDoutput[2], LOW);
      prev = millis();
      counter++;
    }      


    //---------------Button 4----------------
    button4.update ();

    int but4state = button4.read ();
    if (but4state == LOW){  
      digitalWrite(LEDoutput[3], HIGH);                            
      show_seq[counter][0] = LEDoutput[3];                        
      now = millis();

      if (counter == 0){
        show_seq[counter][1] = millis() - start_time;              
      }

      else{
        show_seq[counter][1] = millis() - prev;  
      }

      while (digitalRead(button[3])==0){                          
        delay(10);
      }                                                          
      show_seq[counter][2] = millis() -  now;    
      digitalWrite(LEDoutput[3], LOW);
      prev = millis();
      counter++;
    }

    //----------------Exit Record Button-------------
    recbutton.update ();

    int recState = recbutton.read ();

    if (recState == LOW){                                              //Exit out of record
      isrec = false;
      delay(250);
    }
  }
  digitalWrite(rec_lite , LOW);
  show_pres = true;
}



//============Play Show============
void playShow(){                                                    
  int counter = 0;
  digitalWrite(pla_lite,HIGH);                                      

  while (show_seq[counter][0] > 0){                                 //Play show as long as there is a button value present
    delay(show_seq[counter][1]);                                    
    digitalWrite(show_seq[counter][0], HIGH);
    delay(show_seq[counter][2]);
    digitalWrite(show_seq[counter][0], LOW);
    counter++;
  }
  digitalWrite(pla_lite,LOW);                                       //Turn off play light
}

Attached is the board setup (as good as I could draw it in Fritzing)
11  Using Arduino / Programming Questions / Re: Recording switch press sequences problem on: July 10, 2011, 01:58:21 pm
Ok, I got it working alot better.  It records the button presses and will play them back, however it seems to mess the timing of the presses up upon playback.  I have reviewed the code several times and cannot find out why its doing this.  I believe it has something to do with the math to determine the length of the button presses  and delay time between them because the play back gets slower the longer you wait from resetting the board as well as the delays getting longer the further into the "show" you get.  
Here's the code for a button press and logging the times (each button is a copy of this with the variable names adjusted for the correct button)
Code:
//=============Record Show===========
void recordShow(){                                                  
  delay(250);
  unsigned long start_time = millis();                              //Log time recording starts
  bool isrec = true;                                                //Variable to keep recording until REC is pressed again
  memset(show_seq, 0, sizeof(show_seq[0][0])*100*3);                //Clear show
  int counter = 0;                                                  //Counter for show_seq indexing
  digitalWrite(rec_lite,HIGH);                                      //Turn on REC light

  while (isrec == true){                                            //Keep looping until REC is pressed again

    //----------Button 1-------------
    button1.update ();

    int but1state = button1.read ();
    if (but1state == LOW){                                         //Is button pressed?
      digitalWrite(LEDoutput[0], HIGH);                            //Echo button press on output
      show_seq[counter][0] = LEDoutput[0];                         //Register the button pressed in 1st column

      if (counter == 0){
        show_seq[counter][1] = millis() - start_time;              //Register time until button is pressed from start if first button press 2nd column
      }

      else{
        show_seq[counter][1] = millis() - show_seq[counter-1][2];  //Register time since last button press
      }

      while (digitalRead(button[0])==0){                           //Wait until button is released
        delay(10);
      }                                                          
      show_seq[counter][2] = millis() -  show_seq[counter][1];     //Register time button is held 3rd column
      digitalWrite(LEDoutput[0], LOW);
      counter++;
    }

And here's the code for the playback:

Code:
//============Play Show============
void playShow(){                                                    
  int counter = 0;
  digitalWrite(pla_lite,HIGH);                                      

  while (show_seq[counter][0] > 0){                                 //Play show as long as there is a button value present
    delay(show_seq[counter][1]);                                    
    digitalWrite(show_seq[counter][0], HIGH);
    delay(show_seq[counter][2]);
    digitalWrite(show_seq[counter][0], LOW);
    counter++;
  }
  digitalWrite(pla_lite,LOW);                                       //Turn off play light
}

Let me know if you want to see the entire program.
12  Using Arduino / Programming Questions / Re: Recording switch press sequences problem on: July 10, 2011, 01:44:11 am
ok, I checked out the Bounce library but am now really confused on how to use this with the array structure I've built for the buttons.  I don't know how to do this with the objects the example said to create.  Sorry if this seems real newbie but I'm not used to using objects and libraries.
13  Using Arduino / Programming Questions / Re: Recording switch press sequences problem on: July 10, 2011, 12:55:11 am
Sorry paul, I had that post written since earlier but didn't notice I hadn't submitted it and I didn't see your reply.  Yes I have external pull-up resistors.  And I'll check out the debounce library, maybe that will help me solve the problem.  As far as the wait for 10ms its just an arbitrary small value I picked, its basically just to kinda pause the code there until the button is released for the purpose of recording the timing of the press.
14  Using Arduino / Programming Questions / Re: Recording switch press sequences problem on: July 10, 2011, 12:50:20 am
Ok, I cleaned it up with for loops.  However it is still stuck in the record function only iterating the while loop once.  Also once you press the buttons that turn on the outputs they only light up once.  I think its where I'm trying to implement the debounce.  I've been trying to sort this out all day and have had no luck.  I hope its easier to follow now.  Here's the code:
Code:
int button[] = {
  2,3,4,5};
int trig1= 6; 
int rec  = 7;
int LEDoutput[] = {
  8,9,10,11};
int pla_lite = 12;
int rec_lite = 13;
bool show_pres = false;
unsigned long  show_seq[100][3];
int rButState;
int tButState;
int buttonState[4];


void setup(){
  //pinMode config
  pinMode(rec,INPUT);
  pinMode(trig1,INPUT);
 
  for (int i = 0; i < 5; i++){
    pinMode(button[i],INPUT);
  }
 
  for (int i = 0; i < 5; i++){
    pinMode(LEDoutput[i],OUTPUT);
  }
 
  pinMode(rec_lite,OUTPUT);
  pinMode(pla_lite,OUTPUT);
  //read initial button states
  rButState = digitalRead(rec);
  tButState = digitalRead(trig1);
 
  for (int i = 0; i < 5; i++){
    buttonState[i] = digitalRead(button[i]);
  }

}

void loop(){
  int rval;                                                         //
  int rval2;
  int tval;
  int tval2;
 
  for (int i = 0; i < 5; i++){                                      //Make sure outputs are low
    digitalWrite(LEDoutput[i], LOW);
  }

  tval = digitalRead(trig1);                                        //Read Trigger State
  delay(10);                                                        //Debounce
  tval2 = digitalRead(trig1);                                       //

  if (tval == tval2 && tval == LOW && tval != tButState && show_pres == true){     //Trigger show if one is recorded
    playShow();
    tButState = tval;
  }

  rval = digitalRead(rec);                                          //Read REC button state
  delay(10);                                                        //Debounce
  rval2 = digitalRead(rec);                                         //

  if (rval == rval2 && rval == LOW && rval != rButState){           //Record show
    recordShow();
    rButState = rval;
  }

}

void recordShow(){                                                  //Record show function
  int buttonVal[4];                                             
  int buttonVal2[4];
  int rval;                                                         
  int rval2;                                                       
  unsigned long start_time = millis();                              //Log time recording starts
  bool isrec = true;
  memset(show_seq, 0, sizeof(show_seq[0][0])*100*3);                //Clear show
  int counter = 0;
  rButState = digitalRead(rec);
  digitalWrite(rec_lite,HIGH);                                      //Turn on REC light
 
  while (isrec == true){                                            //Keep looping until record is pressed again
    for (int i = 0; i <5; i++){

      buttonVal[i] = digitalRead(button[i]);                        //Debounce
      delay(10);
      buttonVal2[i] = digitalRead(button[i]);

      if (buttonVal[i] == buttonVal2[i] && buttonVal[i] == LOW && buttonVal[i] != buttonState[i]){   //Is button  pressed?
        digitalWrite(LEDoutput[i], HIGH);                            //Echo button press on output
        show_seq[counter][1] = LEDoutput[i];                         //Register the button pressed in 1st column

        if (counter == 0){
          show_seq[counter][2] = millis() - start_time;              //Register time until button is pressed from start if first button press
        }

        else{
          show_seq[counter][2] = millis() - show_seq[counter-1][3];  //Register time since last button press
        }

        while (digitalRead(button[i])==0){                          //Wait until button is released
          delay(10);
        }                                                           
        show_seq[counter][3] = millis() -  show_seq[counter][2];    //Register time button is held
        digitalWrite(LEDoutput[i], LOW);
        counter++;
        buttonState[i] = buttonVal[i];
      }
      rval = digitalRead(rec);
      delay(10);
      rval2 = digitalRead(rec);
     
      if (rval == rval2 && rval == LOW && rval != rButState){       //Exit out of record
        isrec = false;
        rButState = rval;
      }
    }



  }

  digitalWrite(rec_lite,LOW); 
}

void playShow(){                                                    //Play the show function
  int counter = 0;
  digitalWrite(pla_lite,HIGH);                                      //Turn on play light
 
  while (show_seq[counter][1] > 0){                                 //Play show as long as there is a button value present
    delay(show_seq[counter][2]);
    digitalWrite(show_seq[counter][1], HIGH);
    delay(show_seq[counter][3]);
    digitalWrite(show_seq[counter][1], LOW);
    counter++;
  }
  digitalWrite(pla_lite,LOW);                                       //Turn off play light
}


15  Using Arduino / Programming Questions / Re: Recording switch press sequences problem on: July 09, 2011, 04:41:26 pm
Ok, I changed that to a 100 element array.  I'm an idiot,  variables are stored in the RAM not flash, duh smiley-red.  But it still doesn't work. 
Pages: [1] 2