Documente Academic
Documente Profesional
Documente Cultură
2016 C. Wexler 1
xkcd.com
2016 C. Wexler 2
Contacto:
Email: wexlerc@missouri.edu
2016 C. Wexler 3
Libros
$96 en Amazon.com
$22 en Amazon.com
2016 C. Wexler 4
Seguridad
Tomacorrientes: AC, 220 Vrms, 50 Hz,
I = V/R potencialmente muy peligroso (dolor, quemaduras, paro
cardiaco).
Mucha potencia disponible: daos materiales
Mayora de la electrnica : bajo voltaje: 1-30 V, DC o AC.
Generalmente seguro en piel seca (bateria de 9V en la leguna ay!).
Algunas fuentes pueden producir mucha corriente (no en la piel):
P = V.I puede ser alto. Quemaduras, daos materiales, etc.
Adentro de CRTs (TV, monitores, osciloscopios viejos): muy
alto voltaje (12-50 kV). Algo peligroso, doloroso aunque
generalemnte no letal.
Linease de transmision (100s of kV) o grandes instalaciones
industriales: KAPUT!
Electricidad esttica (San Luis!): miles de V! ( 1 kV/mm).
Molesto. PUEDE SER MORTAL! a la electrnica! (esp.
MOSFET, es decir casi todo lo digital).
2016 C. Wexler 5
Que vamos a asumir
Conocimiento bsico de electricidad:
Voltaje, Corriente, Ley de Ohm I = V/R
Eventualmente leer diagramas de circuitos
(curso de electronica)
2016 C. Wexler 6
Un par de cositas bsicas
Electronica digital:
1, verdadero, high: ~ 5V (o 3.3 V)
0, falso, low: ~ 0 V
Transistores
NPN (bipolar) N-Ch. Enh. MOSFET
I
Vent
capacitors
diodes
LEDs
transistors
integrated circuits
2016 C. Wexler 8
Identificar Componentes
PHYSICS 4060 Advanced Physics Laboratory
Appendix
Resistor Color Codes
Most frequently used resistors are based on carbon films with power ratings of 1/8-1 Watt. Capacitors (ceramic, mylar)
(http://www.elexp.com/t_resist.htm)
10x103 pF = 10 nF
20%, 1KV breakdown
+
Capacitors (electrolytic)
2200 uF
25V breakdown
Ojo polaridad!
2016 C. Wexler 9
Breadboards
Internal Connections
Doblar a 90
2016 C. Wexler 10
Simuladores
2016 C. Wexler 11
2016 C. Wexler 12
2016 C. Wexler 13
2016 C. Wexler 14
2016 C. Wexler 15
Microcontrollers 101
Computer on a chip (ATmega328)
From under $1 to $100s
Memory:
RAM (Random Access): 2 kB, write (variables, data), resets if
power is turned off
FLASH: 32 kB, write 104 (program storage)
EEPROM (Electrically erasable programmable Read Only): 512 B,
write 105 (data storage)
Peripherals:
digital in/out lines (14+, 6 provide PWM)
analog to digital conversion (8, 10 bits, <1 Msps)
communication: serial UART1, SPI2, I2C3
programming: via serial (bootloader), via ICSP4
1Universal Asynchronous Receiver Transmitter, 2Serial Peripheral Interface, 3Inter Integrated Circuit,
4In-Circuit Serial Programming
2016 C. Wexler 16
2016 C. Wexler 17
2016 C. Wexler 18
Shields (cool thing! but not breadboardable)
2016 C. Wexler 19
USB (serial ICSP programming
communication, (loading bootloader)
programming
via bootloader, RESET*
XTAL, 16 MHz
power)
POWER IN
(6-20 V)
Activity LEDs POWER OUT
(power, RX, TX, D13) (regulated 5V, 3.3V)
2016 C. Wexler 20
Digital I/O ports
D0-D13 (~ = PWM) External INTERRUPTS
SPI (10, 11, serial communication
12, 13) RX (D0), TX (D1)
POWER IN
(6-20 V)
WARNING:
Possible issues with FTDI USB-Serial adapters.
Pirate chips get bricked by some versions of Windows FTDI drivers.
Since it is impossible to know whether you have the real FTDI chip, avoid.
New nanos with CH340 chip advisable.
2016 C. Wexler 22
ATtiny85
Internals
(328
little
brother)
2016 C. Wexler 23
ATtiny LED Flasher
2016 C. Wexler 25
Reading a switch (digital input)
2016 C. Wexler 26
Reading Voltages (analog input)
2016 C. Wexler 27
RGB Led with PWM
/* example 1.2 - fun with PWM and RGB LED - Created 07/04/2010 --- CC by-sa v3.0 Share the love!
By John Boxall --- http://tronixstuff.com */
2016 C. Wexler 29
void loop()
{
// first, cycle up each primary colour
for (j = 1; j < 6; j++)
{
for (i = 0; i < 255; i++)
{ // loop from 0 to 254 (fade in)
analogWrite(red, i); // set the LED brightness
delay(20); // Wait 10ms because analogWrite isn't instant
}
analogWrite(red,0);
delay (20);
for (i = 0; i < 255; i++)
{ // loop from 0 to 254 (fade in)
analogWrite(green, i); // set the LED brightness
delay(20); // Wait 10ms because analogWrite isn't instant
}
analogWrite(green,0);
for (i = 0; i < 255; i++)
{ // loop from 0 to 254 (fade in)
analogWrite(blue, i); // set the LED brightness
delay(20); // Wait 10ms because analogWrite isn't instant
}
analogWrite(blue,0);
}
2016 C. Wexler 30
// psychadelic time
for (j = 1; j < 10000; j++)
{
analogWrite(red,random(255)); // set red at random brightness between 0 and 254
delay (random(10,31)); // wait for a random duration between 10 and 30 milliseconds
analogWrite(green,random(255));
delay (random(10,31));
analogWrite(blue,random(255));
delay (random(10,31));
}
}
2016 C. Wexler 31
Managing large loads
Keep Ib < 10 mA
Ib = 0 (cool!!!)
IRF540N can
manage > 30 A @
up to 40 V
2016 C. Wexler 32
Controlling power with PWM (pulse width modulation)
D3
2016 C. Wexler 34
Controlling a Servo
// Sweep
// by BARRAGAN <http://barraganstudio.com>
void setup() {
myservo.attach(9);
// attaches the servo on pin 9 to the servo object
}
void loop() {
for(pos = 0; pos < 180; pos += 1)
// goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos);
// tell servo to go to position in variable 'pos'
delay(15);
// waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1)
// goes from 180 degrees to 0 degrees
{
myservo.write(pos);
// tell servo to go to position in variable 'pos'
delay(15);
// waits 15ms for the servo to reach the position
}
} 2016 C. Wexler 35
Stepper Motor Control
2016 C. Wexler 36
Analog Outputs (DAC)
Some micros have an actual DAC
inside.
4 bit DAC:
C more resistors in
all directions
A B D
2016 C. Wexler 38