Archivo PDF

Anuncio
TARJETA PROGRAMADORA
COMPATIBLE CON ARDUINO TIPO
LEONARDO
ARD-020
Gracias por la compra de este producto Steren.
Este manual contiene todas las indicaciones necesarias para manejar su
nueva Tarjeta programadora compatible con Arduino tipo Leonardo.
Por favor, revíselo completamente para estar seguro de cómo utilizar
apropiadamente el producto.
Para apoyo, compras y todo lo nuevo que tiene Steren,
visite nuestro sitio web:
www.steren.com
La información que se muestra en este manual sirve únicamente
como referencia sobre el producto. Debido a actualizaciones pueden
existir diferencias.
Por favor, consulte nuestra página web (www.steren.com) para
obtener la versión más reciente del instructivo.
2
IMPORTANTE
• Mantenga el equipo fuera del alcance de los niños.
• No exponga el equipo a temperaturas extremas.
• No use ni almacene este equipo en lugares donde existan goteras o salpicaduras
de agua.
• Evite las caídas del equipo, ya que podría sufrir daños.
•No coloque el equipo ni los accesorios sobre superficies inclinadas, inestables
o sometidas a vibraciones.
• 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 brinda
la posibilidad de utilizar todo los puertos de entrada y salida, ayudando a los
desarrolladores estudiantes y hoobistas a no preocuparse por la etapa de
control.
• La interfaz de comunicación y de programación se realiza utilizando el software
libre que utiliza Arduino, se conecta a la computadora por medio del puerto USB
e incorpora puerto ISCP.
3
CÓMO EMPEZAR CON ARDUINO
Este manual le ayudará a entender lo que es y cómo funciona Arduino para
comenzar a construir sus propios proyectos electrónicos.
¿Qué es Arduino?
Arduino es una plataforma de electrónica abierta para la creación de prototipos
basada en software y hardware flexibles y fáciles de usar.
Tiene todo lo que necesita para uso básico soldado en una pequeña placa de
circuito. La placa contiene el microcontrolador y ofrece un cómodo acceso a las
entradas y salidas. Las entradas son dispositivos como sensores (sensores de
luz, termómetros, giroscopios, etc.) y elementos de interfaz humana (botones,
interruptores, perillas). Las salidas son todos los elementos electrónicos que
quiera ser capaz de controlar, tales como luces, pantallas, motores y servos. 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, lo que le permite manipular los
resultados basados en datos que recibe de las entradas.
Arduino es open source. Como hardware de código abierto, los esquemas para
Arduino están disponibles para cualquier persona gratuitamente, por si quiere
comprar los componentes electrónicos y una placa y construir su propio Arduino.
Existe una enorme gama de proyectos que necesitan un microcontrolador. Un
proyecto simple podría ser algo como una tira de luz LED. Un circuito básico
puede encender las luces LED, pero con el fin de conseguir que cambie de color
y ejecutar patrones necesita un microcontrolador. Proyectos más complejos
podrían ser un brazo robótico, una exhibición de LED holográfico o una caja de
arena de gato auto limpiable.
4
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
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.
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á configurar 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.
5
Finalmente, estará listo para escribir programas (el editor de Arduino se refiere
a ellos como “sketches”) para su proyecto. Necesitará cierta familiaridad con
programación en C++, variables, funciones, declaraciones “if” y bucles, pero los
sketches Arduino suelen ser más simples.
SKETCHES
La mejor manera de aprender programación de Arduino es a través de los
sketches de ejemplo incluidos en el IDE de Arduino. Éstos se encuentran en el
menú Archivo>Ejemplos y puede encontrar muchos ejemplos en Internet.
Una vez que ha escrito un sketch, 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 proyectos paso a paso.
1. Intermitente
Se trata de realizar un ejercicio básico que consiste en encender y apagar un
LED que conectamos en el PIN 13 de Arduino configurado como salida. El
tiempo de encendido y apagado es de 1 segundo.
Diagrama y Esquema
Dado que el PIN 13 de Arduino lleva incorporada una resistencia interior, el
diodo LED se coloca sin resistencia en serie; en el caso de colocar el diodo LED
en otra salida, deberíamos colocar una resistencia de entre 220 y 500 ohmios,
dependiendo del consumo de corriente del diodo.
6
POWER
A0
A1
A2
A3
A4
A5
IOREF
RESET
3V3
5V
GND
GND
V1n
DIGIRAL (PWM)
TX1
AX1
A6
A7
7
6
5
4
3
2
11
00
SCL
SDA
AREF
GND
13
A11 12
11
A10
10
A9
A8 9
8
A0
A1
A2
A3
A4
A5
IOREF
RESET
3V3
5V
GND
GND
V1n
POWER
TX1
AX1
A6
A7
7
6
5
4
3
2
11
00
SCL
SDA
AREF
GND
13
A11 12
11
A10
10
A9
A8 9
8
DIGIRAL (PWM)
ANALOG IN
Conexión para realizar la salida por el PIN 10.
ANALOG IN
7
Programa
/*
* Intermitente
*
* Ejemplo básico con Arduino. Encendido y apagado de un LED
* con una cadencia de 1 s usando el PIN 13 como salida
* no es necesario usar una resistencia para el LED
* la salida 13 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 PIN 13
}
void loop()
// bucle de funcionamiento
{
digitalWrite(ledPin, HIGH);
// activa el LED
delay(1000);
// espera 1 s (tiempo encendido)
digitalWrite(ledPin, LOW);
// desactiva el LED
delay(1000);
// espera 1 s (tiempo apagado)
}
8
2. Alarma
Cuando 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
9
Programa
int ledPin= 13; // elija el PIN para el LED
int inPin= 5; // choose the input pin (for a pushbutton) (elija el PIN de entrada
(para un botón)
int val= 0; // variable for reading the pin status (variable para lectura de estatus
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(inPin); // lee valor de entrada
if(val== HIGH) { // chequea si el valor leído es “1” (botón presionado)
digitalWrite(ledPin, LOW); // pone el LED en OFF
} else{
digitalWrite(ledPin, LOW); // parpadea el LED
delay(200);
digitalWrite(ledPin, HIGH);
delay(200);
}
}
10
3. Secuencia Básica de 3 LEDs
Trata de 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.
GND
8
7
6
11
Programa
// Encendido y apagado de 3 LEDs
int ledPin1 = 6; // Define las salidas de los LEDs
int ledPin2 = 7;
int ledPin3 = 8;
void setup() { // Configura las SALIDAS
pinMode(ledPin1, OUTPUT); // declarar LEDs como SALIDAS
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); // Apaga y enciende los LEDs cada 200 ms
delay(200);
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, HIGH);
delay(200);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, HIGH);
delay(200);
digitalWrite(ledPin3, LOW);
}
12
4. Contador
Se trata de contar las veces que se pulsa un botón conectado 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 la PC para que se visualice en la pantalla.
10 K
13
Programa Contador
/* Detecta si el botón conectado a la entrada 7 ha sido presionado y enciende
el LED
* Envía al PC el valor de la variable de cuenta “Contador” vía puerto serie.
*
* Christian Nold & Erica Calogero
*
*/
int LED = 13;
int Boton = 7;
int valor = 0;
int contador = 0;
int estadoanteriorboton = 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 el 7
digitalWrite(Boton,HIGH); // Habilitamos la resitencia interna Pull-up del PIN7
}
void loop()
{
valor = digitalRead(Boton); // lee el valor de la entrada digital pin 7
digitalWrite(LED, !valor); // Escribimos en la salida el valor leído negado
if(valor != estadoanteriorboton){
if(valor == 1){
14
contador++;
Serial.print(contador);
Serial.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 circuito quedaría
como el siguiente:
15
El programa en este caso sería muy parecido al anterior. Obsérvese que ahora
al pulsar el botón introducimos un “=” en el PIN7, por lo tanto, si quiero que se
encienda la salida PIN13 debo escribir en ella el valor leído del pulsador negado,
es decir “!valor”.
Programa Contador Modificado
/* Detecta si el botón conectado a 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;
int contador = 0;
int estadoanteriorboton = 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 el 7
digitalWrite(Boton,HIGH); // Habilitamos la resitencia interna Pull-up del PIN7
}
void loop()
16
{
valor = digitalRead(Boton); // lee el valor de la entrada digital pin 7
digitalWrite(LED, !valor); // Escribimos 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;
}
5. Entrada Analógica
Se trata de configurar un canal de
entrada analógico pin 5 y enviar el
valor leído a la PC para visualizarlo.
17
Programa
/* Entrada Analógica */
int potPin = 5; // selecciona el pin de entrada para colocar el potenciómetro
int val = 0; // variable para almacenar el valor leído por la entrada analógica
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); // 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);
}
6. Control de un motor de cc con un transistor
Con este ejemplo vamos a controlar la velocidad de un motor de cc mediante
la utilización de un transistor BD137. Se trata de utilizar la posibilidad de enviar
una señal de PWM a una de las salidas configurables como salidas analógicas.
18
Tenga en cuenta que el motor debe ser de bajo consumo por dos motivos:
primero porque si alimentamos 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 para evitar que las corrientes
inversas creadas en el bobinado del motor puedan dañar el transistor.
19
La tensión que sacaremos a la salida 10 (analógica tipo PWM) variará en forma
de rampa ascendente y descendente de manera 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 incrementos del valor de la tensión van de 5 en 5 y tenemos
que considerar que 0v equivale a 0 y 5 v equivale a 255.
20
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 +=5) {
// se genera una rampa de subida de tensión de 0 a 255, es decir, de 0 a 5v
analogWrite(motor, valor);
delay(30); // espera 30 ms para que el efecto sea visible
}
for(valor = 255; valor >=0; valor -=5) {
// se genera una rampa de bajada de tensión de 255 a 0, es decir, de 5 a 0v
analogWrite(motor, valor);
delay(30);
}
}
Variante del montaje: Control de la velocidad mediante un potenciómetro.
Se trata de controlar la velocidad a nuestro gusto, es decir, mediante un
potenciómetro que se coloca en una de las entradas analógicas y en función del
valor que se lea en la entrada, así girará más o menos rápido el motor.
21
Programa
int valor = 0; // variable que contiene el valor a sacar por el terminal analógico
int motor = 10; // motor conectado al 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(motor, valor); // Se manda a la salida analógica 0 el valor leído
delay(30); // espera 30 ms para que el efecto sea visible
}
Esquema
22
7. Control de un motor de cc con el driver L293D
Con esta aplicación vamos a mover un motor de cc usando un CI de potencia,
específico para estas aplicaciones. El circuito podrá mover hasta dos motores,
nosotros sólo lo haremos con uno.
Como ventana en este montaje podremos mover el motor en los dos sentidos de
giro, cosa que con el anterior montaje no podíamos.
El funcionamiento será como el primer montaje del motor anterior, es decir,
vamos a crear 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 controlar de un motor de continua son su
dirección de giro y su velocidad. La dirección se controla cambiando su polaridad.
En cambio, para su velocidad, debemos utilizar la técnica de modulación por
ancho de pulso-PWM.
Voltaje
Aquí hay algunos gráficos donde se muestra la relación entre la señal de pulsos
(PWM) y el voltaje efectivo:
Voltaje efectivo
Tiempo
23
Voltaje
Cuando el tiempo que el pulso está activo es la mitad del periodo de la señal
o el parámetro duty cycle está al 50%, el voltaje efectivo es la mitad del voltaje
total de entrada.
Voltaje efectivo
Tiempo
Cuando el tiempo que el pulso está activo es la mitad del periodo de la señal
o el parámetro duty cycle está al 50%, el voltaje efectivo es la mitad del voltaje
total de entrada.
Cuando el duty cycle es reducido al 25%, el 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 controlar la velocidad del motor de continua.
Una forma de realizar dicho control en Arduino es utilizando la salida analógica
PWM.
Hay que recordar que la señal de salida PWM (pines 9, 10) es una señal de
frecuencia constante (30769 Hz) y que sólo nos permite cambiar el “duty cycle”
o el tiempo que el pulso está activo (on) o inactivo (off) utilizando la función
analogWrite().
24
La otra forma es generando señales PWM utilizando la capacidad del
microprocesador a través de la función digitalWrite().
Si queremos controlar simultáneamente la velocidad y dirección de un motor,
necesitamos utilizar un circuito integrado o chip, llamado de forma general
“puentes H”, por ejemplo 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 H). La diferencia entre el modelo L393D y L293B es que el primero
viene con diodos de protección que evitan los daños generados por los picos de
voltaje que puede producir el motor.
Al puerto
paralelo:
pines
1y2
Contiene 4 pines digitales (2, 7, 10, 15) para controlar la dirección de los motores.
25
Los pines “enable” (1, 9) admiten como entrada una señal PWM y se utiliza para
controlar la velocidad de los motores con la técnica de modulación de ancho de
pulso.
Los motores van conectados entre uno de los pines 3, 6, 11, o 14. La tensión Vss
es la que alimentará o dará potencia al motor.
Montaje Básico: Control simple de un motor con el CI L293 a velocidad
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ólo girará en un sentido. Si queremos cambiar
el sentido, sólo será necesario cambiar dicha polarización.
Programa
// Control simple de un motor con el CI L293 a velocidad constante
int motorpin =10; // PIN de salida analógica PWM
void setup() { }
void loop() {
analogWrite(motorpin, 125); // activa el motor a una velocidad constante
delay(100); // espera 100 ms para la próxima lectura
}
26
PWM
11
12
13
14
8
9
10
3
4
5
6
7
0
ANALOG IN
1
POWER
5V GND VIN
2
IOREF
RESET
3V3
DIGITAL
COMMUNICATION
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
15
TXD314
RXD315
TXD216
RXD217
TXD118
RXD217
SDA 20
SCL 21
7
6
5
4
3
2
1
0
AREF
GND
13
12
11
10
9
8
Esquema
8. Control de un motor: velocidad variable y sentido de giro
variable
27
Programa
// Control de Motor con driver L293D
int valor = 0; // variable que contiene el valor
int motorAvance = 10; // Avance motor --> PIN 10
int motorRetroceso = 11; // Retroceso motor --> PIN 11
void setup() { } // No es necesario
void loop() {
analogWrite(motorRetroceso, 0); // Motor hacia 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);
delay(30);
}
analogWrite(motorAvance, 0); // Motor hacia detrás ... sube la velocidad
for(valor = 0 ; valor <= 255; valor+=5) {
analogWrite(motorRetroceso, valor);
delay(30);
}
for(valor = 255; valor >=0; valor-=5) { // Motor hacia detrás ... baja la velocidad
analogWrite(motorRetroceso, valor);
delay(30);
}
}
28
9. Utilizar un relevador para encender dispositivos de 120 V
PWM
11
12
13
14
10
7
8
9
2
3
4
5
6
ANALOG IN
0
POWER
5V GND VIN
1
IOREF
RESET
3V3
DIGITAL
COMMUNICATION
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
110 V
15
TXD314
RXD315
TXD216
RXD217
TXD118
RXD217
SDA 20
SCL 21
7
6
5
4
3
2
1
0
AREF
GND
13
12
11
10
9
8
Este ejemplo enseña cómo encender una bombilla de 120 V de corriente alterna
(AC) mediante un circuito de 5 V de corriente continua (DC) gobernado por
Arduino. Se puede utilizar con cualquier otro circuito de 120 V con un máximo
de 10 A (con el relé del ejemplo).
¿Qué es un relevador?
El relevador o relé es un dispositivo electromecánico que funciona como un
interruptor controlado por un circuito eléctrico en el que, por medio de un
electroimán, se acciona un juego de uno o varios contactos que 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.
Uno a 5 V (Arduino) y otro a 120 V
(la bombilla).
Como se ve en el esquema inferior,
hay dos circuitos. El del cableado
NEGRO funciona a 5 V de DC y el
del cableado ROJO a 120 V de AC.
29
Programa
/*
Enciende y apaga una bombilla de 220 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(2000);
digitalWrite(relayPin, LOW); // APAGADO
delay(2000);
}
30
ESPECIFICACIONES
Micro controlador: MEGA32U4
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
Boot loader: Leonardo
Salida PWM: Sí
Salida de voltaje: 5 V - - Switch reset: Sí
Comunicación a la PC: USB
Software empleado: Arduino
El diseño del producto y las especificaciones pueden cambiar sin
previo aviso.
31
Modelo: Tarjeta programadora compatible con Arduino tipo Leonardo
Producto: ARD-020
Marca: Steren
PÓLIZA DE GARANTÍA
Esta póliza garantiza el producto por el término de un año en todas sus partes y mano de obra, contra
cualquier defecto de fabricación y funcionamiento, a partir de la fecha de entrega.
CONDICIONES
1.- Para hacer efectiva la garantía, presente esta póliza y el producto, en donde fue adquirido o en
Electrónica Steren S.A. de C.V.
2.- Electrónica Steren S.A de C.V. se compromete a reparar el producto en caso de estar defectuoso sin
ningún cargo al consumidor. Los gastos de transportación serán cubiertos por el proveedor.
3.- El tiempo de reparación en ningún caso será mayor a 30 días, contados a partir de la recepción del
producto en cualquiera de los sitios donde pueda hacerse efectiva la garantía.
4.- El lugar donde puede adquirir partes, componentes, consumibles y accesorios, así como hacer válida esta
garantía es en cualquiera de las direcciones mencionadas posteriormente.
ESTA PÓLIZA NO SE HARÁ EFECTIVA EN LOS SIGUIENTES CASOS:
1.- Cuando el producto ha sido utilizado en condiciones distintas a las normales.
2.- Cuando el producto no ha sido operado de acuerdo con el instructivo de uso.
3.- Cuando el producto ha sido alterado o reparado por personal no autorizado por Electrónica Steren S.A.
de C.V.
El consumidor podrá solicitar que se haga efectiva la garantía ante la propia casa comercial 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.
DATOS DEL DISTRIBUIDOR
Nombre del Distribuidor __________________________
Domicilio ______________________________________
Producto ______________________________________
Marca ________________________________________
Modelo _______________________________________
Número de serie ________________________________
Fecha de entrega ________________________________
En caso de que su producto presente alguna
falla, acuda al centro de distribución más
cercano a su domicilio y en caso de tener alguna
duda o pregunta por favor llame a nuestro Centro
de Atención a Clientes, en donde con gusto le
atenderemos en todo lo relacionado con su
producto Steren.
32
Centro de Atención a Clientes
01 800 500 9000
ELECTRÓNICA STEREN S.A. DE C.V.
Camarones 112, Obrero Popular, 02840,
Del. Azcapotzalco, México, D.F. RFC: EST850628-K51
STEREN PRODUCTO EMPACADO S.A. DE C.V.
Biólogo Maximino Martínez No. 3408 Int. 2, 3 y 4, San
Salvador Xochimanca, Del. Azcapotzalco,
México, D.F. 02870, RFC: SPE941215H43
ELECTRÓNICA STEREN DEL CENTRO, S.A. DE C.V.
Rep. del Salvador 20 A y B, Del. Cuauhtémoc, Centro,
06000, México. D.F. RFC: ESC9610259N4
ELECTRÓNICA STEREN DE GUADALAJARA, S.A.
López Cotilla No. 51, Centro, 44100, Guadalajara, Jal.
RFC: ESG810511HT6
ELECTRÓNICA STEREN DE MONTERREY, S.A.
Colón 130 Pte., Centro, 64000, Monterrey, N.L. RFC:
ESM830202MF8
ELECTRÓNICA STEREN DE TIJUANA, S.A. de C.V.
Calle 2a, Juárez 7636, Centro, 22000, Tijuana, B.C.N.
RFC: EST980909NU5
PCB COMPATIBLE WITH ARDUINO
LEONARDO
ARD-020
Thank You on purchasing your new Steren product.
This manual includes all the feature operations and troubleshooting necessary
to install and operate your new Steren´s PCB compatible with Arduino
Leonardo.
Please review 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
The instructions of this manual are for reference about the product. There may
be differences due to updates.
Please check our website (www.steren.com) to obtain the latest version of the
instruction manual.
2
IMPORTANT
• Keep device out of the reach of children.
• Do not expose to extreme temperatures.
• Do not use or store the equipment near wet places.
• Avoid dropping the unit as this may cause damage.
• Do not place the device or accessories on surfaces that are tilted, unstable or
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 you to use all input and
output ports, helping to students and hobbyists not to worry about control stage.
• The communication and programming interface is performed using free
software (used by Arduino) and cab be connected to the PC through the USB
port. It has an ISCP port.
3
GETTING STARTED WITH ARDUINO
This manual will help you understand what it is and how Arduino works to begin
to build your own electronic projects.
What is Arduino?
Arduino is an electronic open platform for prototype creation based on flexible
and easy to use software and hardware.
It has everything you need for basic use soldered on a small circuit. The
plate contains the microcontroller and provides convenient access to inputs
and outputs. Entries are devices such as sensors (sensors, thermometers,
gyroscopes, etc.) and elements of human interface (buttons, switches and
knobs). The outputs are electronic components that you want to be able to
control, such 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 computer, which allows you to
manipulate the results based on data it receives at the inputs.
Arduino is open source. As open source hardware, schemes for Arduino are
available to anyone for free, if you want to buy electronic components and a plate
and build your own Arduino.
There is a huge range of projects that need a microcontroller. A simple project
could be something like a LED light strip. A basic circuit can turn the LED lights
on, but in order to get to change color and patterns you will need a microcontroller.
More complex projects might be a robotic arm, a holographic LED display or
cleanable auto cat litter box.
4
You need to download an additional hardware to set the circuit. You will need
a USB cable for programming it and if you want to be able to run your project
when you are not near your computer, you will need an adapter current AC-DC or
battery and cable. You will find these components on Steren.
Shields
A shield is an additional circuit to your Arduino board. Usually, a shield is placed
over the base Arduino, connects with its I/O pins and allows the Arduino specialize
by adding additional capabilities, or providing a more convenient interface for
your project. For example, a shield could allow to integrate a GPS chip or an SD
card to your project. Some shields can be stacked one on top of the other, to add
several additional functions.
ARDUINO PROGRAMMING
1. Download the Arduino development environment and install it on your PC. The
environment is available for Windows, Mac and Linux and includes everything
you need to begin programming.
2. Connect the Arduino to the computer and (if you are using a Windows machine)
wait for the drivers to be installed.
3. When you start using the Arduino editor, you need to configure in the Tools
menu at the top of the editor, the card and serial port options; in the first, select
the bought Arduino model. In the second select the port at which the Arduino
is connected to. If you have questions about this port, simply disconnect the
Arduino and the option that disappears is your port.
5
Finally, you are ready to write programs (the Arduino editor refers to them as
“sketches”) for your project. You’ll need some familiarity with C++programming,
variables, functions, “if” statements and loops, but the Arduino sketches tend to
be simpler.
SKETCHES
The best way to learn programming Arduino is through the example sketches
included in the Arduino IDE. These are located in the file menu > examples and
many examples can be found on the Internet.
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 will find small step by step projects.
1. Flashing
It is a basic exercise that shows how to turn a LED that is connected to PIN 13 of
Arduino configured as output. Turn on and off time is 1 second.
Plot and scheme
Since Arduino PIN 13 has an internal resistance, the red LED is placed without
resistance in series; if you place the led in another output you should place
a resistance of between 220 and 500 ohms, depending on the power LED
consumption.
6
POWER
A0
A1
A2
A3
A4
A5
IOREF
RESET
3V3
5V
GND
GND
V1n
DIGIRAL (PWM)
TX1
AX1
A6
A7
7
6
5
4
3
2
11
00
SCL
SDA
AREF
GND
13
A11 12
11
A10
10
A9
A8 9
8
A0
A1
A2
A3
A4
A5
IOREF
RESET
3V3
5V
GND
GND
V1n
POWER
TX1
AX1
A6
A7
7
6
5
4
3
2
11
00
SCL
SDA
AREF
GND
13
A11 12
11
A10
10
A9
A8 9
8
DIGIRAL (PWM)
ANALOG IN
The connection to be carried out in this case is
to 10 PIN output.
ANALOG IN
7
Program
/*
* Intermittent
*
* Basic example with Arduino. Switching on and off of a LED
* with a cadence of 1 s using the 13 PIN as output
* is not necessary to use a resistor for 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 output
}
void loop() // operating loop
{
digitalWrite(ledPin, HIGH); // activates the LED
delay (1000); // 1 s wait (on-time)
digitalWrite(ledPin, LOW); // disables the LED
delay (1000); // 1 s wait (off-time)
}
8
2. Alarm
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
9
Program
int ledPin = 13; // choose the PIN for LED
int Nifne = 5; // choose the input pin (for a pushbutton)
int val = 0; // variable for reading the pin status
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” (button pressed)
digitalWrite(ledPin, LOW); // set the LED to OFF
} else{
digitalWrite(ledPin, LOW); // the LED blinks
delay (200);
digitalWrite (ledPin, HIGH);
delay (200);
}
}
10
3. Basic 3 LEDs sequence
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.
GND
8
7
6
11
Program
Switching on and off of 3 LEDs
int ledPin1 = 6; // Defines the LEDs outputs
int ledPin2 = 7;
int ledPin3 = 8;
void setup() { // set the outputs
pinMode(ledPin1, OUTPUT); // declare LEDs as outputs
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 the LEDs lights every 200 ms
delay (200);
digitalWrite (ledPin1, LOW);
digitalWrite (ledPin2, HIGH);
delay (200);
digitalWrite (ledPin2, LOW);
digitalWrite (ledPin3, HIGH);
delay (200);
digitalWrite (ledPin3, LOW);
}
12
4. Counter
It counts the times a button 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 is displayed
on the screen.
10 K
13
Program counter
/ * Detects 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;
int buttonlaststate = 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
digitalWrite(Boton,HIGH); // Enable internal resistance Pull-up from PIN7
}
void loop()
{
value = digitalRead(Boton); // Reads the digital input pin 7 value
digitalWrite(LED, !valor); // Write in the output the read denied value
if(value != int buttonlaststate){
if(value == 1){
counter++;
14
Serial.print(counter);
Serial.write(10);
Serial.write(13);
}}
int buttonlaststate = value;
}
We could avoid the resistance placed at the button if the internal resistance of
PIN7 is enabled, in this case the circuit would be as follows:
15
The program in this case would be very similar to the previous. Note that now
when the button is pressed we introduce an “=” at PIN7, therefore, if you want
to start the PIN13 output, you should write in it the value read from the denied
button, i.e. “!value”.
Modified counter program
/ * Detects 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;
int buttonlaststate = 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
digitalWrite(Button,HIGH); // Enable internal resistance Pull-up from PIN7
}
void loop()
{
16
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++;
Serial.print(counter);
Serial.write(10);
Serial.write(13);
}}
int buttonlaststate = value;
}
5. Analog input
It set up the pin 5 as analog input
and sends the read value to your
PC to view it.
17
Program
/ * 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(9600);
}
void loop() {
val = analogRead(potPin); // Reads the value from the input analog channel
Serial.print(val); // Sends to the PC the read analog value and displays it
on screen
Serial.write(10);
delay(100);
}
6. DC motor control using a transistor
With this example we are going to control the speed of a DC motor using a
BD137 transistor. Uses the possibility of sending a PWM signal to one of the
outputs set up as analog.
18
Please note that the motor must be low power for two reasons: first because
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 the reverse currents
created in the motor winding could damage the transistor.
19
Analog-value
The tension that we are going to pull from outputt 10 (analog type PWM) will
vary on way to 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 range from 5 at 5 and we have to
consider that 0v equals 0 and 5v is equivalent to 255.
20
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){
//generates a ramp of voltage from 0 to 255, i.e. from 0 to 5v
analogWrite (motor, value);
delay (30); // wait 30 ms to make the effect visible
}
for(value = 255; value >=0; value-=5){
// a down ramp from 255 to 0 voltage is generated that is 5 to 0v
analogWrite (motor, value);
delay (30);
}
}
Installation variant: using a potentiometer as speed control.
To control the speed to our liking, i.e. using a potentiometer which is placed in
one of the analog inputs and based on the value that is read at the input, so the
motor rotates more or less fast.
21
Program
int value = 0; // a variable that contains the value to get analog input read
int motor = 10; // motor 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 (motor, value); // The read value is sent to the analog output 0
delay (30); // wait 30 ms to make visible the effect
}
22
7. DC motor control using a L293D driver
With this application we will move a DC motor using a power IC, specific for these
applications. The circuit you can move up to two motors, we’ll only do it with one.
In this Assembly, we can move the motor in both rotation directions, which we
couldn’t with the previous assembly.
It will function as the first approach 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 is its speed and its
rotation direction. The direction is controlled by changing the polarity. On the
other hand, for its speed, we must use modulation technique for PWM-pulse
width.
Here are some graphs showing the relationship between the pulse (PWM) signal
and the effective voltage:
23
When the pulse is active is half of the period of the signal or duty cycle parameter
is 50%, the effective voltage is half of the total input voltage.
When the duty cycle is reduced to 25%, the effective voltage is a quarter of the
total input voltage. 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 analog output.
You should remembered that the PWM output signal (pins 9, 10) is a constant
frequency signal (30769 Hz) and that only allows us to change the “duty cycle”
or the time that the pulse is active (on) or inactive (off), using the analogWrite()
function.
24
The other way is generating PWM signals using the microprocessor capability
through the function digitalWrite ().
If you want to simultaneously control the speed and direction of a motor, we need
to use an integrated circuit or chip, called in 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 H bridges). The difference
between L393D and L293B model is that the first comes with protection diodes
which avoid damage caused by the voltage spikes that the motor can cause.
It contains 4 digital pins (2, 7, 10, 15) to control the motor direction.
25
The “enable” (1, 9) pins support as input a PWM signal and it are used to control
the speed of the motors using pulse width modulation technique.
The motors are connected between pins 3, 6, 11 or 14. The Vss voltage is to feed
or give power to the motor.
Basic installation: Simple Control of an motor with the L293 CI at constant
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. If we want to change direction, it will only be
necessary to change the polarization.
Program
Simple control of an motor with the L293 CI at constant speed
int motorpin = 10; // Output analog PWM PIN
void setup(){}
void loop() {
analogWrite(motorpin, 125); // activates the motor at a constant speed
delay (100); // wait 100 ms for the next reading
}
26
11
12
13
14
8
9
10
3
4
5
6
7
0
ANALOG IN
1
POWER
5V GND VIN
2
IOREF
RESET
3V3
DIGITAL
COMMUNICATION
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
15
TXD314
RXD315
TXD216
RXD217
TXD118
RXD217
SDA 20
SCL 21
7
6
5
4
3
2
1
0
AREF
GND
13
12
11
10
9
8
PWM
8. Motor control: variable speed and variable rotation
27
Program
Motor control with L293D driver
int value = 0; // a variable that contains the value
int motorFowards = 10; // Motor forward - > PIN 10
int motorBackwards = 11; // Motor recoil - > PIN 11
void setup() {} // Not necessary
void loop() {
analogWrite(motorBackwards, 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 (30);
}
analogWrite(motorFowards, 0); // Motor back... raises the speed
for(value = 0; value <= 255; value+=5) {
analogWrite (motor motorBackwards, value);
delay (30);
}
for(value = 255; value >=0; value-=5) { // motor backwards... lowers speed }
analogWrite (motorBackwards, value);
delay (30);
}
}
28
9. Use a relay to turn on 120 V devices
This example shows how to power a 120-Volt alternating current (AC) light bulb
through a circuit of 5 V DC (DC) ruled by the Arduino. It can be used with any
other circuit of 120 V, with a maximum of 10 A (with the relay of the example).
What is a relay?
The relay is an electromechanical device that functions 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 extract important information: we can separate two circuits in such a
way that they work with different voltages. One to 5 V (Arduino) and another 120
v (the bulb).
As shown in the diagram below,
there are two circuits. Black wiring
operates at 5 V DC and the red one
at 120V AC.
29
Program
/*
It turns on and off a 220 V light bulb 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 (2000);
digitalWrite(relayPin, LOW); // Shutdown
delay (2000);
}
30
SPECIFICATIONS
Micro 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 loader: STK500v2
PWM output: Yes
Voltage output: 5 V - - Switch Reset: Yes
PC interface: USB
Software: Arduino
Product design and specifications are subject to change, without notice.
31
Product: PCB compatible with Arduino Leonardo
Part number: ARD-020
Brand: Steren
WARRANTY
This Steren product is warranted under normal usage against defects in workmanship
and materials to the original purchaser for one year from the date of purchase.
CONDITIONS
1. This warranty card with all the required information, invoice, product box or
package, and product, must be presented when warranty service is required.
2. If the product is in the warranty time, the company will repair it free of charge.
3. The repairing time will not exceed 30 natural days, from the day the claim was
received.
4. Steren sell parts, components, consumables and accessories to customer, as well
as warranty 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 enclosed instructions, improper repair by unauthorized
personnel, improper safe keeping, among others.
a) The consumer can also claim the warranty service in the purchase establishment.
b) If you lose the warranty card, we can reissue it, if you show the invoice or purchase
ticket.
32
RETAILER INFORMATION
Name of the retailer
Address
Product
Brand
Part number
Serial number
Date of delivery
In case your product fails
or have questions, please
contact your nearest dealer.
If you are in Mexico, please
call to our Call Center.
01 800 500 9000
Descargar