Show Posts
Pages: [1] 2
1  Community / Exhibition / Gallery / Re: Arduino Sound triggered photography on: May 24, 2011, 06:49:12 am
diagram was wrong. Black and white wires should be reversed. Updated the picture
2  Community / Exhibition / Gallery / Re: Arduino Sound triggered photography on: February 09, 2011, 08:39:03 am
Last result, getting to the point of perfection i'm looking for!



Breadboard diagram (left part is explaind on HIVIZ.com, arduino and part in red rectangle I've added myself):


and the code at the moment is:
Code:
                       
const int ledPin = 13;    
const int meetPin = 2;  
const int flashPin = 7;    

int meet = LOW;            

void setup() {                      
pinMode(ledPin, OUTPUT);    
digitalWrite(flashPin, LOW);  
digitalWrite(meetPin, HIGH);  
digitalWrite(ledPin, LOW);      
}

void loop()                              
{
meet = digitalRead(meetPin);      

if (meet == LOW){                      
delay(100);                              // delay between sound and flash
digitalWrite(flashPin, HIGH);       // flash goes off
digitalWrite(flashPin, LOW);      
digitalWrite(ledPin, HIGH);         // LED during 'dead time'
delay(4000);                            //to make sure I only get one flash
digitalWrite(ledPin, LOW);        
  }

}
3  Community / Exhibition / Gallery / Re: Arduino Sound triggered photography on: February 04, 2011, 11:31:51 am
What camera are you using there?
nikon d300s with sigma 70-200 f2.8 @ iso 200, F5.0 & 3s
4  Community / Exhibition / Gallery / Re: Arduino Sound triggered photography on: February 04, 2011, 08:36:24 am
I love the board game and the glasses. What did you do to get the glasses moving like that?

tape them on a shelve on wheels  smiley-razz


click to view notes, glasses taped to black shelve on wheels, on top of an inclined shelve (white)
5  Community / Exhibition / Gallery / Arduino Sound triggered photography on: February 04, 2011, 03:48:36 am
Not the first, but always nice to show some results  smiley-lol Long exposures in dark room and triggered the flash on sound.



Used piezo for sound detection as in the trigger kit from the hiviz.com website. Hooked it up to my arduino to be abled to set the delay end reset time as I prefered. SCR to shortcut flash. Simple yet effective project.

Playing with different set-ups and delays (time between hard sound and flash trigger). Some results:







6  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Bug in stopwatch example on: October 08, 2008, 06:03:59 am
well, I did read that line but did not think any in the code would be wrong. Then I understand your thinking. But maybe it is not the best place to give exercises on an example site  smiley-wink Since starting programmers will copy full examples to see if and how everything works so when their display does not equal their serial print they might search the fault sooner in their wiring or self written lines they added to the code than in the example code.

Off course one should not make it to easy for their students as well  smiley-grin



The last zero however is not really needed since an intiger can off course be equal to zero so then the last 0 will be displayed and you only have to manually add the 2 zero's before  8-) now you will get one 0 to much, no problem since the value stays the same... but looks not as neat  smiley-razz

Thanks for changing anyway!
7  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Bug in stopwatch example on: September 29, 2008, 04:02:30 pm
 ;D

you are asolutely right, should have thought about that, but that one just hasn't happened yet  :-X


good idea to pull the serial.print out off the else loop... saves me a byte or 2  smiley-razz i sometimes overdo my loops a little
8  Forum 2005-2010 (read only) / Bugs & Suggestions / Bug in stopwatch example on: September 29, 2008, 03:39:54 pm
since i use a small part off the stopwatch example on the arduino site I found out it has a minor bug, with the possibillity of giving a wrong time through the serial port. Since one cannot react on the examples, maybe smart to post it here (maybe they will change it), at least other users might read it. (if it is at the wrong place please move)

The example can be found at:

http://www.arduino.cc/en/Tutorial/Stopwatch

------------

The problem is the way they divide the time into a part before the decimal point (whole seconds) and the fractional part.

Code:
Serial.print( (int)(elapsedTime / 1000L) );         // divide by 1000 to convert to seconds - then cast to an int to print
Serial.print(".");                                     // print decimal point
fractional = (int)(elapsedTime % 1000L);               // use modulo operator to get fractional part of time
Serial.println(fractional);                            // print fractional part of time

The problem lies in the fractional part. Since an intiger cannot begin with a zero (this is then ignored) times (millis()) with zero (0) at the first digit of the fractional part (tenths of a second) are wrongly displayed since the 0 is ignored and the other 2 decimals are moved one digit, turning hundreds of a second into tenths and thousands of a second into hundreds.

So 14565 ms is correctly displayed as 14,565 seconds,
but 14065 ms is displayed as 14,65 seconds i.s.o. 14,065 seconds which is halve a second off  :o

(and the difference can be max 0,891s)

I only found the problem when displaying the millis() on a 7 segment display and when a zero was displayed at the right of the decimal point, the serial output and the displayed value were not corresponding. So people only using this example through serial port might not find the problem at all (or they read the code better then I do before they use it)

I solved the problem with the following code by adding the zero when the fractional part is smaller than 100, but here are probably more and/or neather solutions to solve it

Code:
     Serial.print( (int)(elapsedTime / 1000L) );           // divide by 1000 to convert to seconds - then cast to an int to print
      Serial.print(".");                                    // print decimal point
      fractional = (int)(elapsedTime % 1000L);              // use modulo operator to get fractional part of time
      if (fractional < 100)                                 // if fractional < 100 the 0 is ignored giving a wrong time, so add the zero
      {
      Serial.print("0");                                    // add zero
      Serial.println(fractional);                           // print fractional part of time
      }
      else
      {
      Serial.println(fractional);                           // print fractional part of time
      }  

I know it is only with the serial print function, so when importing the time into another program one will probably use a different method. But i found it worth mentioning since I use the serial print a lot for debugging purposes!

So please take note when using the stopwatch example from the arduino site.

hope it helps some people  smiley-grin



9  Forum 2005-2010 (read only) / Troubleshooting / "To much" connected to ground?? on: October 03, 2008, 03:00:58 am
Since I'm getting the problem sometimes (so not all the time) that the software cannot upload to the arduino board giving the:

Quote
stk500_recv(): programmer is not responding avrdude:

nothing works then such as reset, unplug and wait a minute, restart the computer etc... but when I unplug the wire to the ground pin... EUREKA... it's working again. I got a few LEd displays and a few buttons connected to ground (even split it up over the other ground pins, but I guess they are all connected internally...

so the big question is:

Is it possible to connect to much connections to the ground pin(s)??


or am I missing something else  smiley-grin
10  Forum 2005-2010 (read only) / Troubleshooting / Re: Led blinks without wiring up on: September 08, 2008, 02:58:06 pm
ok, thanks very much for your reply. I could not find the correct word for it (i'm from the netherlands) so googling is a hard task then... This will help a lot.

Thanks again.
11  Forum 2005-2010 (read only) / Troubleshooting / Led blinks without wiring up on: September 08, 2008, 02:37:39 pm
So just got my Arduino and love the simplicity of it. I do encounter one problem though.

I have a simple code that flashes the led in pin 13 when a digitalRead in another channel (i used 9) is HIGH. So, when I wire up the 5V to channel 9, the led should blink. Not so hard is it.

But when I do not wire up the 5V to channel 9, and move my hand somewhere near the arduino... the led flashes. So there is some sort of static electricity around the board. See the not so clear youtube movie:



Anyone an idea how to get rid of this effect
12  Forum 2005-2010 (read only) / Exhibition / Re: Nomothumu 0.9, Time sensor for sport use on: December 29, 2010, 09:54:34 am
Project is kinda hidden in the basement at the moment. Had some problems with powering (but probably due to my lack of knowledge) and the IR-controler had some difficulties in bright sunlight (=huge IR source). Since the IR-beam was just a kit, it's kinda hard to put a pot meter in it for sensitivity adjustment.

So that's the status at the moment. For my camera I made remote with laser beam and I think it would be easy to fit it into this project.
13  Forum 2005-2010 (read only) / Exhibition / Re: Nomothumu 0.9, Time sensor for sport use on: October 08, 2008, 05:00:29 am
check your pm-box
14  Forum 2005-2010 (read only) / Exhibition / Re: Nomothumu 0.9, Time sensor for sport use on: October 04, 2008, 07:38:30 am
Well, sorry, but I don't have any schematics. But if you read the code, you will see there is no complex wiring used at all.

Only the IR beam is not so easy but that was jus a little kit I bought so you can look that one up at:

http://www.produktinfo.conrad.com/datenblaetter/100000-124999/117536-an-01-ml-Infrarot-Lichtschranke_de-en-fr.pdf

The rest is just simple push buttons and flip switches. Wiring up the 7 segement displays is also very simple and there is a good guide on the arduino site (and I hooked up 5 in serie i.s.o. the 2 in the example).

http://www.arduino.cc/en/Tutorial/ShiftOut

Any questions feel free to ask. But like i mentioned, I don't have a scheme for you but I think the previous information will do.

Greetz
15  Forum 2005-2010 (read only) / Exhibition / Re: Nomothumu 0.9, Time sensor for sport use on: October 02, 2008, 04:27:11 pm
part 3
Code:
h = (int)((elapsedTime / 10000L) % 10L);              // get number of deca-seconds (10)
      i = (int)((elapsedTime / 1000L) % 10L);               // get number of seconds (1)
      j = (int)((elapsedTime / 100L) % 10L);                // get number of deci seconds (0,1)
      k = (int)((elapsedTime / 10L) % 10L);                 // get number of centi seconds (0,01)
      l = (int)(elapsedTime % 10L);                         // get number of milli seconds (0,001)
      
             if ((int)(elapsedTime /60000) < 1)                                // if time < 1 minute show as 12.345
                   {      
      
                      digitalWrite(latchPin, LOW);                              // enable writing to display
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfer[h]);         // write deca seconds to first diplay
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfertwee[i]);     // write seconds + decimal point to seconds display
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfer[j]);         // write deci seconds to third display
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfer[k]);         // write centi seconds to fourth display
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfer[l]);         // write millie seconds to fifth display              
                      digitalWrite(latchPin, HIGH);                             // stop writing to display
                    }
                    
             if ((int)(elapsedTime /60000) >= 1 && (int)(elapsedTime /60000) < 10 )  //if time > 1 minute but < 10 minutes show as 1.23.45
                   {
          
           m = (int)(elapsedTime / 60000);
           n = (int)((elapsedTime - (m*60000)) / 10000L);
           o = (int)(((elapsedTime - (m*60000)) / 1000L) % 10L);

                      digitalWrite(latchPin, LOW);                                  // enable writing to display
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfertwee[m]);         //
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfer[n]);             //
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfertwee[i]);         //
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfer[j]);
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfer[k]);                      
                      digitalWrite(latchPin, HIGH);                             // stop writing to display
          
                   }      
                  
  // to do
  //      if ((int)(lastlap /60000) >= 10)                                           //if time > 10 minutes show as 12.34.5

                  
      digitalWrite(ledPin, LOW);                                 // Turn blinking LED off
      digitalWrite(delayPin, HIGH);                              // Turn delay LED on
      delay(2000);                                               // 2 second delay to close the beam
      digitalWrite(delayPin, LOW);                               // Turn delay LED off
      
  
   }

   else{
      lastButtonState = buttonState;                         // store buttonState in lastButtonState, to compare next time
   }

   // blink routine - blink the LED while timing
   // check to see if it's time to blink the LED; that is, is the difference
   // between the current time and last time we blinked the LED bigger than
   // the interval at which we want to blink the LED.

   if ( (millis() - previousMillis > interval) ) {
    
      if (blinking == true && delaybuttonState != true && lastlapState != true)                     // If time is running start blinking and keep updating display
      {
      elapsedTime =   millis() - startTime;                     // store elapsed time                

      h = (int)((elapsedTime / 10000L) % 10L);                                  // get number of deca seconds
      i = (int)((elapsedTime / 1000L) % 10L);                                   // get number of seconds    
        
        if ((int)(elapsedTime /60000) < 1)                                      // if time < 1 minute show as 12.345
         {            

                      digitalWrite(latchPin, LOW);                              // enable writing to display
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfer[h]);         // write deca seconds to first diplay
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfertwee[i]);     // write seconds + decimal point to seconds display
                      shiftOut(dataPin, clockPin, LSBFIRST, B0);                // keep other three displays empty
                      shiftOut(dataPin, clockPin, LSBFIRST, B0);
                      shiftOut(dataPin, clockPin, LSBFIRST, B0);                      
                      digitalWrite(latchPin, HIGH);                             // stop writing to display

         }
        
        if ((int)(elapsedTime /60000) >= 1 && (int)(elapsedTime /60000) < 10 )  //if time > 1 minute but < 10 minutes show as 1.23.45
         {
          
           m = (int)(elapsedTime / 60000);
           n = (int)((elapsedTime - (m*60000)) / 10000L);
           o = (int)(((elapsedTime - (m*60000)) / 1000L) % 10L);

                      digitalWrite(latchPin, LOW);                                  // enable writing to display
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfertwee[m]);         //
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfer[n]);             //
                      shiftOut(dataPin, clockPin, LSBFIRST, cijfertwee[i]);         //
                      shiftOut(dataPin, clockPin, LSBFIRST, B0);
                      shiftOut(dataPin, clockPin, LSBFIRST, B0);                      
                      digitalWrite(latchPin, HIGH);                             // stop writing to display
          
         }
        
        digitalWrite(delayPin, LOW);                                            // turn off delay pin (it should be off but just in case
        previousMillis = millis();                                              // remember the last time we blinked the LED

        
         if (value == LOW)                            // if the LED is off turn it on and vice-versa.
            value = HIGH;
         else
            value = LOW;
         digitalWrite(ledPin, value);
      }
      else{
         digitalWrite(ledPin, LOW);                   // turn off LED when not blinking so when it stops blinking in on-state it is turned off
      }
   }
  }
  }
}

/* todo
 * - flipswitch for switching between laptime and total time in continous mode
*/

// end of program

(good to post my code because I think I found the reason of one of my bugs by reading the entire code over)

In very short:

1. check is reset button is pressed, IF SO, stop time or set display to zero
2. check if last lap button is pressed, IF SO, show last lap on display, keep time running
3. check if delay button is closed, IF SO, don't do anything when beam is broken
3. IF  delay NOT pressed, check for braking beam, start/stop time or end a lap and start a new lap instant (according to position of flipswitch)
4. when time is running, blink LED and keep updating display (only whole seconds)
5. end program

code still in development same as the hardware since we found out soms functions/buttons were missing or could be adjusted. I use some dutch words in ther (ronde=lap, cijfer=number)(etc) but they are explained in the comments mostly so it should be readable

(hope I copied all the lines  smiley-wink)

enjoy
Pages: [1] 2