SlideShare une entreprise Scribd logo
1  sur  71
Télécharger pour lire hors ligne
Making Things Move,
Lighting Things Up and
  AVR Programming
  CS4062 - Eoin Brazil - Semester 2 - 2009
Servos and Motors
 Motion
   linear or
rotary                      Stepper      Servo
   conversion
issues

 Types
  DC
  Servo          Gearhead             DC Motor

  Stepper
  Gearhead
DC Motor

 2 Connections
  Continual spin, given current & voltage
  Reversing current, reverses the direction
  Increasing the voltage, spins faster,
decreasing the voltage, slows the spin
  High speed but low torque
  Gearbox can add torque but at the expense
of speed
DC Motor Example
DC Motor Example
DC Motor Example
Three Pieces
Gearhead Motor
 DC Motor with gearbox
  Not fast but provide more torque

 Servo Motor                                 Gearhead
  Gearhead motor with position feedback
  Feedback is often from potentiometer
  Pulsing the motor moves it to particular
position within 180 degree range
  Can’t move 360 degrees but can be
                                                Servo
positioned precisely within the 180 degree
range
Stepper Motor
  Precise positioning &
360 degrees range
   Move in discrete steps around a circle
   A 200 step motor would move 1.8 degrees
 per step around the full 360 degrees
   Continuous rotation in either direction
   Good torque
   Complex to connect
Solenoids and
                    Actuators
                                    Microactuators

  Linear
Motion                           Actuator
  Pull or Push

  Types
                      Solenoid
  Solenoid
  Actuator
  Microactuator
Motor Characteristics
gears or direct
rated voltage
current (efficiency) - stall / running
speed - spin / rpm, rps, Hz
torque
size, shaft diameter, shaft length
position resolution (Servos & Steppers)
Advanced Mediation
  Lisa McElligott, 2000
  interactive confessional box
  used real confessional box
  confessor was computer
program
  interacted using a voice interface.
  scripted interactions with
random noises to add to
immersion
  suspension of disbelief
  realism
Weave Mirror
                                         Daniel Rozin,
                                       Weave Mirror,
                                       2007



  Mechanical mirror
  Any person standing in front of one of
these pieces is instantly reflected on its
surface.                                                   Side and back
  Uses video cameras, motors and                         views
computers to achieve mirroring
  Sound aspect - soothing sound
Weave Mirror
  Daniel Rozin,
Weave Mirror,
2007
Organic Energy Cloud
Motorised Cloud
PWM
  Analog input / output
  Duration of the digital pulse of voltage
  Microcontroller - HIGH 5V or LOW 0V
  ``Fake’’ it using PWM
  Duty cycle, ratio from low to high to low cycle
   LED dimming, DC Motor speed control, Piezo
speakers, RC Servo positioning
Pulse Width
Modulation
Wiring
            Diagram




Schematic
 Diagram
RC Servo Motor
  Servo Motor
Connections on Arduino
   Black wire would go to Grd pin
   Red wire would go to 5V power pin
    White wire would go to one of the digital
 pins on the board
   Colours can vary, Ground (black or
 brown), Power (red), Control (orange, yellow
 or white)
/*
 * NewSerialServo
 * --------------
 * Servo control from the Serial port
 *
 * Alteration of the control interface to use < and > keys
 * to slew the servo horn left and right. Works best with
 * the Linux/Mac terminal "screen" program.
 *
 * Created 10 December 2007
 * copyleft 2007 Brian D. Wendt
 * http://principialabs.com/
 *
 * Adapted from code by Tom Igoe, http://itp.nyu.edu/physcomp/Labs/Servo
 */

/** Adjust these values for your servo and setup, if necessary **/
int servoPin = 2; // control pin for servo motor
int minPulse = 600; // minimum servo position
int maxPulse = 2400; // maximum servo position
int turnRate = 100; // servo turn rate increment (larger value, faster rate)
int refreshTime = 20; // time (ms) between pulses (50Hz)

/** The Arduino will calculate these values for you **/
int centerServo;
int pulseWidth;
                    // center servo position
                    // servo pulse width
                                                                           continued
int moveServo;      // raw user input
long lastPulse = 0; // recorded time (ms) of the last pulse                 on next
                                                                             slide
/*
 * NewSerialServo
 * --------------
 * Servo control from the Serial port
                                                            Setup the necessary
 *
 * Alteration of the control interface to use < and > keys
 * to slew the servo horn left and right. Works best with
                                                             control values and
                                                             variables to store
 * the Linux/Mac terminal "screen" program.
 *
 * Created 10 December 2007

                                                                information
 * copyleft 2007 Brian D. Wendt
 * http://principialabs.com/
 *
 * Adapted from code by Tom Igoe, http://itp.nyu.edu/physcomp/Labs/Servo
 */

/** Adjust these values for your servo and setup, if necessary **/
int servoPin = 2; // control pin for servo motor
int minPulse = 600; // minimum servo position
int maxPulse = 2400; // maximum servo position
int turnRate = 100; // servo turn rate increment (larger value, faster rate)
int refreshTime = 20; // time (ms) between pulses (50Hz)

/** The Arduino will calculate these values for you **/
int centerServo;
int pulseWidth;
                    // center servo position
                    // servo pulse width
                                                                           continued
int moveServo;      // raw user input
long lastPulse = 0; // recorded time (ms) of the last pulse                 on next
                                                                             slide
// Main program setup
void setup() {
  pinMode(servoPin, OUTPUT); // Set servo pin as an output pin
  centerServo = maxPulse - ((maxPulse - minPulse)/2);
  pulseWidth = centerServo; // Give the servo a starting point (or it floats)
  Serial.begin(9600);
  Serial.println("   Arduino Serial Servo Control");
  Serial.println("Press < or > to move, spacebar to center");
  Serial.println();
}

