Top Banner
Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS
20

Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Mar 26, 2015

Download

Documents

Destiny Berry
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Book Project

Sue Brandt Arduino Project 7-10-13 Interactive with LEDS

Page 2: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Objective

Using arduino and xbee technology create a small closed system to create a fun interactive book for 3 year old child.

Book accessories include wand and crown.

Page 3: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Planning

1. Obtain materials

2. Test ardiuno

3. Test xbee through serial port using XCTU

4. Test xbee for wireless operation using XCTU and terra term software

5. Create system diagram

6. Design control circuit and test

7. Write sketch for control circuit

8. Design wireless receiver circuit

9. Write sketch for receiver circuit

Page 4: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Planning continued

10. Test communication's between wireless circuits

11. Insert magnet switches

12. Test switches

13. Test wireless communications

14. Create wiring harness for book

15. Create wiring harness for receiver system.

16. Test book, wand and crown.

Page 5: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Software used

Arduino X-CTU (XBEE) Fritzing

Page 6: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Hardware Used Arduino Xbee Xbee modem 10K resistors SPSB 4 pin switch LED; 7 3 color 2 -breadboard 2 -“AA” battery packs 6 volts per pack Misc breadboard wires

Page 7: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

System

1 master cue light box to run remote cue light boxes.

Page 8: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Wiring Diagram for Book Controller

Page 9: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Sketch For control unit //3 color led controller to wireless led output // for interative childrens book version 1 // reciever program name:_3_color_reciever_crown //this projects program name_3_color_LED_redand_Blue_andgreen_controlver4 //july 10, 2013

int LedRed = 13; //location red led int LedBlue =12;//location blue led int LedGreen= 11;//location green led int delayPeriod = 250; int LedRbut = 4; // location of red button int LedBbut = 3; // location of blue button int LedGbut = 2; // location of green button

int valR = 0; int valB = 0; int valG = 0; int old_valR = 0; int old_valB = 0; int old_valG = 0; int stateR = 0; int stateB = 0; int stateG = 0;

Page 10: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

set-up: controller void setup(){ Serial.begin(9600); // send out signal please pinMode (LedRed,OUTPUT); pinMode (LedBlue, OUTPUT); pinMode (LedGreen, OUTPUT); pinMode (LedRbut, INPUT); pinMode(LedBbut, INPUT); pinMode(LedGbut, INPUT); }

Page 11: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

program: controller void loop () { valR = digitalRead(LedRbut);// read input value of red button 4 and save if ((valR == HIGH) && (old_valR == LOW)) { stateR = 1-stateR; delay(10); } old_valR = valR; if (stateR == 1) { digitalWrite(LedRed, HIGH);//Red led on {Serial.print('R');}//send R to turn on remote red led } else { digitalWrite(LedRed, LOW); {Serial.print('r');}//send r to turn off remote red led }

valB = digitalRead(LedBbut);// read input value of blue button 3 and save if ((valB == HIGH) && (old_valB == LOW)) { stateB = 1-stateB; delay(10); } old_valB = valB; if (stateB == 1) { digitalWrite(LedBlue, HIGH);//Blue led on {Serial.print('B');}//send B to turn on remote blue led } else { digitalWrite(LedBlue, LOW); {Serial.print('b');}//send B to turn off remote blue led }

valG = digitalRead(LedGbut);// read input value of green button 2 and save if ((valG == HIGH) && (old_valG == LOW)) { stateG = 1-stateG; delay(10); } old_valG = valG; if (stateG == 1) { digitalWrite(LedGreen, HIGH);//Green led on {Serial.print('G');}// send G to turn on remote green led } else { digitalWrite(LedGreen, LOW); {Serial.print('g');}// send G to turn off remote green led

} }

Page 12: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Sketch for receiver /* / for interative childrens book version 1 // reciever program name:_3_color_reciever_crown //this projects program name_3_color_LED_redand_Blue_andgreen_controlver4 //july 10, 2013 */

const int LEDRed = 13;// the number of the Red LED pin const int LEDBlue = 12; //the number of the Blue Led pin const int LEDGreen = 11;// the number of the green led pin int incomingByte; //a variable to read incoming serial data

//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

Page 13: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Setup for receiver

void setup() { Serial.begin(9600); pinMode(LEDRed, OUTPUT);//Red

Led as output pinMode (LEDBlue, OUTPUT); //Blue

Led as output pinMode (LEDGreen, OUTPUT);

//Greeen led as output }

Page 14: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Program for receiver void loop() { if (Serial.available()) { incomingByte = Serial.read(); Serial.println(incomingByte); delay(100); //valB = Serial.read(); //delay(100); if (incomingByte == 'R') { digitalWrite(LEDRed, HIGH); } if (incomingByte == 'r') { digitalWrite(LEDRed, LOW); }

Page 15: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Program for receiver cont. if (incomingByte == 'B') { digitalWrite(LEDBlue, HIGH); } if (incomingByte == 'b') { digitalWrite(LEDBlue, LOW); }

Page 16: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Program for receiver end if (incomingByte == 'G') { digitalWrite(LEDGreen, HIGH); } if (incomingByte == 'g'){ digitalWrite (LEDGreen, LOW); } } } /* The joys of summer! */

Page 17: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Wiring diagram for Receiver

Page 18: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Lights ON!!

Page 19: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.
Page 20: Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS.

Conclusion

Unit works. External harnesses need to be made. Book content to be produced.