Download presentation
Presentation is loading. Please wait.
Published byDestiny Berry Modified over 11 years ago
1
Book Project Sue Brandt Arduino Project 7-10-13 Interactive with LEDS
2
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.
3
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
4
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.
5
Software used Arduino X-CTU (XBEE) Fritzing
6
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
7
System 1 master cue light box to run remote cue light boxes. Controller Book Receiver Crown
8
Wiring Diagram for Book Controller
9
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;
10
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); }
11
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 }
12
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
13
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 }
14
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); }
15
Program for receiver cont. if (incomingByte == 'B') { digitalWrite(LEDBlue, HIGH); } if (incomingByte == 'b') { digitalWrite(LEDBlue, LOW); }
16
Program for receiver end if (incomingByte == 'G') { digitalWrite(LEDGreen, HIGH); } if (incomingByte == 'g'){ digitalWrite (LEDGreen, LOW); } /* The joys of summer! */
17
Wiring diagram for Receiver
18
Lights ON!!
20
Conclusion Unit works. External harnesses need to be made. Book content to be produced.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.