Robot Art Show

The Assignment

Our assignment was to learn about circuits and code, and then based on our gained knowledge, we had to create a circuit of our own online and then code it to do what we wanted it to. This was also an extra challenge because this project took place online at home due to Covid-19.

My Process

First, to start off the project, I had to do an introduction to circuits which I did on a simulator that pretty much did everything on its own, and was really easy to use. Then, it got a little more complicated. I then had to switch to an actual circuit simulator using a breadboard. After I got used to using that, it was time for me to start coding. First, I started really simple. I had to set up a circuit and then I would be able to copy and paste the code in, and take notes on what specific code seemed to do and how and when. For these and for the final project, I used an Arduino to process the code. When I had finished, now it was time for my final project.

Since I am not the best at circuits and coding in the first place, I decided to go with something that sounded easy, but it was actually pretty challenging for me. The project requirements were to include at least three things in our circuit. I decided to go with LEDs, a button, and a piezo. Setting up the circuit was pretty easy for me, and I accomplished that in less than an hour. I arranged 6 LEDs in a vertical line, and then also placed the piezo and the button nearby on the breadboard. My final goal was that when the button was pressed, the LEDs would light up one by one and a tone would also play out of the piezo at the same time, and the lights would continue to light up, going up the line, and the piezo would go up a scale. Next, I had to code the circuit. I found this extremely hard and ended up spending probably around 20 hours on the code over 2 weeks. I was not good at putting in the code or even knowing what does what, so it took me a long time. Finally, in the end, I had been watching a lot of coding videos and looking at websites, and I noticed my code had a line towards the beginning with one extra plus sign than all of theirs, and so I took it out and it worked. After that, fixing all the other bugs in my code was easy and I was able to turn it in complete on time.

My Project

Photo of Circuit

Video of Circuit

Robot Art Show Movie Nathan Farrington

My Code

const int LED1 = 2; //LED1 is connected to digital pin 2

const int LED2 = 3; //LED2 is connected to digital pin 3

const int LED3 = 4; //LED3 is connected to digital pin 4

const int LED4 = 5; //LED4 is connected to digital pin 5

const int LED5 = 6; //LED5 is connected to digital pin 6

const int LED6 = 7; //LED6 is connected to digital pin 7

const int piezo = 10; //piezo is connected to digital pin 10

const int button = 8; //button is connected to digital pin 8

int buttonState = 0; //variable for button being pressed


void setup () {

Serial.begin(9600); //establishing a serial connection with the computer

pinMode(button,INPUT); //declaring the button as an input

pinMode(LED1,OUTPUT); //declaring LED1 as an output

pinMode(LED2,OUTPUT); //declaring LED2 as an output

pinMode(LED3,OUTPUT); //declaring LED3 as an output

pinMode(LED4,OUTPUT); //declaring LED4 as an output

pinMode(LED5,OUTPUT); //declaring LED5 as an output

pinMode(LED6,OUTPUT); //declaring LED6 as an output

pinMode(piezo,OUTPUT); //declaring the piezo as an output

}


void loop () {

buttonState = digitalRead(button); //read the state of the button

Serial.println(buttonState); //print the button state on the serial monitor

if(buttonState = HIGH) { //if the button has been pressed

digitalWrite(LED1,HIGH); //turn on LED1

tone(piezo,2272); //play the frequency 2272 out of the piezo

delay(500); //delay 500 milliseconds

digitalWrite(LED1,LOW); //turn off LED1

digitalWrite(LED2,HIGH); //turn on LED2

tone(piezo,2550); //play the frequency 2550 out of the piezo

delay(500); //delay 500 milliseconds

digitalWrite(LED2,LOW); //turn off LED2

digitalWrite(LED3,HIGH); //turn on LED3

tone(piezo,2864); //play the frequency 2864 out of the piezo

delay(500); //delay 500 milliseconds

digitalWrite(LED3,LOW); //turn off LED3

digitalWrite(LED4,HIGH); //turn on LED4

tone(piezo,3038); //play the frequency 3038 out of the piezo

delay(500); //delay 500 milliseconds

digitalWrite(LED4,LOW); //turn off LED4

digitalWrite(LED5,HIGH); //turn on LED5

tone(piezo,3400); //play the frequency 3400 out of the piezo

delay(500); //delay 500 milliseconds

digitalWrite(LED5,LOW); //turn off LED5

digitalWrite(LED6,HIGH); //turn on LED6

tone(piezo,3830); //play the frequency 3830 out of the piezo

delay(500); //delay 500 milliseconds

digitalWrite(LED6,LOW); //turn off LED6

delay(500); //delay 500 milliseconds

} else { //if the button has not been pressed

noTone(piezo); //play no tone out of the piezo

}

}


