Robot Art Show

Evidence of Work

Video of Robot Art Show

5. Robot Art Show (May 16, 2024 at 2:56 PM).mov

Noted Code

/*

  SparkFun Inventor’s Kit

  Circuit 1A-Blink


  Turns an LED connected to pin 13 on and off. Repeats forever.


  This sketch was written by SparkFun Electronics, with lots of help from the Arduino community.

  This code is completely free for any use.


  View circuit diagram and instructions at: https://learn.sparkfun.com/tutorials/sparkfun-inventors-kit-experiment-guide---v40

  Download code at: https://github.com/sparkfun/SIK-Guide-Code

*/

int speakerPin = 10;


void setup() {

pinMode(speakerPin, OUTPUT);    //set the output pin for the speaker

  pinMode(13, OUTPUT);      // Set pin 13 to output

}


void loop() {


 play('g', 2);       //ha

  digitalWrite(13, HIGH);   // Turn on the LED

  play('g', 1);       //ppy

  delay(500);              // Wait for half a second

  play('a', 4);       //birth

  digitalWrite(13, LOW);    // Turn off the LED

  play('g', 4);       //day

  delay(500);              // Wait for one second

  play('C', 4);       //to

  digitalWrite(13, HIGH);   // Turn on the LED

  play('b', 4);       //you

  delay(500);              // Wait for half a second


  play(' ', 2);       //pause for 2 beats

   digitalWrite(13, LOW);    // Turn off the LED


  play('g', 2);       //ha

  delay(500);              // Wait for half a second

  play('g', 1);       //ppy

  digitalWrite(13, HIGH);   // Turn on the LED

  play('a', 4);       //birth

   delay(500);              // Wait for half a second

  play('g', 4);       //day

   digitalWrite(13, LOW);    // Turn off the LED

  play('D', 4);       //to

   delay(500);              // Wait for half a second

 play('C', 4);       //you

   digitalWrite(13, HIGH);   // Turn on the LED


  play(' ', 2);       //pause for 2 beats

  delay(500);              // Wait for half a second


  play('g', 2);       //ha

  digitalWrite(13, LOW);    // Turn off the LED

  play('g', 1);       //ppy

  delay(500);              // Wait for half a second

  play('G', 4);       //birth 

   digitalWrite(13, HIGH);   // Turn on the LED

  play('E', 4);       //day

  delay(500);              // Wait for half a second

  play('C', 4);       //dear

  digitalWrite(13, LOW);    // Turn off the LED

  play('b', 4);       //your

  delay(500);              // Wait for half a second

  play('a', 6);       //name

    digitalWrite(13, LOW);    // Turn on the LED


  play(' ', 2);       //pause for 2 beats

delay(500);              // Wait for half a second

  play('F', 2);       //ha

  digitalWrite(13, LOW);    // Turn off the LED

  play('F', 1);       //ppy

  delay(500);              // Wait for half a second

  play('E', 4);       //birth

  digitalWrite(13, LOW);    // Turn on the LED

  play('C', 4);       //day

  delay(500);              // Wait for half a second

  play('D', 4);       //to

  digitalWrite(13, LOW);    // Turn off the LED

  play('C', 6);       //you

  digitalWrite(13, HIGH);    // Turn on the LED

  delay(500);              // Wait for one second

  while (true) {}     //get stuck in this loop forever so that the song only plays once

}



void play( char note, int beats)

{

  int numNotes = 14;  // number of notes in our note and frequency array (there are 15 values, but arrays start at 0)


  //Note: these notes are C major (there are no sharps or flats)

 //this array is used to look up the notes

  char notes[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C', 'D', 'E', 'F', 'G', 'A', 'B', ' '};

  //this array matches frequencies with each letter (e.g. the 4th note is 'f', the 4th frequency is 175)

  int frequencies[] = {131, 147, 165, 175, 196, 220, 247, 262, 294, 330, 349, 392, 440, 494, 0};


  int currentFrequency = 0;    //the frequency that we find when we look up a frequency in the arrays

  int beatLength = 150;   //the length of one beat (changing this will speed up or slow down the tempo of the song)


  //look up the frequency that corresponds to the note

  for (int i = 0; i < numNotes; i++)  // check each value in notes from 0 to 14

  {

    if (notes[i] == note)             // does the letter passed to the play function match the letter in the array?

    {

      currentFrequency = frequencies[i];   // Yes! Set the current frequency to match that note

    }

  }


  //play the frequency that matched our letter for the number of beats passed to the play function

  tone(speakerPin, currentFrequency, beats * beatLength);

  delay(beats * beatLength);  //wait for the length of the tone so that it has time to play

  delay(50);                  //a little delay between the notes makes the song sound more natural


  

}

/* CHART OF FREQUENCIES FOR NOTES IN C MAJOR

  Note      Frequency (Hz)

  c        131

  d        147

  e        165

  f        175

  g        196

  a        220

  b        247

  C        262

  D        294

  E        330

  F        349

  G        392

  A        440

  B        494 

  */


Circuit Diagram


Our Task

We were assigned the project of building a robot through the Arduino simulator or in person, with partners. I worked with Harley. We first started this project by learning about electricity and practicing with online circuits. After learning more about coding we took a blinky light quiz to move onto the Arduino simulator. We had to complete experiments and then take notes on the coding part of it. Each experiment and coding would get harder and harder.  We also did an electromagnetic lab and  learned about motors. After we finished the Arduino experiments we moved on to our actual project. We had to combine the codes and multiple things we had learned how to do through Arduino all into one robot. Because Harley and I both didn't have any experience in coding we went with something simple, on Arduino, we had three LEDs flashing while the song Happy Birthday played. 

Electromagnetic Lab Writeup

Copy of Rana Yazdi - Electromagnet Lab

Content

Coulombs Law-The force of attraction/repulsion between two static charges is proportional to their charges and inverse to the square of distance between them

Equation: F=kq1q2/d^2

Unit: k=9x10^9 Nm^2/C^2

Circuit-A closed loop of conductive material from one side of a power source to the other(+ to -)

Parallel circuit-A circuit with branches, each with a separate path for flow of charge

Series circuit-A circuit with a single path and multiple components, one after another all on the same path

Current-Amount of change of electricity through a circuit. Unit: i Measured in: Amps Measured by: Ammeter Current splits in parallel circuits, and stays the same in a series circuit. 

Voltage-Potential energy difference from one side of a component to the other side. Unit: v Measured in: volts Measured with: voltmeter. Voltage splits in a series circuit and stays the same in a parallel circuit.

Resistance-The amount current is slowed, or resisted, through an obstacle. Unit: r Measured in: ohms(Ω).  In a parallel circuit, the sum of the inverse of the resistors equals the inverse of the total resistsnce. In a series circuit, the total resistance is equal to the sum of the resistors.

Power-rate of transferring energy through a circuit. Unit: p. Measured in watts.

Ohm's Law: V=ir

Electromagnet-A type of magnet created by running an electric current around a ferromagnetic material

Notes on Coding:

Reflection

One thing I did well during this project was persevering. I had no experience in coding so it was a very hard project, but by the end, I had learned so much more. I also did well on my collaboration, Harley and I worked well together. We were able to both work on one computer and share our ideas together. Something I want to work on is using all the time I have in class well, some days we were off task and didn't get much done, which led to us having to do parts of this project at home. I also want to work on my conscientious learning, I want to manage my time better and be able to set little goals for myself.