void loop() {
 // wait for serial input
 if (Serial.available() > 0) {
   // read the incoming byte:
   moveServo = Serial.read();

  // ASCII '<' is 44, ASCII '>' is 46 (comma and period, really)
  if (moveServo == 44) { pulseWidth = pulseWidth - turnRate; }
  if (moveServo == 46) { pulseWidth = pulseWidth + turnRate; }
  if (moveServo == 32) { pulseWidth = centerServo; }
  // stop servo pulse at min and max
                                                                               continued
  if (pulseWidth > maxPulse) { pulseWidth = maxPulse; }
  if (pulseWidth < minPulse) { pulseWidth = minPulse; }                         on next
 }
                                                                                 slide
// Main program setup
void setup() {
  pinMode(servoPin, OUTPUT); // Set servo pin as an output pin
  centerServo = maxPulse - ((maxPulse - minPulse)/2);
  pulseWidth = centerServo; // Give the servo a starting point (or it floats)
  Serial.begin(9600);
  Serial.println("   Arduino Serial Servo Control");
  Serial.println("Press < or > to move, spacebar to center");    Setup servo its
}
  Serial.println();
                                                                pin, its pulse, and
void loop() {
 // wait for serial input
                                                               its position. Setup
 if (Serial.available() > 0) {
   // read the incoming byte:                                   serial connection
   moveServo = Serial.read();

  // ASCII '<' is 44, ASCII '>' is 46 (comma and period, really)
                                                                   for control
  if (moveServo == 44) { pulseWidth = pulseWidth - turnRate; }
  if (moveServo == 46) { pulseWidth = pulseWidth + turnRate; }
  if (moveServo == 32) { pulseWidth = centerServo; }
  // stop servo pulse at min and max
                                                                               continued
  if (pulseWidth > maxPulse) { pulseWidth = maxPulse; }
  if (pulseWidth < minPulse) { pulseWidth = minPulse; }                         on next
 }
                                                                                 slide
// Main program setup
void setup() {
  pinMode(servoPin, OUTPUT); // Set servo pin as an output pin
  centerServo = maxPulse - ((maxPulse - minPulse)/2);
  pulseWidth = centerServo; // Give the servo a starting point (or it floats)
  Serial.begin(9600);
  Serial.println("   Arduino Serial Servo Control");
  Serial.println("Press < or > to move, spacebar to center");
  Serial.println();
}                                   The serial input controls the
void loop() {
 // wait for serial input          servo by the ‘<‘ or ‘>’ and keep
 if (Serial.available() > 0) {
   // read the incoming byte:
   moveServo = Serial.read();
                                   its speed within the safe range
  // ASCII '<' is 44, ASCII '>' is 46 (comma and period, really)
  if (moveServo == 44) { pulseWidth = pulseWidth - turnRate; }
  if (moveServo == 46) { pulseWidth = pulseWidth + turnRate; }
  if (moveServo == 32) { pulseWidth = centerServo; }
  // stop servo pulse at min and max
                                                                               continued
  if (pulseWidth > maxPulse) { pulseWidth = maxPulse; }
  if (pulseWidth < minPulse) { pulseWidth = minPulse; }                         on next
 }
                                                                                 slide
// pulse the servo every 20 ms (refreshTime) with current pulseWidth
// this will hold the servo's position if unchanged, or move it if changed
if (millis() - lastPulse >= refreshTime) {
  digitalWrite(servoPin, HIGH); // start the pulse
  delayMicroseconds(pulseWidth); // pulse width
  digitalWrite(servoPin, LOW); // stop the pulse
  lastPulse = millis();       // save the time of the last pulse
}
}
// END of Main program
Pulse the servo every 20ms, this is where the
desired change actually happens and its based
         on the previous serial input
// pulse the servo every 20 ms (refreshTime) with current pulseWidth
// this will hold the servo's position if unchanged, or move it if changed
if (millis() - lastPulse >= refreshTime) {
  digitalWrite(servoPin, HIGH); // start the pulse
  delayMicroseconds(pulseWidth); // pulse width
  digitalWrite(servoPin, LOW); // stop the pulse
  lastPulse = millis();       // save the time of the last pulse
}
}
// END of Main program
Switches
  Types and contacts
  Knives and toggles                           Knive (SPST)
    Single pole = control of one circuit
    Double pole = two circuits controlled at
  once
    Single throw = one path for circuit
    Double throw = two paths for circuit
                                               Toggle (SPDT)
   Foot, tape / mat, roller,
hair trigger, tilt, magnetic /
reed
High and Low
    Practical switching
Arduino looks for 0V (low) to 5V (high)
Digital inputs float between these values
Resistor “pulls” input to ground (0 volts)
Pressing switch “pushes” input to 5 volts
Switch pressed = HIGH, not pressed = LOW
setup(): pinMode(myPin,INPUT)
loop(): digitalRead(myPin)
Sketching your work
                Bill Verplank
                Interaction Design
              Sketchbook

                Bill Buxton
Embodiment using
  Animatronics
               Stefan Marti
               2005, Autonomous
             Interactive
             Intermediaries
              2005, Physical
             Embodiments for Mobile
             Communication Agents
Kinematics
  Gears and mechanical
models
   Geometry of pure motion without
 reference to force or mass
   Cornell University Library, Kinematic
 Models for Design Digital Library             Examples from
 (KMODDL)                                     www.flying-pig.co.uk
  Tutorials, models, e-books, e.g. Linkages
   Chapter 3 in Building Robot Drive
 Trains
PWM Tutorials
ITP Servo tutorial
Principial Labs Arduino Servo
Driving a Unipolar Stepper Motor
Driving a Bipolar Stepper Motor           ITP Servo lab, uses
                                        a potentiometer to
Making an RC Servo wall following car   control the servo.
Arduino Library
Software Servo Library
  attach(int) Turn a pin into a servo driver.
  detach() Release a pin from servo driving.
  write(int) Set the angle of the servo in degrees, 0 to 180.
  read() return that value set with the last write().
  attached() return 1 if the servo is currently attached.
  refresh() must call once every 50ms to keep servos updated, won't call more than
every 20ms
  setMinimumPulse(uint16_t) set the duration of the 0 degree pulse in
microseconds. (default minimum value is 544 microseconds)
 setMaximumPulse(uint16_t) set the duration of the 180 degree pulse in
microseconds. (default maximum pluse value is 2400 microsconds)
  Need to first send position with write() before you can receive any control signals
Projects and
Prototyping Trade-offs
Projects and
   Prototyping Trade-offs

Re-programmable
Projects and
Prototyping Trade-offs
               Size
              matters
Capacitors



Stores charge                 With resistors
I = C * dV/dt                 RC Circuit, parallel or series
removal of electrical noise   low-pass or high-pass filtering
Resistor Color Code
 4-band Color Code
                                                                    10K ! ± 5%



5 - band Color Code
                                                               47.5 K ! ± 1%



6 - band Color Code
                                                                    276 ! ± 5%




                                          Multiplier    Tolerance
                                          SLV 0.01      SLV ± 10%
  1st Digit       2nd Digit   3rd Digit   GLD 0.1       GLD ± 5%            Temperature
  BLK-0           BLK-0        BLK-0       BLK-1                             Coefficient
  BRN-1           BRN-1        BRN-1       BRN-10                          BRN-100ppm
                                                        BRN ± 1%
  RED-2           RED-2        RED-2      RED-100                          RED-50ppm
                                                        RED ± 2%
  ORN-3           ORN-3       ORN-3       ORN-1K                           ORN-15ppm
  YEL-4           YEL-4        YEL-4      YEL-10K                          YEL-25ppm
  GRN-5           GRN-5       GRN-5       GRN-100K     GRN ± 0.5%
  BLU-6           BLU-6        BLU-6      BLU-1M       BLU- ± 0.25%
  VIO-7           VIO-7        VIO-7      VIO-10M      VIO ± 0.1%
  GRY-8           GRY-8       GRY-8
 WHT-9           WHT-9        WHT-9
                                                        GRY-8
Measuring Resistance
Measuring Voltage
Diodes
  LEDs, Zener, Schottky, Photo
  Pass current in one direction
only
  Forward voltage drop
           e.g. forward voltage drop of 0.7 V in circuit where
         input is 5V will have voltage of 4.3V on its far side

    Rectification
           Removal of negative voltages from signal, i.e. a
         bridge rectifier
  LED, 1.6V forward voltage drop, current limit 36mA, circuit
total voltage 5V.
 VR = 5 - 1.6 = 3.4V
  R = V / I = 3.4 / 0.036 = 94.44 Ohm (at least 100 Ohm)
  P = V * I = 3.4 * 0.036 = 0.1224 W (at least 0.125W)
RGB LEDs
RGB LEDs
RGB LEDs
Ambient orb   Cube of LEDS
RGB LEDs
TiniTinct, Arduino-based monome compatible
AVR Programmer
AVR ATTiny13 Blinky
AVR ATTiny13 Blinky
/* Two LEDs, tied to pin b0 and to b1 which correspond to physical pins 5 and 6 on ATTINY13 are turned
on for 100ms and then off for 200ms
*/

#include <avr/io.h>
#define F_CPU 1000000 // set to 1 MHz as delay.h needs F_CPU
#include <util/delay.h>
#include "pin_macros.h" // Leah Buechley's pin macros for AVRs - very useful

int main(void)
{   // Set Port B pins for 3 and 4 as outputs
    b0_output;	 //initialize LED pin
    b1_output;	 //initialize LED pin
    b0_high;	    //LED is off
    b1_high;	    //LED is off
	
    DDRB = 0x18; // In binary this is 0001 1000 (note that is bit 3 and 4)

    for ( ; 1==1 ; ) // loop while 1 equals 1 - forever - C style loop
    {
	      // Set Port B pins for 3 and 4 as HIGH (i.e. turn the LEDs on)
	      b0_low;	 	        //LED is on
	      b1_low;	 	        //LED is on
       _delay_loop_2(65535);
	      b0_high;	 	       //LED is off
	      b1_high;	 	       //LED is off
       _delay_loop_2(65535);
    }
    return 1;
}
/* Two LEDs, tied to pin b0 and to b1 which correspond to physical pins 5 and 6 on ATTINY13 are turned
on for 100ms and then off for 200ms
*/

#include <avr/io.h>
#define F_CPU 1000000 // set to 1 MHz as delay.h needs F_CPU
#include <util/delay.h>                                                      Include the
#include "pin_macros.h" // Leah Buechley's pin macros for AVRs - very useful

int main(void)
                                                                          libraries and set
{   // Set Port B pins for 3 and 4 as outputs
    b0_output;	 //initialize LED pin
                                                                         the speed of chip
    b1_output;	 //initialize LED pin
    b0_high;	    //LED is off
    b1_high;	    //LED is off
	
    DDRB = 0x18; // In binary this is 0001 1000 (note that is bit 3 and 4)

    for ( ; 1==1 ; ) // loop while 1 equals 1 - forever - C style loop
    {
	      // Set Port B pins for 3 and 4 as HIGH (i.e. turn the LEDs on)
	      b0_low;	 	        //LED is on
	      b1_low;	 	        //LED is on
       _delay_loop_2(65535);
	      b0_high;	 	       //LED is off
	      b1_high;	 	       //LED is off
       _delay_loop_2(65535);
    }
    return 1;
}
/* Two LEDs, tied to pin b0 and to b1 which correspond to physical pins 5 and 6 on ATTINY13 are turned
on for 100ms and then off for 200ms
*/

#include <avr/io.h>
#define F_CPU 1000000 // set to 1 MHz as delay.h needs F_CPU
#include <util/delay.h>
#include "pin_macros.h" // Leah Buechley's pin macros for AVRs - very useful

int main(void)                                             Setup LED pins, Data
{   // Set Port B pins for 3 and 4 as outputs
    b0_output;	 //initialize LED pin
    b1_output;	 //initialize LED pin
                                                           Direction Register and
    b0_high;	
    b1_high;	
                 //LED is off
                 //LED is off
                                                               turn LEDS off.
	
    DDRB = 0x18; // In binary this is 0001 1000 (note that is bit 3 and 4)

    for ( ; 1==1 ; ) // loop while 1 equals 1 - forever - C style loop
    {
	      // Set Port B pins for 3 and 4 as HIGH (i.e. turn the LEDs on)
	      b0_low;	 	        //LED is on
	      b1_low;	 	        //LED is on
       _delay_loop_2(65535);
	      b0_high;	 	       //LED is off
	      b1_high;	 	       //LED is off
       _delay_loop_2(65535);
    }
    return 1;
}
/* Two LEDs, tied to pin b0 and to b1 which correspond to physical pins 5 and 6 on ATTINY13 are turned
on for 100ms and then off for 200ms
*/

#include <avr/io.h>
#define F_CPU 1000000 // set to 1 MHz as delay.h needs F_CPU
#include <util/delay.h>
#include "pin_macros.h" // Leah Buechley's pin macros for AVRs - very useful

int main(void)
{   // Set Port B pins for 3 and 4 as outputs
                                                          Loop - Turn the pins
    b0_output;	 //initialize LED pin
    b1_output;	 //initialize LED pin
                                                         on, wait for 262ms, and
    b0_high;	
    b1_high;	
                 //LED is off
                 //LED is off
                                                             turn off. Repeat.
	
    DDRB = 0x18; // In binary this is 0001 1000 (note that is bit 3 and 4)

    for ( ; 1==1 ; ) // loop while 1 equals 1 - forever - C style loop
    {
	      // Set Port B pins for 3 and 4 as HIGH (i.e. turn the LEDs on)
	      b0_low;	 	        //LED is on
	      b1_low;	 	        //LED is on
       _delay_loop_2(65535);
	      b0_high;	 	       //LED is off
	      b1_high;	 	       //LED is off
       _delay_loop_2(65535);
    }
    return 1;
}
# Makefile for sample_led_program for ATtiny13 chip
# Note: to use makefile with a different chip change all
# mmcu statements (-mmcu=attiny13) to reflect new chip
# also change the part option (-p t13) for the avrdude install command

# default target when "make" is run w/o arguments
all: sample_led_program.rom

# compile sample_led_program.c into sample_led_program.o
sample_led_program.o: sample_led_program.c
	     avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o

# link up sample_led_program.o into sample_led_program.elf
sample_led_program.elf: sample_led_program.o
	      avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref -
mmcu=attiny13 -o sample_led_program.elf

# copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom
sample_led_program.rom: sample_led_program.elf
	     avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom

# command to program chip (invoked by running "make install")
install:
	       avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom

# command to clean up junk (no source files) (invoked by "make clean")
clean:
	      rm -f *.o *.rom *.elf *.map *~
# Makefile for sample_led_program for ATtiny13 chip
# Note: to use makefile with a different chip change all
# mmcu statements (-mmcu=attiny13) to reflect new chip
# also change the part option (-p t13) for the avrdude install command

# default target when "make" is run w/o arguments
all: sample_led_program.rom
                                                       When Make is run,
# compile sample_led_program.c into sample_led_program.o
                                                         needs a target
sample_led_program.o: sample_led_program.c
	     avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o

# link up sample_led_program.o into sample_led_program.elf
sample_led_program.elf: sample_led_program.o
	      avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref -
mmcu=attiny13 -o sample_led_program.elf

# copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom
sample_led_program.rom: sample_led_program.elf
	     avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom

# command to program chip (invoked by running "make install")
install:
	       avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom

# command to clean up junk (no source files) (invoked by "make clean")
clean:
	      rm -f *.o *.rom *.elf *.map *~
# Makefile for sample_led_program for ATtiny13 chip
# Note: to use makefile with a different chip change all
# mmcu statements (-mmcu=attiny13) to reflect new chip
# also change the part option (-p t13) for the avrdude install command

# default target when "make" is run w/o arguments     Use avr-gcc to compile
all: sample_led_program.rom
                                                           ‘c’ program
# compile sample_led_program.c into sample_led_program.o
sample_led_program.o: sample_led_program.c
	     avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o

# link up sample_led_program.o into sample_led_program.elf
sample_led_program.elf: sample_led_program.o
	      avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref -
mmcu=attiny13 -o sample_led_program.elf

# copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom
sample_led_program.rom: sample_led_program.elf
	     avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom

# command to program chip (invoked by running "make install")
install:
	       avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom

# command to clean up junk (no source files) (invoked by "make clean")
clean:
	      rm -f *.o *.rom *.elf *.map *~
# Makefile for sample_led_program for ATtiny13 chip
# Note: to use makefile with a different chip change all
# mmcu statements (-mmcu=attiny13) to reflect new chip
# also change the part option (-p t13) for the avrdude install command

# default target when "make" is run w/o arguments   Use avr-gcc on `o’ obj
all: sample_led_program.rom
                                                    file to create `elf’ file
# compile sample_led_program.c into sample_led_program.o
sample_led_program.o: sample_led_program.c
	     avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o

# link up sample_led_program.o into sample_led_program.elf
sample_led_program.elf: sample_led_program.o
	      avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref -
mmcu=attiny13 -o sample_led_program.elf

# copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom
sample_led_program.rom: sample_led_program.elf
	     avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom

# command to program chip (invoked by running "make install")
install:
	       avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom

# command to clean up junk (no source files) (invoked by "make clean")
clean:
	      rm -f *.o *.rom *.elf *.map *~
# Makefile for sample_led_program for ATtiny13 chip
# Note: to use makefile with a different chip change all
# mmcu statements (-mmcu=attiny13) to reflect new chip
# also change the part option (-p t13) for the avrdude install command

# default target when "make" is run w/o arguments   Use avr-objcopy to
                                                create rom from elf file
all: sample_led_program.rom

# compile sample_led_program.c into sample_led_program.o
sample_led_program.o: sample_led_program.c
	     avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o

# link up sample_led_program.o into sample_led_program.elf
sample_led_program.elf: sample_led_program.o
	      avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref -
mmcu=attiny13 -o sample_led_program.elf

# copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom
sample_led_program.rom: sample_led_program.elf
	     avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom

# command to program chip (invoked by running "make install")
install:
	       avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom

# command to clean up junk (no source files) (invoked by "make clean")
clean:
	      rm -f *.o *.rom *.elf *.map *~
# Makefile for sample_led_program for ATtiny13 chip
# Note: to use makefile with a different chip change all
# mmcu statements (-mmcu=attiny13) to reflect new chip
# also change the part option (-p t13) for the avrdude install command

# default target when "make" is run w/o arguments
                                                        Use avrdube and a
all: sample_led_program.rom
                                                     usbtiny to copy to the
# compile sample_led_program.c into sample_led_program.o
sample_led_program.o: sample_led_program.c
	
                                                            ATtiny13 chip
      avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o

# link up sample_led_program.o into sample_led_program.elf
sample_led_program.elf: sample_led_program.o
	      avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref -
mmcu=attiny13 -o sample_led_program.elf

# copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom
sample_led_program.rom: sample_led_program.elf
	     avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom

# command to program chip (invoked by running "make install")
install:
	       avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom

# command to clean up junk (no source files) (invoked by "make clean")
clean:
	      rm -f *.o *.rom *.elf *.map *~
# Makefile for sample_led_program for ATtiny13 chip
# Note: to use makefile with a different chip change all
# mmcu statements (-mmcu=attiny13) to reflect new chip
# also change the part option (-p t13) for the avrdude install command

# default target when "make" is run w/o arguments    Clean up the files
all: sample_led_program.rom

# compile sample_led_program.c into sample_led_program.o
                                                         created
sample_led_program.o: sample_led_program.c
	     avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o

# link up sample_led_program.o into sample_led_program.elf
sample_led_program.elf: sample_led_program.o
	      avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref -
mmcu=attiny13 -o sample_led_program.elf

# copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom
sample_led_program.rom: sample_led_program.elf
	     avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom

# command to program chip (invoked by running "make install")
install:
	       avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom

# command to clean up junk (no source files) (invoked by "make clean")
clean:
	      rm -f *.o *.rom *.elf *.map *~
Call the Makefile
Call the Install part of
Makefile which calls avrdude
Run avrdude, it reads
the rom, writes it to
the chip and verifies
    this process
Things To Remember
Safety first, last, and always
  do not take another person’s work about the state of a piece of equipment, always
check yourself and make sure its safe for you to work
  use the right tool for the job
  treat each tool with respect and rack them back in their correct place when they are
not in use, don’t leave a dangerous tool loose when it can harm somebody else
  don’t leave your safety glasses on the bench or in your pocket
  don’t work on a live circuit, turn the power off first
  don’t solder in an enclosed area without proper ventilation
  read the datasheet first and double check it to be sure
 get twice or three times the number of parts that you need for your circuit, you will
make mistakes and sometimes you will have to throw an almost finished piece away
Data Sheets
  Manufacturer’s details for particular electronic product
     typical device performance
     minimum and maximum requirements and characteristics
     device tolerances, what you can do without harming it
     suggestions for applications, uses, or just hints

   You don’t need to understand everything only need to
focus on the parts that are of interest to your current
problem
Features
            • High Performance, Low Power AVR® 8-Bit Microcontroller
            • Advanced RISC Architecture
                   – 120 Powerful Instructions – Most Single Clock Cycle Execution
                   – 32 x 8 General Purpose Working Registers
                   – Fully Static Operation
                   – Up to 20 MIPS Througput at 20 MHz
            •   High Endurance Non-volatile Memory segments
                   – 1K Bytes of In-System Self-programmable Flash program memory
                   – 64 Bytes EEPROM
                   – 64K Bytes Internal SRAM
                   – Write/Erase cyles: 10,000 Flash/100,000 EEPROM
                                                                                            8-bit
                   – Data retention: 20 years at 85°C/100 years at 25°C(1)
                   – Optional Boot Code Section with Independent Lock Bits
                                                                                            Microcontroller
                             In-System Programming by On-chip Boot Program
                             True Read-While-Write Operation                                with 1K Bytes
                   – Programming Lock for Software Security
            •   Peripheral Features                                                         In-System
                   – One 8-bit Timer/Counter with Prescaler and Two PWM Channels
                   – 4-channel, 10-bit ADC with Internal Voltage Reference                  Programmable



Example:
                   – Programmable Watchdog Timer with Separate On-chip Oscillator

            •
                   – On-chip Analog Comparator
                Special Microcontroller Features
                                                                                            Flash
                   – debugWIRE On-chip Debug System
                   – In-System Programmable via SPI Port
                   – External and Internal Interrupt Sources                                ATtiny13V
                   – Low Power Idle, ADC Noise Reduction, and Power-down Modes
                                                                                                                 Models
                   – Enhanced Power-on Reset Circuit
                   – Programmable Brown-out Detection Circuit
                                                                                            ATtiny13



ATtiny13
                   – Internal Calibrated Oscillator
            •   I/O and Packages
                   – 8-pin PDIP/SOIC: Six Programmable I/O Lines
                   – 20-pad MLF: Six Programmable I/O Lines
                                                                                            Summary
            •   Operating Voltage:
                   – 1.8 - 5.5V for ATtiny13V
                   – 2.7 - 5.5V for ATtiny13                                         If it is the short summary
            •   Speed Grade
                   – ATtiny13V: 0 - 4 MHz @ 1.8 - 5.5V, 0 - 10 MHz @ 2.7 - 5.5V       or longer full datasheet
                   – ATtiny13: 0 - 10 MHz @ 2.7 - 5.5V, 0 - 20 MHz @ 4.5 - 5.5V
            •   Industrial Temperature Range
            •   Low Power Consumption
                   – Active Mode:
                       1 MHz, 1.8V: 240µA
                   – Power-down Mode:
                       < 0.1µA at 1.8V



           One page overview of models and capabilities


                                                                                                         Date

                                                                                                    Rev. 2535HS–AVR–10/07
Pin Configurations    Figure 1. Pinout ATtiny13


            PDIP or SOIC are
                                                                      8-PDIP/SOIC
              the only two
                                      (PCINT5/RESET/ADC0/dW) PB5       1      8     VCC
             package types                 (PCINT3/CLKI/ADC3) PB3      2      7     PB2 (SCK/ADC1/T0/PCINT2)
              we'll use. The                    (PCINT4/ADC2) PB4      3      6     PB1 (MISO/AIN1/OC0B/INT0/PCINT1)
                                                             GND       4      5     PB0 (MOSI/AIN0/OC0A/PCINT0)
           other types require
             SMD soldering.                                         20-QFN/MLF




                                                                      NC
                                                                      NC
                                                                      NC
                                                                      NC
                                                                      NC
                                                                      20
                                                                      19
                                                                      18
                                                                      17
                                                                      16
                                  (PCINT5/RESET/ADC0/dW) PB5      1               15   VCC
                                       (PCINT3/CLKI/ADC3) PB3     2               14   PB2 (SCK/ADC1/T0/PCINT2)
                                                           NC     3               13   NC
                                                           NC     4               12   PB1 (MISO/AIN1/OC0B/INT0/PCINT1)




Example:
                                            (PCINT4/ADC2) PB4     5               11   PB0 (MOSI/AIN0/OC0A/PCINT0)




                                                                      10
                                                                      6
                                                                      7
                                                                      8
                                                                      9
                                                                       NC
                                                                       NC
                                                                      GND
                                                                       NC
                                                                       NC
                                                   NOTE: Bottom pad should be soldered to ground.
                                                   NC: Not Connect




ATtiny13
                                                                    10-QFN/MLF

                                  (PCINT5/RESET/ADC0/dW) PB5      1               10   VCC
                                       (PCINT3/CLKI/ADC3) PB3     2                9   PB2 (SCK/ADC1/T0/PCINT2)
                                                           NC     3                8   NC
                                            (PCINT4/ADC2) PB4     4                7   PB1 (MISO/AIN1/OC0B/INT0/PCINT1)
                                                         GND      5                6   PB0 (MOSI/AIN0/OC0A/PCINT0)




                                                   NOTE: Bottom pad should be soldered to ground.
                                                   NC: Not Connect




           Overview              The ATtiny13 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced
                                 RISC architecture. By executing powerful instructions in a single clock cycle, the
                                 ATtiny13 achieves throughputs approaching 1 MIPS per MHz allowing the system
                                 designer to optimize power consumption versus processing speed.




                                                                                                             Date
            2    ATtiny13
                                                                                                          2535HS–AVR–10/07
Interrupt system to continue functioning. The Power-down mode saves the register con-
                               tents, disabling all chip functions until the next Interrupt or Hardware Reset. The ADC
                               Noise Reduction mode stops the CPU and all I/O modules except ADC, to minimize
                               switching noise during ADC conversions.
                               The device is manufactured using Atmel’s high density non-volatile memory technology.
                               The On-chip ISP Flash allows the Program memory to be re-programmed In-System
                               through an SPI serial interface, by a conventional non-volatile memory programmer or
                               by an On-chip boot code running on the AVR core.
                               The ATtiny13 AVR is supported with a full suite of program and system development
                               tools including: C Compilers, Macro Assemblers, Program Debugger/Simulators, In-Cir-
                               cuit Emulators, and Evaluation kits.

           Pin Descriptions
                                                                    Descriptions of the pins
           VCC                 Digital supply voltage.               shown in the previous
           GND                 Ground.                              diagram with comments




Example:
           Port B (PB5..PB0)   Port B is a 6-bit bi-directional I/O port with internal pull-up resistors (selected for each
                               bit). The Port B output buffers have symmetrical drive characteristics with both high sink
                               and source capability. As inputs, Port B pins that are externally pulled low will source
                               current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset
                               condition becomes active, even if the clock is not running.
                               Port B also serves the functions of various special features of the ATtiny13 as listed on
                               page 51.




ATtiny13
           RESET               Reset input. A low level on this pin for longer than the minimum pulse length will gener-
                               ate a reset, even if the clock is not running. The minimum pulse length is given in Table
                               12 on page 31. Shorter pulses are not guaranteed to generate a reset.
                               Note:   1.


           Data Retention      Reliability Qualification results show that the projected data retention failure rate is much
                               less than 1 PPM over 20 years at 85°C or 100 years at 25!C.


           About Code          This documentation contains simple code examples that briefly show how to use various
                               parts of the device. These code examples assume that the part specific header file is
           Examples
                               included before compilation. Be aware that not all C compiler vendors include bit defini-
                               tions in the header files and interrupt handling in C is compiler dependent. Please
                               confirm with the C compiler documentation for more details.




           4        ATtiny13
                                                                                                            2535HS–AVR–10/07
Electrical Characteristics

           Absolute Maximum Ratings*
            Operating Temperature.................................. -55!C to +125!C          *NOTICE:      Stresses beyond those listed under “Absolute
                                                                                                           Maximum Ratings” may cause permanent dam-
            Storage Temperature ..................................... -65°C to +150°C                      age to the device. This is a stress rating only and
                                                                                                           functional operation of the device at these or
            Voltage on any Pin except RESET                                                                other conditions beyond those indicated in the
            with respect to Ground ................................-0.5V to VCC+0.5V                       operational sections of this specification is not
                                                                                                           implied. Exposure to absolute maximum rating
            Voltage on RESET with respect to Ground......-0.5V to +13.0V                                   conditions for extended periods may affect
                                                                                                           device reliability.
            Maximum Operating Voltage ............................................ 6.0V
                                                                                    Descriptions of the what
            DC Current per I/O Pin ............................................... 40.0 mA

            DC Current VCC and GND Pins................................ 200.0 mA maximum ratings for device are.
                                                                                 Running at these or beyond will
           DC Characteristics                                                         damage the device



Example:
           T = -40!C to 85!C, V = 1.8V to 5.5V (unless otherwise noted)(1)
            A                            CC

            Symbol        Parameter                              Condition                       Min.              Typ.              Max.            Units

                          Input Low Voltage except               VCC = 1.8V - 2.4V                                                  0.2VCC
            VIL                                                                                  -0.5                                                  V
                          RESET pin                              VCC = 2.4V - 5.5V                                                  0.3VCC

                          Input High-voltage except              VCC = 1.8V - 2.4V             0.7VCC(3)
            VIH                                                                                                                    VCC +0.5            V
                          RESET pin                              VCC = 2.4V - 5.5V             0.6VCC(3)




ATtiny13
                          Input Low-voltage
            VIL1                                                 VCC = 1.8V - 5.5                -0.5                               0.1VCC             V
                          CLKI pin
                          Input High-voltage                     VCC = 1.8V - 2.4V             0.8VCC(3)
            VIH1                                                                                                                   VCC +0.5            V
                          CLKI pin                               VCC = 2.4V - 5.5V             0.7VCC(3)
                          Input Low-voltage
            VIL2                                                 VCC = 1.8V - 5.5                -0.5                               0.2VCC             V
                          RESET pin
                          Input High-voltage
            VIH2                                                 VCC = 1.8V - 5.5              0.9VCC(3)                           VCC +0.5            V
                          RESET pin
                          Input Low-voltage                      VCC = 1.8V - 2.4V
            VIL3                                                                                 -0.5                               0.2VCC             V
                          RESET pin                              VCC = 2.4V - 5.5V
                          Input High-voltage                     VCC = 1.8V - 2.4V             0.7VCC(3)
            VIH3                                                                                                                   VCC +0.5            V
                          RESET pin                              VCC = 2.4V - 5.5V             0.6VCC(3)
                          Output Low Voltage(4)                  IOL = 20 mA, VCC = 5V                                                0.7              V
            VOL
                          (PB1 and PB0)                          IOL = 10 mA, VCC = 3V                                                0.5              V
                          Output Low Voltage(4)                  IOL = 10 mA, VCC = 5V                                                0.7              V
            VOL1
                          (PB5, PB4, PB3 and PB2)                IOL = 5 mA, VCC = 3V                                                 0.5              V
                                                                 IOL =TBD mA, VCC =
                          Output Low Voltage(4)                  TBDV                                                                                  V
            VOL2
                          (PB5, Reset used as I/O)               IOL =TBD mA, VCC =                                                                    V
                                                                 TBDV
                          Output High-voltage(5)                 IOH = -20 mA, VCC = 5V          4.2                                                   V
            VOH
                          ( PB1 and PB0)                         IOH = -10 mA, VCC = 3V          2.5                                                   V




           120          ATtiny13
                                                                                                                                                2535H–AVR–10/07
ATtiny13

           TA = -40"C to 85"C, VCC = 1.8V to 5.5V (unless otherwise noted)(1) (Continued)
            Symbol      Parameter                     Condition                         Min.            Typ.             Max.           Units
                                            (5)
                        Output High-voltage           IOH = -10 mA, VCC = 5V            4.2                                               V
            VOH1
                        (PB4, PB3 and PB2)            IOH = -5 mA, VCC = 3V             2.5                                               V
                                                      IOH = - TBD mA, VCC =
                        Output High-voltage(5)        TBDV                                                                                V
            VOH2
                        (PB5, Reset used as I/O)      IOH = - TBD mA, VCC =                                                               V
                                                      TBDV
                        Input Leakage                 Vcc = 5.5V, pin lowSome chips have internal resistors
            IIL                                                                                  1       µA
                        Current I/O Pin               (absolute value)
                                                                         which you can use for inputs, here
                        Input Leakage                 Vcc = 5.5V, pin high
            IIH
                        Current I/O Pin               (absolute value)     is where you can find their value
                                                                                                 1       µA

            RRST        Reset Pull-up Resistor                                           30                               80              k!
            Rpu         I/O Pin Pull-up Resistor                                         20                               50              k!
                                                      Active 1MHz, VCC = 2V                                              0.35            mA
                                                      Active 4MHz, VCC = 3V                                               1.8            mA




Example:
                                                      Active 8MHz, VCC = 5V                                                6             mA
                        Power Supply Current
                                                      Idle 1MHz, VCC = 2V                               0.08              0.2            mA
            ICC
                                                      Idle 4MHz, VCC = 3V                               0.41               1             mA
                                                      Idle 8MHz, VCC = 5V                                1.6               3             mA
                                                      WDT enabled, VCC = 3V                              <5               10              µA
                        Power-down mode




ATtiny13
                                                      WDT disabled, VCC = 3V                            < 0.5              2              µA
                        Analog Comparator Input       VCC = 5V
            VACIO                                                                                       < 10              40             mV
                        Offset Voltage                Vin = VCC/2
                        Analog Comparator Input       VCC = 5V
            IACLK                                                                       -50                               50              nA
                        Leakage Current               Vin = VCC/2
                        Analog Comparator             VCC = 2.7V                                         750
            tACPD                                                                                                                         ns
                        Propagation Delay             VCC = 4.0V                                         500
           Notes:   1. All DC Characteristics contained in this data sheet are based on simulation and characterization of other AVR microcontrol-
                       lers manufactured in the same process technology. These values are representing design targets, and will be updated after
                       characterization of actual silicon.
                    2. “Max” means the highest value where the pin is guaranteed to be read as low.
                    3. “Min” means the lowest value where the pin is guaranteed to be read as high.
                    4. Although each I/O port can sink more than the test conditions (20 mA at VCC = 5V, 10 mA at VCC = 3V for PB5, PB1:0, 10 mA
                       at VCC = 5V, 5 mA at VCC = 3V for PB4:2) under steady state conditions (non-transient), the following must be observed:
                       1] The sum of all IOL, for all ports, should not exceed 60 mA.
                       If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater
                       than the listed test condition.
                    5. Although each I/O port can source more than the test conditions (20 mA at VCC = 5V, 10 mA at VCC = 3V for PB5, PB1:0, 10
                       mA at VCC = 5V, 5 mA at VCC = 3V for PB4:2) under steady state conditions (non-transient), the following must be observed:
                       1] The sum of all IOH, for all ports, should not exceed 60 mA.
                       If IOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current
                       greater than the listed test condition.




                                                                                                                                                121
           2535H–AVR–10/07

Contenu connexe

Dernier

Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 

Dernier (20)

Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Anwar Peternak Ayam Petelur dan Ikan Sukabumi

  • 1. Making Things Move, Lighting Things Up and AVR Programming CS4062 - Eoin Brazil - Semester 2 - 2009
  • 2. Servos and Motors Motion linear or rotary Stepper Servo conversion issues Types DC Servo Gearhead DC Motor Stepper Gearhead
  • 3. DC Motor 2 Connections Continual spin, given current & voltage Reversing current, reverses the direction Increasing the voltage, spins faster, decreasing the voltage, slows the spin High speed but low torque Gearbox can add torque but at the expense of speed
  • 8. Gearhead Motor DC Motor with gearbox Not fast but provide more torque Servo Motor Gearhead Gearhead motor with position feedback Feedback is often from potentiometer Pulsing the motor moves it to particular position within 180 degree range Can’t move 360 degrees but can be Servo positioned precisely within the 180 degree range
  • 9. Stepper Motor Precise positioning & 360 degrees range Move in discrete steps around a circle A 200 step motor would move 1.8 degrees per step around the full 360 degrees Continuous rotation in either direction Good torque Complex to connect
  • 10. Solenoids and Actuators Microactuators Linear Motion Actuator Pull or Push Types Solenoid Solenoid Actuator Microactuator
  • 11. Motor Characteristics gears or direct rated voltage current (efficiency) - stall / running speed - spin / rpm, rps, Hz torque size, shaft diameter, shaft length position resolution (Servos & Steppers)
  • 12. Advanced Mediation Lisa McElligott, 2000 interactive confessional box used real confessional box confessor was computer program interacted using a voice interface. scripted interactions with random noises to add to immersion suspension of disbelief realism
  • 13. Weave Mirror Daniel Rozin, Weave Mirror, 2007 Mechanical mirror Any person standing in front of one of these pieces is instantly reflected on its surface. Side and back Uses video cameras, motors and views computers to achieve mirroring Sound aspect - soothing sound
  • 14. Weave Mirror Daniel Rozin, Weave Mirror, 2007
  • 17. PWM Analog input / output Duration of the digital pulse of voltage Microcontroller - HIGH 5V or LOW 0V ``Fake’’ it using PWM Duty cycle, ratio from low to high to low cycle LED dimming, DC Motor speed control, Piezo speakers, RC Servo positioning
  • 19. Wiring Diagram Schematic Diagram
  • 20. RC Servo Motor Servo Motor Connections on Arduino Black wire would go to Grd pin Red wire would go to 5V power pin White wire would go to one of the digital pins on the board Colours can vary, Ground (black or brown), Power (red), Control (orange, yellow or white)
  • 21. /* * NewSerialServo * -------------- * Servo control from the Serial port * * Alteration of the control interface to use < and > keys * to slew the servo horn left and right. Works best with * the Linux/Mac terminal "screen" program. * * Created 10 December 2007 * copyleft 2007 Brian D. Wendt * http://principialabs.com/ * * Adapted from code by Tom Igoe, http://itp.nyu.edu/physcomp/Labs/Servo */ /** Adjust these values for your servo and setup, if necessary **/ int servoPin = 2; // control pin for servo motor int minPulse = 600; // minimum servo position int maxPulse = 2400; // maximum servo position int turnRate = 100; // servo turn rate increment (larger value, faster rate) int refreshTime = 20; // time (ms) between pulses (50Hz) /** The Arduino will calculate these values for you **/ int centerServo; int pulseWidth; // center servo position // servo pulse width continued int moveServo; // raw user input long lastPulse = 0; // recorded time (ms) of the last pulse on next slide
  • 22. /* * NewSerialServo * -------------- * Servo control from the Serial port Setup the necessary * * Alteration of the control interface to use < and > keys * to slew the servo horn left and right. Works best with control values and variables to store * the Linux/Mac terminal "screen" program. * * Created 10 December 2007 information * copyleft 2007 Brian D. Wendt * http://principialabs.com/ * * Adapted from code by Tom Igoe, http://itp.nyu.edu/physcomp/Labs/Servo */ /** Adjust these values for your servo and setup, if necessary **/ int servoPin = 2; // control pin for servo motor int minPulse = 600; // minimum servo position int maxPulse = 2400; // maximum servo position int turnRate = 100; // servo turn rate increment (larger value, faster rate) int refreshTime = 20; // time (ms) between pulses (50Hz) /** The Arduino will calculate these values for you **/ int centerServo; int pulseWidth; // center servo position // servo pulse width continued int moveServo; // raw user input long lastPulse = 0; // recorded time (ms) of the last pulse on next slide
  • 23. // Main program setup void setup() { pinMode(servoPin, OUTPUT); // Set servo pin as an output pin centerServo = maxPulse - ((maxPulse - minPulse)/2); pulseWidth = centerServo; // Give the servo a starting point (or it floats) Serial.begin(9600); Serial.println(" Arduino Serial Servo Control"); Serial.println("Press < or > to move, spacebar to center"); Serial.println(); } void loop() { // wait for serial input if (Serial.available() > 0) { // read the incoming byte: moveServo = Serial.read(); // ASCII '<' is 44, ASCII '>' is 46 (comma and period, really) if (moveServo == 44) { pulseWidth = pulseWidth - turnRate; } if (moveServo == 46) { pulseWidth = pulseWidth + turnRate; } if (moveServo == 32) { pulseWidth = centerServo; } // stop servo pulse at min and max continued if (pulseWidth > maxPulse) { pulseWidth = maxPulse; } if (pulseWidth < minPulse) { pulseWidth = minPulse; } on next } slide
  • 24. // Main program setup void setup() { pinMode(servoPin, OUTPUT); // Set servo pin as an output pin centerServo = maxPulse - ((maxPulse - minPulse)/2); pulseWidth = centerServo; // Give the servo a starting point (or it floats) Serial.begin(9600); Serial.println(" Arduino Serial Servo Control"); Serial.println("Press < or > to move, spacebar to center"); Setup servo its } Serial.println(); pin, its pulse, and void loop() { // wait for serial input its position. Setup if (Serial.available() > 0) { // read the incoming byte: serial connection moveServo = Serial.read(); // ASCII '<' is 44, ASCII '>' is 46 (comma and period, really) for control if (moveServo == 44) { pulseWidth = pulseWidth - turnRate; } if (moveServo == 46) { pulseWidth = pulseWidth + turnRate; } if (moveServo == 32) { pulseWidth = centerServo; } // stop servo pulse at min and max continued if (pulseWidth > maxPulse) { pulseWidth = maxPulse; } if (pulseWidth < minPulse) { pulseWidth = minPulse; } on next } slide
  • 25. // Main program setup void setup() { pinMode(servoPin, OUTPUT); // Set servo pin as an output pin centerServo = maxPulse - ((maxPulse - minPulse)/2); pulseWidth = centerServo; // Give the servo a starting point (or it floats) Serial.begin(9600); Serial.println(" Arduino Serial Servo Control"); Serial.println("Press < or > to move, spacebar to center"); Serial.println(); } The serial input controls the void loop() { // wait for serial input servo by the ‘<‘ or ‘>’ and keep if (Serial.available() > 0) { // read the incoming byte: moveServo = Serial.read(); its speed within the safe range // ASCII '<' is 44, ASCII '>' is 46 (comma and period, really) if (moveServo == 44) { pulseWidth = pulseWidth - turnRate; } if (moveServo == 46) { pulseWidth = pulseWidth + turnRate; } if (moveServo == 32) { pulseWidth = centerServo; } // stop servo pulse at min and max continued if (pulseWidth > maxPulse) { pulseWidth = maxPulse; } if (pulseWidth < minPulse) { pulseWidth = minPulse; } on next } slide
  • 26. // pulse the servo every 20 ms (refreshTime) with current pulseWidth // this will hold the servo's position if unchanged, or move it if changed if (millis() - lastPulse >= refreshTime) { digitalWrite(servoPin, HIGH); // start the pulse delayMicroseconds(pulseWidth); // pulse width digitalWrite(servoPin, LOW); // stop the pulse lastPulse = millis(); // save the time of the last pulse } } // END of Main program
  • 27. Pulse the servo every 20ms, this is where the desired change actually happens and its based on the previous serial input // pulse the servo every 20 ms (refreshTime) with current pulseWidth // this will hold the servo's position if unchanged, or move it if changed if (millis() - lastPulse >= refreshTime) { digitalWrite(servoPin, HIGH); // start the pulse delayMicroseconds(pulseWidth); // pulse width digitalWrite(servoPin, LOW); // stop the pulse lastPulse = millis(); // save the time of the last pulse } } // END of Main program
  • 28. Switches Types and contacts Knives and toggles Knive (SPST) Single pole = control of one circuit Double pole = two circuits controlled at once Single throw = one path for circuit Double throw = two paths for circuit Toggle (SPDT) Foot, tape / mat, roller, hair trigger, tilt, magnetic / reed
  • 29. High and Low Practical switching Arduino looks for 0V (low) to 5V (high) Digital inputs float between these values Resistor “pulls” input to ground (0 volts) Pressing switch “pushes” input to 5 volts Switch pressed = HIGH, not pressed = LOW setup(): pinMode(myPin,INPUT) loop(): digitalRead(myPin)
  • 30. Sketching your work Bill Verplank Interaction Design Sketchbook Bill Buxton
  • 31. Embodiment using Animatronics Stefan Marti 2005, Autonomous Interactive Intermediaries 2005, Physical Embodiments for Mobile Communication Agents
  • 32. Kinematics Gears and mechanical models Geometry of pure motion without reference to force or mass Cornell University Library, Kinematic Models for Design Digital Library Examples from (KMODDL) www.flying-pig.co.uk Tutorials, models, e-books, e.g. Linkages Chapter 3 in Building Robot Drive Trains
  • 33. PWM Tutorials ITP Servo tutorial Principial Labs Arduino Servo Driving a Unipolar Stepper Motor Driving a Bipolar Stepper Motor ITP Servo lab, uses a potentiometer to Making an RC Servo wall following car control the servo.
  • 34. Arduino Library Software Servo Library attach(int) Turn a pin into a servo driver. detach() Release a pin from servo driving. write(int) Set the angle of the servo in degrees, 0 to 180. read() return that value set with the last write(). attached() return 1 if the servo is currently attached. refresh() must call once every 50ms to keep servos updated, won't call more than every 20ms setMinimumPulse(uint16_t) set the duration of the 0 degree pulse in microseconds. (default minimum value is 544 microseconds) setMaximumPulse(uint16_t) set the duration of the 180 degree pulse in microseconds. (default maximum pluse value is 2400 microsconds) Need to first send position with write() before you can receive any control signals
  • 36. Projects and Prototyping Trade-offs Re-programmable
  • 38. Capacitors Stores charge With resistors I = C * dV/dt RC Circuit, parallel or series removal of electrical noise low-pass or high-pass filtering
  • 39. Resistor Color Code 4-band Color Code 10K ! ± 5% 5 - band Color Code 47.5 K ! ± 1% 6 - band Color Code 276 ! ± 5% Multiplier Tolerance SLV 0.01 SLV ± 10% 1st Digit 2nd Digit 3rd Digit GLD 0.1 GLD ± 5% Temperature BLK-0 BLK-0 BLK-0 BLK-1 Coefficient BRN-1 BRN-1 BRN-1 BRN-10 BRN-100ppm BRN ± 1% RED-2 RED-2 RED-2 RED-100 RED-50ppm RED ± 2% ORN-3 ORN-3 ORN-3 ORN-1K ORN-15ppm YEL-4 YEL-4 YEL-4 YEL-10K YEL-25ppm GRN-5 GRN-5 GRN-5 GRN-100K GRN ± 0.5% BLU-6 BLU-6 BLU-6 BLU-1M BLU- ± 0.25% VIO-7 VIO-7 VIO-7 VIO-10M VIO ± 0.1% GRY-8 GRY-8 GRY-8 WHT-9 WHT-9 WHT-9 GRY-8
  • 42. Diodes LEDs, Zener, Schottky, Photo Pass current in one direction only Forward voltage drop e.g. forward voltage drop of 0.7 V in circuit where input is 5V will have voltage of 4.3V on its far side Rectification Removal of negative voltages from signal, i.e. a bridge rectifier LED, 1.6V forward voltage drop, current limit 36mA, circuit total voltage 5V. VR = 5 - 1.6 = 3.4V R = V / I = 3.4 / 0.036 = 94.44 Ohm (at least 100 Ohm) P = V * I = 3.4 * 0.036 = 0.1224 W (at least 0.125W)
  • 45. RGB LEDs Ambient orb Cube of LEDS
  • 50. /* Two LEDs, tied to pin b0 and to b1 which correspond to physical pins 5 and 6 on ATTINY13 are turned on for 100ms and then off for 200ms */ #include <avr/io.h> #define F_CPU 1000000 // set to 1 MHz as delay.h needs F_CPU #include <util/delay.h> #include "pin_macros.h" // Leah Buechley's pin macros for AVRs - very useful int main(void) { // Set Port B pins for 3 and 4 as outputs b0_output; //initialize LED pin b1_output; //initialize LED pin b0_high; //LED is off b1_high; //LED is off DDRB = 0x18; // In binary this is 0001 1000 (note that is bit 3 and 4) for ( ; 1==1 ; ) // loop while 1 equals 1 - forever - C style loop { // Set Port B pins for 3 and 4 as HIGH (i.e. turn the LEDs on) b0_low; //LED is on b1_low; //LED is on _delay_loop_2(65535); b0_high; //LED is off b1_high; //LED is off _delay_loop_2(65535); } return 1; }
  • 51. /* Two LEDs, tied to pin b0 and to b1 which correspond to physical pins 5 and 6 on ATTINY13 are turned on for 100ms and then off for 200ms */ #include <avr/io.h> #define F_CPU 1000000 // set to 1 MHz as delay.h needs F_CPU #include <util/delay.h> Include the #include "pin_macros.h" // Leah Buechley's pin macros for AVRs - very useful int main(void) libraries and set { // Set Port B pins for 3 and 4 as outputs b0_output; //initialize LED pin the speed of chip b1_output; //initialize LED pin b0_high; //LED is off b1_high; //LED is off DDRB = 0x18; // In binary this is 0001 1000 (note that is bit 3 and 4) for ( ; 1==1 ; ) // loop while 1 equals 1 - forever - C style loop { // Set Port B pins for 3 and 4 as HIGH (i.e. turn the LEDs on) b0_low; //LED is on b1_low; //LED is on _delay_loop_2(65535); b0_high; //LED is off b1_high; //LED is off _delay_loop_2(65535); } return 1; }
  • 52. /* Two LEDs, tied to pin b0 and to b1 which correspond to physical pins 5 and 6 on ATTINY13 are turned on for 100ms and then off for 200ms */ #include <avr/io.h> #define F_CPU 1000000 // set to 1 MHz as delay.h needs F_CPU #include <util/delay.h> #include "pin_macros.h" // Leah Buechley's pin macros for AVRs - very useful int main(void) Setup LED pins, Data { // Set Port B pins for 3 and 4 as outputs b0_output; //initialize LED pin b1_output; //initialize LED pin Direction Register and b0_high; b1_high; //LED is off //LED is off turn LEDS off. DDRB = 0x18; // In binary this is 0001 1000 (note that is bit 3 and 4) for ( ; 1==1 ; ) // loop while 1 equals 1 - forever - C style loop { // Set Port B pins for 3 and 4 as HIGH (i.e. turn the LEDs on) b0_low; //LED is on b1_low; //LED is on _delay_loop_2(65535); b0_high; //LED is off b1_high; //LED is off _delay_loop_2(65535); } return 1; }
  • 53. /* Two LEDs, tied to pin b0 and to b1 which correspond to physical pins 5 and 6 on ATTINY13 are turned on for 100ms and then off for 200ms */ #include <avr/io.h> #define F_CPU 1000000 // set to 1 MHz as delay.h needs F_CPU #include <util/delay.h> #include "pin_macros.h" // Leah Buechley's pin macros for AVRs - very useful int main(void) { // Set Port B pins for 3 and 4 as outputs Loop - Turn the pins b0_output; //initialize LED pin b1_output; //initialize LED pin on, wait for 262ms, and b0_high; b1_high; //LED is off //LED is off turn off. Repeat. DDRB = 0x18; // In binary this is 0001 1000 (note that is bit 3 and 4) for ( ; 1==1 ; ) // loop while 1 equals 1 - forever - C style loop { // Set Port B pins for 3 and 4 as HIGH (i.e. turn the LEDs on) b0_low; //LED is on b1_low; //LED is on _delay_loop_2(65535); b0_high; //LED is off b1_high; //LED is off _delay_loop_2(65535); } return 1; }
  • 54. # Makefile for sample_led_program for ATtiny13 chip # Note: to use makefile with a different chip change all # mmcu statements (-mmcu=attiny13) to reflect new chip # also change the part option (-p t13) for the avrdude install command # default target when "make" is run w/o arguments all: sample_led_program.rom # compile sample_led_program.c into sample_led_program.o sample_led_program.o: sample_led_program.c avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o # link up sample_led_program.o into sample_led_program.elf sample_led_program.elf: sample_led_program.o avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref - mmcu=attiny13 -o sample_led_program.elf # copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom sample_led_program.rom: sample_led_program.elf avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom # command to program chip (invoked by running "make install") install: avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom # command to clean up junk (no source files) (invoked by "make clean") clean: rm -f *.o *.rom *.elf *.map *~
  • 55. # Makefile for sample_led_program for ATtiny13 chip # Note: to use makefile with a different chip change all # mmcu statements (-mmcu=attiny13) to reflect new chip # also change the part option (-p t13) for the avrdude install command # default target when "make" is run w/o arguments all: sample_led_program.rom When Make is run, # compile sample_led_program.c into sample_led_program.o needs a target sample_led_program.o: sample_led_program.c avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o # link up sample_led_program.o into sample_led_program.elf sample_led_program.elf: sample_led_program.o avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref - mmcu=attiny13 -o sample_led_program.elf # copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom sample_led_program.rom: sample_led_program.elf avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom # command to program chip (invoked by running "make install") install: avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom # command to clean up junk (no source files) (invoked by "make clean") clean: rm -f *.o *.rom *.elf *.map *~
  • 56. # Makefile for sample_led_program for ATtiny13 chip # Note: to use makefile with a different chip change all # mmcu statements (-mmcu=attiny13) to reflect new chip # also change the part option (-p t13) for the avrdude install command # default target when "make" is run w/o arguments Use avr-gcc to compile all: sample_led_program.rom ‘c’ program # compile sample_led_program.c into sample_led_program.o sample_led_program.o: sample_led_program.c avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o # link up sample_led_program.o into sample_led_program.elf sample_led_program.elf: sample_led_program.o avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref - mmcu=attiny13 -o sample_led_program.elf # copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom sample_led_program.rom: sample_led_program.elf avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom # command to program chip (invoked by running "make install") install: avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom # command to clean up junk (no source files) (invoked by "make clean") clean: rm -f *.o *.rom *.elf *.map *~
  • 57. # Makefile for sample_led_program for ATtiny13 chip # Note: to use makefile with a different chip change all # mmcu statements (-mmcu=attiny13) to reflect new chip # also change the part option (-p t13) for the avrdude install command # default target when "make" is run w/o arguments Use avr-gcc on `o’ obj all: sample_led_program.rom file to create `elf’ file # compile sample_led_program.c into sample_led_program.o sample_led_program.o: sample_led_program.c avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o # link up sample_led_program.o into sample_led_program.elf sample_led_program.elf: sample_led_program.o avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref - mmcu=attiny13 -o sample_led_program.elf # copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom sample_led_program.rom: sample_led_program.elf avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom # command to program chip (invoked by running "make install") install: avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom # command to clean up junk (no source files) (invoked by "make clean") clean: rm -f *.o *.rom *.elf *.map *~
  • 58. # Makefile for sample_led_program for ATtiny13 chip # Note: to use makefile with a different chip change all # mmcu statements (-mmcu=attiny13) to reflect new chip # also change the part option (-p t13) for the avrdude install command # default target when "make" is run w/o arguments Use avr-objcopy to create rom from elf file all: sample_led_program.rom # compile sample_led_program.c into sample_led_program.o sample_led_program.o: sample_led_program.c avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o # link up sample_led_program.o into sample_led_program.elf sample_led_program.elf: sample_led_program.o avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref - mmcu=attiny13 -o sample_led_program.elf # copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom sample_led_program.rom: sample_led_program.elf avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom # command to program chip (invoked by running "make install") install: avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom # command to clean up junk (no source files) (invoked by "make clean") clean: rm -f *.o *.rom *.elf *.map *~
  • 59. # Makefile for sample_led_program for ATtiny13 chip # Note: to use makefile with a different chip change all # mmcu statements (-mmcu=attiny13) to reflect new chip # also change the part option (-p t13) for the avrdude install command # default target when "make" is run w/o arguments Use avrdube and a all: sample_led_program.rom usbtiny to copy to the # compile sample_led_program.c into sample_led_program.o sample_led_program.o: sample_led_program.c ATtiny13 chip avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o # link up sample_led_program.o into sample_led_program.elf sample_led_program.elf: sample_led_program.o avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref - mmcu=attiny13 -o sample_led_program.elf # copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom sample_led_program.rom: sample_led_program.elf avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom # command to program chip (invoked by running "make install") install: avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom # command to clean up junk (no source files) (invoked by "make clean") clean: rm -f *.o *.rom *.elf *.map *~
  • 60. # Makefile for sample_led_program for ATtiny13 chip # Note: to use makefile with a different chip change all # mmcu statements (-mmcu=attiny13) to reflect new chip # also change the part option (-p t13) for the avrdude install command # default target when "make" is run w/o arguments Clean up the files all: sample_led_program.rom # compile sample_led_program.c into sample_led_program.o created sample_led_program.o: sample_led_program.c avr-gcc -c -g -O0 -Wall -mmcu=attiny13 sample_led_program.c -o sample_led_program.o # link up sample_led_program.o into sample_led_program.elf sample_led_program.elf: sample_led_program.o avr-gcc sample_led_program.o -Wall,-nm,-Map=sample_led_program.map,--cref - mmcu=attiny13 -o sample_led_program.elf # copy ROM (FLASH) object out of sample_led_program.elf into sample_led_program.rom sample_led_program.rom: sample_led_program.elf avr-objcopy -O ihex sample_led_program.elf sample_led_program.rom # command to program chip (invoked by running "make install") install: avrdude -c usbtiny -p t13 -e -U flash:w:sample_led_program.rom # command to clean up junk (no source files) (invoked by "make clean") clean: rm -f *.o *.rom *.elf *.map *~
  • 61.
  • 63. Call the Install part of Makefile which calls avrdude
  • 64. Run avrdude, it reads the rom, writes it to the chip and verifies this process
  • 65. Things To Remember Safety first, last, and always do not take another person’s work about the state of a piece of equipment, always check yourself and make sure its safe for you to work use the right tool for the job treat each tool with respect and rack them back in their correct place when they are not in use, don’t leave a dangerous tool loose when it can harm somebody else don’t leave your safety glasses on the bench or in your pocket don’t work on a live circuit, turn the power off first don’t solder in an enclosed area without proper ventilation read the datasheet first and double check it to be sure get twice or three times the number of parts that you need for your circuit, you will make mistakes and sometimes you will have to throw an almost finished piece away
  • 66. Data Sheets Manufacturer’s details for particular electronic product typical device performance minimum and maximum requirements and characteristics device tolerances, what you can do without harming it suggestions for applications, uses, or just hints You don’t need to understand everything only need to focus on the parts that are of interest to your current problem
  • 67. Features • High Performance, Low Power AVR® 8-Bit Microcontroller • Advanced RISC Architecture – 120 Powerful Instructions – Most Single Clock Cycle Execution – 32 x 8 General Purpose Working Registers – Fully Static Operation – Up to 20 MIPS Througput at 20 MHz • High Endurance Non-volatile Memory segments – 1K Bytes of In-System Self-programmable Flash program memory – 64 Bytes EEPROM – 64K Bytes Internal SRAM – Write/Erase cyles: 10,000 Flash/100,000 EEPROM 8-bit – Data retention: 20 years at 85°C/100 years at 25°C(1) – Optional Boot Code Section with Independent Lock Bits Microcontroller In-System Programming by On-chip Boot Program True Read-While-Write Operation with 1K Bytes – Programming Lock for Software Security • Peripheral Features In-System – One 8-bit Timer/Counter with Prescaler and Two PWM Channels – 4-channel, 10-bit ADC with Internal Voltage Reference Programmable Example: – Programmable Watchdog Timer with Separate On-chip Oscillator • – On-chip Analog Comparator Special Microcontroller Features Flash – debugWIRE On-chip Debug System – In-System Programmable via SPI Port – External and Internal Interrupt Sources ATtiny13V – Low Power Idle, ADC Noise Reduction, and Power-down Modes Models – Enhanced Power-on Reset Circuit – Programmable Brown-out Detection Circuit ATtiny13 ATtiny13 – Internal Calibrated Oscillator • I/O and Packages – 8-pin PDIP/SOIC: Six Programmable I/O Lines – 20-pad MLF: Six Programmable I/O Lines Summary • Operating Voltage: – 1.8 - 5.5V for ATtiny13V – 2.7 - 5.5V for ATtiny13 If it is the short summary • Speed Grade – ATtiny13V: 0 - 4 MHz @ 1.8 - 5.5V, 0 - 10 MHz @ 2.7 - 5.5V or longer full datasheet – ATtiny13: 0 - 10 MHz @ 2.7 - 5.5V, 0 - 20 MHz @ 4.5 - 5.5V • Industrial Temperature Range • Low Power Consumption – Active Mode: 1 MHz, 1.8V: 240µA – Power-down Mode: < 0.1µA at 1.8V One page overview of models and capabilities Date Rev. 2535HS–AVR–10/07
  • 68. Pin Configurations Figure 1. Pinout ATtiny13 PDIP or SOIC are 8-PDIP/SOIC the only two (PCINT5/RESET/ADC0/dW) PB5 1 8 VCC package types (PCINT3/CLKI/ADC3) PB3 2 7 PB2 (SCK/ADC1/T0/PCINT2) we'll use. The (PCINT4/ADC2) PB4 3 6 PB1 (MISO/AIN1/OC0B/INT0/PCINT1) GND 4 5 PB0 (MOSI/AIN0/OC0A/PCINT0) other types require SMD soldering. 20-QFN/MLF NC NC NC NC NC 20 19 18 17 16 (PCINT5/RESET/ADC0/dW) PB5 1 15 VCC (PCINT3/CLKI/ADC3) PB3 2 14 PB2 (SCK/ADC1/T0/PCINT2) NC 3 13 NC NC 4 12 PB1 (MISO/AIN1/OC0B/INT0/PCINT1) Example: (PCINT4/ADC2) PB4 5 11 PB0 (MOSI/AIN0/OC0A/PCINT0) 10 6 7 8 9 NC NC GND NC NC NOTE: Bottom pad should be soldered to ground. NC: Not Connect ATtiny13 10-QFN/MLF (PCINT5/RESET/ADC0/dW) PB5 1 10 VCC (PCINT3/CLKI/ADC3) PB3 2 9 PB2 (SCK/ADC1/T0/PCINT2) NC 3 8 NC (PCINT4/ADC2) PB4 4 7 PB1 (MISO/AIN1/OC0B/INT0/PCINT1) GND 5 6 PB0 (MOSI/AIN0/OC0A/PCINT0) NOTE: Bottom pad should be soldered to ground. NC: Not Connect Overview The ATtiny13 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the ATtiny13 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed. Date 2 ATtiny13 2535HS–AVR–10/07
  • 69. Interrupt system to continue functioning. The Power-down mode saves the register con- tents, disabling all chip functions until the next Interrupt or Hardware Reset. The ADC Noise Reduction mode stops the CPU and all I/O modules except ADC, to minimize switching noise during ADC conversions. The device is manufactured using Atmel’s high density non-volatile memory technology. The On-chip ISP Flash allows the Program memory to be re-programmed In-System through an SPI serial interface, by a conventional non-volatile memory programmer or by an On-chip boot code running on the AVR core. The ATtiny13 AVR is supported with a full suite of program and system development tools including: C Compilers, Macro Assemblers, Program Debugger/Simulators, In-Cir- cuit Emulators, and Evaluation kits. Pin Descriptions Descriptions of the pins VCC Digital supply voltage. shown in the previous GND Ground. diagram with comments Example: Port B (PB5..PB0) Port B is a 6-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port B also serves the functions of various special features of the ATtiny13 as listed on page 51. ATtiny13 RESET Reset input. A low level on this pin for longer than the minimum pulse length will gener- ate a reset, even if the clock is not running. The minimum pulse length is given in Table 12 on page 31. Shorter pulses are not guaranteed to generate a reset. Note: 1. Data Retention Reliability Qualification results show that the projected data retention failure rate is much less than 1 PPM over 20 years at 85°C or 100 years at 25!C. About Code This documentation contains simple code examples that briefly show how to use various parts of the device. These code examples assume that the part specific header file is Examples included before compilation. Be aware that not all C compiler vendors include bit defini- tions in the header files and interrupt handling in C is compiler dependent. Please confirm with the C compiler documentation for more details. 4 ATtiny13 2535HS–AVR–10/07
  • 70. Electrical Characteristics Absolute Maximum Ratings* Operating Temperature.................................. -55!C to +125!C *NOTICE: Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent dam- Storage Temperature ..................................... -65°C to +150°C age to the device. This is a stress rating only and functional operation of the device at these or Voltage on any Pin except RESET other conditions beyond those indicated in the with respect to Ground ................................-0.5V to VCC+0.5V operational sections of this specification is not implied. Exposure to absolute maximum rating Voltage on RESET with respect to Ground......-0.5V to +13.0V conditions for extended periods may affect device reliability. Maximum Operating Voltage ............................................ 6.0V Descriptions of the what DC Current per I/O Pin ............................................... 40.0 mA DC Current VCC and GND Pins................................ 200.0 mA maximum ratings for device are. Running at these or beyond will DC Characteristics damage the device Example: T = -40!C to 85!C, V = 1.8V to 5.5V (unless otherwise noted)(1) A CC Symbol Parameter Condition Min. Typ. Max. Units Input Low Voltage except VCC = 1.8V - 2.4V 0.2VCC VIL -0.5 V RESET pin VCC = 2.4V - 5.5V 0.3VCC Input High-voltage except VCC = 1.8V - 2.4V 0.7VCC(3) VIH VCC +0.5 V RESET pin VCC = 2.4V - 5.5V 0.6VCC(3) ATtiny13 Input Low-voltage VIL1 VCC = 1.8V - 5.5 -0.5 0.1VCC V CLKI pin Input High-voltage VCC = 1.8V - 2.4V 0.8VCC(3) VIH1 VCC +0.5 V CLKI pin VCC = 2.4V - 5.5V 0.7VCC(3) Input Low-voltage VIL2 VCC = 1.8V - 5.5 -0.5 0.2VCC V RESET pin Input High-voltage VIH2 VCC = 1.8V - 5.5 0.9VCC(3) VCC +0.5 V RESET pin Input Low-voltage VCC = 1.8V - 2.4V VIL3 -0.5 0.2VCC V RESET pin VCC = 2.4V - 5.5V Input High-voltage VCC = 1.8V - 2.4V 0.7VCC(3) VIH3 VCC +0.5 V RESET pin VCC = 2.4V - 5.5V 0.6VCC(3) Output Low Voltage(4) IOL = 20 mA, VCC = 5V 0.7 V VOL (PB1 and PB0) IOL = 10 mA, VCC = 3V 0.5 V Output Low Voltage(4) IOL = 10 mA, VCC = 5V 0.7 V VOL1 (PB5, PB4, PB3 and PB2) IOL = 5 mA, VCC = 3V 0.5 V IOL =TBD mA, VCC = Output Low Voltage(4) TBDV V VOL2 (PB5, Reset used as I/O) IOL =TBD mA, VCC = V TBDV Output High-voltage(5) IOH = -20 mA, VCC = 5V 4.2 V VOH ( PB1 and PB0) IOH = -10 mA, VCC = 3V 2.5 V 120 ATtiny13 2535H–AVR–10/07
  • 71. ATtiny13 TA = -40"C to 85"C, VCC = 1.8V to 5.5V (unless otherwise noted)(1) (Continued) Symbol Parameter Condition Min. Typ. Max. Units (5) Output High-voltage IOH = -10 mA, VCC = 5V 4.2 V VOH1 (PB4, PB3 and PB2) IOH = -5 mA, VCC = 3V 2.5 V IOH = - TBD mA, VCC = Output High-voltage(5) TBDV V VOH2 (PB5, Reset used as I/O) IOH = - TBD mA, VCC = V TBDV Input Leakage Vcc = 5.5V, pin lowSome chips have internal resistors IIL 1 µA Current I/O Pin (absolute value) which you can use for inputs, here Input Leakage Vcc = 5.5V, pin high IIH Current I/O Pin (absolute value) is where you can find their value 1 µA RRST Reset Pull-up Resistor 30 80 k! Rpu I/O Pin Pull-up Resistor 20 50 k! Active 1MHz, VCC = 2V 0.35 mA Active 4MHz, VCC = 3V 1.8 mA Example: Active 8MHz, VCC = 5V 6 mA Power Supply Current Idle 1MHz, VCC = 2V 0.08 0.2 mA ICC Idle 4MHz, VCC = 3V 0.41 1 mA Idle 8MHz, VCC = 5V 1.6 3 mA WDT enabled, VCC = 3V <5 10 µA Power-down mode ATtiny13 WDT disabled, VCC = 3V < 0.5 2 µA Analog Comparator Input VCC = 5V VACIO < 10 40 mV Offset Voltage Vin = VCC/2 Analog Comparator Input VCC = 5V IACLK -50 50 nA Leakage Current Vin = VCC/2 Analog Comparator VCC = 2.7V 750 tACPD ns Propagation Delay VCC = 4.0V 500 Notes: 1. All DC Characteristics contained in this data sheet are based on simulation and characterization of other AVR microcontrol- lers manufactured in the same process technology. These values are representing design targets, and will be updated after characterization of actual silicon. 2. “Max” means the highest value where the pin is guaranteed to be read as low. 3. “Min” means the lowest value where the pin is guaranteed to be read as high. 4. Although each I/O port can sink more than the test conditions (20 mA at VCC = 5V, 10 mA at VCC = 3V for PB5, PB1:0, 10 mA at VCC = 5V, 5 mA at VCC = 3V for PB4:2) under steady state conditions (non-transient), the following must be observed: 1] The sum of all IOL, for all ports, should not exceed 60 mA. If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test condition. 5. Although each I/O port can source more than the test conditions (20 mA at VCC = 5V, 10 mA at VCC = 3V for PB5, PB1:0, 10 mA at VCC = 5V, 5 mA at VCC = 3V for PB4:2) under steady state conditions (non-transient), the following must be observed: 1] The sum of all IOH, for all ports, should not exceed 60 mA. If IOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition. 121 2535H–AVR–10/07