arduino Flashcards
electricity
energy produced by movement (static accumulation/dynamic flow) of charged particles
coulombic force
is between two charged particles, attraction between opposite charges and repelling between same charges
a single charged particle has a…
3D radiative electric field
static accumulation / dynamic flow
contact between two charges
immobilized accumulation
movement against a static charged object (like a plate) which generates an electric field
equation for immobilized accumulation
F*d = J
a charged particle within an electric field will move some distance with some force, resulting in work
negatively charged particles move from areas of ______ potential to areas of ______ potential
moves from areas of low potential to areas of high potential
positively charged particles move from areas of _____ potential to areas of ______ potential
moves from areas of high potential to areas of low potential
units for electric force
newtons
units for electric field
newtons/coulumbs
units for potential energy
joules
voltage (V)
amount of energy required to do work (F*d) to move charge (q)
units of voltage
volts
equation of voltage
v = (F*d)/q
current (I)
amount of charge (in columbs) moving over time (seconds)
units of current
amperes
equation of current
I = q/t
how does charge flow through a battery
from the negative terminal (-) to the (+) terminal
current flows in the ________ direction of electrons
opposite
what generates a magnetic field
flow of electrons
how does positive charge flow in a schematic circuit
from the long line to the short line
how do electrons flow in a schematic circuit
from the short line to the long line
how does current flow through a wire
from positive to negative, B is around counterclockwise (right hand rule)
electrons only flow in a ____ circuit
closed
why do individual electrons flow relatively slow
because of atoms and electrostatic of resistance to motion
how do electrons travel in a wave through a wire
they displace each other in the wire causing a motion similar to a wave, this happens instantaneously
force for flow in an electric circuit
EMF (voltage)
flow in electric circuit
charge/time (current)
limitation to flow in electric circuit
size, shape, material of conductor (impedance)
AC
alternating current, varies over time
DC
direct current, consistent over time
voltage is a potential difference between…
two locations, measured with a probe (voltameter)
wall voltage is
120V AC, it is alternating because its easier to travel over long distances
AA battery voltage is
1.5V DC, current always flows consistently in both directions
impedance
Z, opposes or limits current
electrical circuit with hamburger lines
direct current, I flows from positive terminal of battery (long line) to negative terminal (short line)
electrical circuit with circle and squiggly line
alternating current, I flows mainly in positive to negative terminal direction but some alternates in direction
basic analog components of impedance
resistor, inductor, capacitator
resistor
measured in ohms, ZR
inductor
measured in henrys, ZL
capacitor
measured in farads, ZC
series arrangement
elements share one path of current
same current flows through all elements I T = I R1 = I R2
voltage adds across all elements V T = Vr1 + Vr2 + Vr3 (total voltage is divided)
resistance adds linearly R T = R1 + R2 + R3
parallel arrangement
two or more elements share two nodes (multiple paths of current)
current adds among all paths I T = I1 + I2 + I3
same voltage is shared among all elements V T = Vr1 = Vr2
impedance adds in inverse 1/rT = 1/r1 + 1/r2
ohm’s law
current (I) through conductor is proportional to voltage potential difference between before and after conductor
current (I) through conductor is inversely proportional to impedance
in essence: V = I * R
Kirchoff’s Current Law
all current about a node is conserved
Kirchoff’s Voltage Law
voltage over a closed loop is conserved
voltage divider
two resistors in a series
I = V *(R2 / (R1 + R2))
hardware engineering
the actual electrical/mechanical components
software engineering
logic used to communicate between individual components
how do you coordinate between hardware and software?
an interface (platform) or microcontroller (chip that can be programmed to do certain actions)
arduino
a PCB (printed circuit board) that has a microcontroller, power supply, and I/O pins
I/O pins
input/output pins
arduino has 14 digital and 6 analog
power to arduino (USB 2.0)
5V, 0.5A = 2.5 W
power from arduino
5V, 0.2A = 1W (total)
5V, 0.04A = 0.2W (I/O pin)
breadboard
used to physically connect electrical components (rails connnected vertically and rest is horizontal)
programming language of arduino
C
declaration
declaring variables into the memory space
3 parts of declaration
variable type, variable name, and value
variable type
int = integer (whole number)
boolean = true or false (logical)
long = decimal
function
sectioned off piece of code that can be called as needed
3 parts of a function
function name, return type (long (decimal) or void (doesn’t return a value), and arguments (inputs)
pinMode(pin, MODE);
part of setup
sets a specific pin (on the arduino microcontroller) to a specific mode (OUTPUT or INPUT)
analogRead(pin);
returns analog voltage of a pin, for analog input pins ONLY
digitalRead(pin);
returns digital voltage of a pin, for I/O digital pins only
analogWrite(pin, value);
writes an analog voltage (0-255) to a pin, for PWM pins only (~)
digitalWrite(pin, value);
writes digital voltage (HIGH or LOW) to a pin, for digital I/O pins
delay(value);
pauses arduino program for some time (value) in milliseconds
Serial.begin(baud);
starts the serial monitor which displays input/output values, baud is usually 9600
Serial.print(message);
prints text into serial monitor, use “ “ for text
for loop
runs block of code for certain amount of iterations
4 parts of a for loop
loop variable, loop condition, loop variable modification, looped code
explain the parts of this loop
for (int test = 0; test = 10; test = test+1) {
}
int test = 0 -> predefined loop counter at 0
test = 10 -> sets the limit to how many times the loop should iterate
test = test+1 -> sets the increment that the counter increases by per iteration
while loop
loop runs indefinitely while statement is true
2 parts of while loop
condition and looped code
explain the parts of this loop
int var = 0
while (var < 200) {
var = var + 1 }
int var = 0 is defining the variable as an integer, equal to 0
the while loop will only operate under the condition that var is less than 200
each iteration 1 is added to var
if
conditional statement, only runs if it is true
else
runs prior if statement is false
CAD
fairly basic but powerful software, better for additive as subtractive is hard to visually create, can be buggy and files can be exported as STL for 3D printing
you can only access code in tinkered if
microprocessor (Arduino) is present
circuits on tinkercad provide
dynamic simulations for user interaction
debug in tinkercad
click debug
add breakpoint (select line(s) of code to debug)
simulate
step (right bar)
hover over variables to see values
old school debug
print everything into serial monitor