Evidence:
(has 2 parts)
Noted Code:
SparkFun Inventor’s Kit
Circuit 2A - Buzzer
Play notes using a buzzer connected to pin 10
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---v41
Download drawings and code at: https://github.com/sparkfun/SIK-Guide-Code
*/
int speakerPin = 7; //the pin that buzzer is connected to
#include <LiquidCrystal.h> //the liquid crystal library contains commands for printing to the display
LiquidCrystal lcd(13, 12, 11, 10, 9, 8); // tell the RedBoard what pins are connected to the display
void setup()
{
pinMode(speakerPin, OUTPUT); //set the output pin for the speaker
lcd.begin(20, 2); //tell the lcd library that we are using a display that is 16 characters wide and 2 characters high
lcd.clear(); //clear the display
}
void loop()
{
lcd.setCursor(0, 0); //set the cursor to the 0,0 position (top left corner)
lcd.print("Ode to Joy"); //print hello, world! starting at that position
delay(1000);
lcd.setCursor(0, 0);
lcd.print(" by Ludwig Van ");
delay(1000);
lcd.setCursor(0, 0);
lcd.print(" Beethoven ");
delay(2000);
lcd.setCursor(0, 0);
lcd.print(millis() / 1); //print the number of seconds that have passed since the last reset
lcd.setCursor(0, 0);
play('e', 4); //ha
play('e', 4); //ppy
play('f', 4); //birth
play('g', 4); //day
play('g', 4); //to
play('f', 4); //you
play('e', 4); //pause for 2 beats
play('d', 4); //ha
play('c', 4); //ppy
play('c', 4); //birth
play('d', 4); //day
play('e', 4); //to
play('e', 8); //you
play(' d', 2); //pause for 2 beats
play('d', 8); //ha
play('e', 4); //ppy
play('e', 4); //birth
play('f', 4); //day
play('g', 4); //dear
play('g', 4); //your
play('f', 4); //name
play(' e', 4); //pause for 2 beats
play('d', 4); //ha
play('f', 4); //ppy
play('e', 4); //birth
play('d', 6); //day
play('c', 2); //to
play('c', 8); //you
lcd.print("notes played:e,e");
delay(2000);
lcd.setCursor(0, 0);
lcd.print("f,g,g,f,e,d,c,c ");
delay(2000);
lcd.setCursor(0, 0);
lcd.print("d,e,e,d,d,e,e,f ");
delay(2000);
lcd.setCursor(0, 0);
lcd.print(" g,g,f,e,d,f,e,d ");
delay(2000);
lcd.setCursor(0, 0);
lcd.print(" c,c ");
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
}
Circuit Diagram
Circuit
We started this project by doing different experiments with just circuits and components. Soon moving too, the blinky light test then we moved on to Arduino experiments with our Arduino uno kits. We took coding notes to go along with our experiments to note down important pieces of code to use later in the finial project. We stepped back from Arduino experiments and wrote our electromagnet lab and then went back to doing coding experiments. The coding experiments included using all of the different components in the kit separately and some of them together. Components that were used are photo resisters, different types of LED'S, a speaker, a motion sensor, servo motors, a temperature sensor, motors with wheels, and an LCD screen.
Once my partner and I finished the coding experiments we moved on to brainstorming possible actions to make our robot preform. Originally, we wanted to have a " Night time sleeper" machine that would blink cool calming colors with a LCD screen that would tell you 'goodnight!' and play calming tones on the Buzzer but we decided not to do that because there was not enough room and seemed to simple to do. Finally, we made up our mind and looked through the Arduino booklet with all the different circuits and picked out which circuits would make our finial idea come true. Our finial design is a starter on how to play Ode to Joy by Beethoven, it gave all the information to play Ode to Joy. It provided the artist full name, what notes are use on a c major scale, and an example of what it is suppose to sound like as an end result, and finally thanking you note for following along.
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. F=kq1q2/d^2, k=9x10^9 Nm^2/C^2.
Charge-Magnitude of electrical quantity. C=6.24x10^18 electrons.
Ohm's Law-V=ir. Voltage equals current times resistance.
Kirchhoff's Current Law-The sum of the currents going into a connection must equal the sum of the currents leaving the connection.
Kirchhoff's Voltage Law-The sum of the voltages around a circuit must be equal to zero.
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(In parallel and in series)-Amount of change of electricity through a circuit. Measured in Amps, with the variable i, and measured with an ammeter. Current stays the same in a series circuit and splits in a parallel circuit.
Voltage(In parallel and in series)-Potential energy difference from one side of a component to the other side. Measured in volts, with the variable V, and measured with a 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. Measured in Ohms(Ω), variable r. In a series circuit, the total resistance is equal to the sum of the resistors. In a parallel circuit, the sum of the inverse of the resistors equals the inverse of the total resistance.
Power-Rate of transferring energy through a circuit. The variable is P, and it is measured in watts, or Joules per second.
Electromagnetism- The interaction of electric currents in fields to create a magnetic field.
Reflection:
Overall, this project I feel that I exceeded at empathy and critical thinking for this project with my partner. I found new solutions to many of the problems that my partner and I faced, and asked for helped when it was very much needed. During the stage of the project where we were experimenting with circuits and Arduino, my partner and I ran into some trouble for some of the circuits but was quickly solved by looking back at the Arduino booklet and analyze/comparing it with our circuit board. My partner took care of constructing the circuit and I was in charge of our code. Empathy I feel was exucuded well during this project. Since my partner was under the weather and had to miss a few days I didn't let it hold us back and kept moving forward with the experiments and writing down codes so it would be easier for both of us. I was there when my partner needed help even when I was doing my own thing.
Even though we worked well together and finished what we started with a well score I feel like I could have improvement on collaborating and conscientious learning. Looking back I wish I could improve my collaborating and be more involved in wiring the Arduino experiments and our robot as well. Though I did do work I could have been less separated from my partner. Conscientious learning is also something I felt that I could have done better and push myself more at. Seeing my mistakes and noticing them but not having enough effort to stop them from happening. I did not reflect enough so the same mistake kept popping up. Lastly, this was a great experience and It showcased my mistakes but also my achievements.