Uploaded by mtfrank1000

ECEN 101 Tinkercad

advertisement
ECEN 101 – Tinkercad Virtual Circuit
Implementation
Introduction
Welcome to the opportunity to learn about how to build circuits using your Arduino, breadboard, and
LED and resistors and other electric parts. The next module will use your actual hardware. The last
assignment we used Easyeda to simulate the design of our circuits. This module will use a virtual
construction toolkit called Tinkercad to build your circuits.
Tinkercad is provided by an amazing software company called Autodesk. Autodesk is a very important
software company in the simulation space. It provides some very high end products in the area of
Mechanical Design, as well as in the Media and Entertainment space. This includes products like Maya,
the tool used by most movie studios to create Computer Generated Images. They also support the
3dMax tool, a modeling and animation program used by most video gaming companies. The cool thing
about Autodesk is that they provide students with these tools for free. If you are interested in these
products, go to https://www.autodesk.com/education/support to learn how to get them for free.
Tinkercad
To get started go, the www.tinkercad.com. You should see this:
To use Tikerkad you’ll need a free account. Select the JOIN NOW button at the top right of the screen.
Create your own personal account, you can sign up with your BYUI email, or with a Google account, if
you have one. When you have created an account and signed in, you should see something like this:
Tinkercad supports a number of different virtual environments. You’ll want to select the Circuits
selection on the left side of the screen. You should see something like this:
So, now let’s get started. Select the Create new Circuit at the upper left of the screen. Now you’ll have a
screen that you can add virtual components to, as well as a list of possible components on the right
hand side of the screen.
The first thing you’ll want to do is find the Components -> Basic pull down menu at the top right of the
screen. Change the selection to All:
Now you are ready to start adding virtual components. Let’s start with a solderless breadboard. Scroll
down to in the component area and find the Breadboad selection. Select the regular size Breadboard:
Place your Breadboard in the virtual workspace. Let’s look at the solderless breadboard. The solderless
breadboard is designed to allow you to connect components; wires, resistors, LEDs without having to
heat up some medal and fuse the two parts together. It is a wonderful tool when you want to prototype
and evaluate your circuit.
The solderless breadboard is a piece of plastic with lots of holes. However, underneath all of that plastic
are some metal strips that connect the holes together electrically.
Now back to the breadboard. The holes on the upper and lower two rows are connected. Tinkercad
helps you to understand this when you hover over one of those holes, notice the green indicator of the
other holes that are connected electronically to this one:
The center set of holes are connected quite differently, they are connected as columns. If we choose
one of the holes, the green line indicates the holes to which it is connected electrically:
We will use this useful characteristics to create our circuits. To power the circuits we need to add a
voltage supply. In our case we’ll use the Arduino to use the power that is no our laptops and transfer it
to the breadboard. To do this you’ll need to add an Arduino to your circuits. Go to the components
section and find the Arduino (if you don’t find it make sure you have the Components->All selected at
the top of the components section.)
On the Arduino there are two pins we can use to get power to our breadboard. They are the 5V and
GND pins. So let’s connect them to the breadboard using male-to-male jumper wires. The jumper wires
will have special connectors on the end that allow you to plug them into the Arduino and Breadboard.
The color of the jumper wire will not matter to electricity. However, I often use a red cable when I
connect to 5 volts and a black cable to connect to GND.
So connect your circuit like this:
Notice the selection at the top to change the color of the wire. Your circuit should look like this:
The red wire will go from the 5V connection on your Arduino to the + row on the breadboard. The GND
connection will go from the Arduino to the – row on your breadboard. Now you have power, or will have
when you plug your Arduino in.
The first circuit that you will build is the LED circuit that you designed last module. Remember it is a
simple circuit that has an LED with a resistor in series. So, let’s first add the LED to our breadboard. To
do this grab the LED from the component library and add it to the column area of the board:
The LED should be connected to two different columns. You’ll also need to notice that the LED has two
different connections. If you hover over one of the connections you’ll see an Anode label.
The other lead will be labeled cathode. We won’t go into detail on how an LED works here, just
remember that the Anode must be connected to the positive voltage. So go ahead and connect a red
wire from the 5 volt supply on the breadboard to the Anode connection on the LED, like this:
Be a bit careful. On some solderless breadboards the left and right sides of the + and – rows are not
connected. Also make sure the jumper wire is connected in the same column as the Anode on your LED.
Now you’ll want to add a resistor to the circuit. Select the resistor from the component set, and place it
so that one end is in the same column as the Cathode of the LED, like this:
To get the resistor to be place side ways, while the resistor is selected hit the R key. The resistor is a
reciprocal device, which means it doesn’t matter which end goes in which column. You will, however,
want to change the value of the resistor. While it is selected you’ll notice the Resistor specifier in the
upper right hand corner. Type in 330 and select the Ω units. This will give you a 330 Ω resistor.
Now you have one more connection, and that is to connect the other side of the resistor to the – row
(GND).
Now that everything is connected let’s connect it all to power (virtually.) To do this click on the Start
Simulation button in the upper right corner.
The LED should light, indicating that your circuit is working. It is not there are several things you can
check. First, you should check to make sure your LED is connected in the right direction. If it is in
backwards it will not light. Also, check to make sure your wires are connected in the right columns. If
they aren’t then current won’t flow.
Now that we have that circuit built, let’s continue on to the four resistor circuit. First, let’s stop the
simulation and turn the power to the circuit off (virtually.) If you remember the four resistor circuit, we
had two pairs of resistors, each connected in series, then we connected the pairs in parallel. Let’s start
with two resistors in series.
Let’s copy the resistor that is already on the board. To do this select the resistor, the press Cntrl C. Then
press Cntrl V and a new resistor will appear as you move the mouse. If this doesn’t occur, make sure you
have Stopped the Simulation. Place the resistor on your breadboard, like this:
Now create another copy by hitting Cntrl V again. Move the resistor so that the two ends are in the
same column, like this:
The resistors are connected in series because the current that flows through the first resistor will also
flow through the second resistor. Let’s finish the connection to illustrate the point.
The current will flow from the GND connection on the Arduino, through the connections on the
solderless breadboard, through both resistors, and back to the 5V connection on the Arduino. If you
press the Start Simulation button the circuit will be energized.
Unfortunately there is no visible way to see the circuit is working, like on the LED circuit. Let’s turn to
our Arduino and make some measurements, this will allow you to see that the circuit is indeed working.
First, let’s add some Arduino Code to our simulation environment. To do this Stop the Simulation. Then
press the Code selection in the upper right hand corner.
The code editor will open:
Click on the Blocks selection, then change it to Text
Tinkercad will confirm your selection (hit the Continue button). Now you can add code to your Arduino.
You’ll now want to replace the code in this window with some example code from the Arduino File>Examples->Basics->ReadAnalogVoltage file. Here is the code:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
// print out the value you read:
Serial.println(voltage);
}
The Arduino reads the value from A0, then prints it out the Serial Monitor port. We could now run the
code, but we need to connect A0 to a measurement point on our circuit. Let’s connect it between the
two resistors, like this:
Now we can run the program. Click Start Simulation. However, we also need access to the Serial Monitor
to see our values. Click on the Code selection again.
Notice at the Bottom right of the screen you’ll see the Serial Monitor selection. Click on that and it will
open a window and show us the value:
The value is 2.5 volts. Is that what we would expect. Let’s do some calculations. How much current
would flow in our two resistors? Well, since I = V/R, then I = 5/(330 + 330), or roughly 7.6 milliamps. How
much voltage is dropped across a single resistor? V = I *R, or 7.6 millamps * 330 ohms, or 2.5 volts.
Now let’s add two more resistors on series, and then connect them to our first two resistors in parallel.
Use Cntrl C and Cntrl V to copy the resistors and place them on the breadboard:
These resistors are in series. Now let’s connect the 5V and GND so that the resistors are in parallel:
Let’s also change the measurement wire to measure the voltage between the two resistors:
Before running the simulation, let’s predict the voltage value that will be returned. As before, the
current is I = V/R, then I = 5/(330 + 330), or roughly 7.6 milliamps. And the voltage is V = I *R, or 7.6
millamps * 330 ohms, or 2.5 volts.
Run the simulation, and click Code to see the Serial Monitor report the measurement:
The final part of the exercise is to change one of the resistor values and see if we can predict the value
of voltage that will be read. Change the lower, left-hand resistor to 660 ohms.
Notice that the color bands on the resistor changed. These bands are a color indication of the resistor’s
value.
Now let’s look at our current. The current is I = V/R, then I = 5/(330 + 360), or roughly 5 milliamps. Now
you might say, hey, why don’t we use exact calculations. And the answer is that we know that our real
resistors won’t be exact. In fact we are going to use 10% resistors in our actual designs, which means
they can vary as much as +/-10% of the resistor value. The voltage is V = I *R, or 6 millamps * 330 ohms,
or 1.67 volts.
Run the simulation and look at the results:
That’s it. Take a screen shot of these final results and submit them under the Basic Circuit Virtual
Construction Lab.
Download