background image

5

PROGRAMACIÓN ARDUINO

1. Descargue el entorno de desarrollo de Arduino (www.arduino.cc) e instálelo 
en su PC. El ambiente está disponible para Windows, Mac y Linux e incluye todo 
lo que necesita para empezar a programar.
2. Conecte el Arduino a la computadora y si está usando una máquina Windows, 
espere a que se instale el controlador. 
3. Cuando comience a usar el editor de Arduino, deberá con

fi

 gurar en el menú 

Herramientas, en la parte superior del editor, la opción de tarjeta y la opción de 
Puerto Serial; en la primera seleccione el modelo de Arduino que compró. En la 
segunda elija el puerto al que está conectado el Arduino. Si tiene dudas acerca 
de este puerto, simplemente desconecte el Arduino y la opción que desaparezca 
es su puerto.

Un escudo es una placa de circuito adicional a su Arduino. Generalmente, un 
escudo se coloca encima de la placa base Arduino, se conecta con sus pines 
I/O y permite al Arduino especializarse añadiendo capacidades adicionales, o 
proporcionando una interfaz más conveniente para su proyecto. Por ejemplo, 
un escudo podría permitir integrar un chip GPS o una tarjeta SD a su proyecto. 
Algunos escudos se pueden apilar uno encima del otro, para agregar varias 
funciones adicionales.

Deberá descargar un hardware adicional para programar el circuito. Necesitará 
un cable USB para programarlo y si quiere ser capaz de ejecutar su proyecto 
cuando no está cerca de la computadora, necesitará un adaptador de corriente 
AC-DC o batería y cable. Usted encontrará estos componentes en Steren.

Escudos

Содержание ARD-020

Страница 1: ......

Страница 2: ...c mo utilizar apropiadamente el producto Para apoyo compras y todo lo nuevo que tiene Steren visite nuestro sitio web www steren com TARJETA PROGRAMADORA COMPATIBLE CON ARDUINO TIPO LEONARDO La infor...

Страница 3: ...ciones No coloque objetos pesados sobre el equipo ni sobre sus accesorios No exponga el equipo ni sus accesorios al polvo humo o vapor La Tarjeta programadora con micro controlador Atmel MEGA32U4 le b...

Страница 4: ...ervos Un microcontrolador tiene todas las partes b sicas de un ordenador procesador memoria pines de entrada salida en un solo chip y ejecuta el software que se carga sobre ella desde una computadora...

Страница 5: ...o simplemente desconecte el Arduino y la opci n que desaparezca es su puerto Un escudo es una placa de circuito adicional a su Arduino Generalmente un escudo se coloca encima de la placa base Arduino...

Страница 6: ...simplemente haga clic en el bot n Cargar y ste ser enviado a su placa Arduino El microcontrolador se reiniciar y ejecutar su sketch hasta subir uno diferente A continuaci n se muestran peque os proyec...

Страница 7: ...L SDA AREF GND 13 12 11 10 9 8 7 6 5 4 3 2 1 0 A0 A1 A2 A3 A4 A5 TX1 1 AX1 0 POWER ANALOG IN DIGIRAL PWM A11 A10 A9 A8 A7 A6 IOREF RESET 3V3 5V GND GND V1n SCL SDA AREF GND 13 12 11 10 9 8 7 6 5 4 3 2...

Страница 8: ...de Arduino la lleva incorporada http www arduino cc en Tutorial Blink int ledPin 13 Definici n de la salida en el PIN 13 void setup Configuraci n pinMode ledPin OUTPUT designa la salida digital al PI...

Страница 9: ...presiona el pulsador entrada 5 a 0 la salida 13 se enciende y se apaga de forma intermitente Funcionamiento Cuando la E5 1 Entonces S13 0 Cuando la E5 0 Entonces S13 0 1 Intermitente 200 200 ms 10 K...

Страница 10: ...us del PIN void setup pinMode ledPin OUTPUT declare LED as output declare el LED como salida pinMode inPin INPUT declare pushbutton as input declare el bot n como salida void loop val digitalRead inPi...

