Pages: [1]   Go Down
Author Topic: Turning arduino prototype into an Interactive Light  (Read 1059 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
   
  }
  }
 
  }
}
}
}
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 30
Posts: 2602
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Length of wires depends on data rate, for DC wouldn't be a problem 10-20 meters.
Maximum current Atmega328p  - 200 mA, it can supply 10 leds with 20 mA each
or 20 leds with 10 mA ( that will bring brightness to lower level ).
For board projects, there is a CAD Eagle, just google it.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 544
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can also do expresspcb.com, much quicker to figure out than eagle for a 1-time thing.

Here are some LED boards I did in expresspcb.
group of 20, group of 3, 1 single. arduino Promini controls the transistors.
2 of the LED boards are mounted in a box 50 feet from a controller, serial/ground and 12V power/ground got thru 4 conductor cable, arduino decodes message and turns LEDs on/off. 7805 provides 5V to arduino and the single LED, the 3 & 20 are powered from 12V.

You can get a length of 24/4 wire from home depot, they'll cut off what you need from a 500' roll.



« Last Edit: May 10, 2011, 11:28:17 pm by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: