Difference between revisions of "Virtual Circuit Simulation Guide"
(46 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
= | = Circuitry = | ||
This guide focuses on two options for virtual circuitry, one for simulation called Tinkercad and one for more advanced circuit creation called Fritzing. It is highly recommended that students utilize these software for EG-UY 1004 assignments. | |||
= Tinkercad = | |||
Tinkercad is a free in-browser software that will be used for the simulation of microcontrollers and associated electrical components. A link to the website can be found [https://www.tinkercad.com/| here]. Sign into a Tinkercad with an Autodesk account. After logging in, a circuit project can be created by clicking Create new Circuit (Figure 1). | |||
[[File:Vc1.png|500px|thumb|center|Figure 1: Creating a Circuit in TinkerCAD]] | |||
The sidebar allows access to common electrical components and templates for prototyping (Figure 2). | |||
Figure | [[File:Vc2.png|700px|thumb|center|Figure 2: Tinkercad Sidebar]] | ||
Tinkercad allows the user to directly write and execute code within the software. When the circuit is ready, click Start Simulation to simulate powering the circuit (Figure 3). | |||
Figure | [[File:Vc3.png|400px|thumb|center|Figure 3: TinkerCAD Simulation]] | ||
Click Code to open the panel to write code. The code is based on the Arduino programming language. A guide to coding with Arduino can be found [[Arduino Coding Guide | here]]. The Serial Monitor window function as it would in the Arduino IDE, and has the same setup and loop areas (Figure 4). Note that the circuit cannot be adjusted while the code tab is opened. | |||
[[File:Vc4.png|600px|thumb|center|Figure 4: TinkerCAD Code Area]] | |||
= Frtizing = | |||
Fritzing is a free, open-source software that has a variety of tools. A link to download the software can be found [[Media: Fritzing.zip |here]]. Extract the ZIP file to a folder on a computer and run the EXE file. | |||
Fritzing's interface is similar to Tinkercad's interface, with the exception that it cannot perform simulations. Still, Fritzing provides a greater variety of components that are not included in Tinkercad. | |||
Upon installation, the following tabs are shown (Figure 5). The Breadboard View tab displays the components, and the Code tab gives the in-program access to Arduino IDE. | |||
Figure 5: Tabs | [[File:Vc5.png|600px|thumb|center|Figure 5: Fritzing Tabs]] | ||
The Parts menu has the same interface as that of Tinkercad, but with many more options (Figure 6). | |||
Figure 6: Parts | [[File:Vc6.png|300px|thumb|center|Figure 6: Fritzing Parts Menu]] | ||
= | = Examples = | ||
In this guide, two basic example projects will be shown in Tinkercad, but can be easily replicated in Fritzing. The examples include a DC motor rotating continuously in one direction and a DC motor that rotates based on the input of the user. | |||
== Continuous DC Motor == | |||
A DC motor that runs continuously will be simulated in TinkerCAD. After dragging in a DC motor and Arduino from the Tinkercad sidebar (Figure 7), the wiring is drawn and the simulation is run. | |||
Figure | [[File:Vc7.png|400px|thumb|center|Figure 7: Continuous DC Motor Example]] | ||
The DC motor displays the revolutions per minute (RPM) that it rotates at for this amount of voltage, specifically 6586 RPM at 3.30 V. The RPM is directly proportional to the input voltage, so the motor speed can be controlled by varying the input voltage. Note that in this situation, the microcontroller is functioning directly as a battery to the motor. Were this a 9.00 V battery instead of a microcontroller, the displayed RPM would be much higher, if the DC motor is able to support the speed. | |||
When creating this same circuit in a physical motor, it is highly unlikely that the motor will be directly connected to the power supply. Additionally, resistors are used to prevent damage to the motor from being directly exposed to the full voltage from the power supply and are used to manipulate the RPM to a desired speed. Drag a breadboard and a 10.00 kΩ resistor into the circuit (Figure 8). | |||
Figure | [[File:VCSG Figure 8.png|400px|thumb|center|Figure 8: Continuous DC Motor with 10 kΩ Resistor]] | ||
With all electrical components, Tinkercad allows the user to directly set the value of the component, such as the resistance for a resistor or voltage for a power supply. A resistor is dragged in and set to 10 kΩ (Figure 9). | |||
[[File:VCSG Figure 9.png|400px|thumb|center|Figure 9: Setting Resistor Value]] | |||
By using the resistor, the RPM of the motor decreased to 41.00 RPM, while the input voltage was the same. The resistor directly controls how fast the motor will rotate. | |||
== DC Motor with Specified Input == | |||
A DC motor that runs for a specified time based on a specified input will be simulated in Tinkercad (Figure 10). | |||
[[File:Vc10.png|800px|thumb|center|Figure 10: Motor Programmed to Run and Pause]] | |||
To control the motor with a specified input, the motor must be connected with the Arduino. In this circuit, the power supply is wired to digital pin 8. This will allow the Arduino board to communicate with the power supply, which will directly communicate with the motor. As pin 8 is a digital pin, it only has two values: HIGH or LOW. In the program, the function digitalWrite sends signals to the specified pin. In the code, HIGH will cause the pin to supply power and therefore for the motor to run, while LOW shuts off the power being supplied to the circuit for the motor to stop, as seen in rows 8 and 10, respectively. The motor can also be directly wired to the board instead of wired to the power supply to receive signals directly from the Arduino board. | |||
For the Arduino, digital pins that will transmit signals utilizing 5.00 V, so a resistor is used to protect the motor from burning out from too much voltage. The delay function tells the microcontroller how long to run one line of code, or how long to turn on the motor, before executing the next line of code. The delay function reads its value in milliseconds. In this example, the motor is running for 1.00 s, then stopping for 1.00 s. As this part of the program is in the Loop area, it repeats until a line of code indicates it to stop. |
Latest revision as of 20:01, 2 September 2024
Circuitry
This guide focuses on two options for virtual circuitry, one for simulation called Tinkercad and one for more advanced circuit creation called Fritzing. It is highly recommended that students utilize these software for EG-UY 1004 assignments.
Tinkercad
Tinkercad is a free in-browser software that will be used for the simulation of microcontrollers and associated electrical components. A link to the website can be found here. Sign into a Tinkercad with an Autodesk account. After logging in, a circuit project can be created by clicking Create new Circuit (Figure 1).
The sidebar allows access to common electrical components and templates for prototyping (Figure 2).
Tinkercad allows the user to directly write and execute code within the software. When the circuit is ready, click Start Simulation to simulate powering the circuit (Figure 3).
Click Code to open the panel to write code. The code is based on the Arduino programming language. A guide to coding with Arduino can be found here. The Serial Monitor window function as it would in the Arduino IDE, and has the same setup and loop areas (Figure 4). Note that the circuit cannot be adjusted while the code tab is opened.
Frtizing
Fritzing is a free, open-source software that has a variety of tools. A link to download the software can be found here. Extract the ZIP file to a folder on a computer and run the EXE file.
Fritzing's interface is similar to Tinkercad's interface, with the exception that it cannot perform simulations. Still, Fritzing provides a greater variety of components that are not included in Tinkercad.
Upon installation, the following tabs are shown (Figure 5). The Breadboard View tab displays the components, and the Code tab gives the in-program access to Arduino IDE.
The Parts menu has the same interface as that of Tinkercad, but with many more options (Figure 6).
Examples
In this guide, two basic example projects will be shown in Tinkercad, but can be easily replicated in Fritzing. The examples include a DC motor rotating continuously in one direction and a DC motor that rotates based on the input of the user.
Continuous DC Motor
A DC motor that runs continuously will be simulated in TinkerCAD. After dragging in a DC motor and Arduino from the Tinkercad sidebar (Figure 7), the wiring is drawn and the simulation is run.
The DC motor displays the revolutions per minute (RPM) that it rotates at for this amount of voltage, specifically 6586 RPM at 3.30 V. The RPM is directly proportional to the input voltage, so the motor speed can be controlled by varying the input voltage. Note that in this situation, the microcontroller is functioning directly as a battery to the motor. Were this a 9.00 V battery instead of a microcontroller, the displayed RPM would be much higher, if the DC motor is able to support the speed.
When creating this same circuit in a physical motor, it is highly unlikely that the motor will be directly connected to the power supply. Additionally, resistors are used to prevent damage to the motor from being directly exposed to the full voltage from the power supply and are used to manipulate the RPM to a desired speed. Drag a breadboard and a 10.00 kΩ resistor into the circuit (Figure 8).
With all electrical components, Tinkercad allows the user to directly set the value of the component, such as the resistance for a resistor or voltage for a power supply. A resistor is dragged in and set to 10 kΩ (Figure 9).
By using the resistor, the RPM of the motor decreased to 41.00 RPM, while the input voltage was the same. The resistor directly controls how fast the motor will rotate.
DC Motor with Specified Input
A DC motor that runs for a specified time based on a specified input will be simulated in Tinkercad (Figure 10).
To control the motor with a specified input, the motor must be connected with the Arduino. In this circuit, the power supply is wired to digital pin 8. This will allow the Arduino board to communicate with the power supply, which will directly communicate with the motor. As pin 8 is a digital pin, it only has two values: HIGH or LOW. In the program, the function digitalWrite sends signals to the specified pin. In the code, HIGH will cause the pin to supply power and therefore for the motor to run, while LOW shuts off the power being supplied to the circuit for the motor to stop, as seen in rows 8 and 10, respectively. The motor can also be directly wired to the board instead of wired to the power supply to receive signals directly from the Arduino board.
For the Arduino, digital pins that will transmit signals utilizing 5.00 V, so a resistor is used to protect the motor from burning out from too much voltage. The delay function tells the microcontroller how long to run one line of code, or how long to turn on the motor, before executing the next line of code. The delay function reads its value in milliseconds. In this example, the motor is running for 1.00 s, then stopping for 1.00 s. As this part of the program is in the Loop area, it repeats until a line of code indicates it to stop.