Страница 11: ...e encender y apagar 3 LEDs colocados en las salidas 6 7 y 8 PIN 6 PIN 7 y PIN 8 con una cadencia de 200 ms Las variables asignadas a cada LED son ledPin1 ledPin2 y ledPin3 3 Secuencia B sica de 3 LEDs...

Страница 12: ...DAS pinMode ledPin2 OUTPUT pinMode ledPin3 OUTPUT digitalWrite ledPin1 LOW Apaga los LEDs digitalWrite ledPin2 LOW digitalWrite ledPin3 LOW void loop Bucle de Funcionamiento digitalWrite ledPin1 HIGH...

Страница 13: ...ctado en la entrada 7 de Arduino al mismo tiempo que cada vez que contamos encendemos el LED conectado en la salida 13 El valor de la variable que almacena el n mero de impulsos generados se env a a l...

Страница 14: ...oanteriorboton 0 void setup Serial begin 9600 Configura velocidad de transmisi n a 9600 pinMode LED OUTPUT inicializa como salida digital el pin 13 pinMode Boton INPUT inicializa como entrada digital...

Страница 15: ...rial write 10 Serial write 13 estadoanteriorboton valor Podr amos prescindir de la resistencia colocada con el pulsador si se habilita la resistencia interna Pull up de la entrada PIN7 en ese caso el...

Страница 16: ...la entrada 7 ha sido presionado y enciende el LED Env a a la PC el valor de la variable de cuenta Contador v a puerto serie Christian Nold Erica Calogero J M Ruiz int LED 13 int Boton 7 int valor 0 i...

Страница 17: ...imos en la salida el valor le do negado if valor estadoanteriorboton if valor 1 contador Serial print contador Serial write 10 Serial write 13 estadoanteriorboton valor Se trata de configurar un canal...

Страница 18: ...Pin lee el valor del canal de ENTRADA anal gica Serial print val Env a al PC el valor anal gico le do y lo muestra en pantalla Serial write 10 delay 100 Con este ejemplo vamos a controlar la velocidad...

Страница 19: ...amos en las pruebas desde el conector USB no debemos sacar demasiada corriente de la computadora y segundo porque el transistor es de una corriente limitada El diodo 1N4001 se coloca como protecci n p...

Страница 20: ...nera c clica tal como vemos en la figura Este efecto lo conseguimos con una estructura del tipo for for valor 0 valor 255 valor 5 ascendente for valor 255 valor 0 valor 5 descendente Obs rvese que los...

Страница 21: ...el motor Programa int valor 0 variable que contiene el valor a sacar por el terminal anal gico int motor 10 motor conectado al PIN 10 void setup No es necesario void loop for valor 0 valor 255 valor...

Страница 22: ...l PIN 10 int potenciometro 0 Se define la entrada anal gica void setup No es necesario void loop valor analogRead potenciometro se lee el valor de la entrada anal gica y se asigna a val analogWrite mo...

Страница 23: ...rear una rampa de subida de tensi n y una de bajada con el fin de que el motor modifique su velocidad de modo autom tico Control o Driver de un motor de continua Los dos par metros que queremos contro...

Страница 24: ...voltaje efectivo es un cuarto del voltaje total de entrada Entonces la velocidad del motor disminuye De esta forma controlando el duty cycle o el tiempo que el pulso est activo frecuencia podemos con...

Страница 25: ...plo como el L293D Chip L293D B puente H Es un circuito integrado o chip que puede ser utilizado para controlar simult neamente la velocidad y direcci n de dos motores de continua contiene dos puentes...

Страница 26: ...constante Primero s lo vamos a demostrar el control de la velocidad de un motor de continua a trav s del integrado L293D Para ello fijamos los pines de control de direcci n a 5v y 0v de forma que s l...

Страница 27: ...2 13 14 15 DIGITAL AREF GND 13 12 11 10 9 8 TXD314 RXD315 TXD216 RXD217 TXD118 RXD217 SDA 20 SCL 21 COMMUNICATION PWM POWER ANALOG IN 7 6 5 4 3 2 1 0 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 8...