Electromagnet Lab

Also, to close off this project, we ran a short electromagnet lab. The goal was to run a few experiments, and find some conclusive data on what made an electromagnet stronger and how different variations of materials or using the materials affected the magnet.

Electromagnet Lab Write Up

Objective (What are you testing/trying to find out?):

How do electric currents influence a magnetic field?

SubQuestion - Does the number of coils around a magnet make an electromagnet stronger or weaker?

Hypothesis (If _________, then __________): If a coil is wrapped around a nail more, then the magnetic field will be stronger because there are more coils, which contribute to making the magnet stronger.

Background Research (Describe how an electromagnet works using current through a wire, the right hand rule, and ferromagnetic materials):

For the electromagnet that we are building, the current will run from the battery, to the insulated copper wire, around the coil, and back to the battery. For the magnetic field, you can always tell which direction the magnetic field is travelling by the right hand rule. This states that if you hold your right hand to the wire, so that your thumb is parallel to it, when you close your hand, the way that your fingers curve is the direction that the magnetic field is travelling. This stays true for every wire for the whole wire. This means that when the wire coils around the nail, the magnetic field will be pushing in, towards the nail’s core. This makes the nail a magnet when the electric current runs through it. When touching the ends of the copper wire to the battery, this allows the current to travel, and creates the magnet.

Materials to be tested:

Paper Clips

Other Needed Materials:

Insulated Copper Wire

Any Battery

Nail or other ferromagnetic material

Independent Variable (What are you changing? - Only 1 allowed in a good experiment):

The coil - # of wraps and wire intersection

Dependent Variable (What are you measuring? can be multiple):

How many paper clips can be picked up by the magnet when stacked on top of each other

Controlled variables (should be everything else. Include how you’re keeping them the same (ex. room temperature kept at 21 degrees C )):

Length of nail-using the same nail

# and size of paper clips - 15 small

Battery Voltage- using the same battery

Procedure (Order of steps):

  1. Take the insulated copper wire and strip the ends, so that it can create a circuit with the battery.
  2. Take the iron nail and wrap the copper wire around it to create a coil, and wrap it the correct number of times and with crossings or spread out, if needed.
  3. Place 15 paper clips in a small and compact cluster.
  4. Attach the ends of the insulated copper wire to the battery.
  5. Lower the magnet to the cluster in the center and wait until it touches the magnet on top before lifting..
  6. Count how many came up, and then repeat for three trials total.
  7. Collect the data for the set of trials, and then find the average number of clips picked up.
  8. Move to the next set of trials, adjust the number of coils or how they are done.
  9. Conduct the experiment and collect data. Repeat this for the rest of the trial sets.
  10. Create an analysis and conclusion with the data findings when finished.

Data/Observations (make a data table below to record your data):

Analysis/Discussion:

1. all necessary calculations & graphs are present and correct. Graph your data in at least 2 ways. Calculate the mean, low, or high values for your data (which one is most relevant for your experiment? Ideas for analysis (mass, force, median, mean, graph all data, graph averages))

2. Meaning of the data is explicitly stated and accurate in words.

3. Revisits hypothesis and states if right or wrong and why

4. States & explains any errors

5. States ways to improve/revise the experiment

6. States what further investigations would be next

Conclusion: use CLEAR format (Claim, Lead-in, Evidence, Analysis, Repeat (of the evidence and analysis steps))

