Show Posts
Pages: [1]
1  Topics / Interactive Art / Interactive Arts & Visuals Questionnaire on: May 26, 2011, 08:02:16 pm
Hey Guys,
I'm using Arduino for my dissertation, to help create interactive features at live music gig's and performances.
It would be really useful to get the opinions of similar minded people, and of course,
most appreciated if you could spare a minute to fill out the questionnaire below,

Thanks!


http://www.surveymonkey.com/s/QZQJWLJ
2  Using Arduino / General Electronics / Turning arduino prototype into an Interactive Light on: May 08, 2011, 06:14:18 pm
Hey Guys,

I'm building a lighting feature for my dissertation, I've finished my code, below if your interested.
I'm looking to turn the prototype into an actual light.
Does anyone have any advice for turning the breadboard into an actual product?

I'm unsure of what wires I need to replace the jumper wires, as the distance between the arduino and the actual light could be quite a distance in a live situation..


Also, does anyone know how many LED's you could power off of an Arduino Uno? I'm hoping to use at least 15-20
I'm currently using 3mm Blue Diffused LED 5k MCD, but I'm looking to change these to 1.8-2.4v Red LED's...

Any help appreciated,

Thanks
Sam


Code:
// LED gets brighter the less light the LDR recieves

#define LED1 9 // pin that LED is attached to
#define LED2 10
#define LED3 11
#define LED4 6

int Val = 0; // variable used to store the value coming from the sensor
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

long randNumber;

void setup() {

 
    pinMode(LED1, OUTPUT);  // LED is an OUTPUT
    pinMode(LED2, OUTPUT);  // LED is an OUTPUT
    pinMode(LED3, OUTPUT);  // LED is an OUTPUT
    pinMode(LED4, OUTPUT);  // LED is an OUTPUT
    randomSeed(analogRead(2 & 3));
                        // Analogue pins are autmatically set as inputs

}

void loop() {
     
  // READ SENSOR INOUT
 if ((Val = analogRead(0)) < 200)    // read the value from the sensor
                             // HIGHER NUMBER = MORE SENSITIVE
                             // LOWER NUMBER = LESS SENSITIVE
 {
 analogWrite(LED1, 255-Val);  // turn LED on at brightness set by sensor value
  analogWrite(LED2, 255-Val); 
    analogWrite(LED3, 255-Val);  // turn LED on at brightness set by sensor value
      analogWrite(LED4, 255-Val); 
 delay(10);    // stop the program for some time
 }
 
 else if ((Val = analogRead(0)) > 200)
{  //RANDOMLY BLINK LED 1
  randNumber = random(0, 150000);
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > randNumber) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(LED1, ledState);
    //END OF RANDOM BLINK
   
  }
  {  // RANDOMLY BLINK LED 2
    randNumber = random(0, 100000);
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > randNumber) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   
   
        digitalWrite(LED2, ledState);
        if (ledState == HIGH)
            ledState = LOW;
         else
            ledState = HIGH;
            // END OF RANDOM BLINK
  }
  {  // RANDOMLY BLINK LED 3
    randNumber = random(0, 100000);
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > randNumber) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   
   
        digitalWrite(LED3, ledState);
        if (ledState == LOW)
            ledState = HIGH;
         else
            ledState = LOW;
            // END OF RANDOM BLINK
  }
  {  //RANDOMLY BLINK LED 4
  randNumber = random(0, 150000);
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > randNumber) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(LED4, ledState);
    //END OF RANDOM BLINK
   
  }
  }
 
  }
}
}
}
3  Using Arduino / LEDs and Multiplexing / How many LED's can you run off an Arduino Uno on: May 08, 2011, 06:00:36 pm
Hey Guys,

I'm building a lighting feature for my dissertation, I've finished my code, below if your interested.
I'm looking to turn the prototype into an actual light.
Does anyone have any advice for turning the breadboard into an actual product?

I'm unsure of what wires I need to replace the jumper wires, as the distance between the arduino and the actual light could be quite a distance in a live situation..


Also, does anyone know how many LED's you could power off of an Arduino Uno? I'm hoping to use at least 15-20
I'm currently using 3mm Blue Diffused LED 5k MCD, but I'm looking to change these to 1.8-2.4v Red LED's...

Any help appreciated,

Thanks
Sam



Code:
// LED gets brighter the less light the LDR recieves

#define LED1 9 // pin that LED is attached to
#define LED2 10
#define LED3 11
#define LED4 6

int Val = 0; // variable used to store the value coming from the sensor
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

long randNumber;