Страница 28: ...ia delante sube la velocidad for valor 0 valor 255 valor 5 analogWrite motorAvance valor delay 30 for valor 255 valor 0 valor 5 Motor hacia delante baja la velocidad analogWrite motorAvance valor dela...

Страница 29: ...permiten abrir o cerrar otros circuitos el ctricos independientes De aqu extraemos una informaci n muy importante Podemos separar dos circuitos de forma que funcionen con voltajes diferentes 9 Utiliz...

Страница 30: ...V cada 2 segundos mediante un rel conectado al PIN 8 de Arduino int relayPin 8 PIN al que va conectado el rel void setup pinMode relayPin OUTPUT void loop digitalWrite relayPin HIGH ENCENDIDO delay 2...

Страница 31: ...U4 Alimentaci n 5 12 V Frecuencia de operaci n 16 MHz Puertos de entrada an loga 12 Puertos de entrada salida digital 20 incluyendo puertos PWM Capacidad de memoria flash 32 kB SRAM 2 5 kB EEPROM 1 kB...

Страница 32: ...donde adquiri el producto Si la presente garant a se extraviara el consumidor puede recurrir a su proveedor para que le expida otra p liza previa presentaci n de la nota de compra o factura respectiva...

Страница 33: ......

Страница 34: ...iew this manual thoroughly to ensure proper installation and operation of this product For support shopping and everything new at Steren visit our website www steren com ARD 020 PCB COMPATIBLE WITH AR...

Страница 35: ...subject to vibration Do not put heavy objects on the device or accessories Do not expose the device or accessories to dust smoke or steam HIGHLIGHTS The PCB with MEGA32U4 Atmel micro controller allows...

Страница 36: ...ch as lights displays motors and servos A microcontroller has all the basic parts of a computer processor memory input output pins on a single chip and runs the software that is loaded on it from a co...

Страница 37: ...t simply disconnect the Arduino and the option that disappears is your port A shield is an additional circuit to your Arduino board Usually a shield is placed over the baseArduino connects with its I...

Страница 38: ...et Once you have written a sketch simply click the load button and it will be sent to your Arduino board The microcontroller will restart and run your sketch until it gets a different one Below you wi...

Страница 39: ...GND V1n SCL SDA AREF GND 13 12 11 10 9 8 7 6 5 4 3 2 1 0 A0 A1 A2 A3 A4 A5 TX1 1 AX1 0 POWER ANALOG IN DIGIRAL PWM A11 A10 A9 A8 A7 A6 IOREF RESET 3V3 5V GND GND V1n SCL SDA AREF GND 13 12 11 10 9 8 7...

Страница 40: ...LED exit 13 Arduino has it built in http www arduino cc en Tutorial Blink int ledPin 13 Definition of the PIN 13 output void setup Configuration pinMode ledPin OUTPUT designates the PIN 13 digital out...

Страница 41: ...9 9 When you press the button input 5 to 0 output 13 turns on and shuts off intermittently How it works When the I5 1 then O13 0 When the I5 0 then O13 0 1 intermittent 200 200 ms 10 K 2 Alarm...

Страница 42: ...us void setup pinMode ledPin OUTPUT declare LED as output pinMode inPin INPUT declare pushbutton as input void loop val digitalRead Nifne reads input value if val HIGH check if the value read is 1 but...

Страница 43: ...1 It turns on and off 3 LEDs placed in the 6 7 and 8 outputs PIN 6 PIN 7 and PIN 8 with a cadence of 200 ms Assigned to each LED are ledPin1 ledPin2 and ledPin3 variables 3 Basic 3 LEDs sequence 8 7 6...

Страница 44: ...pinMode ledPin2 OUTPUT pinMode ledPin3 OUTPUT digitalWrite ledPin1 LOW Turn off the LEDs digitalWrite ledPin2 LOW digitalWrite ledPin3 LOW void loop work loop digitalWrite ledPin1 HIGH turn off and on...

