1 / 36

Let’s have some fun building stuff

Let’s have some fun building stuff. The next section I call the competition This is to give you more real life type experience building and coding simple but challenging proven circuits before we engage on the payload designs

maite-york
Télécharger la présentation

Let’s have some fun building stuff

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. Let’s have some fun building stuff The next section I call the competition This is to give you more real life type experience building and coding simple but challenging proven circuits before we engage on the payload designs I have some circuits that the teams can pick from you’re your challenge and then to give to the other team as a challenge Pick one breadboard it and see it work Then your team write the specification or requirements using words, flowcharts, and or state diagrams your choice. Now the other team will use this information to write the software for the Arduino to do the same thing. Only restriction is the teams can’t choose the same circuit, if time permits and you want we can do more than one round.

  2. Let’s have some fun building stuff • Note: I am not providing anything other than the schematics on the following pages (and parts under my control in the bags like before), before you start, that doesn’t mean you can’t ask me for additional information but we have rules we going use. • The first group to choose a circuit gets it. I have put on each schematic my relative estimate of a hardness score. The fun and coolness is your own to determine. I have built everyone of these circuits and even have made a couple changes to them based on that building experience. • Once a team has bread boarded the circuit, they have to show it to me and demonstrate its operation is correct. • Then they go write the operational requirements down for the other team to use to code it. • Once Demonstrated to me, then they will hand the requirements write up to the other team who will then duplicate the requirements its operation in the Arduino S/W & some H/W. Once completed again that team need to demonstrate to me the operational code. But I will be comparing it to the Bread Board operation.

  3. The flow to operational success • While it would be great to assume that things will work first time correctly, it is also not realistic. So here is how we’ll do this. If things don’t. • I am the customer and the separate H/W supplier: All H/W orders for resistors must be presented by their color code not 1K or 10 ohms, etc. • If you have questions on the requirements from the H/W schematic you need to send one representative (if multiple times it can be different people) from your team to me with questions. Then they can go back and provide those answers to your team. Remember on how we started the course with communication presentation remember all the good methods and avoid the bad ones.

  4. The flow to operational success (Continue) • Once you have completed the Bread board phase and demonstrated it to me. Then and only then do you get to give your requirements to the opposite team (Not the bread board and/or schematic that stays with me.) • The S/W team may not be given the Circuit Schematicas part of your requirement, only your written requirement, If this proprietary information is discovered to be in your S/W vendor possession (Ty and I may visit your team as the customer and audit you anytime) then the effort is null and void and you must pick a different one and start over. Plus we may want to entertain a donation to the Payload fund! Seriously this is how the real world works.

  5. The flow to operational success (Continue) • When the team writing the S/W from the other teams requirements has questions they must select one representative (If multiple times it can be a different person) to go talk to the other team. The original team may select a representative to answer the other teams questions and then revises in RED the requirements with the new information, whether it be a correction, a deletion or adding an omission. If the original team can’t answer the S/W teams question then they can come talk to me the customer (same protocol as before). Note: The S/W implementing team doesn’t get to ask me their questions directly.

  6. Summary • I may call a pause or stop to the whole effort on the bases of time taken getting too long or stop everything discuss issues with you prior to resuming. After all we do need to build the Payloads. But this is a good exercise on multiple levels. • Just wanted to alert you before hand! • Once done we will talk about the problems that both teams had and maybe even identify solutions if we were to repeat it. Witch in a sense we are with the payload effort at least on the communication aspect.

  7. I’ll show you a example • We’ll use the Demo 20 Blink as the example • Yours will not be from prior activities wee have done, they will be more involved than Blink also • Also the hardware to do our example would need to be different than the example. How?

  8. DEMO 20 - Making a LED blink Hardware

  9. Exercise - Making a LED blink Software The source code for this: You’ll find is in: Files, Examples, 1. Basic as Blink, I have only add a couple comments not needed to run it. Fritzing Example Code 4.9 High 13 stop 13 13 13

  10. LED blinker /* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ // The setup() method runs once, when the sketch starts void setup() { // Pin 13 has an LED connected on most Arduino boards: pinMode(13, OUTPUT);} // the loop() method runs over and over again, // as long as the Arduino has power void loop() { digitalWrite(13, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(13, LOW); // set the LED off delay(1000); // wait for a second }

  11. Example • Lets use the original Blink program with a couple changes • It starts running at power application • It will blink nine time then stop • The ON duration will be 0.7 seconds • The OFF duration will be 1.4 seconds

  12. Example • /* • New nine blink • Turns on an LED on for 0.7 second, then off for 1.4 second. • Repeat 9 times then stop • */ • void setup() { • pinMode(13, OUTPUT); • } • void loop() { • for (inti = 1;9;1){ • digitalWrite(13, HIGH); // set the LED on • delay(700); // wait for 0.7 seconds • digitalWrite(13, LOW); // set the LED off • delay(1400); // wait for 1.4 seconds • } • while (1) {} • }

  13. Hint the Sequencer controls sequences /* Sequencer case statement state diagram modelit uses the button as the means to go to the next stateit uses LEDs to indicate the state along with the print to the PCLastly it uses the speaker to indicate when done */ // payload variables #define speaker 5 // the pin the piezo speaker is connected int count = 0; int mode = 1; // init mode const int flight = 1; const int coast = 2; const int done = 3; long previousMillis; // will store last time sensors were scanned

  14. // 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 = 50; // interval at which to blink (milliseconds) long rcy_inter = 50; // recovery 1 per sec long cst_inter = 50; // coast 10 per sec void setup() { pinMode(9, OUTPUT); pinMode(8, OUTPUT); Serial.begin(9600); digitalWrite(8, LOW); digitalWrite(9, LOW); pinMode(speaker, OUTPUT); // set as an output previousMillis = millis(); Serial.println("Flight"); }

  15. void loop() { if ((millis() - previousMillis) > interval) { previousMillis = millis(); count++; switch (mode){ case 1: // flight state(); if (count >= 50) { // less than 1 G Serial.println("Coast"); mode = coast; interval = cst_inter; } break;

  16. case 2: // coast state(); if (count >= 100) { // less than 0 G's Serial.println("Recovery"); mode = done; interval = rcy_inter; } break;default: state(); Serial.println("End"); tone(speaker,294,2000); delay(1000); tone(speaker,349,5000); while(1); // hang here } } }

  17. void state() { if (mode == flight) { digitalWrite(8,HIGH); digitalWrite(9, LOW); } if (mode == coast) { digitalWrite(8, LOW); digitalWrite(9, HIGH); } if (mode == done) { digitalWrite(8, HIGH); digitalWrite(9, HIGH); } }

  18. Competition Circuits Team 1 Team 2 Choose a circuit A Bread board circuit A Write a specification for circuit A Gives Spec. to Team 2 Receives from Team 2 Specification for circuit B Team using circuit B specification writes it Presents any issues found to the whole group Choose a circuit B Bread board circuit B Write a specification for circuit B Gives Spec. to Team 1 Receives from Team 2 Specification for circuit A Team using circuit A specification writes it Presents any issues found to the whole group

  19. LED Sequencer Hardness score 5 The 555 astable Oscillator is set For about 14 Hz to 960 Hz Using a ten element LED makes this easier

  20. Decimal Counter Hardness score 7

  21. Traffic Stop Light Hardness score 8 The 555 square wave Oscillator is set For about 0.3 Hz

  22. Cylon Eye Hardness score 10 The 555 square wave Oscillator is set For about 0.3 Hz Vcc Vcc GND Oscillator input GND NC Output GND GND LED 1 through 6 connect to it cathode the Anodes for all 6 go to ground.

  23. On your mark, get set, and GO • You have the remainder of class minus the last five minute to compare the results and or successes

  24. /* LED sequencer competition S/W count at 14 Hz from 1 to 10. */ int count = -1; long previousMillis; // will store last time sensors were scanned // 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 = 714; // 14 Hz interval at which to blink (milliseconds) void setup() { pinMode(10, OUTPUT); pinMode(9, OUTPUT); pinMode(8, OUTPUT); pinMode(7, OUTPUT); pinMode(6, OUTPUT); pinMode(5, OUTPUT); pinMode(4, OUTPUT); pinMode(3, OUTPUT); pinMode(2, OUTPUT); pinMode(11, OUTPUT); Serial.begin(9600); previousMillis = millis(); }

  25. void loop() { if ((millis() - previousMillis) > interval) { previousMillis = millis(); count++; switch (count){ case 0: digitalWrite(10, LOW); break; case 1: digitalWrite(11, HIGH); break; case 2: digitalWrite(11, LOW); digitalWrite(2, HIGH); break; case 3: digitalWrite(2, LOW); digitalWrite(3, HIGH); break; case 4: digitalWrite(3, LOW); digitalWrite(4, HIGH); break; case 5: digitalWrite(4, LOW); digitalWrite(5, HIGH); break;

  26. case 6: digitalWrite(5, LOW); digitalWrite(6, HIGH); break; case 7: digitalWrite(6, LOW); digitalWrite(7, HIGH); break; case 8: digitalWrite(7, LOW); digitalWrite(8, HIGH); break; case 9: digitalWrite(8, LOW); digitalWrite(9, HIGH); break; case 10: digitalWrite(9, LOW); digitalWrite(10, HIGH); delay(interval); count = -1; break; default: Serial.println("End"); while(1); // hang here } } }

  27. /* Decimal counter up to six button presses competition S/W */ int count = 0; constintbuttonPin = 12; //ans the number of the pushbutton pin constint led1 = 2; constint led2 = 3; constint led3 = 4; constint led4 = 5; constint led5 = 6; constint led6 = 7; intbuttonState = 0; // variable for reading the pushbutton status int Old = 0; // the previous reading from the input pin int last = 0; void setup() { pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); pinMode(led4, OUTPUT); pinMode(led5, OUTPUT); pinMode(led6, OUTPUT); pinMode(buttonPin, INPUT); Serial.begin(9600); }

  28. void loop() { int reading = digitalRead(buttonPin); // Serial.print("Reading "); // Serial.println(reading); if (reading == LOW) { Old = Old - 1; if (Old < -5) Old = -5; } if (reading == HIGH) { Old = Old + 1; if (Old > 5) Old = 5; } if (Old >= 4) { buttonState = 1; // Serial.println("High"); } if (Old <= -4) { buttonState = 0; // Serial.println("LOW"); } if ((last != buttonState) && (buttonState == 1)) { count++; } last = buttonState;

  29. switch (count){ case 0: digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, LOW); digitalWrite(led4, LOW); digitalWrite(led5, LOW); digitalWrite(led6, LOW); Serial.println("Zero"); break; case 1: digitalWrite(led6, LOW); digitalWrite(led1, HIGH); Serial.println("One"); break; case 2: digitalWrite(led1, LOW); digitalWrite(led2, HIGH); Serial.println("Two"); break; case 3: digitalWrite(led2, LOW); digitalWrite(led3, HIGH); Serial.println("Three"); break;

  30. case 4: digitalWrite(led3, LOW); digitalWrite(led4, HIGH); Serial.println("Four"); break; case 5: digitalWrite(led4, LOW); digitalWrite(led5, HIGH); Serial.println("Five"); break; case 6: digitalWrite(led5, LOW); digitalWrite(led6, HIGH); Serial.println("Six"); break; default: count = 0; Serial.println("Reset"); break; } }

  31. /* Traffic Light competition S/W */ int count = 0; long previousMillis; // will store last time sensors were scanned // 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; // 0.3 Hz interval at which to blink (milliseconds) constint red = 7; constint yellow = 6; constint green = 5; void setup() { pinMode(7, OUTPUT); pinMode(6, OUTPUT); pinMode(5, OUTPUT); Serial.begin(9600); previousMillis = millis(); }

  32. void loop() { if ((millis() - previousMillis) > interval) { previousMillis = millis(); count++; switch (count){ case 0: digitalWrite(green, LOW); digitalWrite(yellow, LOW); digitalWrite(red, HIGH); break; case 1: digitalWrite(green, LOW); digitalWrite(yellow, LOW); digitalWrite(red, HIGH); break; case 2: digitalWrite(green, LOW); digitalWrite(yellow, HIGH); digitalWrite(red, LOW); break; case 3: digitalWrite(green, HIGH); digitalWrite(yellow, LOW); digitalWrite(red, LOW); break;

  33. case 4: digitalWrite(green, HIGH); digitalWrite(yellow, LOW); digitalWrite(red, LOW); break; case 5: digitalWrite(green, LOW); digitalWrite(yellow, HIGH); digitalWrite(red, LOW); count = 0; break; default: Serial.println("End"); while(1); // hang here } } }

  34. /* Cylon Eye competition S/W */ int count = 0; long previousMillis; // will store last time sensors were scanned // 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 = 100; // interval at which to blink (milliseconds) void setup() { pinMode(6, OUTPUT); pinMode(5, OUTPUT); pinMode(4, OUTPUT); pinMode(3, OUTPUT); pinMode(2, OUTPUT); pinMode(11, OUTPUT); Serial.begin(9600); previousMillis = millis(); }

  35. void loop() { if ((millis() - previousMillis) > interval) { previousMillis = millis(); count++; switch (count){ case 1: digitalWrite(11, HIGH); break; case 2: digitalWrite(11, LOW); digitalWrite(2, HIGH); break; case 3: digitalWrite(2, LOW); digitalWrite(3, HIGH); break; case 4: digitalWrite(3, LOW); digitalWrite(4, HIGH); break; case 5: digitalWrite(4, LOW); digitalWrite(5, HIGH); break;

  36. case 6: digitalWrite(5, LOW); digitalWrite(6, HIGH); break; case 7: digitalWrite(6, LOW); digitalWrite(5, HIGH); break; case 8: digitalWrite(5, LOW); digitalWrite(4, HIGH); break; case 9: digitalWrite(4, LOW); digitalWrite(3, HIGH); break; case 10: digitalWrite(3, LOW); digitalWrite(2, HIGH); break; case 11: digitalWrite(2, LOW); digitalWrite(11, HIGH); count = 0; break; default: Serial.println("End"); while(1); // hang here } } }

More Related