void setup() {

 
    pinMode(LED1, OUTPUT);  // LED is an OUTPUT
    pinMode(LED2, OUTPUT);  // LED is an OUTPUT
    pinMode(LED3, OUTPUT);  // LED is an OUTPUT
    pinMode(LED4, OUTPUT);  // LED is an OUTPUT
    randomSeed(analogRead(2 & 3));
                        // Analogue pins are autmatically set as inputs

}

void loop() {
     
  // READ SENSOR INOUT
 if ((Val = analogRead(0)) < 200)    // read the value from the sensor
                             // HIGHER NUMBER = MORE SENSITIVE
                             // LOWER NUMBER = LESS SENSITIVE
 {
 analogWrite(LED1, 255-Val);  // turn LED on at brightness set by sensor value
  analogWrite(LED2, 255-Val); 
    analogWrite(LED3, 255-Val);  // turn LED on at brightness set by sensor value
      analogWrite(LED4, 255-Val); 
 delay(10);    // stop the program for some time
 }
 
 else if ((Val = analogRead(0)) > 200)
{  //RANDOMLY BLINK LED 1
  randNumber = random(0, 150000);
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > randNumber) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(LED1, ledState);
    //END OF RANDOM BLINK
   
  }
  {  // RANDOMLY BLINK LED 2
    randNumber = random(0, 100000);
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > randNumber) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   
   
        digitalWrite(LED2, ledState);
        if (ledState == HIGH)
            ledState = LOW;
         else
            ledState = HIGH;
            // END OF RANDOM BLINK
  }
  {  // RANDOMLY BLINK LED 3
    randNumber = random(0, 100000);
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > randNumber) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   
   
        digitalWrite(LED3, ledState);
        if (ledState == LOW)
            ledState = HIGH;
         else
            ledState = LOW;
            // END OF RANDOM BLINK
  }
  {  //RANDOMLY BLINK LED 4
  randNumber = random(0, 150000);
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > randNumber) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(LED4, ledState);
    //END OF RANDOM BLINK
   
  }
  }
 
  }
}
}
}






4  Using Arduino / LEDs and Multiplexing / Randomly blinking multiple LED's without delay on: April 30, 2011, 12:48:46 pm
Hey guys,

I'm working on a code to randomly blink without (delay), and uses if and else functions to incorporate a sensor too..
I just want to expand the code to include more than 1 LED, however at the moment with 2 LED's they just blink randomly together as a pair.
Is there a way so they individually blink randomly?

here's the code:
Code:
// LED gets brighter the less light the LDR recieves

#define LED1 9 // pin that LED is attached to
#define LED2 10


int Val = 0; // variable used to store the value coming from the sensor
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

long randNumber;

void setup() {

 
    pinMode(LED1, OUTPUT);  // LED is an OUTPUT
    pinMode(LED2, OUTPUT);  // LED is an OUTPUT
    randomSeed(analogRead(2));
                        // Analogue pins are autmatically set as inputs


}

void loop() {
     
 
 if ((Val = analogRead(0)) < 600)    // read the value from the sensor
 {
 analogWrite(LED1, 255-Val);  // turn LED on at brightness set by sensor value
  analogWrite(LED2, 255-Val);  // turn LED on at brightness set by sensor value
 delay(10);    // stop the program for some time
 }
 
 else if ((Val = analogRead(0)) > 600)
{
  randNumber = random(0, 150000);
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > randNumber) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(LED1, ledState);
        digitalWrite(LED2, ledState);
  }
  }
 
}
5  Using Arduino / Sensors / Re: Combining an LDR sensor with random blinking on: April 28, 2011, 08:44:25 am
The extra brackets seem to have worked. It does now fade in - but only very slightly...
Is there a way to start the LED's much dimmer, for a more overt fade in rather than subtle??

This is the code as it stands..

Code:
// LED gets brighter the less light the LDR recieves

#define LED1 9 // pin that LED is attached to
#define LED2 10


int Val = 0; // variable used to store the value coming from the sensor
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

long randNumber;

void setup() {

 
  pinMode(LED1, OUTPUT);  // LED is an OUTPUT
    pinMode(LED2, OUTPUT);  // LED is an OUTPUT
                        // Analogue pins are autmatically set as inputs
  randomSeed(analogRead(2));

}

void loop() {
     
 
 if ((Val = analogRead(0)) < 500)    // read the value from the sensor
 {
 analogWrite(LED1, 255-Val/4);  // turn LED on at brightness set by sensor value
  analogWrite(LED2, 255-Val/4);  // turn LED on at brightness set by sensor value
 delay(10);    // stop the program for some time
 }
 
 else if ((Val = analogRead(0)) > 500)
{
  randNumber = random(0, 150000);
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > randNumber) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(LED1, ledState);
        digitalWrite(LED2, ledState);
  }
  }
 
}