Страница 45: ...ton connected to Arduino input 7 is pressed whenever we have we light the LED connected at output 13 The value of the variable that stores the number of pulses generated is sent to the PC so that it i...

Страница 46: ...state 0 void setup Serial begin 9600 Configures transmission speed to 9600 pinMode LED OUTPUT Initializes as a digital output pin 13 pinMode Boton INPUT initializes as a digital input the 7 digitalWri...

Страница 47: ...d avoid the resistance placed at the button if the internal resistance of PIN7 is enabled in this case the circuit would be as follows Serial print counter Serial write 10 Serial write 13 int buttonla...

Страница 48: ...s if connected to the input jack 7 button has been pressed and LED lights up Send the value of the variable Counter account via serial port to the PC int LED 13 int Button 7 int value 0 int counter 0...

Страница 49: ...to view it 5 Analog input valor digitalRead Button Reads the digital input pin 7 value digitalWrite LED value Write in the output the read denied value if value int buttonlaststate if value 1 counter...

Страница 50: ...6 DC motor control using a transistor Analog input int potPin 5 Selects the input PIN to put the potentiometer int val 0 variable to store the value read from the analog input void setup Serial begin...

Страница 51: ...se if we feed testing from USB connector must not pull too much current from the computer and second because the transistor is current limited 1N4001 diode is positioned as protection to prevent that...

Страница 52: ...ramp up and down cyclically We get this effect with a structure for type for value 0 value 255 value 5 ascending for value 255 value 0 value 5 descending Note that increases in the voltage value rang...

Страница 53: ...ss fast Program int value 0 a variable that contains the value to get analog input terminal int motor 10 motor connected to PIN 10 void setup Not necessary void loop for value 0 value 255 value 5 gene...

Страница 54: ...or connected to PIN 10 int potentiometer 0 Set the analogue input void setup Not necessary void loop value analogRead potentiometer reads the value of the analog input and allocates val analogWrite mo...

Страница 55: ...ch of the previous motor i e let s create a power surge and a descent ramp so motor change speed in automatic mode DC motor control or driver The two parameters that we want to control of a DC motor i...

Страница 56: ...tage Then the motor speed decreases Thus by controlling the duty cycle or while the pulse is active frequency we can control the DC motor speed A way to perform this check on Arduino is using the PWM...

Страница 57: ...general as H bridge for example the L293D Chip L293D B H bridge It is an integrated circuit or chip that can be used to simultaneously control the speed and direction of two DC motors containing two...

Страница 58: ...stant speed First we will just show the speed of a DC motor control through the L293D integrated So we set the direction control PIN to 5v and 0v in such a way that it will only turn in one direction...

Страница 59: ...ion IOREF RESET 3V3 5V GND VIN 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 DIGITAL AREF GND 13 12 11 10 9 8 TXD314 RXD315 TXD216 RXD217 TXD118 RXD217 SDA 20 SCL 21 COMMUNICATION PWM POWER ANALOG IN 7 6 5 4...

Страница 60: ...0 Motor forward raises the speed for value 0 value 255 value 5 analogWrite motorFowards value delay 30 for value 255 value 0 value 5 forward motor lowers the speed analogWrite motorFowards value delay...

Страница 61: ...as a switch controlled by an electrical circuit in which by means of an electromagnet actuates a set of one or more contacts that allow open or close other independent electrical circuits From here ex...

Страница 62: ...lb every 2 seconds using a relay connected to the Arduino PIN 8 int relayPin 8 PIN to which the relay is connected void setup pinMode relayPin OUTPUT void loop digitalWrite relayPin HIGH Power delay 2...

Страница 63: ...o controller MEGA32U4 Input 5 12 V Operational frequency 16 MHz Analogue input ports 12 Digital input output ports 20 including PWM ports Flash memory capacity 256 kB SRAM 2 5 kB EEPROM 1 kB Boot load...

Страница 64: ...service at any of the addresses mentioned later THIS WARRANTY IS VOID IN THE NEXT CASES If the product has been damaged by an accident acts of God mishandling leaky batteries failure to follow enclos...

Страница 65: ......

Страница 66: ......

Отзывы: