1 / 22

Wireless Cue Light Project

Wireless Cue Light Project. Sue Brandt Arduino Project 12-10-2010 Ins and Outs. Objective. Using arduino and xbee technology create a system of cue lights using a master controller to turn on and off LED lamps connected to a wireless receiver. Planning. Obtain materials Test ardiuno

jesse
Download Presentation

Wireless Cue Light Project

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Wireless Cue Light Project • Sue Brandt • Arduino Project • 12-10-2010 • Ins and Outs

  2. Objective • Using arduino and xbee technology create a system of cue lights using a master controller to turn on and off LED lamps connected to a wireless receiver.

  3. Planning • Obtain materials • Test ardiuno • Test xbee through serial port • Test xbee for wireless operation • Create system diagram • Design Unit C main control • Write program for unit C • Design Unit A wireless receiver • Write program for unit A

  4. Planning continued 10. Set up unit C to control one LED on main board 11. Set up unit C and A test control of one LED 12. Analyze data 13. Set up unit C to control two LEDs’on main board Set up unit C and A test control of Two LEDs.

  5. Software used • Arduino • X-CTU (XBEE) • Fritzing

  6. Hardware Used • Arduino • Arduino Shield • Xbee • Xbee modem • 10K resistors • SPSB 4 pin switch • LED; 2 Blue, 2 green • 1 -breadboard • 2 -“AA” battery packs 6 volts per pack • Misc breadboard wires

  7. System • 1 master cue light box to run remote cue light boxes.

  8. Wiring Diagram for C; sending

  9. Code For Unit C; defining variables • //Board C sending version 3 • //using push button to cue wireless LED • //using combination of pushbutton program and serial program • //constants do not change Used to set pin numbers. • const int buttonPinR = 2; //the number of the Red Led button on board C • const int LedPinR = 13; // the number of the Red LED pin • const int buttonPinB = 3; //the number of ther Blue Led button on board C • const int LedPinB = 12; //the number of the Blue Led pin • int valR = 0; //val will be stored the state of the input pin Red • int valB = 0; //val will be stored the state of the input pin Blue • int old_valR= 0;// this variable stores the previous value red • int old_valB = 0; // this variable stores the previouse value blue • int stateR = 0; //0=Led red off and 1= Led red on • int stateB= 0; // 0= led blue off and 1= led blue on

  10. Code For Unit C; set-up • void setup() • { • Serial.begin(9600);//talk to other units • pinMode(LedPinR, OUTPUT);//initialize Red Led as output • pinMode (LedPinB, OUTPUT); // initial Blue Led as output • pinMode(buttonPinR, INPUT);//initalize button Red as input • pinMode(buttonPinB, INPUT); //initial button Blue as output • }

  11. Code For Unit C; program • void loop(){ • valR = digitalRead(buttonPinR); //read input value Red and store it • valB = digitalRead(buttonPinB); //read input value Blue and store it • if ((valR == HIGH) && (old_valR == LOW)){ • stateR = 1-stateR; • delay(10); • } • if ((valB == HIGH) && (old_valB == LOW)){ • stateB = 1-stateB; • delay(10); • //check if there was a transition • }

  12. Code For Unit C; send • old_valR = valR; //valR is now old store it. • old_valB = valB; //valB is now old store it. • if (stateR == 1){ //turn led red on • digitalWrite(LedPinR, HIGH); • Serial.print ("R"); //I switched the messages so uppercase R and B are for red and blue on, lowercase r and b is for red and blue off, single character messages make simpler • } • if (stateB == 1){ //turn led blue on • digitalWrite(LedPinB, HIGH); • Serial.print ("B"); • } • if (stateR == 0) { • // turn LED off • digitalWrite(LedPinR, LOW); • Serial.print ("r"); • } • if (stateB == 0) { • digitalWrite(LedPinB, LOW); • Serial.print ("b"); • } • }

  13. Wiring diagram for Unit A Receiving

  14. Code For Unit A; Receive; variables • // recieving board "A" version 3 • const int LedPinR = 13; // the number of the Red LED pin • const int LedPinB = 12; //the number of the Blue Led pin • int incomingByte; //a variable to read incoming seril data into • //int val = 0; //val will be stored the state of the input pin Red • //int valB = 0; //val will be stored the state of the input pin Blue • //int old_valR= 0;// this variable stores the previous value red • //int old_valB = 0; // this variable stores the previouse value blue • //int stateR = 0; //0=Led red off and 1= Led red on • //int stateB= 0; // 0= led blue off and 1= led blue on

  15. Code For Unit A; set-up • void setup() • { • Serial.begin(9600); • pinMode(LedPinR, OUTPUT);//initialize Red Led as output • pinMode (LedPinB, OUTPUT); // initial Blue Led as output • }

  16. Code For Unit A; program • void loop() • { • if (Serial.available()) { • incomingByte = Serial.read(); • Serial.println(incomingByte); • delay(100); • //valB = Serial.read(); • //delay(100); • if (incomingByte == 'R') { • digitalWrite(LedPinR, HIGH); • } • if (incomingByte == 'r') { • digitalWrite(LedPinR, LOW); • } • if (incomingByte == 'B') { • digitalWrite(LedPinB, HIGH); • } • if (incomingByte == 'b') { • digitalWrite(LedPinB, LOW); • } • } • } • /* I changed it to use the incomingByte variable you already had setup and made it match the data being sent from the other board, using single characters for the messages makes everything simpler

  17. Lights ON!!

  18. Conclusion • Unit works. • Circuits need to be made. • Boxes designed to house units. • Issues: • About a 30 second wait for the LED’s to turn on or off. • Xbee configuration needs to be researched.

  19. Testing XBEE for operation board#1 send unit • Attached to pc • Type H to turn on LED

  20. Program for send unit • /*  Physical Pixel An example of using the Arduino board to receive data from the  computer.  In this case, the Arduino boards turns on an LED when it receives the character 'H', and turns off the LED when it receives the character 'L'.   The circuit: * LED connected from digital pin 13 to groundconst int ledPin = 13; // the pin that the LED is attached toint incomingByte;      // a variable to read incoming serial data intovoid setup() {// initialize serial communication:  Serial.begin(9600);// initialize the LED pin as an output:  pinMode(ledPin, OUTPUT);}void loop() {// see if there's incoming serial data:  if (Serial.available() > 0) {// read the oldest byte in the serial buffer:    incomingByte = Serial.read();// if it's a capital H (ASCII 72), turn on the LED:    if (incomingByte == 'H') {      digitalWrite(ledPin, HIGH);    } // if it's an L (ASCII 76) turn off the LED:    if (incomingByte == 'L') {      digitalWrite(ledPin, LOW);    }  }}

  21. Testing XBEE for operation board #2 Receiver unit • Second board programming • void setup() { Serial.begin(9600); } void loop() { Serial.print('H'); delay(1000); Serial.print('L'); delay(1000); }

More Related