cheers for the help!
6  Using Arduino / Sensors / Re: Combining an LDR sensor with random blinking on: April 21, 2011, 12:01:08 pm
thanks, it's going to be used in a live installation, so a motion detector wouldn't be suitable...

I've managed to use the if and else functions to put a threshold on the ldr sensor, so it randomly blinks, then when a set low amount of light is recieved, the lights stays on, however it doesn't fade in like it used to..

any ideas?

Code:
// Randomly blink - LED gets brighter the less light the LDR recieves

#define LED1 9 // pin that LED is attached to
#define LED2 10


int Val = 0; // variable used to store the value coming from the sensor
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

long randNumber;

void setup() {

 
  pinMode(LED1, OUTPUT);  // LED is an OUTPUT
    pinMode(LED2, OUTPUT);  // LED is an OUTPUT
                        // Analogue pins are autmatically set as inputs
  randomSeed(analogRead(2));

}

void loop() {
     
 
 if (Val = analogRead(0) < 800)    // read the value from the sensor
 {
 analogWrite(LED1, 255-Val/4);  // turn LED on at brightness set by sensor value
  analogWrite(LED2, 255-Val/4);  // turn LED on at brightness set by sensor value
 delay(10);    // stop the program for some time
 }
 
 else if (Val = analogRead(0) > 800)
{
  randNumber = random(0, 150000);
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > randNumber) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(LED1, ledState);
        digitalWrite(LED2, ledState);
  }
  }
 
}
7  Using Arduino / Sensors / Combining an LDR sensor with random blinking on: April 19, 2011, 10:23:27 am
Hi Guys,

The bigger picture - I want a few LED's to randomly blink on/off as a general state (without using delay), untill someone gets close to them. (SEE CODE BELOW)
Then set a limit on an LDR sensor, so that when people approach the light, the LED's stop flickering, and stay on - dimmed, gradually getting brighter, the closer (less light) someone gets.

I've got the stages in separate codes, but I'm having trouble combining them together.

 This is the blink randomly without delay code:
Code:
//* Blink without Delay
 
// Turns on and off a light emitting diode(LED) connected to a digital 
// pin, without using the delay() function.  This means that other code
// can run at the same time without being interrupted by the LED code.
 
//The circuit:
// * LED attached from pin 13 to ground.
// * Note: on most Arduinos, there is already an LED on the board
// that's attached to pin 13, so no hardware is needed for this example.
 

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

// constants won't change. Used here to
// set pin numbers:
#define LED =  9;      // the number of the LED pin

// Variables will change:
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated



// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.

long randNumber;

void setup() {
  // set the digital pin as output:
  pinMode(9, OUTPUT);   
randomSeed(analogRead(2));

}

void loop()
{
  // here is where you'd put code that needs to be running all the time.

  // check to see if it's time to blink the LED; that is, if the
  // difference between the current time and last time you blinked
  // the LED is bigger than the interval at which you want to
  // blink the LED.
  randNumber = random(0, 1000000);
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > randNumber) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(9, ledState);
  }
}

And this is the LDR sensor code I've been using

Code:
//Example 06B: Set the brightness of the LED at a rate specified by the value of the analogue input


#define LED 9       // pin that the LED is attached to


int val = 0;   // variable used to store the value coming from the sensor


void setup() {
 
  pinMode(LED, OUTPUT);   //LED is as an OUTPUT
 
                     // Note: Analogue pins are automatically set as inputs
}

void loop() {
 
  val = analogRead(0);   // read the value from the sensor
 
  analogWrite(LED, val/4);     // turn the LED on at the brightness set by the sensor
 
  delay(10);             // stop the program for some time
 
}

Do you know if this is possible? If so, any tips or tricks would be greatly appreciated? smiley

Cheers

8  Using Arduino / LEDs and Multiplexing / Re: Randomly blink without delay? on: April 19, 2011, 10:17:50 am
sweet, that's great!!


THANKSS
9  Using Arduino / LEDs and Multiplexing / Re: Randomly blink without delay? on: April 19, 2011, 09:50:21 am
oh thanks,

so how would this be written?

sorry - having trouble getting to grips with the arduino language...
10  Using Arduino / LEDs and Multiplexing / Randomly blink without delay? on: April 19, 2011, 08:43:14 am
Hi Guys,

I've been searching for a way to randomly blink without using delay.
Theres a few codes about to blink without delay, but it seems the only way to randomize this blinking (randomly on/off between a set of values) is with the delay function.

This is the blink without delay code: // http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay

Code:
// constants won't change. Used here to
// set pin numbers:
const int ledPin =  9;      // the number of the LED pin

// Variables will change:
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long interval = 1000;           // interval at which to blink (milliseconds)

void setup() {
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT);     
}

void loop()
{
  // here is where you'd put code that needs to be running all the time.

  // check to see if it's time to blink the LED; that is, if the
  // difference between the current time and last time you blinked
  // the LED is bigger than the interval at which you want to
  // blink the LED.
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > interval) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(ledPin, ledState);
  }
}


Do you know if this is possible? If so, how?

For the bigger picture - I want a few LED's to randomly blink on/off as a general state, untill someone gets close to them. Then have an LDR sensor, so that when people approach the light, they stop flickering, and stay on dimmed, gradually getting brighter, the closer (less light) someone gets.

I've got the stages in separate codes, but I'm having trouble combining them together.


Cheers
11  Using Arduino / Sensors / Re: Combining an LDR sensor with random blinking on: March 27, 2011, 03:23:55 pm
RuggedCircuits - my LDR works, I've used it with other codes, I've got it so that it gets brighter as you get near (as the LDR receives less light), I'm just trying to combine that with the random blinking, i.e when there is a set level of light it randomly blinks. Then when this light is reduced, it will become stable and begin getting brighter...
12  Using Arduino / Sensors / Re: Combining an LDR sensor with random blinking on: March 27, 2011, 03:19:40 pm
cool thanks,

what would you have instead of digitalWrite though?
13  Using Arduino / Sensors / Re: Combining an LDR sensor with random blinking on: March 27, 2011, 03:08:37 pm
RuggedCircuits - I've got the LDR connected to a resistor, into the ground and 5.v of my arduino uno board?


AWOL - Should I not have the digital write function in the code?
14  Using Arduino / Sensors / Combining an LDR sensor with random blinking on: March 27, 2011, 02:53:23 pm
I'm trying to create a code that has an LED (2 in this case), randomly blinking on/off between set values. I've got this part working amongst the code below.

But I also want to incorporate a LDR sensor into it, so that the closer a hand gets (the less light it receives) the brighter and more stable (gradually stop blinking) the light gets.


//Work in progress Code
int LED1 = 9;               // LED connected to digital pin 9
int LED2 = 11;

long randOn = 0;             // Initialize a variable for the ON time
long randOff = 0;           // Initialize a variable for the OFF time
int val = 0;           // variable used to store the value coming from the senor


void setup()                      // run once, when the sketch starts
{
 randomSeed (analogRead (0));    // randomize
 pinMode( LED1, OUTPUT);        // sets the digital pin as output
 pinMode( LED2, OUTPUT);
}

void loop()                       // run over and over again
{
    val = analogRead(0);    // read the value from the sensor
 
  analogWrite(LED1, val/4);
  analogWrite(LED2, val/4);
  delay(10);
 
 randOn = random (10, 150);    // generate ON time between 0.02 and 0.15 seconds
 randOff = random (250, 2000);    // generate OFF time between 0.25 and 2.5 seconds
   digitalWrite(LED1, HIGH);   // sets the LED on
   digitalWrite(LED2, HIGH);
   delay(randOn);                // waits for a random time while ON
   digitalWrite(LED1, LOW);    // sets the LED off
   digitalWrite(LED2, LOW);
   delay(randOff);               // waits for a random time while OFF

}
 


Any ideas what I'm doing wrong? At the moment, it's only blinking the LED's randomly, not reacting to the sensor at all...

Thanks!
15  Using Arduino / Sensors / how to reverse the function of an LDR sensor on: February 15, 2011, 06:15:49 pm
Hi guys,

I have a code (below) that reacts to the proximity of a person, so the less light the LDR recieves (the closer you get), the dimmer the LED gets.
The more light the LDR receives, the brighter it gets.
I simply want to reverse this function, so that the closer you get to the LDR (the less light it recieves), the brighter the LED shines.
When the LDR receives lots of light, I want the LED to be dimm, (or in the future blinking at a slow rate!)

Does anyone know how to simply reverse this function of the LDR, here is the code:

______________________________________________________________________



//Example 06B: Blink LED at a rate specified by the analogue input

#define LED 9 // the pin for the LED

int val = 0;   // variable used to store the value coming from the sensor

void setup() {
  pinMode(LED, OUTPUT);   //LED is as an OUTPUT
 
                          // Note: Analogue pins are automatically set as inputs..
}

void loop() {
  val = analogRead(0);   // read the value from the sensor
 
  analogWrite(LED, val/4);     // turn the LED on at the brightness set by the sensor
 
  delay(10);             // stop the program for some time
 
}



______________________________________________________________________

Any help at all is appreciated,

Cheers,
Sam
mrkrules@hotmail.com
Pages: [1]