When using an electromagnet, the number of coils and how they are done matters in how strong and effective the electromagnet will be. The coils cause the electromagnet to be an electromagnet. This happens when the current runs through the wire. Then, using the right hand rule, the coil's magnetic field pushes into the object being used, such as a nail, and gives it a magnetic field. For example, when the test was conducted with 100 coils around the nail, with the coils neatly stacked on top of each other, the paper clips flew with great attraction to the magnet. However, with 50 coils, the same number of paper clips still came but with not as great of an attraction as the first time. This leads me to believe that with more coils, the objects will have a greater attraction to the magnet, but even with less coils, the same number of objects will still be attracted, just with less force than before. When I then used 70 and 50 coils for my next set of trials, I crossed the coils over each other instead of stacking to see if the current would still produce a magnetic field that way (wasn’t enough wire for 100 so I chose 70). Again, it worked, but the magnet with 70 coils made things attract to it faster than the 50 coils, but only slightly because I had to use less coils. However, this time, during the 50 crossing coils, the average number of paper clips dropped a little because the magnet wasn’t as strong. What I find from that is the crossing of the wire must be interfering a little with the magnetic field’s strength than if the wires weren't crossing. From my data, I have concluded that the electromagnet is stronger when the wires do not cross in the coil, and when there is a greater number of coils wrapped around.


Concepts

Circuits

A circuit is a complete loop of conductive material from one side of a power source to the other. Circuits do not work and do not function properly if the circuit is incomplete. There are also two types of circuits, a series and a parallel circuit. A series circuit is a circuit with a single path and multiple components, one after another, all on the same path. A parallel circuit is a circuit with branches each with a separate path for the flow of charge and with each path having separate components. With any of these types of circuits, you can put something together and create pretty much anything once you get used to it.

Current

Current is the flow of the charge or the electricity through a circuit. The current flow is what powers things in a circuit like lights and speakers. Current can be sped up or slowed down depending on its path in the circuit if the circuit has more than 1 path. Current's unit is (i) and it is measured in amps (A). The equation for current is V (voltage) = i (current) * r (resistance). When you calculate for current, you find how fast or slow the current is going by its number in amps.

Voltage

Voltage is the potential energy difference from one side of a component to the other side. For example, a battery could have a voltage of nine volts (9V), which means that the average difference in potential energy is equal to 9V. Voltage (V) is measured in volts (V), and when you solve for voltage, you use the same equation as for current: V (voltage) = i (current) * r (resistance).

Resistance

Resistance is the amount that the current of a circuit is slowed or resisted through an obstacle. Different sections of a circuit can have different resistances, resulting in different current speeds throughout the circuit. Resistance (r) is measured in ohms. It also uses the equation V (voltage) = i (current) * r (resistance) for solving. When you solve for resistance, the number in ohms equals the amount of resistance in that part of the circuit, or in the whole circuit, depending on its setup.

Power

Power is the rate of transferring electrical energy through a circuit. In other words, power is the amount of energy going through the circuit. Power (P) is measured in watts (W). The equation for power is Power (P) = current (i) * voltage (V).

Programming and Coding

For me coding and programming was the very challenging part of this project. I didn't have much prior coding experience, so most of it was new to me. During this, I also had to code my project in type, and the only previous coding I had done was beginner stuff with the coding blocks. For me, that was a big and hard change. Another thing that I found was that once you get to know how to set up a certain component of your circuit, it becomes much easier. For example, it took me quite awhile to figure out how to code the LEDs to turn on one by one, but eventually I got used to it, and it became gradually easier. All I had to do was persevere and get through it while teaching myself along the way, and eventually, I succeeded.


Reflection

Overall, I think this project was fairly successful and I think I did pretty well on it with what I had available to me. Two things that I think went really well during this project were my Conscientious Learner and Communicator skills. I think I did well being a conscientious learner because this project took place at home using online resources due to the coronavirus. Thus, I was not able to directly ask for help, and also had to find and use a lot of online resources on my own. I think that my communicator skills were well because even though we were not at school, when I was completely stuck, I was able to ask my friends and my teacher for help so that I could unstick myself and move on with my work.

One the other hand, two things that I think I could work on are my Critical Thinking and Conscientious Learner Skills. First, for critical thinking, whenever something in my code was wrong, I tended not to think about what I had done wrong in the code, but that I just had the wrong piece or kind of code. In the end, it was just a simple mistake I made, but that wouldn't have happened if I had made sure to check and double check my code to make sure it was all correct. Second, I think I could work on my conscientious learner skills. While I also said that this was something that went well, I think it was also something that I struggled with a little too. It was hard for me to stay on task, especially since I was bored at home, and after working on the project for several hours, I would find myself getting very easily distracted from my work for long periods of time. In general, I think staying more focused on my work could have helped me finish this project more efficiently and quicker.

Overall, I think this project went really well, and I am still proud of what I accomplished with my final product.