0% encontró este documento útil (0 votos)
27 vistas342 páginas

Escuela Superior Politécnica Del Litoral

informe

Cargado por

JUAN DIAZ MAMANI
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
27 vistas342 páginas

Escuela Superior Politécnica Del Litoral

informe

Cargado por

JUAN DIAZ MAMANI
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd
Está en la página 1/ 342

ESCUELA SUPERIOR POLITÉCNICA DEL LITORAL

Facultad de Ingeniería Eléctrica y Computación

“DISEÑO E IMPLEMENTACIÓN DE UN SISTEMA DOMÓTICO USANDO


LABVIEW Y MICROCONTROLADORES”

INFORME DE PROYECTO DE GRADUACIÓN

Previo a la obtención del Título de:

INGENIERO EN ELECTRICIDAD ESPECIALIZACIÓN ELECTRÓNICA Y


AUTOMATIZACIÓN INDUSTRIAL

Presentado por:

Carlos Roberto Luo Xu


Marianela Del Cisne Ochoa Piña

GUAYAQUIL – ECUADOR
2015
II

AGRADECIMIENTO

A Dios, por ser la guía de nuestro camino y fuente de

bendiciones, por alentarnos y brindarnos esperanza.

A nuestros padres, por su apoyo y consejos para nuestro

diario vivir, por inculcarnos metas y por sus deseos de

vernos triunfantes.

A nuestros familiares y amigos, por su apoyo para que

fuese posible la realización del proyecto.

Al Ing. Holger Cevallos por su guía a través del desarrollo

de nuestro proyecto, por sus consejos y ejemplo de

profesionalismo.

A Patricia, Martin y César por su predisposición a

orientación y ayuda incondicional.


III

DEDICATORIA

A nuestros padres y demás familiares,

pilares fundamentales de nuestras vidas,

presentes durante el tiempo de

aprendizaje y formación profesional.


IV

TRIBUNAL DE SUSTENTACIÓN

ING. SARA RIOS O.

SUBDECANA FIEC

ING. DAMIAN LARCO GOMEZ

PROFESOR DELEGADO POR LA

UNIDAD ACADÉMICA

ING. HOLGER CEVALLOS

PROFESOR DEL PROYECTO DE


GRADUACIÓN
V

DECLARACIÓN EXPRESA

“La responsabilidad del contenido de este informe, nos corresponde

exclusivamente; y el patrimonio intelectual de la misma, a la Escuela

Superior Politécnica del Litoral”.

(Reglamento de Graduación de la ESPOL)

Carlos Roberto Luo Xu Marianela Del Cisne Ochoa Piña


VI

RESUMEN

El presente proyecto consiste en crear un sistema domótico usando como

interfaz de programación gráfica Labview (Laboratory Virtual Instrument

Engineering Workbench) e incorporando microcontroladores en marca

MICROCHIP Y ARDUINO que aportarán al funcionamiento del mismo.

La tarjeta que funcionará como adquisición de datos es la Arduino

SainSmart mega 2560 el cual previamente para que establezca

comunicación con Labview se cargó el LIFA BASE haciendo uso del

entorno IDE de Arduino.

Inicialmente se realizó una investigación de los componentes domóticos

presentes en el mercado actual de las empresas como Bticino, SimonVis

y Domobak; y a la vez se realiza un estudio de instalación domótica.

Luego se explica el funcionamiento tanto de la programación en Labview

2013 como de la programación en MICROCHIP (PIC16F887) y Arduino

(Uno y MEGA 2560), para uso de los mismos en nuestro proyecto.

Finalmente se presentará el resultado de las pruebas realizadas en la

maqueta en tiempo real.


VII

INDICE GENERAL
AGRADECIMIENTO ...................................................................................... II

DEDICATORIA ............................................................................................. III

TRIBUNAL DE SUSTENTACIÓN ................................................................. IV

DECLARACIÓN EXPRESA ........................................................................... V

RESUMEN .................................................................................................... VI

ABREVIATURAS ........................................................................................... X

INDICE DE FIGURAS .................................................................................. XII

INDICE DE TABLAS ................................................................................ XVIII

INTRODUCCION ....................................................................................... XIX

CAPÍTULO 1 .................................................................................................. 1

DESCRIPCIÓN GENERAL DEL PROYECTO ............................................... 1

1.1 DESCRIPCIÓN DEL PROBLEMA ....................................................... 1

1.2 SOLUCIÓN DEL PROBLEMA ............................................................ 3

1.3 JUSTIFICACIÓN ................................................................................. 3

CAPÍTULO 2 .................................................................................................. 6

FUNDAMENTO TEÓRICO ............................................................................ 6

2.1 DEFINICIONES DE LA DOMÓTICA .................................................... 6

2.2 TIPOS DE GESTIONES DE LA DOMÓTICA ....................................... 8

2.3 TIPOS DE DISPOSITIVOS USADOS ................................................ 11

2.4 DIAGRAMA DE FLUJO DE LAS GESTIONES DOMOTICAS Y LOS


DISPOSITIVOS A USAR ............................................................................. 12

CAPÍTULO 3 ................................................................................................ 15
VIII

METODOLOGÍA .......................................................................................... 15

3.1 ANÁLISIS DE COSTOS DE LOS DISPOSITIVOS DEL MERCADO .. 15

3.2 ESTUDIOS DE CAMPOS DE INSTALACIONES DOMÓTICAS ......... 29

3.3 DESCRIPCIÓN DE LOS DISPOSITIVOS A UTILIZAR ...................... 31

CAPÍTULO 4 ................................................................................................ 33

ANÁLISIS Y DISEÑOS DE LA MAQUETA ................................................... 33

4.1 PLANOS DE LA VIVIENDA ............................................................... 33

4.2 PLANO ELÉCTRICO ......................................................................... 38

4.3 PLANOS DE UBICACIÓN DE LOS DISPOSITIVOS .......................... 40

CAPÍTULO 5 ................................................................................................ 44

PROGRAMACIÓN DE LAS GESTIONES DOMÓTICAS EN LABVIEW ....... 44

5.1 SISTEMAS DE CONTROL DE ILUMINACIÓN .................................. 44

5.1.1 ESCENARIO POR PRESENCIA ................................................ 44

5.1.2 DIMERIZACIÓN POR AMBIENTE .............................................. 55

5.1.3 CONTROL POR TIEMPO ........................................................... 64

5.1.4 CONTROL MANUAL .................................................................. 68

5.1.5 AMBIENTACIÓN ........................................................................ 70

5.2 SISTEMAS DE PERSIANAS ............................................................. 74

5.3 SISTEMA DE SEGURIDAD ............................................................... 81

5.3.1 MEMORIAS DE RUTINA PARA SIMULAR PRESENCIA DE


UNA PERSONA EN LA CASA ..................................................................... 81

5.3.2 SISTEMA POR VOZ Y TARJETA PARA PUERTA ..................... 84

5.4 SISTEMA DE RIEGO ......................................................................... 97


IX

5.5 SISTEMA DE GARAGE ..................................................................... 99

5.6 DISEÑO DE PRUEBAS ................................................................... 103

CAPÍTULO 6 .............................................................................................. 117

MONTAJE Y ACOPLAMIENTO DE LOS DISPOSITIVOS


ELECTRÓNICOS....................................................................................... 117

6.1 SOFTWARE Y DISPOSITIVOS ELECTRÓNICOS .......................... 117

6.2 ACOPLAMIENTO GENERAL .......................................................... 159

CAPÍTULO 7 .............................................................................................. 163

ANÁLISIS DE RESULTADOS .................................................................... 163

7.1 ELEMENTOS UTILIZADOS Y COSTOS.......................................... 163

7.2 PRESUPUESTOS ........................................................................... 166

7.3 PRUEBAS Y RESULTADOS DE PRUEBAS ................................... 167

CONCLUSIONES Y RECOMENDACIONES .. ¡Error! Marcador no definido.

BIBLIOGRAFÍA .......................................................................................... 176

ANEXOS .................................................................................................... 179


X

ABREVIATURAS

ASK Amplitude-Shift Keying

DAQ Data Acquisition - Adquisición de Datos

HIGH Alto

ID Identidad

LABVIEW Laboratory Virtual Instrument Engineering Workbench -

Laboratorio Virtual banco Instrumento de Trabajo de Ingeniería

LED Light-Emitting Diode - Diodo Emisor de Luz

LDR Light-Dependent Resistor - Resistencia Dependiente de la Luz

LOW Bajo

MISO Master Input, Slave Output - Entrada del Maestro y Salida del

Esclavo

MOSI Master Output, Slave Input - Salida del Maestro y Entrada del

Esclavo

NFC Near Field Communication - Comunicación de Campo Cercano

OFF Apagado

ON Encendido

PIC Peripheral Interface Controller - Controlador de Interfaz Periférico

PWM Pulse-Width Modulation - Modulación de Ancho de Pulso

RFID Radio Frequency Identification - Identificación por

Radiofrecuencia
XI

RX Recepción

SCK Serial Clock

SPI Serial Peripheral Interface

SS Slave Select - Selección de Esclavo

TX Transmisión

UART Universal Asynchronous Receiver-Transmitter - Transmisor-

Receptor Asíncrono Universal


XII

INDICE DE FIGURAS

Fig. 2.1 Gestiones de la domótica. .......................................................... 12

Fig. 2.2 Organizador gráfico de las gestiones domóticas ........................ 13

Fig. 3.1 Plano eléctrico-domótico planta alta .......................................... 29

Fig. 3.2 Plano eléctrico-domótico planta baja .......................................... 30

Fig. 4.1 Vista frontal sur .......................................................................... 34

Fig. 4.2 Vista lateral sur .......................................................................... 35

Fig. 4.3 Perspectiva oeste ....................................................................... 35

Fig. 4.4 Perspectiva este......................................................................... 35

Fig. 4.5 Plano de la planta baja ............................................................... 36

Fig. 4.6 Plano de la planta alta ................................................................ 37

Fig. 4.7 Plano eléctrico de la planta baja ................................................. 38

Fig. 4.8 Plano eléctrico de la planta alta .................................................. 39

Fig. 4.9 Simbología usada en los planos eléctrico................................... 40

Fig. 4.10 Plano del sistema domótico planta baja ................................... 41

Fig. 4.11 Plano del sistema domótico planta alta. ................................... 42

Fig. 4.12 Simbología empleada para el sistema domótico ...................... 43

Fig. 5.1 Panel frontal del control por escenario ....................................... 45

Fig. 5.2 Programación del sistema de escenario ..................................... 47

Fig. 5.3 Escenario#1 uso de variable local .............................................. 48

Fig. 5.4 Escenario#1 variable local de planta baja y alta ......................... 49

Fig. 5.5 Escenario#2 secuencia de encendido- garaje ............................ 50


XIII

Fig. 5.6 Escenario#2 secuencia de encendido- cocina ............................ 51

Fig. 5.7 Escenario#2 secuencia de apagado- dormitorio ......................... 51

Fig. 5.8 Escenario#2 secuencia de apagado- estudio ............................. 52

Fig. 5.9 Escenario#3 ambientación y persiana ....................................... 53

Fig. 5.10 Programación de ambientación-escenario 3 ........................... 53

Fig. 5.11 Programación de persiana-escenario 3 .................................... 54

Fig. 5.12 Control programable del sistema de iluminación ...................... 55

Fig. 5.13 Control del sensor lumínico pasillo 1 ........................................ 57

Fig. 5.14 Control del sensor lumínico pasillo 2 ........................................ 58

Fig. 5.15 Control del LDR ........................................................................ 59

Fig. 5.16 Control de horas para el sensor ............................................... 60

Fig. 5.17 Control del pulsador ON/OFF ................................................... 61

Fig. 5.18 Control manual planta baja del panel frontal ............................ 61

Fig. 5.19 Control programable y dimmer para la sala .............................. 62

Fig. 5.20 Control manual planta alta del panel frontal ............................. 63

Fig. 5.21 Control programable................................................................. 64

Fig. 5. 22 Control de encendido de luminarias por tiempo....................... 65

Fig. 5.23 Control programable para la cocina .......................................... 67

Fig. 5.24 Control manual diagrama de bloques. ...................................... 68

Fig. 5.25 Programación para control manual planta alta ......................... 69

Fig. 5.26 Código ambientación en IDE Arduino ....................................... 73

Fig. 5.27 Controles para ambientación .................................................... 73


XIV

Fig. 5.28 Control programable de ambientación ...................................... 74

Fig. 5.29 Control del sistema de persiana ............................................... 80

Fig. 5.30 Indicadores string–rutina de seguridad ..................................... 81

Fig. 5.31 Programación rutina de seguridad............................................ 82

Fig. 5.32 Programación de captura de imagen ........................................ 84

Fig. 5.33 Programación de cierre de captura de imagen ......................... 86

Fig. 5.34 Programación de control para los módulos .............................. 95

Fig. 5.35 Bloques para configuración de servo ....................................... 96

Fig. 5.36 Panel frontal del sistema de seguridad ..................................... 97

Fig. 5.37 Control del sistema de riego ..................................................... 98

Fig. 5.38 Control remoto para el garaje ................................................ 102

Fig. 5.39 Prueba uno para escenarios .................................................. 104

Fig. 5.40 Prueba dos para dimerización ................................................ 105

Fig. 5.41 Prueba tres dimerización por hora.......................................... 106

Fig. 5.42 Prueba cuatro para el control por tiempo................................ 107

Fig. 5.43 Prueba cinco-panel frontal ..................................................... 108

Fig. 5.44 Prueba seis del control para ambientación ............................. 109

Fig. 5.45 Prueba siete para la captura de imágenes ............................. 110

Fig. 5.46 Prueba ocho para el sistema de riego .................................... 111

Fig. 5.47 Prueba nueve para la sección dos ......................................... 112

Fig. 5.48 Código para la prueba nueve ................................................. 115

Fig. 5.49 Código de la prueba final ....................................................... 116


XV

Fig. 6. 1 Organizador gráficos de los controles implementados ................ 119

Fig. 6.2 Comunicación entre pc y tarjeta ........................................................... 120

Fig. 6.3 Modelo de la trama de bits .................................................................... 121

Fig. 6.4 Esquema de puente UART a USB ...................................................... 122

Fig. 6.5 Pin1 Tx ....................................................................................................... 123

Fig. 6.6 Pin 0 RX ...................................................................................................... 124

Fig. 6.7 Data - ........................................................................................................... 124

Fig. 6.8 Data + .......................................................................................................... 125

Fig. 6.9 Arduino Mega 2560 ................................................................................. 125

Fig. 6.10 Descripción de los pines de la interfaz USB ................................. 127

Fig. 6.11 Administrador de dispositivos ............................................................. 128

Fig. 6.12 Bloque Init- Labview .............................................................................. 129

Fig. 6.13 Configuración del bloque Init .............................................................. 130

Fig. 6.14 Programación interna del bloque Init ................................................ 131

Fig. 6.15 Placa con Relays ................................................................................... 133

Fig. 6.16 Placa electrónica Dimmer .................................................................... 134

Fig. 6.17 Placa con los pics PIC16F887 ........................................................... 136

Fig. 6.18 ULN2003APG Driver ............................................................................. 137

Fig. 6.19 Motor de pasos 28BYJ-48 ................................................................... 138

Fig. 6. 20 Placa Arduino UNO .............................................................................. 140

Fig. 6.21 Arduino UNO y NFC PN532 ............................................................... 141

Fig. 6. 22 Conexión entre la Arduino y la tarjeta ............................................. 142


XVI

Fig. 6.23 Comunicación serial SPI ...................................................................... 143

Fig. 6.24 Módulo EASYVR .................................................................................... 147

Fig. 6. 25 Trama de bits ......................................................................................... 147

Fig. 6. 26 Diagrama de conexión ........................................................................ 149

Fig. 6. 27 Ancho de pulso y ángulo de giro del motor ................................... 150

Fig. 6.28 Modo de envión de la trama para la comunicación .................... 152

Fig. 6.29 Módulo de Transmisión ........................................................................ 152

Fig. 6.30 Módulo de recepción ............................................................................. 153

Fig. 6.31 Obtención de los datos ......................................................................... 154

Fig. 6.32 Tiempos de los códigos ....................................................................... 155

Fig. 6.33 Trama de datos de los LEDS ............................................................. 156

Fig. 6.34 Imagen de la Tira de LEDS WS2812B ............................................ 157

Fig. 6.35 Imagen de los conectores de la tira de LEDS ............................... 157

Fig. 6.36 Comunicación al Conjunto de LEDS ................................................ 159

Fig. 6.37 Acoplamiento del sistema .................................................................... 160

Fig. 6.38 Dimmer baquelita ................................................................................... 161

Fig. 6.39 Control Remoto y Receptor ................................................................. 161

Fig. 6.40 PIC para los motores de paso ............................................................ 162

Fig. 6.41 Relays ....................................................................................................... 162

Fig. 7.1 Resultado uno en el cual se visualizan los LEDS encendidos .. 167

Fig. 7.2 Resultado de escenario .......................................................................... 168

Fig. 7.3 Resultado del control lumínico. ............................................................ 168


XVII

Fig. 7.4 Resultado del control ............................................................................... 169

Fig. 7. 5 Resultado de la maqueta ...................................................................... 170

Fig. 7. 6 Resultado del control de persianas .................................................... 172

Fig. 7. 7 Resultado del control de tira de LEDS .............................................. 172


XVIII

INDICE DE TABLAS

Tabla # 1 Módulos utilizados ................................................................... 11

Tabla # 2 Precios de productos Bticino ................................................... 21

Tabla # 3 Precios de productos SimonVis. .............................................. 26

Tabla # 4 Precios de productos Domobak............................................... 28

Tabla # 5 Costos de software de empresas ............................................ 28

Tabla # 6 Descripción de los módulos..................................................... 32

Tabla # 8 Descripción de puertos .......................................................... 126

Tabla # 9 Descripción del cable ............................................................ 126

Tabla # 10 Descripción de los bloques de configuración ....................... 130

Tabla # 11 Funciones del SPI ............................................................... 142

Tabla # 12 Precios de elementos adquiridos. ........................................ 165

Tabla # 13 Precios de materiales adquiridos. ........................................ 166

Tabla # 14 Inversión total. ..................................................................... 166


XIX

INTRODUCCION

El presente proyecto de graduación tiene el fin de crear un sistema


domótico que será demostrativo para la materia Domótica, que permita el
diseño de automatizar una vivienda usando microcontroladores y el
software Labview como interfaz gráfica para el usuario, ampliando los
conocimientos de programación en Labview, microcontroladores y
automatización, cuyo fin es la demostración que es posible implementar
este sistema domótico utilizando los conocimientos académicos
adquiridos sin necesidad de contratar empresas dedicadas a la
automatización de viviendas.

Los capítulos se encuentran estructurados de la siguiente manera:

En el capítulo uno se describe el problema, la solución presentada y la


justificación del desarrollo del presente proyecto.

En el capítulo dos se detalla las definiciones de la domótica así como las


gestiones que presenta, se indica los dispositivos más comunes a usar en
el momento de cotizar una instalación domótica y un diagrama de flujo
que permite visualizar las gestiones y los dispositivos domóticos.

En el Capítulo tres se describe los dispositivos domóticos de las marcas


Myhome, Insteon y Simonvis presentes en el mercado y el costo de
adquisición de cada uno ellos y se presenta un estudio de una posible
instalación domótica.

En el Capítulo cuatro se puede visualizar los planos de la vivienda que se


tomó como modelo para la construcción de la maqueta.
XX

En el Capítulo cinco se detalla la programación en Labview realizada; y se


incluye las programaciones en Arduino y Mikroc PRO for Pic

En el Capítulo seis se hace referencia al software utilizado, a la


programación y el modo de comunicación para verificar que los
dispositivos electrónicos seleccionados funcionen de acuerdo a lo
esperado.

En el Capítulo siete se presenta los elementos electrónicos y módulos


usados para la demostración en la maqueta, así como el costo de cada
uno de ellos, presupuesto para la construcción e implementación de la
maqueta domótica, pruebas y el resultado que se obtuvo de cada una de
las pruebas.
CAPÍTULO 1

DESCRIPCIÓN GENERAL DEL PROYECTO

1.1 DESCRIPCIÓN DEL PROBLEMA

La tecnología y la ciencia con el pasar de los años se han desarrollado

notoriamente evolucionando e innovando para satisfacer las crecientes

necesidades no solo en el área industrial sino también en el hogar,

originando avances domóticos e inmóticos cuyo fin es aportar servicios

de gestión energética, seguridad, bienestar y comunicación.

Obtener todos estos servicios que la línea domótica ofrece, requiere

tener en consideración sistemas a gestionar en el dimensionado de la

casa que se posea, los elementos a implementar para dar el servicio,


2

el costo de mano de obra y el costo de cada elemento incorporado,

todo esto implica grandes costos 1 de inversión lo que significa que

solo lo podrá obtener personas de un nivel económico alto.

Por tal motivo da como resultado a que surja la necesidad de

desarrollar un sistema alterno para domotizar la vivienda usando el

entorno de programación gráfica Labview como interfaz para el

usuario y la incorporación de microcontroladores; cuya finalidad es

brindar los mismos beneficios de seguridad, control y confort que la

domótica ofrece.

Además, la materia de Domótica no cuenta con un laboratorio para

que sus estudiantes realicen prácticas relacionadas a la

automatización de viviendas o creación de proyectos, que permita

reforzar los conocimientos académicos adquiridos.

Con esto aspiramos a desarrollar un sistema domótico que pueda ser

más accesible y cómodo para el usuario; y, que pueda ser

demostrado en las clases de Domótica e Inmótica.

1
Véase el anexo3 en el cual se adjunta la proforma dada por Bticino.
3

1.2 SOLUCIÓN DEL PROBLEMA

Desarrollar una aplicación domótica usando el software de ingeniería

Labview y dispositivos que se puedan obtener en el mercado nacional

como son los módulos Arduino, microcontroladores o PIC16F887, etc.

La maqueta fue creada con el fin de realizar las demostraciones del

sistema domótico implementado para verificar que se lo puede aplicar

a una vivienda real, y además; podrá ser usado en alguna clase

demostrativa en la materia de Domótica e Inmótica ya que integra los

conceptos de automatización en vivienda y controles usando la

interfaz gráfica Labview.

1.3 JUSTIFICACIÓN

Los estudiantes de la materia de Domotica e Inmotica necesitan

reforzar los conocimientos teóricos adquiridos realizando prácticas,

proyectos demostrativos y exposiciones, manipulando el sistema

domótico desarrollado o creando nuevos sistemas que puedan ser

demostrados en la maqueta.
4

Además, se considera que el sistema propuesto es más económico2

comparado con los existentes en el mercado ya que empresas como

Bticino utilizan módulos eléctricos compatibles con el software que

usan, propios de la línea de ellos y sus equipos 3 domóticos son

importados haciendo que el costo total de instalación sea

extremadamente elevado.

Por tal motivo se implementará un sistema que permita realizar los

servicios domóticos que ofrecen otras empresas, incorporando tarjetas

Arduino, microcontroladores y demás módulos que permitan acoplarse

al Arduino para acceder a las gestiones que la domótica ofrece

mejorando el estilo de vida de todas las personas, brindando

seguridad, confianza, ahorro energético, teniendo un mayor control del

entorno, y todo esto ayuda a mejorar el estado emocional de la

persona haciendo que el sistema sea accesible y cómodo para el

usuario, teniendo un servicio de calidad.

Con el fin de cubrir lo anteriormente mencionado es necesario utilizar

un software de ingeniería que permita controlar todas las gestiones por

computadora.

2
Véase la tabla# 3 que es el cuadro comparativo de costos de software.
3
Véase la tabla# 2 en la que se describen algunos de los módulos eléctricos y domóticos de Bticino.
5

Se empleará Labview el cual posee una gran variedad de

herramientas como Vision 4 development y Labview 5 Interface for

Arduino; bloques gráficos que facilitan la programación.

Para el desarrollo del proyecto se usará microcontroladores, circuitos

electrónicos y el software Labview que será la interfaz de usuario.

4
Es un toolkit o herramienta que permite la interface entre Labview y la webcam
5
Es un toolkit o herramienta que permite la interface entre Labview y la tarjeta Arduino mega2560
CAPÍTULO 2

FUNDAMENTO TEÓRICO

2.1 DEFINICIONES DE LA DOMÓTICA

El término domótica viene del Latín DOMUS, “casa” y del término,

“TICA” de robótica; también conocida en inglés como home

automation¸ concretamente es la automatización del hogar. [1]

En la actualidad se considera a la domótica como la integración de

nuevas tecnologías al espacio arquitectónico; cabe recalcar que la

domótica busca aportar en el usuario una mejor calidad de vida con la

incorporación de equipos que permitan gestionar de forma eficiente,


7

segura y confortable los distintos sistemas domésticos que integra una

vivienda.

Un sistema domótico dispone de una red de comunicación y diálogo

con lo cual se interconecta con los equipos a fin de obtener

información sobre el entorno doméstico; y, permite que la vivienda

posea un entorno más funcional y acorde a cada usuario. [2]

Las técnicas empleadas para automatizar hogares, son las incluidas

en la automatización de construcciones para el control de actividades

domésticas, tales controles incluyen los sistemas de entretenimiento,

sistemas de riego, alimentación de mascotas, utilización de escenas

para cambiar el ambiente según el evento, etc.

También se lo denomina al término domótica como gestión técnica de

edificios y viviendas ya que incluye de manera simultánea la

utilización de electricidad, electrónica e informática, gestionando la

comunicación entre el usuario y la vivienda. [3]

Al hablar de este concepto encontramos que la domótica presenta dos

tipos de filosofías principales:


8

La primera filosofía corresponde a los sistemas domóticos restringidos,

se llaman así porque no permiten utilizar mecanismos (interruptores,

pulsadores, etc.) que desee el usuario, sino que limitan a los modelos

y marcas que son compatibles con sus sistemas y estándares de

control.[4]

La segunda filosofía se refiere a la gestión, con esta filosofía trabajan

los fabricantes del país de la domótica (home automation), estos

sistemas controlan todo lo que se instala en las viviendas como por

ejemplo puertas automáticas, electroválvulas, toldos, televisores,

persianas, luces, etc. [4]

2.2 TIPOS DE GESTIONES DE LA DOMÓTICA

La domótica persigue la integración de 4 aspectos básicos en el hogar;

siendo estos: confort, seguridad, comunicaciones y gestión energética.

[2]

GESTIÓN DEL CONFORT:

Proporciona comodidades ya que se ejerce control en accesos como

persianas, riego, toldos, ventanas, puertas, etc.


9

Permite establecer controles para la climatización que puede ser

manejado mediante control remoto para tener diferentes temperaturas

en el día o programarlo según la zona climática cuya finalidad es tener

temperaturas ideales al llegar a la vivienda.

También es posible tener el control de la iluminación regulando los

niveles de intensidad a diferentes horas del día, o estableciendo

controles de encendido y apagado usando sensores de presencia. [5]

GESTIÓN DE LA SEGURIDAD:

Evita riesgos y accidentes domésticos con la integración de detectores

de fugas que pueden ser de gas, agua y fuego.

Además permite la protección de bienes gestionando el control de

acceso a la vivienda, incorporando controles para la simulación de

presencia cuya finalidad es repetir patrones de comportamientos de

las personas en el momento que la casa se encuentre deshabitada,

incluye también alarmas contra intrusiones.


10

Con la gestión de seguridad es posible brindar auxilio a las personas

especialmente de edades mayores con la realización de llamadas

telefónicas y accesando a los servicios de ambulancias, policía, etc.

GESTIÓN DE LA COMUNICACIÓN:

Está íntimamente relacionada con las funcionalidades que tengamos

definidas en el hogar puesto que se debe dar la posibilidad de

expandir el sistema teniendo controles externos e internos,

visualizando aquellos parámetros de interés, permitiendo la entrada

de datos, transmisión de alarmas, y las intercomunicaciones.

Incorpora la tele asistencia, tele mantenimiento, informes de consumo

y costos.

GESTION ENERGÉTICA:

Permite gestionar el accionamiento automático de luces usando

detectores de presencia, de esta manera se controlará el consumo

energético manteniendo apagadas las demás luminarias que han sido

instaladas en la vivienda y regula la intensidad de iluminación

censando la luminosidad del día.


11

También controla las conexiones de cargas a distintas horas para

reducir la potencia contratada y ejercer el control de climatización.

La gestión energética permite la subida automática de persianas al

detectar luz solar para aprovechar la iluminación natural. [6]

2.3 TIPOS DE DISPOSITIVOS USADOS

DISPOSITIVO DESCRIPCION
Será conectado directamente al
Arduino mega
computador y a los diferentes
2560
módulos.
Para la programación del módulo
Arduino UNO
Shield NFC PN532.
Usado para la programación del
Arduino UNO
módulo de reconocimiento de voz.
Usado para la programación de la
Arduino UNO
tira de LEDS.
Módulo Shield Módulo lector de tarjeta magnética
NFC pn532 compatible con Arduino.
Módulo de reconocimiento de voz
Módulo EasyVR
adaptable a la programación con
Shield 2.0
Arduino.
Usado para la captura de
Cámara zen
imágenes.
Incluye el integrado WS2812B6,
Tira led strip tira programable para el control de
los colores en los LEDS RGB. [7]
Tabla # 1 Módulos utilizados

6
Para conocer con más detalle el integrado véase el anexo en el cual se adjunta el datasheet.
12

Se ha realizado un breve detalle de los módulos que ayudarán al

funcionamiento del sistema domótico que será demostrado en la

maqueta y se ha omitido todos los componentes electrónicos debido a

que ayudarán a los diseños de fuerza y porque están relacionados a la

electrónica que se ha estudiado.

2.4 DIAGRAMA DE FLUJO DE LAS GESTIONES DOMOTICAS Y LOS


DISPOSITIVOS A USAR

Se presenta la Fig. 2.1 en la cual podemos visualizar la distribución de

las aplicaciones domóticas que se ha implementado en la maqueta.

Fig. 2.1 Gestiones de la domótica.


13

El modelo arquitectónico que se visualiza en la Fig. 2.1 fue creado por

el Arq. Segal Faia 7.

Para especificar los controles creados por gestión se ha elaborado un


organizador gráfico; el mismo que se encuentra representado en la
Fig. 2.2:

SISTEMA
DOMOTICO

Gestiones presentes
en la maqueta

GESTION DEL GESTION DE LA


CONFORT SEGURIDAD

CONTROLES ILUMINACION CONTROLES SIMULACION DE


RIEGO
AMBIENTACION PRESENCIA

PERSIANAS
DE ACCESO
GARAJE

Fig. 2.2 Organizador gráfico de las gestiones domóticas

7
Arquitecto de la ciudad de San Diego California, premiado por su desarrollo y tendencia
única en arquitectura; para más información visite el sitio web:
http://www.jonathansegalarchitect.com/index.html
14

Los sensores que se ha implementado en la maqueta corresponden a


los módulos EasyVR 2.08, shield NFC PN5329, y el sensor lumínico
LDR.

Los actuadores presentes en la maqueta son: caja de relays, caja de


dimmers, WS2812B10, ULN2003APG11, servomotor.

La descripción de los módulos usados como sensores están


detallados en el capítulo seis y de la misma manera para los
actuadores.

8
Véase el capítulo seis en el cual se describe el funcionamiento del mismo.
9
Examínese el capítulo seis en el cual se describe el funcionamiento y véase los anexos en el cual se
adjunta el datasheet.
10
Véase los anexos en el cual se adjunta el datasheet.
11
Obsérvese los anexos en el cual se adjunta el datasheet.
CAPÍTULO 3

METODOLOGÍA

3.1 ANÁLISIS DE COSTOS DE LOS DISPOSITIVOS DEL MERCADO

En la tabla que se presenta a continuación se detalla el costo y el

modelo de algunos de los dispositivos que se pueden encontrar en la

marca Bticino para la automatización de persianas, luces, seguridad

así como el software para el funcionamiento de los mismos.

ARTICULO MODELO DESCRIPCION CANTIDAD COSTOS

Dimmer electrónico, 500 W, 127 Vac,


AM5704 6 1198,79
2 mod.
16

AM4406 Dimmer resistivo, 300 W, 127Vac. 30 554

AM5356R* Dimmer deslizable, 1000W, 127Vac. 10 961,41

Detector de movimiento de pared


AM5377R* 180° de cobertura 800/1200W, 10 1578,88
127/277V con placa.

Sistema de videoinferton 4 hilos


316311 1 3567,42
c/monitor manos libres.

Pantalla LCD color 3.5'' cámara


oculta con visión nocturna permite
316411 1 4338,6
crecimiento hasta dos monitores
adicionales.

Sistema de videoinferton a color con


316611 1 6486,22
monitor lcd 7"

Sistema de videoinferton a color con


316811 1 8432,08
monitor lcd 7"

316211 Sistema de videoinferton 4 hilos 1 3488,75

331551 Videoportero con auricular 1 2229,64

331651 Videoportero sin auricular 1 2308,34


17

331751 Videoportero con auricular en color 1 2774,82

Videoportero con controles


domóticos y video para la puerta de
369411 1 1075,82
la casa, kit de manos libres con
memoria de llamada e imágenes.

Funciones de videoporteros y
HD4690 videocontrol, gestión de contenidos
HC4690 multimedia presentes en fuentes 1 2271,92
HS4690 externas (usb y SDCard), en red
LAN, IP.

Módulo de memoria para el estado


F425 1 51,1
de los actuadores

Videoportero con funciones de


369521 1 2089,37
automatización Myhome

Dispositivo para memorizar 16


F420 1 42,86
escenarios

Dispositivo para la ejecución de


MH200N escenarios programados con el 1 570,41
software TIMH200N.

Alimentador compacto para


346020 alimentar el programador de 1 82,92
escenarios MH200N-2 módulos DIN

Comando para funciones especiales


tales como activación de 4
H4651M2 escenarios memorizados con el 1 80,104
módulo F420, comandos, dimmer
activación de cerraduras
18

Mando integrable con una cubretecla


HA4596
de 1 módulo para el control on/off de 1 35,56
HB4596
grupo de actuadores.

Mando integrable con 2 cubreteclas


HA4597
de 1 módulo para el control on/off de 1 37,81
HB4597
2 grupos de actuadores.

Mando integrable con 2 cubreteclas


HA4598
de 1 módulo para el control de 1 1 43,27
HB4598
grupo de actuadores.

Actuador integrable con cubretecla


H4590 de 1 módulo para accionamiento de 1 103,08
lámparas.

Actuador integrable con cubretecla


H4591 de 1 módulo para accionamiento de 1 193,15
lámparas.

Actuador integrable con cubretecla


H4592 de 1 módulo para accionamiento de 1 67,54
lámparas.

HA4599 Modulo radio para automatización de


-------- 1 55,69
HB4599 persianas.

HA4589 Mando radio para la gestión de


1 32
HB4589 escenarios.

Actuador radio dimmer para


H4593 1 69,3
automatización de luces.
19

Actuador radio dimmer con 2


H4594 1 71,1
cubreteclas de 1 módulo.

Actuadores radio para


H4595 1 71,1
automatización de persianas.

N4578N
Interfaz de radio para la integración
NT4578N ------ 1 79,92
de los sistemas de radio.
L4578N

L4599N Mando radio para automatización de


1 42,83
N4599N persianas.

N4589N Mando radio para la gestión de


1 24,608
L4589N escenarios.

Mando radio para la automatización


N4596N
de luces con 1 cubretecla de 1 1 27,34
L4596N
módulo.

Mando radio para la automatización


N4597N
de luces con 2 cubreteclas de 1 1 29,158
L4597N
módulo.

Actuadores radio para


LN4595 1 54,685
automatización de persianas.

3527N Mando a distancia radio 1 53,23


20

3528N Mando a distancia radio 1 39,27

Mando radio por infrarojo para


3579 cargas generales, dotado de detector 1 36,453
de movimiento.

Actuadores radio para


3576 1 42,83
automatización de persianas.

HD4607
Mando protegido con código,
HC4607 1 91,77
memoriza hasta 30 identificativos.
HS4607

Comando escenarios, mando


HD4607Z4 protegido con código hasta 30 1 117,85
identificativos.

3530S Identificativo portátil 1 5,41

BMSE1001 Sensor de iluminación/ movimiento. 1 81,53

Kit automatización para 5 persianas


MHKIT10N 1 364,5
o cortinas motorizadas.

BMSE2002 ------ Sensor de iluminación/ movimiento. 1 44,98

BMSE2005 Sensor de iluminación/ movimiento. 1 65,85


21

Actuadores para centralizaciones


F411/1N 1 36,18
con 1 relé de dos vías.

Actuador para centralizaciones de 4


BMSW1003 1 109,29
salidas.

391661
Telecámara de interior para
391662 1 4331,69
instalaciones de 2 hilos
391663

Panel pc de empotrar con pantalla


táctil para el control del sistema MY
H4687 1 3492,41
HOME mediante el software
MHVisual
Software MHVisual de supervisión
de las funciones de iluminación,
MHVisual automatización, escenarios, 1 878,18
videocontrol, gestión energética y
sonora.

Comando escenarios personalizado


N4680 para accionar 4 situaciones 1 50,93
ambientales de automatización

Interfaz de contactos para


3477 accionamientos con funciones 1 24,1
dobles para persianas, interruptores.

Módulo de memoria para el estado


F425 de los actuadores para restablecer el 1 51,1
sistema de luces anti black out.

Tabla # 2 Precios de productos Bticino


22

La lista de precios que se muestran a continuación corresponde a los

módulos simonvis y hay que considerar que todos los productos

domóticos son importados.

ARTÍCULO MODELO DESCRIPCIÓN CANTIDAD COSTO

Touch LightManager
permite programar y
Touch
controlar todos los 1 1047,8
LightManager
elementos del sistema a
través de pantalla táctil.

Controla los recursos


Touch Light naturales para mantener
Manager Multi- un nivel constante de luz 1 1047,8
Scenas y maximizar las fuentes
de luz natural.

Touch LightKeypad
permite el control desde
otro punto. Activa por
Touch LightKeypad
defecto: 6 escenas +
1 200,60
subida/bajada de
persianas y apagado.

Touch LightKeypad Escenarios de iluminación


(serigrafía 4 y secuencias aplicados en
- 1 200,60
canales / las habitaciones para que
4 escenas) sean más acogedoras.

Módulo control de
Módulo Control persianas para el control
- 1 179,30
persianas de motores con finales de
carrera.

Módulo conversor de
Conversor señales señales digitales para la
- 1 134,48
Digitales vinculación de una señal
230V en función scena.
23

Módulo conversor de
señales analógicas para
Conversor señales la vinculación de una
-- 1 151,29
Analógicas señal tipo 1-10V en
función scena detector
para el control de luz.

Escenarios de iluminación
y ahorro de energía de
Sensor Daylight 1-
hasta un 40 %. 1 -
10V standalone
Compensa el 100% de la
luz entrante

Central de telecontrol de
servicios domésticos a
Central SimonVox través del teléfono,
mediante la previa 1 172,52
basic
introducción de un código
personal.
Central telecontrol
5 entradas (NA-NC). 5
230V~ 50/60 Hz 1 723,39
salidas de relé
CRA

El detector de movimiento
debe colocarse en el
Detector de
techo a una altura ideal
movimiento de 1 93,92
de 2,4 mt. Dispone de un
techo
ángulo de cobertura de
360º.
Detector de
presencia Regula la intensidad de
1 116,10
regulador de luz luz de las luminarias.
techo empotrar

Electroválvula de Usada para el control de


1 116,10
agua los sistemas de riego.

Receptor para persianas


Receptor IR para
IR, Potencia máxima 1 106,09
persianas
700W/VA 230V.

Se utiliza para gestionar


Detector de
el nivel de iluminación de 1 57,87
luminosidad
una estancia.
24

Módulo Dimmer Universal


para regulación de
Módulo Dimmer circuitos de iluminación
1 475,22
universal para cualquier tipo de
carga.

Módulo dimmer 4 canales,


Módulo Dimmer de regula 4 circuitos de carga
- 1 782,89
4 Canales independientes entre sí.
Permite la transmisión de
Módulo terminador datos de manera fiable y
sin errores. 1 68,82
de red

Detector pasivo de
infrarrojos con
Detector de alimentación a 24 V c.c.
infrarrojos pasivo desde la fuente, ángulo 1 115,57
PIR de cobertura 110 vertical
y 80 horizontal, alcance
de 6 a 8m.
Detector crepuscular con
alimentación a 24V c.c.
Detector desde la fuente, regulable
1 137,11
crepuscular de 5 a 100 lux con led
indicador de contacto
cerrado.

Protocolo de
Software de comunicaciones, software
instalación SIMON y sistema operativo 1 765,12
Vit@ común para la tecnología
Lonworks.

Software formación Software de programación


1 467,50
SIMON Vit@ con 64 créditos

Módulo Conexión a PC:


Módulo conexión a conexión al bus de datos
PC a través del PC mediante
1 619,72
puerto USB.
25

Conexión al bus de datos,


conexión a la red LAN a
través de un puerto
Interfaz de
Ethernet; se utiliza para 627,79
conexión remota
acceder de forma remota
a instalaciones sobre bus
SimonVIT@.

Kit de control de
El kit controla los
acceso autónomo
accesos utilizando tarjetas 240,04
por tarjeta
RFID.
RFID

Registro de usuarios,
restricción de acceso,
posibilidad de control y
Lector biométrico y
monitorización a través de
RFID. Incluye 843,43
Internet. Combina el
Software
acceso con cámaras de
seguridad y ahorro
energético.

Terminal de bloqueo.
Simétrico.
Abre puertas Funcionamiento normal o
1 28,79
eléctrico 12 Vdc autónomo.
Funcionamiento normal o
invertido.

Tiene la función de un
Controlador de lector de control de
1 739,81
puerta 2 relés acceso o de un interruptor
de llave.
Fuente de alimentación
switching 12VDC - 2A
Fuente de Ideal para Alimentar
alimentación 12 Varias Cámaras ( Según 1 58,02
Vdc 2A Modelo) o Cámaras con
Movimiento

Pack 10 tarjetas RFID


Pack 10 tarjetas
para sistema de control 1 50,96
RFID
de acceso en red
26

Movilidad en los 3 ejes


Cámara Domo
que permite orientar el 1 89,65
Día/Noche con IR
visor a cualquier objetivo.

Sensor CMOS de 2-
megapixel
Cámara Domo Filtro de corte IR con
Día/Noche función Día / Noche,
recorte de vídeo para 1 207,32
Antivandálica
Exterior IP66 ahorrar ancho de banda,
detección de
manipulación y sabotaje

Juego 4
Juego de 4 Conectores
Conectores DC 1 13,85
para alimentación DC
alimentación

Alimentador de Alimentador para cámaras


1 18,49
cámaras SIMON.

Monitor profesional de
Monitor de video alto rendimiento, especial
vigilancia para funcionar de forma 1 516,90
profesional ininterrumpida.

Tabla # 3 Precios de productos SimonVis.

A continuación se presenta algunos de los módulos que ofrece

Domobak:

ARTÍCULO MODELO DESCRIPCIÓN CANTIDAD COSTO

Switchlinc-
Interruptor dimmer para
INSTEON
aumentar o disminuir la luz de 1 59,99
Dimmer (Dual-
un espacio.
Band)
27

Switchlinc Interruptor para encender o


INSTEON apagar la luz de un espacio no
1 54,99
Relay (Dual- dimerizable o artefactos
Band) eléctricos.
INSTEON HUB Configuración de horarios ,
Cerebro de escenas, se lo controla 1 129,99
Toda la casa mediante smartphones

INSTEON Micro Automatiza lo que el usuario


1 49,99
On/Off Module desee.

Módulo para controlar


Micro motores. Especial para
Open/Close instalarlo “in situ”, 1 50
control module conjuntamente con las cortinas
y la motorización de toldos.
Modulo Universal IOLinc para
I/O Linc Contact
automatizar la puerta eléctrica
Closure 1 45,99
o cargas más fuertes, e
Interface
integrarlas al sistema.
Funciona con smartphones y
Cámara IP equipos móviles. Amplio rango
Inalámbrica de movimientos con 300° pan 1 79,9
Blanca y 120° tilt (pan: mov.
horizontal, tilt: mov. vertical).

El NXS - MHS acomoda una


Controladores
tarjeta y se completa con
NetLinx NX 1 49,32
Integrados placas frontales para el
Maestro y el Hub

El NXS - NMS es una opción


sencilla y económica para la
NXS-NMS integración de una 1 59,99
funcionalidad adicional en los
sistemas de control.

Los LED emiten una señal de


advertencia por un minuto
Controles de
cuando las luces o un 1 50,4
iluminación
ventilador están a punto de
apagarse.
28

Pico Wireless Ajuste de luces desde


Control & cualquier lugar en un espacio 1 56
Pedestal con control inalámbrico Pico.

La ENV- VST -C es un
termostato de comunicación
programable para la
programación automática de 1 400,25
ENV-VST-C
la temperatura y los ajustes de
humedad relativa y la
protección en corte de luz.

NMX-VCC-
1000-WM La cámara Sereno puede ser
Sereno™ montado en variedad de 1 163
Camera Wall superficies.
Mount

Se apaga automáticamente
después de que se detenga el
Motion sensor 1 34,99
movimiento (ajustable entre 30
segundos y 2 horas)

INSTEON 2672-
222 LED Bulb, Bombilla regulable en red. 1 29,99
8-wat
Tabla # 4 Precios de productos Domobak.

Software MHVisual de Bticino $ 879


Software formación y software de instalación SIMON
$ 1232.62
Vit@
Tabla # 5 Costos de software de empresas

En tecnología no se puede comparar con la marca Bticino conociendo

que los costos de adquisición de sus módulos son muy elevados, en el


29

mercado hay módulos similares; la diferencia está en el tiempo de vida

útil, la calidad de los mismos y las certificaciones que poseen.

3.2 ESTUDIOS DE CAMPOS DE INSTALACIONES DOMÓTICAS

Se presenta a continuación el plano eléctrico 12 de la vivienda con la

incorporación de la distribución domótica:

Fig. 3.1 Plano eléctrico-domótico planta alta

12
Véase los anexos ya que se adjunta el plano en formato A3 para las figuras 3.1 y 3.2.
30

Fig. 3.2 Plano eléctrico-domótico planta baja


31

3.3 DESCRIPCIÓN DE LOS DISPOSITIVOS A UTILIZAR

Se presenta a continuación la tabla con los módulos a considerar para

el sistema domótico, es importante analizar la fuente de alimentación

para cada módulo ya que se puede requerir adaptadores o de ser

necesario la alimentación directa.

Se ha considerado la potencia de cada módulo para estimar el

amperaje necesario que la fuente de alimentación debe suplir.

Corrie
Corrie nte
Volta nte Nomin
Nombre Función
je [V] Inicial al con
[A] Carga
[A]
Movimiento de apertura de la puerta del
Servomotor 5 0,13 0,075
hogar
Arduino -
9 0,05 Módulo de control de la tira de LEDS
Pololu
Arduino-
9 0,13 Lector de la tarjeta magnética
NFC
Tira de
5 0,05 0,7 Tira de LEDS para a ambientación
LEDS
7805 12 0,18 Reductor de voltaje para los Arduinos
Arduino
5 0,3 Procesador central
Mega
Placa
5 0,055 Módulo que puede dimerizar 11 LEDS
Dimmer
Placa Módulo de control de apertura de 5
5 0,38
Relay LEDS y el riego
Placa PIC 5 0,003 Módulo de control de persianas
32

Motor de Motor que permite el movimiento de


5 0,16
Paso persiana y garaje
Total 0,18 2,033
Tabla # 6 Descripción de los módulos
CAPÍTULO 4

ANÁLISIS Y DISEÑOS DE LA MAQUETA

4.1 PLANOS DE LA VIVIENDA

El modelo de la vivienda fue tomada de una residencia ya edificada,

fue considerada por cómo está estructurada; es decir, los grandes

ventanales que posee facilitan la demostración del sistema domótico

con respecto a las persianas. Los detalles de cómo ha sido construida

las escaleras hace posible la visualización del sistema de

ambientación.

Toda la residencia presenta ventanales lo que permite la demostración

del sistema de luces y el diseño a la entrada de la vivienda nos facilita


34

la incorporación del sistema de seguridad y realizar las

demostraciones respectivas.

Cabe indicar que la edificación de ésta vivienda (maqueta), hace

posible que todo el sistema domótico sea demostrativo y se puede

seguir manipulándola para fines didácticos.

A continuación se presenta las perspectivas de la vivienda real y los

planos:

Fig. 4.1 Vista frontal sur


35

Fig. 4.2 Vista lateral sur

Fig. 4.3 Perspectiva oeste

Fig. 4.4 Perspectiva este


36

Fig. 4.5 Plano de la planta baja


37

Fig. 4.6 Plano de la planta alta


38

4.2 PLANO ELÉCTRICO

Fig. 4.7 Plano eléctrico de la planta baja


39

Fig. 4.8 Plano eléctrico de la planta alta


40

Fig. 4.9 Simbología usada en los planos eléctrico

4.3 PLANOS DE UBICACIÓN DE LOS DISPOSITIVOS

Se presenta en la página siguiente el plano de ubicación de los

componentes que fueron usados para domotizar la maqueta.


41

Fig. 4.10 Plano del sistema domótico planta baja


42

Fig. 4.11 Plano del sistema domótico planta alta.


43

Fig. 4.12 Simbología empleada para el sistema domótico


CAPÍTULO 5

PROGRAMACIÓN DE LAS GESTIONES DOMÓTICAS EN


LABVIEW

5.1 SISTEMAS DE CONTROL DE ILUMINACIÓN

5.1.1 ESCENARIO POR PRESENCIA

Previo a la programación se ha analizado los espacios más habituales

dentro de la vivienda por tal motivo se ha incorporado tres escenarios

los cuales incluyen lo siguiente:

Escenario 1: luminaria del comedor, luminaria del pasillo de la planta

baja y alta, luminaria del dormitorio general.


45

Escenario 2: luminaria de garaje, cocina, planta baja y alta, luminaria

del estudio y dormitorio general.

Escenario 3: incluye la ambientación y persianas.

A continuación en la Fig. 5.1 se presenta el panel frontal del sistema,

en los cuales se visualiza el control por escenario:

Fig. 5.1 Panel frontal del control por escenario

Para una mejor visualización se ha incorporado las capturas de los

planos de distribución de la vivienda. Tanto la planta baja como la alta


46

presenta indicadores (LEDS) con los que se puede vigilar y asegurar

que el escenario seleccionado haya sido activado.

Los led indicadores de cocina, estudio, garaje y riego visualizados en

el panel frontal tienen salida a relays permitiendo el control y a la vez

la energización de las luminarias; los demás LEDS indicadores

presentan salidas de PWM que han sido establecidos al valor de 250

(unidad de 8 bits de 0 a 255 valor decimal) al ser activados.

Como se ha integrado todas las programaciones al sistema domótico

general se presentará solo los códigos que corresponden a cada

subsistema para una mejor comprensión y desglose de los mismos.

En la Fig. 5.2 se aprecia la programación realizada para el control de

escenarios.

Observando la imagen podremos identificar los push button con los

nombres Escenario#1, Escenario#2 y Escenario#3; los cuales

activarán a cada distribución de LEDS asignada.


47

Fig. 5.2 Programación del sistema de escenario

Si analizamos la distribución correspondiente a Escenario# 1 se

observa que al activar el push button, se encienden los LEDS de

planta baja, dormitorio general, planta alta y comedor. Al ser activados

éstos y usando el comando de variable local se asigna a la salida de


48

los pines el valor máximo PWM que es 255 de acuerdo al número de

pin asignado.

Fig. 5.3 Escenario#1 uso de variable local

Enfocándonos solo en las variables locales comedor y dormitorio

general de la Fig. 5.3 podemos comprender que al estar en estado

ON, se enviará el valor máximo PWM a la salida del puerto digital que

será en los pines 6 y 7.

Se cumple lo anteriormente descrito siempre y cuando no se haya

usado el slide para dimerización el cual manipula la señal PWM

controlando la intensidad luminosa y no se haya activado la rutina de

seguridad; la cual impide la activación de cualquier escenario.


49

La programación será exactamente igual para el control de los pasillos

de la planta alta y baja, la diferencia está en que al activar la rutina de

seguridad los LEDS indicadores que se encuentran en la sección

manual son bloqueados; impidiendo su ejecución.

Fig. 5.4 Escenario#1 variable local de planta baja y alta

Las luminarias de los pasillos de la planta alta y baja se han

establecido en los códigos posteriores para que funcionen mediante

dimerización y control lumínico, por tal motivo para que los escenarios
50

y las variables locales se ejecuten; se envía el valor de 250 al

controlador PWM del Arduino como se puede apreciar en la Fig. 5.4.

Si otra programación (dimmer y lumínico) le envía otro valor los datos

son sumados y el resultado es comparado, si el valor se excede de

250 el selector lo setea a 250 para el PWM; y, de esta manera ningún

control presenta fallas y se ejecuta el correcto funcionamiento.

Analizando la Fig. 5.5, en el escenario 2 existe dos consideraciones:

en la primera se ha añadido el shift register con la finalidad de ejercer

un control durante el encendido de los LEDS de manera pausada y

secuencial haciendo uso de dos case y de bloques comparadores. En

la segunda consideración los valores que el shift register presente

serán decrementados dentro de la estructura case con la finalidad de

dar inicio al apagado de LEDS de manera ordenada y secuencial.

Fig. 5.5 Escenario#2 secuencia de encendido- garaje


51

Fig. 5.6 Escenario#2 secuencia de encendido- cocina

A continuación se presenta la secuencia de apagado:

Fig. 5.7 Escenario#2 secuencia de apagado- dormitorio

Dentro del primer case se ha establecido limites numéricos para el

shift register siendo el número máximo el siete como se visualiza en la


52

Fig. 5.6, de esta manera se establece seis secuencias en el case

interno y el último número corresponde al estado vacío; el cual al no

presentar código preguntará constantemente por el estado del push

button escenario#2 para dar inicio a la secuencia de apagado.

Si asumimos por un instante que el valor del shift register es siete, al

ejecutarse la división para uno tenemos un residuo de cero; esto

permitirá que el valor del registro sea decrementado en uno teniendo

como resultado el seis y de esta manera se permite la secuencia de

apagado del escenario dos; como se aprecia en la Fig. 5.7.

Fig. 5.8 Escenario#2 secuencia de apagado- estudio

La programación del escenario tres incluye el control sobre la

ambientación y las persianas. En el caso de ambientación se ha


53

distribuido para que tanto la planta baja como alta presenten la

secuencia de juegos de luces y la variable local ambientación activará

la secuencia en el pin correspondiente; véase la Fig. 5.9 y 5.10.

Fig. 5.9 Escenario#3 ambientación y persiana

Fig. 5.10 Programación de ambientación-escenario 3


54

Hay que indicar que mientras esté activada la rutina de seguridad

ningún escenario se ejecutará y se lo puede visualizar en la Fig. 5.11.

De una manera muy similar se realiza el control sobre las persianas,

es decir si la variable local Persiana es true, enviará un valor lógico 1 a

la salida de los pines 28, 29, 30 y 31.

Fig. 5.11 Programación de persiana-escenario 3


55

5.1.2 DIMERIZACIÓN POR AMBIENTE

Fig. 5.12 Control programable del sistema de iluminación

En la Fig. 5.12 se puede apreciar que existen tres tipos de controles,

el primero es el lumínico, el segundo es controlado por la hora del

sistema dejando a disposición del usuario el uso del mismo y el

tercero es el control de ambientación.

Previo a introducirnos a la programación del primer control debemos

conocer los conceptos básicos para el funcionamiento del mismo.


56

Los interruptores lumínicos encienden y apagan la luminaria en

función del valor de luminosidad que se haya ajustado, es decir

cuando el dispositivo detecte que no hay luz solar suficiente se

encenderá la bombilla instantáneamente.

El dimmer es un regulador o atenuador de la energía variando la

intensidad de luz que emite cierta luminaria.

El LDR es un fotoresistor es decir varia su resistencia en función de la

intensidad lumínica, cuando hay incidencia de luz el valor de

resistencia puede oscilar entre los 50 a 1000 ohmnios y de 50k a

varios mega ohmnios cuando está a oscuras.

Teniendo bajo consideración los conceptos mencionados se ha

programado de tal manera que el control con sensor lumínico permita

dimerizar las luminarias de los pasillos a determinada hora y

oscuridad.

Debido a que la programación es extensa y para una mejor

comprensión y visualización se ha optado por presentar el código

seccionado; es decir, el código correspondiente por pasillo.


57

Fig. 5.13 Control del sensor lumínico pasillo 1


58

Fig. 5.14 Control del sensor lumínico pasillo 2

Para poder comprender esta programación necesitaremos desglosar

el mismo, el primer análisis que se hará es al sensor de luz o LDR y

los rangos programados para que se ejecute el control,

consecutivamente se estudiará el control de hora y la afectación que

ejerce al sistema y finalmente se comprenderá la función de las

botoneras o push button.


59

Los dos sensores resistivos luminicos LDR estan conectados a los

pines análogos cero y uno de la tarjeta Arduino mega, los valores

receptados del LDR estan entre 0 y 5 ya que cuando hay mayor

presencia de luz la resistencia disminuye y el valor de voltaje es

cercano a cero, mientras cuando se está en oscuridad la resistencia

es alta y el valor de voltaje medido es alto dependiendo del valor del

voltaje de alimentación.

Fig. 5.15 Control del LDR

Cuando el valor sensado del LDR es menor a 2, se manda un cero a

la salida de PWM, sucede lo contrario si el valor sensado esta entre 3

y 2 ya que de cumplirse esa condicion se enviará el valor de 80 y para

valores mayores a 3 se manda el valor de 250 a la salida del pin

digital, como se puede apreciar en la Fig. 5.15.


60

Fig. 5.16 Control de horas para el sensor

Para poder ejercer un correcto control de horas, se ha tomado la hora

del sistema de la computadora como se indica en la figura 5.16

utilizando los bloques get date/time in seconds, format date/time string;

con el string subset se situa la longitud numérica en dos para obtener

solo los valores de hora sin considerar minutos ni segundos.

El bloque decimal string to number convierte el dato obtenido en string

a número, dicho valor es comparado y solo enviará un true el bloque

and cuando tal valor esté dentro del rango de 7 a 23 horas.

Si el control de horas se cumple, es decir esta dentro de los límites de

tiempo, y si sensor LDR envia el dato indicando que es mayor a 3,

solo se activarán las luminarias si el pulsador o push button ON/OFF

ha sido activado como se puede apreciar en la Fig. 5.17.


61

Fig. 5.17 Control del pulsador ON/OFF

Adicional del control lumínico se ha dimerizado la sala, el comedor y el

pasillo de la planta baja; cuyos controles están situados en la sección

manual del sistema.

Fig. 5.18 Control manual planta baja del panel frontal


62

Fig. 5.19 Control programable y dimmer para la sala

En la Fig. 5.19 podemos visualizar la programación para dimerizar la

sala que está de color naranja, el slide con nombre de sala es

conectado a un bloque multiplicador ya que el valor máximo presente

en el slide es 100, se puede apreciar la Fig. 5.20.


63

Dicho valor es multiplicado por 2.5 ya que el valor máximo de PWM

fue establecido a 250, y el resultado del bloque multiplicador pasa por

el bloque round to nearest para ser redondeado al entero mas cercano

y solo se escribirá ese resultado en el pin asignado si el valor de PWM

es mayor a 25.

La misma programación descrita en los párrafos anteriores se aplica

para ejercer el control de dimmerización para el comedor, pasillo de

planta baja y alta, dormitorio principal y secundario; hay que tener en

consideración que el codigo adicional corresponde a otro control que

será explicado más adelante.

Fig. 5.20 Control manual planta alta del panel frontal


64

5.1.3 CONTROL POR TIEMPO

En la Fig. 5.12 se puede apreciar que existe un segmento en el panel

que dice control de escenario programable, el objetivo de este control

es que sea manipulado por el usuario a conveniencia; es decir, el

usuario podra disponer del tiempo de duración de encendido de cierta

luminaria o de todas las luminarias de la vivienda.

La ventaja de esta programación es que; mientras se encuentre la

botonera activa en estado On, funcionará el control todos los dias sin

tener que realizar comparaciónes de meses o dias.

Fig. 5.21 Control programable


65

Fig. 5. 22 Control de encendido de luminarias por tiempo

Las variables locales Cocina, Comedor, Dormitorio General que están

conectadas a las puertas lógicas or corresponden a los controles de

escenario y manual del sistema; los mismos que seran detallados en

las secciones correspondientes a cada control.


66

Para una mejor comprensión del código se tomará una muestra de la

programación, es decir se analizará el control de la sala como se

aprecia en la Fig. 5.22 ya que también está asociado al control por

dimerización a excepción del control para la cocina.

Si por un instante asumimos que el ususario programe el encendido a

las 18:00 pm y el apagado esté en las 05:00 am, siendo la hora del

sistema las 17:59 pm; esto significa que dentro de un minuto se

encenderá el led asignado a la sala ya que el bloque in range and

coerse enviará una señal true si la hora del sistema esta dentro del

rango asignado.

En el caso de que el bloque envie una señal true, además de

encenderse los LEDS, se convertirá el dato de boolean a numérico

siendo éste el valor de uno.

Si el push button activa es presionado es decir es activado, permitirá

que se ejecute la comparación entre el dato convertido y el valor

numérico uno; y, al ser verdadera la condición se escribirá el valor de

250 a la salida del pin PWM correspondiente.


67

La programación adicional no la analizaremos puesto que corresponde

al control por dimerización, tal programación ya fue explicada

anteriormente.

Si analizamos la programación realizada para el control de la cocina,

determinaremos que no está asociado a algún control dimerizable, por

tal razón solo se envía el valor numérico de uno a la salida del pin 23;

como se ve en la figura 5.23.

Fig. 5.23 Control programable para la cocina

Hay que considerar que la rutina de seguridad afecta al

funcionamiento de todo el sistema; por tal motivo si éste estuviese

activado no se ejecutará ningún control programable para luminarias.


68

5.1.4 CONTROL MANUAL

Esta sección fue creada bajo la consideración de que si el usuario por

algún motivo no desee los controles anteriormente expuestos como el

programable o los escenarios, pueda encender las luminarias sin

complicación alguna manipulando botoneras y los controles para la

dimerización.

En la Fig. 5.20 podemos observar que hay sliders para la dimerización

y push buttons para una sencilla activación; y en la Fig. 5.24 se

aprecia que no se ejerce ningún tipo de control para los push button y

solo se enviará un uno digital a la salida del pin correspondiente.

Fig. 5.24 Control manual diagrama de bloques.


69

De manera similar se realizó la programación para la planta alta,


teniendo las mismas consideraciones para los sliders y push button
como anteriormente se explicó.

Fig. 5.25 Programación para control manual planta alta


70

Los slider de dormitorio principal y de dormitorio secundario al ser

manipulados activarán los indicadores dp1, dp2, ds1 y ds2

dependiendo de los valores que se manipulen; aumentará o disminuirá

la intensidad luminosa del led; y se escribirán a la salida PWM digital

de los pines 7 y 8 del Arduino mega, se puede apreciar la

programación realizada en la Fig. 5.25.

5.1.5 AMBIENTACIÓN

Previamente para que la tira de led funcione de acuerdo a las

condiciones establecidas; se programó en el microcontrolador atmega

328 del Arduino uno para que exista 2 opciones de ambientación.

La opción uno quedo establecida para que el color que el rgb

presentará sea el cian y sea aplicado a los 60 LEDS presentes en la

tira.

La opción dos fue establecida para que exista un juego de colores, es

decir la tira de LEDS presentará el color rojo, morado y azul; y, cada

color tendra un determinado tiempo de duración; además de

ejecutarse la secuencia hasta que el usuario desactive el push button

programado en Labview.
71

Se presenta a continuación la programación realizada en el ide de

Arduino para una mejor comprensión.


72
73

Fig. 5.26 Código ambientación en IDE Arduino

Fig. 5.27 Controles para ambientación

En la Fig. 5.27 se puede apeciar los controles establecidos para la

ambientación, cada push button activará cierta secuencia de luces las

cuales ya fueron descritas anteriormente.


74

Fig. 5.28 Control programable de ambientación

5.2 SISTEMAS DE PERSIANAS

Toda vivienda cuenta con al menos tres ventanales y para

demostración en la maqueta se ha optado por controlar las persianas

de los ventanales de la planta baja y alta siendo en total cuatro, los

mismos seran visualizados en el panel frontal como se indica en la

Fig. 5.18 y 5.20.

Cabe indicar que la programación para el control de los motores para

las persianas fue realizado en el PIC16F887 y solo se programó la

activación en Labview.
75

Para comprender a totalidad este sistema es necesario incluir la

programación realizada en el lenguaje c del mikroBASIC PRO for pic

tal como se presenta a continuación:

const valor as byte[8] = (0x08,0x0C,0x04,0x06,0x02,0x03,0x01,0x09)


'arreglo para la secuencia de giro horario
'numero de vueltas completas que giran los motores de paso para el control de
persianas
const giro1 as word = 2
const giro2 as word = 2
const giro3 as word = 2
const pasos as word = 8 'numero de pasos de motor 28byg
const vuelta as word = 512 'cálculo de un vuelta completo

'variable para el control de pasos completos a realizar para las persianas


DIM mover1 AS INTEGER
DIM mover2 AS INTEGER
DIM mover3 AS INTEGER

'variable para el control de pasos del motor 1


DIM mod1 AS INTEGER
DIM mod2 AS INTEGER
DIM mod3 AS INTEGER

'creación de variables a operación numéricos


DIM STEPA AS INTEGER
DIM TURNA AS INTEGER
DIM STEPB AS INTEGER
DIM TURNB AS INTEGER
DIM STEPC AS INTEGER
DIM TURNC AS INTEGER
DIM STEPD AS INTEGER
DIM TURND AS INTEGER

'Declaración de los bits para las banderas de los motores de paso


DIM servo1 as bit
DIM servo2 as bit
DIM servo3 as bit

'Seteo de los puertos I/O (entradas y salidas del PIC)


76

TRISA=%11111111 ' 1 entrada


TRISB=%00000000 ' 0 salida
TRISC=%00000000 ' 0 salida
TRISD=%00000000 ' 0 salida
TRISE=%00000000 ' 0 salida

‘Detalles de los puertos de Entrada sean analógicos


ANSEL=%00000000
ANSELH=%00000000
ADCON1 = 0x0F
OSCCON = 0x65
OPTION_REG = %10000110
Delay_ms(50)
main:
' Main program
STEPB = 0
STEPC = 0
STEPD = 0
‘Contador de pasos y vueltas de los motores de paso
mover1 = vuelta * pasos * giro1
mover2 = vuelta * pasos * giro2
mover3 = vuelta * pasos * giro3

while(1) ' programa principal de control de motores de pasos


if(PORTA.B0)then
‘sistema de reinicio; cuando pin es 1 se resetea STEPS a 0 y paraliza la acción de los
siguientes puertos de control
if(STEPB > 0)then
STEPB = STEPB - 1
end if
if(STEPC > 0)then
STEPC = STEPC -1
end if
if(STEPD > 0)then
STEPD = STEPD -1
end if
servo1 = 0
servo2 = 0
servo3 = 0
else
if(PORTA.B1)then
‘puerto de activación del 1 motor de paso llamado servo cuando llegan al máximo
se auto detiene
servo1 = 1
else
77

if(STEPB >= mover1)then


servo1 = 0
end if
end if
if(PORTA.B2)then
servo2 = 1
else
if(STEPC >= mover2)then
servo2 = 0
end if
end if

if(PORTA.B3)then
servo3 = 1
else
if(STEPD >= mover3)then
servo3 = 0
end if
end if
'sistema sumador y restador para escribir los movimientos de los motores de paso
if(servo1)then
if (STEPB >= mover1 )then
STEPB = mover1
else
STEPB = STEPB + 1
end if
else
if(STEPB > 0)then
STEPB = STEPB - 1
end if
end if
if(servo2)then
if (STEPC >= mover2 )then
STEPC = mover2
else
STEPC = STEPC + 1
end if
else
if(STEPC > 0)then
STEPC = STEPC - 1
end if
end if
if(servo3)then
if (STEPD >= mover3 )then
STEPD = mover3
78

else
STEPD = STEPD + 1
end if
else
if(STEPD > 0)then
STEPD = STEPD - 1
end if
end if
end if
'Sistema de colocador del puerto B, C y D el control de motor de pasos
'Con su sistema de terminación en los extremos
if(STEPB >= mover1)then
mod1 = 0
PORTB = 0x00
else
if(STEPB <= 0)then
mod1 = 0
PORTB = 0X00
else
mod1 = ( STEPB )mod( pasos )
PORTB = valor[mod1]
end if
end if
if(STEPC >= mover2)then
mod2 = 0
PORTC = 0X00
else
if(STEPC <= 0)then
mod2 = 0
PORTC = 0X00
else
mod2 = ( STEPC )mod( pasos )
PORTC = valor[mod2]
end if
end if
if(STEPD >= mover3)then
mod3 = 0
PORTD = 0X00
else
if(STEPD <= 0)then
mod3 = 0
PORTD = 0X00
else
mod3 = ( STEPD )mod( pasos )
PORTD = valor[mod3]
79

end if
end if
‘Retardo de 1 ms de cada paso
delay_ms(1)
end
end

Cada sección del código c fue documentado para un mejor análisis; y,

los cuatro pines del puerto B, C y D van conectados al ULN 2003APG

el cual actúa como un módulo de fuerza para emitir una secuencia y

girar los motores13.

Los pines digitales del Arduino mega van conectados a los del puerto

A del PIC16F887 y la programación en Labview controla el

accionamiento del sistema de persianas ya que está conectado al

Arduino mega.

La botonera o push button programada en Labview enviará un alto o

bajo a la salida de los pines digitales, tal pin estará conectado al

microcontrolador correspondiente permitiendo la activación o no del

sistema. Si observamos el panel frontal en la sección manual como

indica la Fig. 5.29, podremos notar que cada piso de la vivienda

cuenta con su push button para controlar las persianas.

13
Se usa el stepper motor 28BYJ-48, para comprender mejor el funcionamiento del mismo véase el
datasheet que se ha adjuntado en los anexos.
80

Fig. 5.29 Control del sistema de persiana

Si se presiona el push button Persianas correspondiente a la planta

baja, se encenderán los LEDS per1 y per2; y, se enviará un uno digital

a la salida de los pines 6 y 7. El comportamiento es similar si

presionamos el push button correspondiente a la planta alta, ya que se

encienden los LEDS per3 y per4; y, adicionalmente se envía un uno

digital a la salida de los pines 4 y 5.


81

5.3 SISTEMA DE SEGURIDAD

5.3.1 MEMORIAS DE RUTINA PARA SIMULAR PRESENCIA DE UNA


PERSONA EN LA CASA

Fig. 5.30 Indicadores string–rutina de seguridad

En la Fig. 5.1 de la sección correspondiente a los escenarios del panel

frontal, se encuentra los indicadores string y led para la rutina de

seguridad, tal indicador string mostrará No Activado si la variable local

Rutina de Seguridad no ha sido activada, caso contrario se presentará

un detalle de lo que estará activo mientras se encuentre operando la

rutina, véase la Fig. 5.30.


82

Fig. 5.31 Programación rutina de seguridad


83

La Fig. 5.31 detalla la programación para el funcionamiento de la

rutina, y se puede apreciar cómo afecta al funcionamiento del control

programable y dimerizable ya que solo se ejecutarán si la seguridad

no es activada.

Las únicas programaciones que no son afectadas por la rutina es el

reconocimiento de voz, control con tarjeta magnética, cámara de

seguridad, sistema de control para garaje y riego; por evidentes

razones no se puede permitir que la rutina ejerza control sobre lo

anteriormente mencionado ya que es necesario que estén

funcionando al momento de que el usuario decida ingresar a la

vivienda, guardar el vehículo y asegurarse que el jardín se encuentre

en buen estado.

La rutina de seguridad permite que se encienda la luminaria de la sala

por un lapso de tiempo de 2 horas es decir desde las 18:00 pm hasta

las 20:00 pm, la luminaria del pasillo de la planta baja se encenderá

desde las 18:00 pm hasta las 22:00 pm y la del dormitorio principal se

encenderá desde las 21:00 pm hasta las 23:00 pm inhabilitando todos

los controles anteriormente programados; y, se ha configurado de esa

manera porque es el patrón de evento más común en toda vivienda.


84

5.3.2 SISTEMA POR VOZ Y TARJETA PARA PUERTA

Antes de analizar la programación en Labview hay que considerar que

para manipular la tarjeta NFC shield v1.6 se la programó en el entorno

de Arduino, y de la misma manera para poder realizar el

reconocimiento de voz la programación principal tuvo que realizarse

en el ide de Arduino.

En Labview se ejecuta el control para los dos modulos permitiendo al

usuario manipular la activación de los mismos, y a la vez ambos

controles estan vinculados con la captura de imágenes usando la

cámara digital. Ya que ambos módulos estan asociados con el

funcionamiento de la cámara, analizaremos la programación de la

captura de imágenes.

Fig. 5.32 Programación de captura de imagen


85

En la Fig. 5.32 se puede ver que se selecciona la cámara instalada

con el bloque sesion in; mientras que con los bloques IMAQdx open

camera e IMAXdx configure grab se inicia sesion con la cámara

seleccionada y comienza la configuración para la grabación.

Con el IMAQ create se crea una localización temporal de memoria

para las imágenes y con el bloque IMAQdx grab se puede visualizar la

imagen cuando se haya conectado el bloque image display a image

out del imaqdx grab cuyo tipo de dato sera rgb unsigned long de 32

bytes.

Se realizará la captura y se guardará en una dirección siempre y

cuando se tenga un alto o higth al identificar la tarjeta magnética o

cuando se haya reconocido la voz.

Se guarda un máximo de dos capturas por segundo en la dirección

establecida en las constantes string y para evitar que se sobreescriba

la captura se ha añadido el format date/time string con la finalidad de

que se guarde la imagen bajo el nombre de la hora, minutos,

segundos, dia, mes y año del sistema con formato (.jpg).


86

Al final se cierra la grabación y se da el tratamiento de errores para

evitar afectaciones al sistema domótico como se indica en la Fig. 5.33.

Fig. 5.33 Programación de cierre de captura de imagen

Antes de continuar con la programación en Labview para los controles

de los módulos, es necesario incluir la programación realizada en el

ide de Arduino, tal programación hace posible el funcionamiento de

todo el sistema de seguridad.

El código que se presentará a continuación corresponde al easyvr 2.0

siendo el siguiente:

// Declaración de las librerías del Arduino, comunicación serial, control de puertos y


pines

#if defined(ARDUINO) && ARDUINO >= 100


#include "Arduino.h"
#include "SoftwareSerial.h"
SoftwareSerial port(12,13);

#else // Arduino 0022 - use modified NewSoftSerial


87

#include "WProgram.h"
#include "NewSoftSerial.h"
NewSoftSerial port(12,13);
#endif

// Añadimos las librerías descargables de EasyVR para acoplar al ARDUINO y logre


una comunicación con el MEGA 2560
#include "EasyVR.h"
#define SND_Access_denied 1
#define SND_Access_granted 2
#define SND_Hello 3
#define SND_Please_repeat 4
#define SND_Please_say_your_password 5
#define SND_Please_talk_louder 6

// Declaración de los puertos a easyVR y logre una comunicación UART

EasyVR easyvr(port);
EasyVRBridge bridge;

// Declaración de las variables para la comunicación de datos del easyVR y Arduino

uint32_t mask = 0;
int8_t group = 0;
uint8_t train = 0;
char name[32];
// Declaración de pin 8 como salida digital para la integración con el Arduino mega

int led = 8;
void setup()
{
// bridge mode?

pinMode(led,OUTPUT); // el pin 8 ( led ) una salida digital

// Preparación del puente de comunicación de ARDUINO con el easyVR usando los


pines 0 1 12 y 13

if (bridge.check())
{
cli();
bridge.loop(0, 1, 12, 13);
}
// Declaración del tiempo serial de comunicación de 9600 bps

Serial.begin(9600);
port.begin(9600);
88

digitalWrite(led,LOW);

// Programación para detector el easyVR y poder realizar la programación deseada


para el reconocimiento de VOZ

if (!easyvr.detect())
{
Serial.println("EasyVR not detected!");
for (;;);
}
easyvr.setPinOutput(EasyVR::IO1, LOW);

//Una vez el easyVR se ha detectado se programa el lenguaje a ESPAÑOL

Serial.println("EasyVR detected!");
easyvr.setTimeout(5);
easyvr.setLanguage(EasyVR::SPANISH);
int16_t count = 0;

//Se realiza en enlace de la memoria del EASYVR para grupo de palabras grabadas
con sus respectivas voces para utilizar como la palabra ABRIR y con su clave SOL

if (easyvr.getGroupMask(mask)) // get trained user names and passwords


{
uint32_t msk = mask;
for (group = 0; group <= EasyVR::PASSWORD; ++group, msk >>= 1)
{
if (!(msk & 1)) continue;
if (group == EasyVR::TRIGGER) // Busca las palabras del Grupo 1 como ABRIR
Serial.print("Trigger: ");
else if (group == EasyVR::PASSWORD) // Busca la palabra del PASSWORD o
Contraseña NOW
Serial.print("Password: ");
else
{
Serial.print("Group ");
Serial.print(group);
Serial.print(": ");
}
count = easyvr.getCommandCount(group);
Serial.println(count);
for (int8_t idx = 0; idx < count; ++idx)
{
if (easyvr.dumpCommand(group, idx, name, train))
{
Serial.print(idx);
89

Serial.print(" = ");
Serial.print(name);
Serial.print(", Trained ");
Serial.print(train, DEC);
if (!easyvr.isConflict())
Serial.println(" times, OK");
else
{
// Añade en código de 8 bits la palabra obtenida

int8_t confl = easyvr.getWord();


if (confl >= 0)
Serial.print(" times, Similar to Word ");
else
{
confl = easyvr.getCommand();
Serial.print(" times, Similar to Command ");
}
Serial.println(confl);
}
}
}
}
}
easyvr.setLevel(EasyVR::HARDER);
easyvr.playSound(SND_Hello, EasyVR::VOL_FULL);
}

// Programación sin fin del control de VOZ

void loop()
{
// Declaración de las variables principales

int idx_cmd;
int idx_pwd;

// easy empieza a escuchar con su led integrado en ON

easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)

// easy VR esperando la palabra del grupo 1 ABRIR

Serial.println("Say a name in Group 1");


easyvr.recognizeCommand(1); // recognise command in group 1
// Se ha reconocido la palabra del Grupo 1
90

while (!easyvr.hasFinished()); // wait for user name


easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off
// easyVR terminado de escuchar con su led integrado en OFF

idx_cmd = easyvr.getCommand(); // get recognised user name


if (idx_cmd >= 0)
{
Serial.print("Name: ");
if (easyvr.dumpCommand(1, idx_cmd, name, train))
Serial.println(name);
else
Serial.println();

// Una vez realizado el paso anterior se emitirá un sonido y se prepara el password o


contraseña

easyvr.playSound(SND_Please_say_your_password , EasyVR::VOL_FULL); // ask


for password

easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)


Serial.println("Say the password");
// Donde se repita la function de esperar, oir y comprobar si la contraseña es
correcta, donde si no lo es se reanuda el procedimiento desde el principio y si lo es
se energiza el led de salida 8

easyvr.recognizeCommand(EasyVR::PASSWORD); // set group 16


while (!easyvr.hasFinished()); // wait for password

easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off

idx_pwd = easyvr.getCommand(); // get recognised password

if (idx_pwd >= 0)
{
Serial.print("Password: ");

if (easyvr.dumpCommand(EasyVR::PASSWORD, idx_pwd, name, train))


{
Serial.print(" = ");
Serial.println(name);
}
else

Serial.println();

if ( idx_pwd == idx_cmd) // index of username and password are the same,


access granted
91

// Se logra escuchar las 2 palabras y se confirma que son las palabras guardadas en
la memoria del easyVR donde se ejecuta la acción del easyVR en energizar un led

Serial.println("Access granted");

easyvr.playSound(SND_Access_granted , EasyVR::VOL_FULL);

// Se energiza el led por 2500 milisegundos y luego se apaga

digitalWrite(led,HIGH);
delay(2500); // wait a while
digitalWrite(led,LOW);
}
else // index of username and password differ, access is denied

// Paso de fallo la confirmacion del LED

Serial.println("Access denied");
easyvr.playSound(SND_Access_denied , EasyVR::VOL_FULL);
}

int16_t err = easyvr.getError();

if (easyvr.isTimeout() || (err >= 0)) // password timeout, access is denied


{

Serial.println("Error, try again...");


easyvr.playSound(SND_Access_denied , EasyVR::VOL_FULL);
// Se reanuda la operacion de nuevo

}
}

else
{

//También el easyVR posee un contador de tiempo para escuchar la voz deseada,


donde easyVR da su tiempo preestablecido por 1 seg, si sobrepasa el tiempo es
como anunciar error y se reanuda el procedimiento sin ejecutar la acción deseada
para la comunicación del mega Arduino

if (easyvr.isTimeout())
92

Serial.println("Timed out, try again...");


int16_t err = easyvr.getError();
if (err >= 0)
{
Serial.print("Error ");
Serial.println(err, HEX);
}
}
}

Se ha agregado comentarios a la programación que ha sido

presentada para detallar las funciónes de las variables, comandos y la

forma de operación del módulo del reconomiento de voz.

Se especifican las palabras (llaves por voz) que activarán la captura

de imágenes y se detalla la programación de los mismos, haciendo

que el código de programación sea mas manipulable.

Terminado el análisis anterior se añadira el código que permite el

funcionamiento de la tarjeta magnética siendo este el siguiente:

//incluir liberaría PN532 para la comunicación de la tarjeta BIOMÉTRICA


#include <PN532.h>

// Declaración de los pines 10 11 12 y 13 para la comunicación con el módulo de la


tarjeta biométrica
#define SCK 13
#define MOSI 11
#define SS 10
93

#define MISO 12

// Declaración de pin 8 como constante door como puerto de salida


#define door 8

// Declaración de la tarjeta BIOMETRICA con su respectiva ID de la tarjeta a utilizar


#define ID_TARJETA 2868713947

// Usando el comando de PN532 para declarar la comunicación dada


PN532 nfc(SCK, MISO, MOSI, SS);
void setup()
{

Serial.begin(9600); // Declaración de Puerto de comunicación serial a 9600 bps


nfc.begin();
nfc.SAMConfig();
// Declaración de la constante door como Salida
pinMode(door, OUTPUT);
Serial.println("Placa preparada para leer !");
}
// Programación Principal
void loop()
{

//uint32 como variable para leer el código dada de la tarjeta BIOMETRICA


uint32_t id = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A);

// Si el id es igual a código de la tarjeta BIOMETRICA realiza la acción de encender o


apagar el LED
if ( id == ID_TARJETA)
{
digitalWrite( door, !digitalRead (door)); // Escritura en el pin door
delay (1000); // Tiempo de retardo un segundo
}
}

Para determinar cuál es el id de la tarjeta es necesario realizar otra

programación en la cual los códigos para el void setup y loop serán los

siguientes:
94

void setup()
{
Serial.begin(9600);
nfc.begin();
// Configura la Shield para leer etiquetas RFID:
nfc.SAMConfig();
Serial.println("Placa preparada para leer!");
}

void loop()
{
uint32_t id = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A);
if( id != 0 )
{
Serial.print("ID= "); Serial.println(id);
delay(1000);
}
}

Obtenida la id de cualquier tarjeta se puede programar de acuerdo a

las necesidades presentadas; en nuestro caso permitirá la apertura de

la puerta y el cerrado de la misma.

Comprendido el código anterior se retoma la programación en

Labview para incluir los controles para la tarjeta magnética y el módulo

de voz.
95

Fig. 5.34 Programación de control para los módulos

Cuando el módulo nfc identifica el id de la tarjeta, enviará un alto a la

salida del pin 8, tal pin es leido por la tarjeta Arduino mega en el pin 2

y procesado por Labview; permitiendo que se encienda el led

indicador y a la vez la captura de imágenes; se puede apreciar la

programación en la Fig. 5.34.

De una manera muy similar se manipula el modulo easyvr, ya que es

configurado para que cuando haga el reconocimiento de voz envie un

alto a la salida del pin 8, tal señal es leida en el pin 3 de la tarjeta


96

Arduino mega y procesada por Labview para que se active el led

indicador y se proceda a la captura de imágenes.

En la Fig. 5.34 podemos apreciar que cuando esté activado el led

indicador de voz o tarjeta magnética; el bloque selector if enviará el

valor de 90 a la entrada angle/degrees del bloque servo write angle.

El bloque de escritura de servos permite manipular los servos

conectados, se puede apreciar en la Fig. 5.35, para ello es necesario

escribir el ángulo a mover y especificar el número del servo que se ha

conectado.

Fig. 5.35 Bloques para configuración de servo


97

Se presenta a continuación la imagen del panel frontal del sistema de

seguridad , y hay que considerar que se encuentra en estado de sin

ejecución; mas adelante se verifica el funcionamiento del mismo.

Fig. 5.36 Panel frontal del sistema de seguridad

5.4 SISTEMA DE RIEGO

Una electroválvula esta conectada con un switch y la fuente de

alimentación, por demostración se ha incoporado un led asumiendo

que ejecutará la función del switch en la vida real; y cada vez que se

active la botonera en el panel frontal de Labview se encenderá el led,

vease la Fig. 5.18; en la imagen que se presenta en la pagina

siguiente se detalla la programación realizada.


98

Fig. 5.37 Control del sistema de riego


99

El control del sistema de riego no presenta mayor complejidad puesto

que solo se manipula la salida digital del pin 26 de la Arduino mega y

se ejerce un mínimo control de tiempo para duración del regado.

5.5 SISTEMA DE GARAGE

La programación principal para el funcionamiento del motor se realizó

en el PIC16F887 dejando unicamente el control para programar en

Labview.

El pin asignado para ejecutar el control es el 27, tal pin va conectado

al puerto A del pic y cuyas salidas van conectados al puente h

permitiendo la secuencia de giro del motor.

La programación de secuencia del motor fue realizada en lenguaje c

usando el microPRO for pic como se visualiza a continuación:

const valor as byte[8] = (0x08,0x0C,0x04,0x06,0x02,0x03,0x01,0x09)


Arreglo para la secuencia de giro horario
Número de vueltas completas que gira el motor de paso para el control del garaje
const giro1 as word = 2
const pasos as word = 8 'numero de pasos de motor 28byg
const vuelta as word = 512 'cálculo de un vuelta completo

'variable para el control de pasos completos a realizar para el garaje


DIM mover1 AS INTEGER
100

Variable para el control de pasos del motor 1


DIM mod1 AS INTEGER

Creación de variables a operación numéricos


DIM STEPA AS INTEGER
DIM TURNA AS INTEGER
DIM STEPB AS INTEGER
DIM TURNB AS INTEGER
DIM STEPC AS INTEGER
DIM TURNC AS INTEGER
DIM STEPD AS INTEGER
DIM TURND AS INTEGER

'Declaración de los bits para las banderas de los motores de paso


DIM servo1 as bit

'Seteo de los puertos I/O (entradas y salidas del PIC)


TRISA=%11111111 ' 1 entrada
TRISB=%00000000 ' 0 salida
TRISC=%00000000 ' 0 salida
TRISD=%00000000 ' 0 salida
TRISE=%00000000 ' 0 salida

‘Detalles de los puertos de Entrada sean analógicos


ANSEL=%00000000
ANSELH=%00000000
ADCON1 = 0x0F
OSCCON = 0x65
OPTION_REG = %10000110
Delay_ms(50)
main:
' Main program
STEPB = 0
STEPC = 0
STEPD = 0
‘Contador de pasos y vueltas del motor de paso
mover1 = vuelta * pasos * giro1
mover2 = vuelta * pasos * giro2
mover3 = vuelta * pasos * giro3

while(1) ' programa principal de control de motores de pasos


if(PORTA.B0)then
Sistema de reinicio; cuando pin es 1 se resetea STEPS a 0 y paraliza la acción de los
siguientes puertos de control
if(STEPB > 0)then
101

STEPB = STEPB - 1
end if
servo1 = 0
else
if(PORTA.B1)then
Puerto de activación del 1 motor de paso llamado servo cuando llegan al máximo se
auto detiene
servo1 = 1
else
if(STEPB >= mover1)then
servo1 = 0
end if
end if
Sistema sumador y restador para escribir los movimientos de los motores de paso
if(servo1)then
if (STEPB >= mover1 )then
STEPB = mover1
else
STEPB = STEPB + 1
end if
else
if(STEPB > 0)then
STEPB = STEPB - 1
end if
end if
Sistema de colocador del puerto B, C y D el control de motor de pasos con su
sistema de terminación en los extremos
if(STEPB >= mover1)then
mod1 = 0
PORTB = 0x00
else
if(STEPB <= 0)then
mod1 = 0
PORTB = 0X00
else
mod1 = ( STEPB )mod( pasos )
PORTB = valor[mod1]
end if
end if

end if
‘Retardo de 1 ms de cada paso
delay_ms(1)
end
end
102

El sistema de garaje además de podérselo controlar con un push

button virtual también se lo puede activar haciendo uso de un control

remoto y la programación que permite el funcionamiento del mismo

se muestra en la figura 59.

Fig. 5.38 Control remoto para el garaje


103

La frecuencia obtenida del control remoto es leída por el receptor y

éste envía un valor de 0 o 5 voltios al pin 2; en caso de ser 5 voltios se

envía un uno digital al pin 27 permitiendo el funcionamiento del motor.

5.6 DISEÑO DE PRUEBAS

Se ha optado realizar 3 secciones de verificación del sistema siendo

éstos los siguientes:

La primera sección engloba todos los subsistemas en funcionamiento

independiente; es decir, no se realizó asociaciones, integraciones o

uniones entre sistemas.

Las pruebas correspondientes a la segunda sección fueron realizadas

en base a las gestiones de la domótica propuestas para el desarrollo

del proyecto.

La tercera sección corresponde a la integración de todos los

subsistemas y gestiones para la validación del sistema domótico total.

A continuación validaremos cada subsistema acorde a lo especificado

anteriormente:
104

SECCION I

PROGRAMACIÓN DE ESCENARIOS:

Fig. 5.39 Prueba uno para escenarios

Se realizó los controles para controlar el encendido de las luminarias

permitiendo una secuencia para encender y apagar los LEDS, y se

agregó un speed para posteriormente setear a una velocidad

determinada de encendido y apagado.


105

En esta etapa no se realiza la distribución de pines ni tampoco se

agrega los bloques de escritura para pines digitales de la Arduino ya

que se está desarrollando lo que va a ser el sistema de iluminación.

DIMERIZACIÓN POR AMBIENTE:

Fig. 5.40 Prueba dos para dimerización


106

Para poder dimerizar cierto led es necesario conocer la cantidad

lumínica presente en el ambiente, para ello las primeras pruebas

fueron de lectura del LDR y establecer rangos de voltaje para

determinar los valores de PWM a escribir en los pines de la Arduino.

Los pines seleccionados son solo para la verificación de la

programación y una vez concluido ese segmento de código se

añadió el control de hora para completar el funcionamiento del control

lumínico; se puede apreciar la programación en la Fig. 5.41.

Fig. 5.41 Prueba tres dimerización por hora


107

CONTROL POR TIEMPO:

Fig. 5.42 Prueba cuatro para el control por tiempo

Se realiza las comparaciones de hora y minutos entre la hora del

sistema y la ingresada por el usuario; en el caso de que se cumpla la

condición además de encenderse el led indicador virtual se encenderá

los LEDS que se han conectado a la Arduino.


108

Fig. 5.43 Prueba cinco-panel frontal

Para este ejemplo la hora del sistema es 00:04 am y se verificó el

funcionamiento del control de luces por tiempo, véase la Fig. 5.43.

AMBIENTACIÓN:

La programación de la tira fue realizada en código c haciendo uso del

ide de Arduino y para constatar que funciona conforme a lo

programado se diseñó dos controles que activarán cada secuencia;

ésta primera programación fue para prueba y se minimizó bloques

para la codificación final, como se indica en la Fig. 5.44.


109

Fig. 5.44 Prueba seis del control para ambientación

CAPTURA DE IMÁGENES:

Como el sistema de seguridad funciona con la tarjeta y el módulo

reconocimiento de voz, por simulación se creó botoneras o push

button en reemplazo del funcionamiento de los módulos tal como se

indica en la Fig. 5.45.


110

Fig. 5.45 Prueba siete para la captura de imágenes

Los módulos son programados en Arduino uno y para verificar el

funcionamiento de los mismos se usó el monitor serial, el dato que

enviarán a la Arduino mega es digital por tal motivo se usó un push

button con el nombre de VOZ ACTIVACIÓN en la simulación de la

figura presentada.

De la misma manera el funcionamiento de los motores fue

programado en otro software y a diferencia de lo anterior descrito el

microcontrolador PIC16F887 recibirá el dato digital que la Arduino


111

enviará; para que la Arduino envié un dato basta con programar un

push button a la salida del pin digital y de esa manera se ejerce un

control en esta primera etapa de pruebas.

CONTROL DEL RIEGO:

Fig. 5.46 Prueba ocho para el sistema de riego

Se controla el tiempo de duración para el encendido del sistema de

riego, programandose para que sea por segundos y con la ayuda del

indicador led se verificó el funcionamiento del mismo; ver la Fig. 5.46.

Este control es el más sencillo ya que no presenta integración de otros

módulos para el funcionamiento del mismo.


112

SECCION II

La prueba realizada fue la integración del sistema de luces; es decir,

unión de los controles lumínico, dimerización, ambientación y

luminarias controladas por push buttons, como se presenta en la

Fig.5.47.

Fig. 5.47 Prueba nueve para la sección dos

Toda la programación realizada para probar los controles para la

iluminación hace posible que la gestión del confort esté lista para ser
113

evaluada en la programación final es decir cuando todas las gestiones

hayan sido incluidas, a pesar que también se ha incorporado la

gestión de programación y ahorro energético en la cual se controla

persianas y garaje como se puede observar en la Fig. 5.48.

No se realizó programaciones adicionales para verificar el

funcionamiento de la gestión de la seguridad ya que con las pruebas

iniciales realizadas se estima que los módulos funcionarán acorde a lo

programado.

SECCION III

Anteriormente se ha verificado el funcionamiento de las

programaciones realizadas, pero ahora se englobará todo el sistema

dentro de un solo lazo while para determinar si entre las gestiones no

hay error de comunicación o tiempo de respuesta agotados,

situaciones en la que el programa se volvería ineficiente y

adicionalmente hay que considerar la correcta comunicación entre la

DAQ y el software.

Ésta sección fue ejecutada una vez que la maqueta ha sido

terminada; así como la instalación de todas las conexiones eléctricas,


114

ubicación de dispositivos y ajustes considerables para poner a prueba

la validez del programa.

Los resultados obtenidos de la ejecución del programa se describirán

más adelante en los capítulos correspondientes.

En la Fig. 5.49 se presenta la programación completa; cabe recalcar

que se lo puede visualizar en los anexos ya que se lo ha imprimido en

formato A1.
115

Fig. 5.48 Código para la prueba nueve


116

Fig. 5.49 Código de la prueba final


CAPÍTULO 6

MONTAJE Y ACOPLAMIENTO DE LOS DISPOSITIVOS


ELECTRÓNICOS

6.1 SOFTWARE Y DISPOSITIVOS ELECTRÓNICOS

Se incorporó en la construcción de la maqueta diversas funciones para

cumplir un fin domótico, para ello se utilizó equipos con fácil

accesibilidad y amplia gama de información proporcionada por los

fabricantes y terceros. A continuación se describirá los componentes

que se utilizaron en el proyecto:


118

Tarjeta de Adquisición de
Arduino Mega 2560
Datos:
Sistema de Iluminación y Placa Electrónica con Relé
Riego: Placa Electrónica de DIMMER
Microcontroladores -
Sistema de Control Persianas y PIC16F887
Garaje: ULN2003APG Drivers
Motor de Paso – 28BYJ-48
Webcam
Arduino UNO
Sistema de Seguridad: EasyVR
PN532 NFC/RFID
Servomotor – HS-311
Sistema de Control Remoto por Módulo para transmisión
Radio Frecuencia Módulo para recepción
Sistema de Ambientación: Tira de LEDS – Pololu
Tabla # 7 Módulos implementados en la maqueta

En la página siguiente se presenta un organizador gráfico en el cual se

describe los componentes usados por sistema, ver la Fig. 6.1.

Tarjeta de Adquisición de Datos

La tarjeta de adquisición de datos es un procesador de señales

eléctricas a tiempo real que permite la interpretación y manipulación

de datos con el ordenador.


119

Fig. 6. 1 Organizador gráficos de los controles implementados

Arduino Mega 2560

El Arduino Mega 2560 14 es una placa electrónica basada en el

Atmega2560 que permite trabajarla como un módulo de control o

como tarjeta de adquisición de datos para el ordenador y el resto de

los dispositivos. Posee 54 pines digitales que pueden usarse como

entradas o salidas digitales, de los cuales 15 pines son para salidas

PWM, adicionalmente presenta 16 pines para entrada analógica, 4

puertas seriales UART, un oscilador o reloj interno de 16 MHz (Mega

14
Véase Anexo 6 para características y esquemático del Arduino Mega 2560
120

Hertz), cabecera ICSP, un puerto USB y alimentación externa,

incluyendo el integrado ATMega8U2 para la programación USB-

Serial. [17]

Comunicación entre Labview y Arduino Mega 2560

El Arduino se conecta al computador usando el protocolo de

comunicación serial UART (Transmisor y Receptor Asincrónico

Universal), y se logra establecer una comunicación entre el ordenador

y el módulo de manera básica, efectiva y segura.

Fig. 6.2 Comunicación entre pc y tarjeta

El UART es un protocolo de comunicación Serial que permite la

transmisión de datos a través de cables físicos TX y RX que significan


121

transmisor y receptor respectivamente, bajo una trama de bits. La

trama contiene 10 bits que operan de manera lógica, entiéndase que

los bits lógicos son 0 y 1. La información se mantiene en 1 hasta

recibir el bit de inicio y permitir el envío de información; además, el

protocolo contiene un bit de inicio, que es el 0; luego envía 8 bits

para la trama de información y se finaliza con un bit de parada, el cual

es el 1, cerrando la información. [8]

Los datos son procesados por el Integrado ATMega8U2 que se

encuentra en el Arduino Mega 2560 para que las señales sean

convertidas de TX y RX a Data+ y Data- respectivamente; permitiendo

establecer comunicación usando la interface USB. [9]

Los pines Data+ y Data- pertenecen a la interface USB.

Fig. 6.3 Modelo de la trama de bits


122

Fig. 6.4 Esquema de puente UART a USB15

Se presenta a continuación la programación del Arduino Mega 256016

para habilitar la comunicación Serial con el Labview.

#define FIRMWARE_MAJOR 02
#define FIRMWARE_MINOR 00 // Preparación de los registros del Arduino para
permitir la comunicación serial
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
//Definición del ATmega2560 para el LIFA BASE (Interface de Labview )
#define DEFAULTBAUDRATE 9600 //Velocidad de bits por segundo natural
#else
#define DEFAULTBAUDRATE 115200 // Velocidad de bits por Segundo
#endif
#define MODE_DEFAULT 0
// Modulo Normal de los comandos de Labview si no hay comandos se coloca el
comando nulo
#define COMMANDLENGTH 15 // Paquete de 15 bytes de datos

15
Véase la bibliografía en el apartado [10]
16
Véase la bibliografía en el Anexo 7
123

Para que se establezca la sincronización entre Labview y Arduino es

necesario definir el tipo de Arduino que se conectará, la velocidad de

bits por segundo que es 9600 bps y la cantidad de 15 bytes de

información para la correcta comunicación entre ambos.

En primera instancia se realizaron pruebas de lectura en el puerto de

transmisión y de recepción del Arduino, en primera instancia solo se

colocó la punta del osciloscopio en el pin 1 TX sin enviar dato alguno y

se obtuvo el resultado que se presenta en la Fig. 6.5.

Fig. 6.5 Pin1 Tx

Se realizó el mismo procedimiento para la recepción, es decir se situó

la punta del osciloscopio en el pin 0 RX de la Arduino, obteniendo el

resultado como se observa en la Fig. 6.6.


124

Fig. 6.6 Pin 0 RX

También se realizó muestreos en los pines Data- y Data+, como se

muestran en las Fig. 6.7 y 6.8 respectivamente.

Fig. 6.7 Data -


125

Fig. 6.8 Data +

Diagrama de Conexiones de la Comunicación Serial

En la Fig. 6.9 se puede apreciar los componentes del Arduino Mega

2560 que son utilizados para realizar la comunicación con la interfaz

USB y permitir la comunicación serial.

Fig. 6.9 Arduino Mega 2560


126

Puerto de comunicación:

Pin Puerto Detalle

TX 1 Comunicación Pin de transmisión de Datos

RX 0 Comunicación Pin de recepción de Datos

Tabla # 8 Descripción de puertos

Integrado ATMEGA8U2: Integrado que permite la conversión Lógico

de los pines TX y RX a Data+ y Data-. [11]

Puerto USB JACK: Conecta el cable que permite las conexiones de

ambas partes.

Nombre Color Detalle

5V Rojo Cable de Alimentación con 5 V

Data + Blanco Cable de dato con diferencial positivo

Data - Verde Cable de dato con diferencial negativo

GND Negro Cable de punto común

Tabla # 9 Descripción del cable


127

Fig. 6.10 Descripción de los pines de la interfaz USB

Una vez realizada la conexión entre los puertos de la tarjeta Arduino y

del computador, es necesario revisar el administrador de dispositivos;

véase la Fig. 6.11 ya que se instala y se prepara un puerto COM para

la comunicación con el Arduino, ésta información es necesaria para

realizar las programaciones en el bloque de inicialización en

LABVIEW. Labview puede reconocer y escribir la información de 8 bits

y decodificarlas a código de letras ASCII, usando el VISA (Arquitectura

de Instrumento Visual) que enlaza el puerto COM con el Labview.


128

Fig. 6.11 Administrador de dispositivos

Programación en Labview para la comunicación con el Arduino:

Para poder realizar la programación en Labview, es necesario haber

instalado los toolkit para Arduino-Interface; ya que contiene el sketch

para que la tarjeta Arduino se comunique con el software LABVIEW y

poder ejercer control sobre la tarjeta.


129

Fig. 6.12 Bloque Init- Labview

Dentro de la programación en LABVIEW se utiliza el toolkit para

Arduino; en la Fig. 6.12 se muestra el Bloque Init, que inicia y procede

a establecer la transmisión y recepción de datos con la tarjeta; para

ello se necesita detallar el modo de comunicación; es decir, el puerto

COM que fue reconocido por el ordenador como se visualiza en la

Fig. 6.11, la velocidad de transmisión que fue establecido a 9600 bps,

el tipo de Arduino que se va a utilizar en este caso es el Mega 2560 y

la cantidad de paquetes que son 15 datos con 8 bits integrados para

la transmisión de información dada.


130

Fig. 6.13 Configuración del bloque Init

Visa Resource Selección del puerto

Baud Rate Velocidad de Transmisión

Board Type Selección del Arduino que se está usando

Bytes Per Packet Transmisión de 15 bytes para cada paquete

Connection Type Tipo de Cable para la conexión

Tabla # 10 Descripción de los bloques de configuración

En la Fig. 6.14 se muestra la programación del bloque Arduino Init, el

programa lee los valores iniciales configurados como se visualiza en la

Fig. 6.13 y se prepara para iniciar la comunicación, verifica si el

Arduino está conectado; en el caso de haber respuesta de


131

comunicación se procede a mantenerla; caso contrario se cancela y

se envía un anuncio de error.

Fig. 6.14 Programación interna del bloque Init

Sistema de Iluminación y Riego

Para nuestro sistema de iluminación y riego se utilizó una placa

electrónica con Relé con la cual es posible realizar las demostraciones

para el control del encendido y apagado de luminarias y al mismo

tiempo se simula el accionamiento de una electroválvula para el

sistema de riego.
132

La placa electrónica DIMMER controla la intensidad lumínica que se

ha aplicado a ciertas luminarias. En la siguiente tabla se describe la

ubicación en la maqueta y la cantidad de LEDS que han sido

dimerizados y aquellos que tienen un control manual.

Lugar Cantidad Tipo

Dormitorio Principal 2 Es dimerizable

Dormitorio Secundario 2 Es dimerizable

Pasillo Planta Alta 2 Es dimerizable

Pasillo Planta Baja 2 Es dimerizable

Sala 2 Es dimerizable

Comedor 1 Es dimerizable

Estudio 2 ON/OFF

Garaje 1 ON/OFF

Cocina 2 ON/OFF

Riego 1 ON/OFF

Tabla # 11 Espacios en la maqueta con el sistema de iluminación

En la Fig. 6.15 se visualiza la placa electrónica con Relés; la misma

que ha sido energizada por transistores ya que operan como


133

interruptores y a la vez la placa es controlada por la Arduino Mega

2560.

Fig. 6.15 Placa con Relays

La placa electrónica DIMMER permite controlar la intensidad de los

LEDS usando transistores bipolares (Abierto y Cerrado ) 2N2222 17

que permite el control de voltaje con la técnica PWM (Modulación de

Ancho de Pulso) , y permite el control de accionamientos por pulsos a

los transistores. La tarjeta Arduino Mega 2560 posee, se ha

programado a operar a 1000 Hertz y LABVIEW controla al Arduino

17
Visualícese al Anexo 8 Datasheet 2N2222
134

ya que los datos son convertidos de 0 - 255 valores enteros a 0 -

100% de PWM, se la puede apreciar en la Fig. 6.16.

En la Fig. 5.18 y 5.20 se pueden observar los indicadores LEDS y las

placas que han sido mencionadas ejecutarán el control programado.

Fig. 6.16 Placa electrónica Dimmer

Sistema de Control de Persianas y Garaje

Para el control de persianas y garaje se implementó motores de paso

que permitirán girar y enrollar la tela con bambú, permitiendo

visualizar el control para abrir y cerrar persianas y la puerta del

garaje. El Arduino Mega 2560 se comunica con los micro

controladores PIC16F887 ya que son usados como módulo de control


135

de giro para los motores y el ULN2003APG se usa como integrado de

fuerza.

Control de los motores de paso

El microcontrolador PIC16F88718 (Controlador de Interfaz Periférico),

es un circuito integrado con memoria, procesador y pines

programables con 35 pines de entrada y salida, de los cuales algunos

pines fueron programados 19 para controlar los motores de paso, y

generar pulsos de manera secuencial que permitirán el giro para cada

motor. Los motores de paso 28BYJ-48 20 de 5 voltios poseen ocho

pasos para realizar el giro adecuado y se debe repetir 512 veces los 8

pasos para dar una vuelta completa. Los motores fueron programados

para que realicen 2 giros cuando las persianas y la puerta del garaje

se estén abriendo.

18
Obsérvese en el Anexo 9 Características del PIC16F887
19
Visualice página 75 Programación en C de los microcontroladores
20
Revise en el Anexo 10 Características del Motor de Paso
136

Fig. 6.17 Placa con los pics PIC16F887

Los microcontroladores PIC16F887 se comunican de manera lógico al

Mega Arduino 2560 para iniciar el movimiento de los motores de paso

y generar la secuencia que se requiere para girar a los mismos. Se

utilizan cuatro puertos del microcontrolador de ocho pines; es decir,

se usan los puertos A,B,C, y D que fueron programados como puertos

digitales de entrada, el puerto A se comunica a la tarjeta Mega

Arduino 2560, mientras que el resto de los puertos se conectan con

los integrados de fuerza para cada motor.


137

21
El ULN2003APG es un conductor Darlington que permite la

alimentación de cargas, se comunica con los 5 pines del motor de

paso y opera de manera lógica. El motor de paso presenta 5 cables

cuyos colores son azul, rosado, amarillo, naranja y rojo; el cable Rojo

es para la alimentación y se conectan a la salida del conductor

Darlington; los demás cables a excepción de la alimentación puede

estar conectados a tierra o permanecer sin conexión; se puede

apreciar la Fig. 6.18 y 6.19.

Fig. 6.18 ULN2003APG Driver

En la siguiente imagen se puede visualizar que el cable rojo es el

cable de poder y e l resto son para control.

21
Véase en el Anexo 11 Características del ULN2003APG
138

Fig. 6.19 Motor de pasos 28BYJ-48

Sistema de Seguridad

Se implementó estos dispositivos simulado un video portero, se

realiza una breve descripción en la tabla # 12 que se presenta en la

página siguiente:
139

Dispositivos Nombre Descripción

Cámara que permite monitorear la entrada de


WebCam
Cámara
ZEN la puerta de la maqueta y tomar fotografías
Módulo que permite el censado de la tarjeta
Módulo RFID PN532 magnética

Módulo Módulo que permite la identificación de la


Reconocedor de EasyVR
voces grabadas
Voz
Motor de permite el control de la apertura de
Servo Motor HS-311
la puerta

Tabla # 12 Elementos que simulan un videoportero

El Arduino UNO22 es una placa con un microcontrolador ATMega 328

desarrollado por Atmel AVR, y un entorno desarrollado para múltiples

usos electrónicos. La placa Arduino posee 14 pines de entrada y

salida, 6 de esos pines son salidas PWM y 4 pines la comunicación

SPI, 6 pines de entrada analógica y 2 pines para la comunicación

serial UART con el integrado ATMega8U2 para el interfaz USB. La

placa Arduino UNO se implementó con un módulo de control con el

módulo reconocedor EasyVR, PN532 NFC/RFID y la tira de LEDS

para el control de ambientación de la maqueta.

22
Observe el Anexo 12 Características del Arduino UNO
140

Fig. 6. 20 Placa Arduino UNO

Se incorporó una cámara webcam la cual se comunica con el

Ordenador y usando el programa LABVIEW se monitoreará y se

capturará fotos que serán almacenadas en la memoria del ordenador.

El Módulo PN532 NFC / RFID Shield 23 (Comunicación de Campo

Cercano / Identificador de Radio Frecuencia) puede implementarse en

el Arduino, desarrollado por ELECFREAKS que permite la detección

de varias tarjetas magnéticas e identificarlas por sus propios ID

(Identidad de la tarjeta), el Arduino se comunica con el módulo para

identificar el censado de la tarjeta y realizar la apertura de la misma.

23
Visualice Anexo 13 DataSheet PN532 NFC/RFID
141

Comunicación de la Tarjeta magnética

El NFC PN532 es un módulo RFID que permite censar la proximidad

de la tarjeta magnética y reconocerla mediante su ID. El controlador

que permite programar a la tarjeta es el Arduino UNO y se puede

conectar los pines digitales de salida del módulo a la Arduino Mega

2560; al realizar esta acción se crea un puente con la finalidad de

establecer comunicación y control. [12]

El SPI (Bus de interface serial periférico) permite la comunicación del

Arduino UNO como Maestro y NFC PN532 como Esclavo. [13]

Fig. 6.21 Arduino UNO y NFC PN532

El SPI es un bus de comunicación serial Síncrono para distancias

cortas, cuyo modo de comunicación es full dúplex usando la


142

arquitectura maestro – esclavo con un único Maestro y varios

Esclavos.

Fig. 6. 22 Conexión entre la Arduino y la tarjeta

Entiéndase que la comunicación full dúplex permite la transmisión de

datos en ambas direcciones usando el mismo canal. Algunas veces se

lo llama al SPI bus serial de 4 cables, y las funciones de los cables

para la comunicación son:

Nombre Simbología Detalle


SCK Clock Reloj Sincronizador
MISO Master In Slave Out Información del Esclavo al Maestro
MOSI Master Out Slave In Información Maestro a Esclavo
SS Slave Select Activador del Esclavo Asignado
Tabla # 13 Funciones del SPI
143

Para realizar la comunicación SPI los pines de la Arduino están en 1

es decir en alto, el SS o selector de esclavo envía un 0 para entablar

una conexión Maestro - Esclavo y se sincroniza el reloj SCK para

enviar la trama de datos. El MOSI envía la trama para que el Maestro

le pregunte al Esclavo y luego el MISO responde cuando finaliza la

pregunta, en la Fig. 6.23 que se presenta a continuación se puede

apreciar con mayor claridad la comunicación entre dispositivos. [13]

Fig. 6.23 Comunicación serial SPI

Introducción de la programación para el PN532 en el archivo .cpp24

#include <Arduino.h>

24
Obsérvese la página 92 Programación Completa del Arduino UNO - PN532
144

#include "PN532.h"
byte pn532ack[] = {0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00};
byte pn532response_firmwarevers[] = {0x00, 0xFF, 0x06, 0xFA, 0xD5, 0x03};
#define PN532_PACKBUFFSIZ 64
byte pn532_packetbuffer[PN532_PACKBUFFSIZ];
PN532::PN532(uint8_t clk, uint8_t miso, uint8_t mosi, uint8_t ss) {
_clk = clk;
_miso = miso;
_mosi = mosi;
_ss = ss;
pinMode(_ss, OUTPUT);
pinMode(_clk, OUTPUT);
pinMode(_mosi, OUTPUT);
pinMode(_miso, INPUT);
}

/************** low level SPI */


void PN532::spiwrite(uint8_t c) {
int8_t i;
digitalWrite(_clk, HIGH);
for (i=0; i<8; i++) {
digitalWrite(_clk, LOW);
if (c & _BV(i)) {
digitalWrite(_mosi, HIGH);
} else {
digitalWrite(_mosi, LOW);
}
digitalWrite(_clk, HIGH);
}
}
145

uint8_t PN532::spiread(void) {
int8_t i, x;
x = 0;
digitalWrite(_clk, HIGH);
for (i=0; i<8; i++) {
if (digitalRead(_miso)) {
x |= _BV(i);
}
digitalWrite(_clk, LOW);
digitalWrite(_clk, HIGH);
}
return x;
}

En la programación que se le realiza al Arduino se incluye las librerías

Arduino.h y PN532.h que son dadas por el fabricante, los paquetes de

datos pn532ack, pn532response_firmwarevers y pn532_packetbuffer;

son establecidos para que se efectúe la comunicación SPI al PN532

definiendo el (clk, miso, mosi, ss) que ha sido mencionado en los

párrafos anteriores.

El MISO y MOSI van en una trama de 8 bits, usando el CLK como reloj

sincronizador y los datos son recibidos cuando hay un flanco positivo

del CLK como se visualiza en la Fig. 6.23.


146

El Módulo EasyVR 25 pertenece a la marca TIGAL VEEAR, la cual

elabora varios productos que son implementados para efectuar el

reconocimiento de voz y comandos por voz. Posee una adaptación

con la plataforma Arduino que es EasyVR Arduino Shield 2.0 TIGAL y

permite al módulo operar con un sensor para recibir e identificar la

palabra.

Comunicación entre el Arduino y el EASY VR

La comunicación con EASYVR y el Arduino se realiza bajo una

comunicación Serial –UART, donde interactúan los pines TX y RX

para la comunicación entre ellos. Para manipular el EASYVR se usa

librerías y ejemplos dados por los programadores de la tarjeta. [14]

Es posible que el ARDUINO y el EASYVR interactúen entre sí

estableciendo comunicación con el ordenador; cuya finalidad es el

monitoreo del módulo y realizar cambios en la programación.

25
Visualice Anexo 14 Propiedades del EasyVR
147

Fig. 6.24 Módulo EASYVR

La Fig. 6.25 describe la trama de los Bits de la comunicación Serial

UART. La comunicación inicia con 1 y se espera el bit 0 para iniciar la

transmisión en la cual se reciben los 8 bits de código ASCII; se

finaliza con el bit de Parada en 1 y se regresa al estado inicial 1.

Fig. 6. 25 Trama de bits


148

Declaración de librerías e introducción a la programación del Arduino

UNO26 con el EasyVR.

#if defined(ARDUINO) && ARDUINO >= 100 //Detección de la versión del Arduino
#include "Arduino.h" //Uso de las librerías del Arduino
#include "SoftwareSerial.h" //Uso conexión con pines seriales
SoftwareSerial port(12,13); // Declaración de los pines para la comunicación serial

#else // Arduino 0022 - use modified NewSoftSerial


// si no se detecta el Arduino apropiado se busca otra librería de Arduino
#include "WProgram.h"
#include "NewSoftSerial.h"
NewSoftSerial port(12,13);
#endif
#include "EasyVR.h" //Uso de las librerías EasyVR
if (bridge.check())
{
cli();
bridge.loop(0, 1, 12, 13); Selección de los pines para la comunicación de los
módulos
}
Serial.begin(9600); //Setea de la velocidad de transmisión
port.begin(9600);
digitalWrite(led,LOW);

Esquema de comunicación entre módulos.

Dada la declaración de comunicación, el Arduino utiliza los pines 12 y

13 para la transmisión y recepción de datos con el EasyVR. Los pines

26
Veáse página 86 Programación Completa del Arduino UNO – EasyVR
149

0 y 1 permiten realizar una comunicación serial con el ordenador y

permite un monitoreo de ello.

Fig. 6. 26 Diagrama de conexión

El Control de Apertura de la Puerta

El servomotor es un actuador que permiten controlar de manera

precisa para mantener la posición del eje en un ángulo determinado.

Se implementó un servomotor para simular un sistema de apertura en

la puerta principal de la casa, se incorpora un brazo en el eje del motor

para proporcionar el movimiento de la puerta. El servomotor Hitec HS-


150

31127, posee 3 pines de color negro que se conectan a un punto en

común, el rojo se conecta a la fuente de alimentación de 5 voltios y el

cable amarillo es para el control, el Arduino Mega 2560 controla el

servomotor bajo señal PWM de 50 Hertz o 20 milisegundos, y el

servomotor opera de 1 a 2 milisegundos de ancho de pulso

posicionando el eje en un ángulo de 0 a 180 grados respectivamente.

La Fig. 6.27 describe el ancho de pulso con la posición del ángulo.

Fig. 6. 27 Ancho de pulso y ángulo de giro del motor

Sistema de Control Remoto de Radio Frecuencia

El control remoto se diseñó para controlar de forma manual la

activación de la apertura de la puerta del Garaje, y la activación de la


27
Véase Anexo 15 Descripción de Servomotor
151

Rutina de Seguridad, simulando un circuito electrónico de control

externo que permita ejecutar las acciones como: estacionar el auto

del dueño del hogar o salidas de viajes familiares.

Se implementó 2 placas para el sistema de control remoto, una es

para el transmisor y otra para el receptor28.

La placa electrónica de transmisión posee un módulo de radio

frecuencia transmisor que opera a modulación ASK (Modulación por

Desplazamiento de Amplitud) enviando una frecuencia de 433 Mega

Hertz si recibe un 1 lógico, caso contrario no generará ninguna señal

y es tratado como un 0 lógico. El módulo posee 3 pines los cuales

están conectados a tierra o GND, punto para la alimentación y el Data

que comunica con el codificador HT12E, que es controlado de manera

lógico.

El integrado HT12E29 es un codificador de 8 bits para dirección y 4

bits para datos formando la trama que será transmitida hacia el

receptor, los 4 bits son operados de manera manual por el usuario a

través de pulsadores.

28
Revisar Anexo 16 Módulos de Radio Frecuencia
29
Observe Anexo 17 Datasheet del Integrado HT12E
152

El módulo receptor recibe la señal de frecuencia y lo transforma en

una trama de datos usando el integrado decodificador HT12D 30

obteniendo la señal de los 12 bits, 8 bits de la dirección del

decodificador asignado y 4 bits de datos mencionado anteriormente y

enviadas al Arduino Mego 2560.

Fig. 6.28 Modo de envión de la trama para la comunicación

Fig. 6.29 Módulo de Transmisión

30
Revise Anexo 18 Datasheet del Integrado HT12D
153

Fig. 6.30 Módulo de recepción

Sistema de Sensor Lumínico

El LDR es un fotoresistor es decir varia su resistencia en función de la

intensidad lumínica, cuando hay incidencia de luz el valor de

resistencia puede oscilar entre los 50 a 1000 ohmnios y de 50k a

varios mega ohmnios cuando está a oscuras.

Sistema de Ambientación

La tira de LEDS de la marca POLOLU posee el integrado WS2812B 31

para el control de cada LED, se utilizó el módulo Arduino UNO para

controlar la tira y generar los colores deseados.

31
Veáse Anexo 19 Descripción del WS2812B
154

Comunicación con la tira de LEDS

Se establece comunicación serial ya que se envía datos de manera

lógica a cada módulo LED independiente cuyo tamaño de trama es de

24 bits; se repite varias veces según la cantidad de LEDS. [15]

Cada LED posee un registro de 24 bits en la cual es posible programar

los 3 colores en código RGB teniendo 8 bits de datos por color (Rojo,

Verde y Azul).

La trama de datos opera de manera lógica y son codificadas por un

control de tiempo en alto (5 voltios) y tiempo en bajo (0 voltios) a 1,25

microsegundos. En la figura 6.31 y 6.32 se visualiza el código en 0 y 1

para permitir el control del color que deseamos. El RESET es para

eliminar el color asignado.

Fig. 6.31 Obtención de los datos


155

Fig. 6.32 Tiempos de los códigos

Se dice que está en código cero; cuando la tira de LEDS detecta que

la duración del High es de 0.35 µs. y la duración del Low es 0.9 µs,

se puede observar la Fig. 6.31. Se dice que el código está en uno;

cuando la tira de LEDS detecta que la duración del High es de 0.90 µs

y la duración del Low es 0.35µs.

Si no hay datos por 50 µs se resetea la secuencia de LEDS y se aplica

la trama de datos a todos los LEDS.

Armado de la trama de datos:

Cada módulo led WS2812B posee 1 registro con 24 bits y para

controlar mediante código de color RGB se debe programar la

intensidad del color a mostrar en los LEDS; para ello la trama está
156

dividida en 3 arreglos con 8 bits cada uno, los primeros 8 bits es para

la intensidad del color verde, el segundo arreglo es para el color rojo y

la última secuencia es para el color azul.

Fig. 6.33 Trama de datos de los LEDS

Los LEDS se encuentran interconectados entre ellos mediante el pin

Dout y el pin Din permitiendo la comunicación entre ellos.

El Arduino enviará la trama de datos que ha sido codificada (véase la

figura 90 y 91), donde destinará los 24 bits para cada LED, es decir si

la tira posee 3 LEDS, el Arduino mandará trama de 96 bits y cada

módulo adquirirá los primeros 24 bits para almacenarlos y producir la

luz que ha sido programada. Finalmente se elimina la trama enviada.


157

Fig. 6.34 Imagen de la Tira de LEDS WS2812B

Se ha utilizado el pin 12 de la Arduino UNO para ejercer el control

sobre la tira; tal pin está conectado al DIN del LEDSTRIP (cable

VERDE), y le envía la trama de datos con sus respectivos tiempos

para que cada led presente el color que ha sido programado. Se usa

el cable Rojo para la alimentación a 5 V y el negro para el punto

común (GND).

Fig. 6.35 Imagen de los conectores de la tira de LEDS

La Figura 6.35 representa una tira de 3 módulos de LEDS, y se

muestra como la trama de datos es desglosado por cada estado D1,

D2, D3 y D4.
158

Se toma como referencia D1, D2 y D3 como módulos ya que D4 es un

dispositivo con pin Dout sin conexión. Se comienza con el primer ciclo,

donde el D1 recibe trama de 96 bits y toma sus 24 bits que le

corresponden aminorando la secuencia a 48, D2 recibe los 48 bits y

repetirá el proceso que realizo D1, el D3 recibe y repite la secuencia y

en el caso de que exista más módulos se deberá enviar una trama

cuya cantidad de bits resultará de la multiplicación del número total de

LEDS existentes en la tira por los 24 bits.

En D4 no hay bits por leer y escribir por lo tanto se genera el RESET

para resetear los módulos anteriores y generar el segundo ciclo; de

esta manera se repetirá infinitas veces.

La Fig. 6.36 permite visualizar la forma de escritura de la trama de

datos por led; es decir, de la trama de datos general el D1 (primer led)

obtiene los bits que le corresponden y tales bits son eliminados de la

trama general, el D2 repite la acción y obtendrá los bits que le fueron

asignados; sucederá lo mismo hasta que todos los bits hayan sido

tomados y se vuelve a enviar el código para los siguientes LEDS

repitan la secuencia.
159

Fig. 6.36 Comunicación al Conjunto de LEDS

6.2 ACOPLAMIENTO GENERAL

En la página siguiente se presenta el diagrama de conexiones que se

realizó en la maqueta:
160

Fig. 6.37 Acoplamiento del sistema

Se presenta a continuación las imágenes de las baquelitas:


161

Dimmer

Fig. 6.38 Dimmer baquelita

Control Remoto y Receptor

Fig. 6.39 Control Remoto y Receptor


162

PIC Motor de paso

Fig. 6.40 PIC para los motores de paso

Relay

Fig. 6.41 Relays


CAPÍTULO 7

ANÁLISIS DE RESULTADOS

7.1 ELEMENTOS UTILIZADOS Y COSTOS

La tabla que se presenta a continuación corresponde a los

componentes electrónicos así como se incluye también costos de

cable, conectores y módulos.

COSTO
ITEM DESCRIPCION CANTIDAD TOTAL
UNITARIO
1 Relé 5V 20 1 20
2 Transistores 2N3904 10 0,1 1
3 Diodos 1N4148 10 0,05 0,5
4 Borneras 3 0,2 0,6
5 Resistencia 1/4 Watt 40 0,05 2
164

6 Zócalos 40 pines 3 0,2 0,6


7 Espadines 4 0,325 1,3
8 2N2222 5 0,2 1
9 IRF640 2 1,5 3
10 PLUG 9V 4 0,25 1
11 105 250 2 0,8 1,6
12 ULN2003APG 2 0,8 1,6
13 Cables 20 0,4 8
14 Placa DIMMER 1 4,78 4,78
Placa Control
15 1 3,25 3,25
Remoto
16 Placa Fuente 1 7,96 7,96
17 Películas 3 1 3
18 2N2222 14 0,1 1,4
19 Resistencias 10K 24 0,05 1,2
20 Resistencias 470 12 0,05 0,6
21 Zócalos 18 pines 3 0,15 0,45
22 9V Conector 2 0,25 0,5
23 Resistencia 43K 1 0,05 0,05
24 Tira de led 1 54,21 54,21
25 Mega 2560 3 32,51 97,53
26 Motor de pasos 3 10,43 31,29
Matrimonio 1/4'' a 5
27 mm y eje de 1/4 x7'' 7 16,68 116,76
acero inoxidable
28 Modulo lector de 1 13.9 13,9
memoria SD
Cable plano de 40
29 2 11,26 22,52
pines
Conector + Terminal
30 macho/ hembra para 45 0,34 15,2
espadines
31 Motor de pasos 2 10,43 20,86
Llave hexagonal
32 3/32'' para ajustar 2 1.24 2,48
polea y matrimonio
33 Servomotor 1 12 12
34 Arduino uno 3 30 90
165

35 Easyvr 2.0 shield 1 90 90


36 Cámara 1 20 20

Total $ 652,14
Tabla # 14 Precios de elementos adquiridos.

La tabla que se presenta a continuación corresponde a los materiales

obtenidos para la construcción de la maqueta, y herramientas que

ayudarán para que la implementación del sistema funcione.

COSTO COSTO
ITEM DESCRIPCION CANTIDAD
UNITARIO TOTAL
1 Blancola 1 lt 1 2,95 2,95
2 Amoladora 1 70 70
3 Arco sierra 1 5,35 5,35
4 Dcorlac 2 7,78 15,56
Plancha de plywood de 4
1 26,4 26,4
5 mm
Plancha de plywood de 9
1 15,54 15,54
6 mm
7 Lija agua 3 0,54 1,62
8 Lija madera 3 0,36 1,08
Funda de tornillo para
9 2 0,2 0,4
madera
10 Funda de tornillo pequeño 2 0,44 0,88
11 Pistola para silicón 1 1,78 1,78
12 Silicona barras 1 1,78 1,78
13 Brochas 2'' 2 0,49 0,98
14 Brocha prensada 1 1,78 1,78
15 Madera Balsa 3 1 3
16 Plumafon 1 0,7 0,7
17 Cinta aislante 2 6,24 12,48
166

18 Rollo de alambre de 1.6 1 7,84 7,84


19 Baterías 9 V 2 3 6
20 Martillo Stanley 1 7,11 7,11
21 Clavo fino paquete 1 0,5 0,5
22 Destornillador 2 1,27 2,54
23 Estaño 1 21 21
24 Brujitas 10 0,8 8
25 Plancha de acrílico 1 80 80
Subtotal $ 264,85
Total $ 295,27
Tabla # 15 Precios de materiales adquiridos.

El costo total por realización de baquelitas es 38.03 dólares.

7.2 PRESUPUESTOS

Para la realización del presente proyecto es necesario tener a

disposición la cantidad de mil dólares americanos considerando que

no se realiza montajes reales sino en maqueta y se está demostrando

la eficacia del sistema. A continuación se detalla el costo total:

DESCRIPCION PRESUPUESTO
Componentes electrónicos 652,14
Herramientas para carpintería 295,27
Baquelitas 38,03
Inversión por pruebas y fallos 10
Total $ 995,44
Tabla # 16 Inversión total.
167

7.3 PRUEBAS Y RESULTADOS DE PRUEBAS

Se presenta los resultados de los diseños de pruebas que

anteriormente se expusieron correspondientes a cada sección.

La primera prueba realizada fue la verificación del sistema de

escenarios (escenario #1, #2 y #3) teniendo los siguientes resultados:

Fig. 7.1 Resultado uno en el cual se visualizan los LEDS encendidos


168

Fig. 7.2 Resultado de escenario

En la Fig. 7.2 se puede apreciar que en las 2 primeras imágenes se

está iniciando la secuencia de encendido de luces mientras que en las

imágenes 3 y 4 se activa la secuencia de apagado de LEDS. La

segunda prueba efectuada fue el control lumínico como se visualiza

en la Fig. 7.3.

Fig. 7.3 Resultado del control lumínico.


169

Para que la prueba tenga los resultados esperados; fue realizada en

las horas programadas; es decir, se esperó a que exista presencia de

oscuridad y si observamos con detalle la imagen, notaremos lo

siguiente:

- La lectura de los LDR son diferentes debido a que uno fue

manipulado con la mano para variar la intensidad de luminosidad.

- Los indicadores LEDS virtuales están activados y por consiguiente

los LEDS físicos están encendidos al cumplirse el control.

Fig. 7.4 Resultado del control


170

En la Fig. 7.4 se aprecia que el control programado correspondiente al

lumínico funciona acorde a lo esperado.

La siguiente prueba realizada fue la integración de los controles de

iluminación como se comentó en la sección 2 del diseño de pruebas.

Fig. 7. 5 Resultado de la maqueta

En la Fig. 7.5 se puede apreciar que todas las luminarias están

energizadas; esto nos indica que funciona todo el control para

iluminación, es decir; los controles manuales, dimerización, control de

escenarios, están activos completando una gestión; la cual es

programación y ahorro energético.


171

Para la sección tres se realizaron varias pruebas en diferentes días

para determinar si el sistema funciona correctamente, y se concluyó

que los controles para el sistema de iluminación no presenta

complicación alguna y de manera similar podemos afirmar el

funcionamiento de la tarjeta magnética junto con la captura de

imágenes usando la cámara que forman parte del sistema de

seguridad.

En el caso del reconocimiento de voz se observó que si el usuario

modifica la pronunciación así como la tonalidad; el módulo no

reconoce la voz que fue programada y por lo tanto no se ejecutará

ninguna acción.

A continuación se presenta imágenes en los cuales se puede

observar el funcionamiento de las persianas y ambientación.


172

Fig. 7. 6 Resultado del control de persianas

Fig. 7. 7 Resultado del control de tira de LEDS


173

CONCLUSIONES Y RECOMENDACIONES

CONCLUSIONES:

1. El resultado del funcionamiento del sistema domótico implementado

en la maqueta utilizando los microcontroladores Arduino y la interfaz

de usuario Labview funcionó conforme a lo programado.

2. Se podrá realizar demostraciones del sistema domótico en la clase de

domótica y usarla a la maqueta para futuros proyectos.

3. Se obtienen buenos resultados usando los módulos Arduino cuando

se trata de automatización ya que además de ser didácticos, fácil para

implementación y de bajo costo; son también amigables para la

programación.
174

RECOMENDACIONES:

1. Cotizar módulos considerando la funcionalidad, eficacia y durabilidad para

comparar dispositivos en varias marcas como Bticino, simonvis, e

insteon.

2. Como el sistema domótico se presentó en una maqueta, es necesario

darle el mantenimiento correcto del mismo para las demostraciones

académicas y realizaciones de experimentos.

3. Para que el módulo de reconocimiento de voz funcione establemente se

necesita un ambiente silencioso; caso contrario no funcionará y no se

ejecutará el reconocimiento de voz.

4. En el caso de ejecutar el control lumínico en un lugar cerrado donde

exista poca intensidad de luz; es preferible usar una linterna para

maniobrar el control.

5. Permanecer a una distancia menor a 5 metros para un adecuado

funcionamiento del control remoto siempre y cuando el nivel de la batería

sea óptimo, caso contrario la distancia debe acortarse. Si se está usando


175

el control remoto permanecer a una distancia menor a 5 metros para la

funcionalidad del receptor, ignorando el déficit de energía de la batería.

6. En el caso de usar las tarjetas Arduino para la realización de proyectos;

añadir el código ya programado al sketch modificado considerando las

librerías incorporadas, caso contrario no funcionará el sistema.

7. Considerar el uso de reguladores de voltaje para la seguridad de los

módulos, los picos de corrientes dañan los integrados ocasionando

pérdidas de control, el Jack de la Arduino no soporta voltajes mayores a

10 voltios ya que se sobrecalienta hasta ocasionar el daño total de la

tarjeta.
176

BIBLIOGRAFÍA

[1] Live Modern, DOMÓTICA, http://www.livemodern.org/domotica-

definicion/

[2] Huidobro José Manuel, http://www.monografias.com/trabajos14/

domotica/domotica.shtml

[3] Pérez Guzmán Julio César, EDIFICIOS INTELIGENTES,

http://www.monografias.com/trabajos15/edific-inteligentes/edific-

inteligentes.shtml

[4] Reyes Padilla Karenh Gyssel, DOMÓTICA,

http://www.monografias.com/trabajos35/domotica/domotica.shtml

[5] Escobar Alex, http://www.monografias.com/trabajos5/edin/edin.shtml

[6] Quiñones Ponte Bhily, https://es.scribd.com/doc/218307407/Monografia-

de-Domotica

[7] Pololu Robotics & Electronics, https://www.pololu.com/product/2546

[8] MyHDL, Python silicon, http://old.myhdl.org/doku.php/projects:uart_rs232_

receiver_transmitter

[9] SILICA Avnet Company , http://www.silica.com/product/cy7c64225-28pvxc-

plug-and-play-usb-to-uart-brid.html
177

[10] Maxim Integrated, http://www.maximintegrated.com/en/app-notes/

index.mvp/id/214\

[11] Atmel Corporation, http://www.atmel.com/Images/doc7799.pdf

[12] Elecfreaks, http://www.elecfreaks.com/5418.html

[13] Sparkfun, https://learn.sparkfun.com/tutorials/serial-peripheral-interface-

spi

[14] TIGAL VEEAR, http://www.veear.eu/products/easyvr-Arduino-shield/

[15] Pololu Robotics & Electronics, https://www.pololu.com/product/2551

[16] Wikipedia, http://en.wikipedia.org/wiki/USB

[17] Arduino Software, http://Arduino.cc/en/Main/ArduinoBoardMega2560

[18] José Rivas A. , MANUAL ILUSTRADO PARA LA INSTALACIÓN

DOMÓTICA, http://books.google.com.ec/books?id=eB5Mp-

b0asAC&lpg=PA24&dq=instalacion+alarma&pg=PP1&redir_esc=y#v=onepag

e&q&f=true

[19] Stefan Junestrand, Xavier P., DOMÓTICA Y HOGAR DIGITAL, 2004

http://books.google.com.ec/books?id=8ERFqWcdHAEC&pg=PA51&hl=es&so

urce=gbs_toc_r&cad=3#v=onepage&q&f=false

[20] Luciano Redolfi, DOMÓTICA, Pocket Users, 2013,

http://www.mediafire.com/view/lntn44jni0d1juw/DOMOTICA.pdf
178

[21] Simon Monk, 30 ARDUINOS PROJECTS for the EVIL GENIUS, Mc

Graw Hill,

http://www.nfiautomation.org/FREE_Download/Technical%20Documents/Ard

uino/30%20Arduino%20projects%20for%20the%20evil%20genius.pdf
ANEXOS

ANEXO 1. PROGRAMACIÓN TOTAL DEL SISTEMA DOMÓTICO


ANEXO 2. PRUEBAS DE VOLTAJE Y CORRIENTE DE LA MAQUETA
Pruebas de Voltaje y Corriente

Corriente
Voltaje Corriente Nominal
Nombre Función
[V] Inicial [A] con Carga
[A]
Servomotor 5 0,13 0,075 Movimiento de apertura de la puerta del hogar
Arduino -Pololu 9 0,05 Módulo de control de la tira de LEDS
Arduino-NFC 9 0,13 Lector de la tarjeta magnética
Tira de LEDS 5 0,05 0,7 Tira de LEDS para a ambientación
7805 12 0,18 Reductor de voltaje para los Arduinos
Arduino Mega 5 0,3 Procesador central
Placa Dimmer 5 0,055 Módulo que puede dimerizar 11 LEDS
Placa Relay 5 0,38 Módulo de control de apertura de 5 LEDS y el riego
Placa PIC 5 0,003 Módulo de control de persianas
Motor de Paso 5 0,16 Motor que permite el movimiento de persiana y garaje
Total 0,18 2,033
Pruebas de Potencia

Potencia
Potencia
Nombre Nominal con Función
Inicial [W]
Carga [W]

Servomotor 0,65 0,375 Movimiento de apertura de la puerta del hogar


Arduino-Pollolu 0 0,45 Módulo de control de la tira de LEDS
Arduino-NFC 0 1,17 Lector de la tarjeta magnética
Tira de LEDS 0,25 3,5 Tira de LEDS para a ambientación
7805 0 2,16 Reductor de voltaje para los Arduinos
Arduino Mega 0 1,5 Procesador central
Placa Dimmer 0 0,275 Módulo que puede dimerizar 11 LEDS
Placa Relay 0 1,9 Módulo de control de apertura de 5 LEDS y el riego
Placa PIC 0 0,015 Módulo de control de persianas
Motor de Paso 0 0,8 Motor que permite el movimiento de persiana y garaje
Total 0,9 12,145
ANEXO 3. COTIZACIÓN PRESENTADA POR BTCINO
ANEXO 4. PLANOS ELÉCTRICOS DE LA VIVIENDA
ANEXO 5. PLANOS DOMÓTICOS DE LA MAQUETA
ANEXO 6. ESQUEMÁTICO DEL ARDUINO MEGA 2560
The Arduino Mega 2560 is a microcontroller board based on the ATmega2560
(datasheet). It has 54 digital input/output pins (of which 14 can be used as PWM outputs),
16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB
connection, a power jack, an ICSP header, and a reset button. It contains everything
needed to support the microcontroller; simply connect it to a computer with a USB cable or
power it with a AC-to-DC adapter or battery to get started. The Mega is compatible with
most shields designed for the Arduino Duemilanove or Diecimila.
EAGLE files: arduino-mega2560-reference-design.zip Schematic: arduino-mega2560-schematic.pdf

Microcontroller ATmega2560
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 54 (of which 14 provide PWM output)
Analog Input Pins 16
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 256 KB of which 8 KB used by bootloader
SRAM 8 KB
EEPROM 4 KB
Clock Speed 16 MHz
The Arduino Mega2560 can be powered via the USB connection or with an external power supply. The power source is
selected automatically. External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The
adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery
can be inserted in the Gnd and Vin pin headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may
supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat
and damage the board. The recommended range is 7 to 12 volts.

The Mega2560 differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip. Instead, it
features the Atmega8U2 programmed as a USB-to-serial converter.

The power pins are as follows:

• VIN. The input voltage to the Arduino board when it's using an external power source (as opposed to 5 volts
from the USB connection or other regulated power source). You can supply voltage through this pin, or, if
supplying voltage via the power jack, access it through this pin.
• 5V. The regulated power supply used to power the microcontroller and other components on the board. This
can come either from VIN via an on-board regulator, or be supplied by USB or another regulated 5V supply.
• 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.
• GND. Ground pins.

The ATmega2560 has 256 KB of flash memory for storing code (of which 8 KB is used for the bootloader), 8 KB of
SRAM and 4 KB of EEPROM (which can be read and written with the EEPROM library).

Each of the 54 digital pins on the Mega can be used as an input or output, using pinMode(), digitalWrite(), and
digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an
internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions:

• Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16 (TX); Serial 3: 15 (RX) and
14 (TX). Used to receive (RX) and transmit (TX) TTL serial data. Pins 0 and 1 are also connected to the
corresponding pins of the ATmega8U2 USB-to-TTL Serial chip .
• External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt 4), 20 (interrupt 3), and 21
(interrupt 2). These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a
change in value. See the attachInterrupt() function for details.
• PWM: 0 to 13. Provide 8-bit PWM output with the analogWrite() function.
• SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication, which, although
provided by the underlying hardware, is not currently included in the Arduino language. The SPI pins are also
broken out on the ICSP header, which is physically compatible with the Duemilanove and Diecimila.
• LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when
the pin is LOW, it's off.
• I2C: 20 (SDA) and 21 (SCL). Support I2C (TWI) communication using the Wire library (documentation on the
Wiring website). Note that these pins are not in the same location as the I2C pins on the Duemilanove.

The Mega2560 has 16 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By default
they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and
analogReference() function.

There are a couple of other pins on the board:

• AREF. Reference voltage for the analog inputs. Used with analogReference().
• Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which
block the one on the board.
The Arduino Mega2560 has a number of facilities for communicating with a computer, another Arduino, or
other microcontrollers. The ATmega2560 provides four hardware UARTs for TTL (5V) serial communication.
An ATmega8U2 on the board channels one of these over USB and provides a virtual com port to software on
the computer (Windows machines will need a .inf file, but OSX and Linux machines will recognize the board
as a COM port automatically. The Arduino software includes a serial monitor which allows simple textual
data to be sent to and from the board. The RX and TX LEDs on the board will flash when data is being
transmitted via the ATmega8U2 chip and USB connection to the computer (but not for serial communication
on pins 0 and 1).

A SoftwareSerial library allows for serial communication on any of the Mega's digital pins.

The ATmega2560 also supports I2C (TWI) and SPI communication. The Arduino software includes a Wire
library to simplify use of the I2C bus; see the documentation on the Wiring website for details. To use the SPI
communication, please see the ATmega2560 datasheet.

The Arduino Mega2560 can be programmed with the Arduino software (download). For details, see the
reference and tutorials.

The Atmega2560 on the Arduino Mega comes preburned with a bootloader that allows you to upload new
code to it without the use of an external hardware programmer. It communicates using the original STK500
protocol (reference, C header files).

You can also bypass the bootloader and program the microcontroller through the ICSP (In-Circuit Serial
Programming) header; see these instructions for details.
Rather then requiring a physical press of the reset button before an upload, the Arduino Mega2560 is
designed in a way that allows it to be reset by software running on a connected computer. One of the
hardware flow control lines (DTR) of the ATmega8U2 is connected to the reset line of the ATmega2560 via a
100 nanofarad capacitor. When this line is asserted (taken low), the reset line drops long enough to reset the
chip. The Arduino software uses this capability to allow you to upload code by simply pressing the upload
button in the Arduino environment. This means that the bootloader can have a shorter timeout, as the
lowering of DTR can be well-coordinated with the start of the upload.

This setup has other implications. When the Mega2560 is connected to either a computer running Mac OS X
or Linux, it resets each time a connection is made to it from software (via USB). For the following half-second
or so, the bootloader is running on the Mega2560. While it is programmed to ignore malformed data (i.e.
anything besides an upload of new code), it will intercept the first few bytes of data sent to the board after a
connection is opened. If a sketch running on the board receives one-time configuration or other data when it
first starts, make sure that the software with which it communicates waits a second after opening the
connection and before sending this data.

The Mega contains a trace that can be cut to disable the auto-reset. The pads on either side of the trace can
be soldered together to re-enable it. It's labeled "RESET-EN". You may also be able to disable the auto-reset
by connecting a 110 ohm resistor from 5V to the reset line; see this forum thread for details.

The Arduino Mega has a resettable polyfuse that protects your computer's USB ports from shorts and
overcurrent. Although most computers provide their own internal protection, the fuse provides an extra layer
of protection. If more than 500 mA is applied to the USB port, the fuse will automatically break the connection
until the short or overload is removed.

The maximum length and width of the Mega PCB are 4 and 2.1 inches respectively, with the USB connector
and power jack extending beyond the former dimension. Three screw holes allow the board to be attached to
a surface or case. Note that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even multiple
of the 100 mil spacing of the other pins.

The Mega is designed to be compatible with most shields designed for the Diecimila or Duemilanove. Digital
pins 0 to 13 (and the adjacent AREF and GND pins), analog inputs 0 to 5, the power header, and ICSP
header are all in equivalent locations. Further the main UART (serial port) is located on the same pins (0 and
1), as are external interrupts 0 and 1 (pins 2 and 3 respectively). SPI is available through the ICSP header on
both the Mega and Duemilanove / Diecimila. Please note that I2C is not located on the same pins on the
Mega (20 and 21) as the Duemilanove / Diecimila (analog inputs 4 and 5).
Arduino can sense the environment by receiving input from a variety of sensors and can affect its
surroundings by controlling lights, motors, and other actuators. The microcontroller on the board is
programmed using the Arduino programming language (based on Wiring) and the Arduino
development environment (based on Processing). Arduino projects can be stand-alone or they can
communicate with software on running on a computer (e.g. Flash, Processing, MaxMSP).

Arduino is a cross-platoform program. You’ll have to follow different instructions for your personal
OS. Check on the Arduino site for the latest instructions. http://arduino.cc/en/Guide/HomePage

Once you have downloaded/unzipped the arduino IDE, you can Plug the Arduino to your PC via USB cable.

Now you’re actually ready to “burn” your


first program on the arduino board. To
select “blink led”, the physical translation
of the well known programming “hello
world”, select

File>Sketchbook>
Arduino-0017>Examples>
Digital>Blink

Once you have your skecth you’ll


see something very close to the
screenshot on the right.

In Tools>Board select MEGA

Now you have to go to


Tools>SerialPort
and select the right serial port, the
one arduino is attached to.
1. Warranties

1.1 The producer warrants that its products will conform to the Specifications. This warranty lasts for one (1) years from the date of the sale. The
producer shall not be liable for any defects that are caused by neglect, misuse or mistreatment by the Customer, including improper installation or testing,
or for any products that have been altered or modified in any way by a Customer. Moreover, The producer shall not be liable for any defects that result from
Customer's design, specifications or instructions for such products. Testing and other quality control techniques are used to the extent the producer deems
necessary.

1.2 If any products fail to conform to the warranty set forth above, the producer's sole liability shall be to replace such products. The producer's liability
shall be limited to products that are determined by the producer not to conform to such warranty. If the producer elects to replace such products, the
producer shall have a reasonable time to replacements. Replaced products shall be warranted for a new full warranty period.

1.3 EXCEPT AS SET FORTH ABOVE, PRODUCTS ARE PROVIDED "AS IS" AND "WITH ALL FAULTS." THE PRODUCER DISCLAIMS ALL OTHER
WARRANTIES, EXPRESS OR IMPLIED, REGARDING PRODUCTS, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE

1.4 Customer agrees that prior to using any systems that include the producer products, Customer will test such systems and the functionality of the
products as used in such systems. The producer may provide technical, applications or design advice, quality characterization, reliability data or other
services. Customer acknowledges and agrees that providing these services shall not expand or otherwise alter the producer's warranties, as set forth
above, and no additional obligations or liabilities shall arise from the producer providing such services.

1.5 The Arduino products are not authorized for use in safety-critical applications where a failure of the product would reasonably be expected to cause
severe personal injury or death. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the
operation of nuclear facilities and weapons systems. Arduino products are neither designed nor intended for use in military or aerospace applications or
environments and for automotive applications or environment. Customer acknowledges and agrees that any such use of Arduino products which is solely
at the Customer's risk, and that Customer is solely responsible for compliance with all legal and regulatory requirements in connection with such use.

1.6 Customer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements concerning its
products and any use of Arduino products in Customer's applications, notwithstanding any applications-related information or support that may be
provided by the producer.

2. Indemnification

The Customer acknowledges and agrees to defend, indemnify and hold harmless the producer from and against any and all third-party losses, damages,
liabilities and expenses it incurs to the extent directly caused by: (i) an actual breach by a Customer of the representation and warranties made under this
terms and conditions or (ii) the gross negligence or willful misconduct by the Customer.

3. Consequential Damages Waiver

In no event the producer shall be liable to the Customer or any third parties for any special, collateral, indirect, punitive, incidental, consequential or
exemplary damages in connection with or arising out of the products provided hereunder, regardless of whether the producer has been advised of the
possibility of such damages. This section will survive the termination of the warranty period.

4. Changes to specifications

The producer may make changes to specifications and product descriptions at any time, without notice. The Customer must not rely on the absence or
characteristics of any features or instructions marked "reserved" or "undefined." The producer reserves these for future definition and shall have no
responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The product information on the Web Site or Materials is
subject to change without notice. Do not finalize a design with this information.

The producer of Arduino has joined the Impatto Zero®


policy of LifeGate.it. For each Arduino board produced is
created / looked after half squared Km of Costa Rica’s
forest’s.
TM +5V

Arduino MEGA 2560

CD1206-S01575
+5V

RN5A 10K
8

D3

RN1B 10K

RN1C 10K
X1
+5V

1
RESET

6
POWERSUPPLY_DC21MMX
IC1 +5V
3 3 NCP1117ST50T3G C1
VIN GREEN

3
3 4 ON
1

IN OUT

GND
D1 2 1 8 22p +5V
M7 RN3A 1k ICSP SCL
1

PWRIN C2 3 IC7A (MISO) PB3 1 2 SDA


+

PC1 PC2 YELLOW


1

47u 47u 1 L GND (SCK) PB1 3 4 PB2 (MOSI)


1k RN3B

GND
100n 2 L13 7 2 RESET 5 6
LMV358IDGKR
GND GND GND 3x2M GND

4
2
2x2M - NM
GND GND IC3
RESET 30 RESET 71 PA7
(AD7)PA7

JP5
3
1
Y1 72 PA6
(AD6)PA6 PA5
XTAL2 33 XTAL2 (AD5)PA5 73
GND

R1 74 PA4
(AD4)PA4 PA3
1M XTAL1 34 75

8PB7
8PB6
8PB5
8PB4
XTAL1 (AD3)PA3 PA2
(AD2)PA2 76
XTAL1 16MHZ
CSTCE16M0V53-R0 AREF 98 AREF 77 PA1 JP6
(AD1)PA1 PA0
100 AVCC (AD0)PA0 78 SCL 1
+5V 99 SDA 2
AGND +5V
AREF (OC0A/OC1C/PCINT7)PB7 26 PB7 pwm AREF 3
C3 (OC1B/PCINT6)PB6 25 PB6 pwm GND 4
C4 C5 10 VCC (OC1A/PCINT5)PB5 24 PB5 pwm 5 13
100n C6 31 23 PB4 pwm 6 12 ICSP1
VCC (OC2A/PCINT4)PB4
100n 100n 61 VCC (MISO/PCINT3)PB3 22 PB3 (MISO) 7 11 MISO2 1 2
100n 80 21 PB2 (MOSI) 8 10 SCK2 3 4 MOSI2
VCC (MOSI/PCINT2)PB2

CD1206-S01575
GND 11 GND (SCK/PCINT1)PB1 20 PB1 (SCK) PH6 pwm 9 9 RESET2 5 6

7 RN5B
32 19 PB0 PH5 pwm 10 1 2

2
GND (SS/PCINT0)PB0 8
GND

D2
62 GND 3x2M
18x2F-H8.5 81 60 PC7 10x1F-H8.5 RESET-EN
GND (A15)PC7 GND IC4

10K
36 35 59 PC6 GND
53 PB0 (SS) (A14)PC6
34 33 (SCK) PB1 52 GND (A13)PC5 58 PC5
(PCINT7/OC0A/OC1C)PB7 21
51 PB2 (MOSI) 32 31 (MISO) PB3 50 57 PC4 20
(A12)PC4 (PCINT6)PB6

22p
49 PL0 30 29 PL1 48 56 PC3 C8 RESET2 24 19 DTR RESET

C15
47 PL2 PL3 46 (A11)PC3 PC2 RESET(PC1/DW) (PCINT5)PB5
28 27 55 USB-B_TH 100n 18

100n
C7
45 PL4 PL5 44 (A10)PC2 PC1 (T1/PCINT4)PB4
26 25 (A9)PC1 54 XT2 (PD0/MISO/PCINT3)PB3 17 MISO2
X2 F1

16MHz

Y2
43 PL6 24 23 PL7 42 PL7 42 53 PC0 XVCC USBVCC 2 16 MOSI2

1
PL7 (A8)PC0 8x1F-H8.5 22R RN2A XTAL2(PC0) (PDI/MOSI/PCINT2)PB2

GND
41 PG0 22 21 PG1 40 PL6 41 PL6 1 MF-MSMF050-2 500mA 8 1 R2 15 SCK2
39 PG2 PD7 38 PL5 (SCLK/PCINT1)PB1
50 PD7 TXD3 8 14

USB
20 19 pwm 40 PL5(OC5C) (T0)PD7 2 D- RD- 1M 1 XTAL1 (SS/PCINT0)PB0 14
37 PC0 PC1 36 PL4 RXD3 7 15

2
18 17 pwm 39 49 3 D+ RD+

P$2
P$1
PL4(OC5B) (T1)PD6 22R
35 PC2 16 15 PC3 34 PL3 pwm 38 48 TXD2 6 16 4 5 RN2D
4 XT1

CG0603MLC-05E
33 PC4 PC5 32 PL2 PL3(OC5A) (XCK1)PD5 RXD2 +5V
14 13 37 47 5 17 2 7 32 22

CG0603MLC-05E

USB boot En
C14
PL2(T5) (ICP1)PD4 AVCC (INT4/ICP1/CLK0)PC7

22p
31 PC6 PC7 30 PL1 TXD1 4 18 COMMUNICATION

UGND
12 11 36 PL1(ICP5) (TXD1/INT3)PD3 46 RN2B 22R (OC1A/PCINT8)PC6 23

USHIELD P$2
P$1

1k RN3D
29 PA7 10 9 PA6 28 PL0 35 45 RXD1 3 19 3 6 25 GND

5
27 PA5 PA4 26 8x1F-H8.5 PL0(ICP4) (RXD1/INT2)PD2 SDA (PCINT9/OC1B)PC5
8 7 (SDA/INT1)PD1 44 2 20 RN2C 22R 4 VCC (PCINT10)PC4 26

Z1

Z2
25 PA3 6 5 PA2 24 8 ADC15 82 PK7(ADC15/PCINT23) 43 SCL 1 21 3 GND 5
23 PA1 PA0 22 ADC14 (SCL/INT0)PD0 8x1F-H8.5 (AIN2/PCINT11)PC2

4
4 3 7 83 PK6(ADC14/PCINT22)
2 1 6 ADC13 84 9 PH4 pwm 8 7 13
+5V ADC12 PK5(ADC13/PCINT21) (CLKO/ICP3/INT7)PE7 PH3 pwm (CTS/HWB/AIN6/TO/INT7)PD7
5 85 PK4(ADC12/PCINT20) (T3/INT6)PE6 8 7 6 VUCAP 27 UCAP (RTS/AIN5/INT6)PD6 12
XIO ADCH 4 ADC11 86 7 PE5 pwm PE3 pwm 6 5 6 3 USBVCC 31 11 TXL 3 6 +5V
ADC10 PK3(ADC11/PCINT19) (OC3C/INT5)PE5 PE4 PG5 pwm BLM21 UVCC (XCK/AIN4/PCINT12)PD5
3 87 PK2(ADC10/PCINT18) (OC3B/INT4)PE4 6 pwm 5 4 RD- 30 D- (INT5/AIN3)PD4 10 RXL RN4C 1k
2 ADC9 88 5 PE3 pwm PE5 pwm 4 3 PWML 1k RN3C RD+ 29 9 M8RXD
ADC8 PK1(ADC9/PCINT17) (OC3A/AIN1)PE3 PE4 pwm L1 1u D+ (TXD1/INT3)PD3
1 89 PK0(ADC8/PCINT16) (XCK0/AIN0)PE2 4 3 2 C10 UGND 28 UGND (RXD1/AIN1/INT2)PD2 8 M8TXD
3 PE1 (TX0) PE1 2 1 7
(TXD0)PE1 PE0 PE0 100n (AIN0/INT1)PD1 TX
79 PJ7 (RXD0/PCIN8)PE0 2 (RX0) 1 0 33 PAD (OC0B/INT0)PD0 6 YELLOW
69 8x1F-H8.5 C9
+5V+3V3 PJ6(PCINT15) ADC7
68 PJ5(PCINT14) (ADC7/TDI)PF7 90 8 1 2 ATMEGA16U2-MU
1 67 91 ADC6 7 GND
PJ4(PCINT13) (ADC6/TDO)PF6 ADC5 GROUND
2 66 PJ3(PCINT12) (ADC5/TMS)PF5 92 6 1 8 4 5
3 65 93 ADC4 5 ADCL RN1A 10K 2 7 RX RN4D 1k
PJ2(XCK3/PCINT11) (ADC4/TCK)PF4 ADC3
4
POWER
TXD3
RXD3
64 PJ1(TXD3/PCINT10) (ADC3)PF3 94
ADC2
4 4 5 GND PE0 RN4B 1k M8RXD YELLOW
5 63 PJ0(RXD3/PCINT9) (ADC2)PF2 95 3 RN1D 10K
6 96 ADC1 2
(ADC1)PF1 ADC0 M8TXD
7 27 PH7(T4) (ADC0)PF0 97 1 PE1
8 pwm PH6 18 1 8
VIN pwm PH5 PH6(OC2B) PG5 pwm
17 PH5(OC4C) (OC0B)PG5 1 RN4A 1k
GND 8x1F-H8.5 pwm PH4 16 29
pwm PH3 PH4(OC4B) (TOSC1)PG4
15 PH3(OC4A) (TOSC2)PG3 28
14 PH2(XCK2) 70 PG2
TXD2 (ALE)PG2 PG1
13 PH1(TXD2) (RD)PG1 52
RXD2 12 PH0(RXD2) 51 PG0
(WR)PG0
ATMEGA2560-16AU
5
Reference Designs ARE PROVIDED "AS IS" AND "WITH ALL FAULTS. Arduino DISCLAIMS ALL OTHER WARRANTIES, EXPRESS OR IMPLIED,
GND

RESET 4 2
3 1
REGARDING PRODUCTS, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
TS42031-160R-TR-7260
RESET Arduino may make changes to specifications and product descriptions at any time, without notice. The Customer must not
1 5
+3V3 rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined." Arduino reserves
+5V IN OUT
+5V 3
these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them.
VIN ON/OFF
C13+3V3

CMP The product information on the Web Site or Materials is subject to change without notice. Do not finalize a design with this information.
RN5D 10K RN5C 10K

5 IC7B 2 4
6

GND NC/FB
7 GATE_CMD
+3V3 6 ARDUINO is a registered trademark.
8

LMV358IDGKR
1u

C11
5

100n C12
100n
4

GND GND
+5V
4

GND GND
USBVCC +5V
T1
FDN340P
ANEXO 7. PROGRAMACIÓN DEL ARDUINO MEGA 2560
LVIFA_BASE

/*********************************************************************************
**
** LVFA_Firmware - Provides Basic Arduino Sketch For Interfacing With LabVIEW.
**
** Written By: Sam Kristoff - National Instruments
** Written On: November 2010
** Last Updated: Dec 2011 - Kevin Fort - National Instruments
**
** This File May Be Modified And Re-Distributed Freely. Original File Content
** Written By Sam Kristoff And Available At www.ni.com/arduino.
**
*********************************************************************************/

/*********************************************************************************
**
** Includes.
**
********************************************************************************/
// Standard includes. These should always be included.
#include <Wire.h>
#include <SPI.h>
#include <Servo.h>
#include "LabVIEWInterface.h"

/*********************************************************************************
** setup()
**
** Initialize the Arduino and setup serial communication.
**
** Input: None
** Output: None
*********************************************************************************/
void setup()
{
// Initialize Serial Port With The Default Baud Rate
syncLV();

// Place your custom setup code here


}

/*********************************************************************************
** loop()
**
** The main loop. This loop runs continuously on the Arduino. It
** receives and processes serial commands from LabVIEW.
**
** Input: None
** Output: None
*********************************************************************************/
void loop()
{
// Check for commands from LabVIEW and process them.

checkForCommand();
// Place your custom loop code here (this may slow down communication with LabVIEW)

if(acqMode==1)
{
sampleContinously();
}

}
LabVIEWInterface
/*********************************************************************************
**
** LVIFA_Firmware - Provides Functions For Interfacing With The Arduino Mega 2560
**
** Written By: Sam Kristoff - National Instruments
** Written On: November 2010
** Last Updated: Dec 2011 - Kevin Fort - National Instruments
**
** This File May Be Modified And Re-Distributed Freely. Original File Content
** Written By Sam Kristoff And Available At www.ni.com/arduino.
**
*********************************************************************************/

#include <Wire.h>
#include <SPI.h>
#include <LiquidCrystal.h>

/*********************************************************************************
** Optionally Include And Configure Stepper Support
*********************************************************************************/
#ifdef STEPPER_SUPPORT

// Stepper Modifications
#include "AFMotor.h"
#include "AccelStepper.h"

// Adafruit shield
AF_Stepper motor1(200, 1);
AF_Stepper motor2(200, 2);

// you can change these to DOUBLE or INTERLEAVE or MICROSTEP


// wrappers for the first motor
void forwardstep1() {
motor1.onestep(FORWARD, SINGLE);
}
void backwardstep1() {
motor1.onestep(BACKWARD, SINGLE);
}
// wrappers for the second motor
void forwardstep2() {
motor2.onestep(FORWARD, SINGLE);
}
void backwardstep2() {
motor2.onestep(BACKWARD, SINGLE);
}
AccelStepper steppers[8]; //Create array of 8 stepper objects
#endif
// Variables
unsigned int retVal;
int sevenSegmentPins[8];
int currentMode;
unsigned int freq;
unsigned long duration;
int i2cReadTimeouts = 0;
char spiBytesToSend = 0;
char spiBytesSent = 0;
char spiCSPin = 0;
char spiWordSize = 0;
Servo *servos;
byte customChar[8];
LiquidCrystal lcd(0,0,0,0,0,0,0);
// Sets the mode of the Arduino (Reserved For Future Use)
void setMode(int mode)
{
currentMode = mode;
}
// Checks for new commands from LabVIEW and processes them if any exists.
int checkForCommand(void)
{
#ifdef STEPPER_SUPPORT
// Call run function as fast as possible to keep motors turning
for (int i=0; i<8; i++){
steppers[i].run();
}
#endif
int bufferBytes = Serial.available();
if(bufferBytes >= COMMANDLENGTH)
{
// New Command Ready, Process It
// Build Command From Serial Buffer
for(int i=0; i<COMMANDLENGTH; i++)
{
currentCommand[i] = Serial.read();
}
processCommand(currentCommand);
return 1;
}
else
{
return 0;
}
}

// Processes a given command


void processCommand(unsigned char command[])
{
// Determine Command
if(command[0] == 0xFF && checksum_Test(command) == 0)
{
switch(command[1])
{
/*********************************************************************************
** LIFA Maintenance Commands
*********************************************************************************/
case 0x00: // Sync Packet
Serial.print("sync");
Serial.flush();
break;
case 0x01: // Flush Serial Buffer
Serial.flush();
break;
/*********************************************************************************
** Low Level - Digital I/O Commands
*********************************************************************************/
case 0x02: // Set Pin As Input Or Output
pinMode(command[2], command[3]);
Serial.write('0');
break;
case 0x03: // Write Digital Pin
digitalWrite(command[2], command[3]);
Serial.write('0');
break;
case 0x04: // Write Digital Port 0
writeDigitalPort(command);
Serial.write('0');
break;
case 0x05: //Tone
freq = ( (command[3]<<8) + command[4]);
duration=(command[8]+ (command[7]<<8)+ (command[6]<<16)+(command[5]<<24));
if(freq > 0)
{
tone(command[2], freq, duration);
}
else
{
noTone(command[2]);
}
Serial.write('0');
break;
case 0x06: // Read Digital Pin
retVal = digitalRead(command[2]);
Serial.write(retVal);
break;
case 0x07: // Digital Read Port
retVal = 0x0000;
for(int i=0; i <=13; i++)
{
if(digitalRead(i))
{
retVal += (1<<i);
}
}
Serial.write( (retVal & 0xFF));
Serial.write( (retVal >> 8));
break;
/*********************************************************************************
** Low Level - Analog Commands
*********************************************************************************/
case 0x08: // Read Analog Pin
retVal = analogRead(command[2]);
Serial.write( (retVal >> 8));
Serial.write( (retVal & 0xFF));
break;
case 0x09: // Analog Read Port
analogReadPort();
break;
/*********************************************************************************
** Low Level - PWM Commands
*********************************************************************************/
case 0x0A: // PWM Write Pin
analogWrite(command[2], command[3]);
Serial.write('0');
break;
case 0x0B: // PWM Write 3 Pins
analogWrite(command[2], command[5]);
analogWrite(command[3], command[6]);
analogWrite(command[4], command[7]);
Serial.write('0');
break;
/*********************************************************************************
** Sensor Specific Commands
*********************************************************************************/
case 0x0C: // Configure Seven Segment Display
sevenSegment_Config(command);
Serial.write('0');
break;
case 0x0D: // Write To Seven Segment Display
sevenSegment_Write(command);
Serial.write('0');
break;
/*********************************************************************************
** I2C
*********************************************************************************/
case 0x0E: // Initialize I2C
Wire.begin();
Serial.write('0');
break;
case 0x0F: // Send I2C Data
Wire.beginTransmission(command[3]);
for(int i=0; i<command[2]; i++)
{
#if defined(ARDUINO) && ARDUINO >= 100
Wire.write(command[i+4]);
#else
Wire.send(command[i+4]);
#endif
}
Wire.endTransmission();
Serial.write('0');
break;
case 0x10: // I2C Read
i2cReadTimeouts = 0;
Wire.requestFrom(command[3], command[2]);
while(Wire.available() < command[2])
{
i2cReadTimeouts++;
if(i2cReadTimeouts > 100)
{
return;
}
else
{
delay(1);
}
}
for(int i=0; i<command[2]; i++)
{
#if defined(ARDUINO) && ARDUINO >= 100
Serial.write(Wire.read());
#else
Serial.write(Wire.receive());
#endif
}
break;
/*********************************************************************************
** SPI
*********************************************************************************/
case 0x11: // SPI Init
SPI.begin();
Serial.write('0');
break;
case 0x12: // SPI Set Bit Order (MSB LSB)
if(command[2] == 0)
{
SPI.setBitOrder(LSBFIRST);
}
else
{
SPI.setBitOrder(MSBFIRST);
}
Serial.write('0');
break;
case 0x13: // SPI Set Clock Divider
spi_setClockDivider(command[2]);
Serial.write('0');
break;
case 0x14: // SPI Set Data Mode
switch(command[2])
{
case 0:
SPI.setDataMode(SPI_MODE0);
break;
case 1:
SPI.setDataMode(SPI_MODE1);
break;
case 2:
SPI.setDataMode(SPI_MODE2);
break;
case 3:
SPI.setDataMode(SPI_MODE3);
break;
default:
break;
}
Serial.write('0');
break;
case 0x15: // SPI Send / Receive
spi_sendReceive(command);
break;
case 0x16: // SPI Close
SPI.end();
Serial.write('0');
break;
/*********************************************************************************
** Servos
*********************************************************************************/
case 0x17: // Set Num Servos
free(servos);
servos = (Servo*) malloc(command[2]*sizeof(Servo));
for(int i=0; i<command[2]; i++)
{
servos[i] = Servo();
}
if(servos == 0)
{
Serial.write('1');
}
else
{
Serial.write('0');
}
break;
case 0x18: // Configure Servo
servos[command[2]].attach(command[3]);
Serial.write('0');
break;
case 0x19: // Servo Write
servos[command[2]].write(command[3]);
Serial.write('0');
break;
case 0x1A: // Servo Read Angle
Serial.write(servos[command[2]].read());
break;
case 0x1B: // Servo Write uS Pulse
servos[command[2]].writeMicroseconds( (command[3] + (command[4]<<8)) );
Serial.write('0');
break;
case 0x1C: // Servo Read uS Pulse
retVal = servos[command[2]].readMicroseconds();
Serial.write ((retVal & 0xFF));
Serial.write( (retVal >> 8));
break;
case 0x1D: // Servo Detach
servos[command[2]].detach();
Serial.write('0');
break;
/*********************************************************************************
** LCD
*********************************************************************************/
case 0x1E: // LCD Init
lcd.init(command[2], command[3], command[4], command[5], command[6], command[7],
command[8], command[9], command[10], command[11], command[12], command[13]);
Serial.write('0');
break;
case 0x1F: // LCD Set Size
lcd.begin(command[2], command[3]);
Serial.write('0');
break;
case 0x20: // LCD Set Cursor Mode
if(command[2] == 0)
{
lcd.noCursor();
}
else
{
lcd.cursor();
}
if(command[3] == 0)
{
lcd.noBlink();
}
else
{
lcd.blink();
}
Serial.write('0');
break;
case 0x21: // LCD Clear
lcd.clear();
Serial.write('0');
break;
case 0x22: // LCD Set Cursor Position
lcd.setCursor(command[2], command[3]);
Serial.write('0');
break;
case 0x23: // LCD Print
lcd_print(command);
break;
case 0x24: // LCD Display Power
if(command[2] == 0)
{
lcd.noDisplay();
}
else
{
lcd.display();
}
Serial.write('0');
break;
case 0x25: // LCD Scroll
if(command[2] == 0)
{
lcd.scrollDisplayLeft();
}
else
{
lcd.scrollDisplayRight();
}
Serial.write('0');
break;
case 0x26: // LCD Autoscroll
if(command[2] == 0)
{
lcd.noAutoscroll();
}
else
{
lcd.autoscroll();
}
Serial.write('0');
break;
case 0x27: // LCD Print Direction
if(command[2] == 0)
{
lcd.rightToLeft();
}
else
{
lcd.leftToRight();
}
Serial.write('0');
break;
case 0x28: // LCD Create Custom Char
for(int i=0; i<8; i++)
{
customChar[i] = command[i+3];
}
lcd.createChar(command[2], customChar);

Serial.write('0');
break;
case 0x29: // LCD Print Custom Char
lcd.write(command[2]);
Serial.write('0');
break;
/*********************************************************************************
** Continuous Aquisition
*********************************************************************************/
case 0x2A: // Continuous Aquisition Mode On
acqMode=1;
contAcqPin=command[2];
contAcqSpeed=(command[3])+(command[4]<<8);
acquisitionPeriod=1/contAcqSpeed;
iterationsFlt =.08/acquisitionPeriod;
iterations=(int)iterationsFlt;
if(iterations<1)
{
iterations=1;
}
delayTime= acquisitionPeriod;
if(delayTime<0)
{
delayTime=0;
}
break;
case 0x2B: // Continuous Aquisition Mode Off
acqMode=0;
break;
case 0x2C: // Return Firmware Revision
Serial.write(byte(FIRMWARE_MAJOR));
Serial.write(byte(FIRMWARE_MINOR));
break;
case 0x2D: // Perform Finite Aquisition
Serial.write('0');
finiteAcquisition(command[2],(command[3])+(command[4]<<8),command[5]+(command[6]<<8));
break;
/*********************************************************************************
** Stepper
*********************************************************************************/
#ifdef STEPPER_SUPPORT
case 0x30: // Configure Stepper
if (command[2] == 5){ // Support AFMotor Shield
switch (command[3]){
case 0:
steppers[command[3]] = AccelStepper(forwardstep1, backwardstep1);
break;
case 1:
steppers[command[3]] = AccelStepper(forwardstep2, backwardstep2);
break;
default:
break;
}
}
else if(command[2]==6) { // All other stepper configurations
steppers[command[3]] = AccelStepper(1, command[4],command[5],command[6],command[7]);
}
else{
steppers[command[3]] = AccelStepper(command[2],
command[4],command[5],command[6],command[7]);
}
Serial.write('0');
break;
case 0x31: // Stepper Write
AccelStepper_Write(command);
Serial.write('0');
break;
case 0x32: // Stepper Detach
steppers[command[2]].disableOutputs();
Serial.write('0');
break;
case 0x33: // Stepper steps to go
retVal = 0;
for(int i=0; i<8; i++){
retVal += steppers[i].distanceToGo();
}
Serial.write( (retVal & 0xFF) );
Serial.write( (retVal >> 8) );
break;
#endif
/*********************************************************************************
** Unknown Packet
*********************************************************************************/
default: // Default Case
Serial.flush();
break;
}
}
else{
// Checksum Failed, Flush Serial Buffer
Serial.flush();
}
}
/*********************************************************************************
** Functions
*********************************************************************************/
// Writes Values To Digital Port (DIO 0-13). Pins Must Be Configured As Outputs Before Being Written To
void writeDigitalPort(unsigned char command[])
{
digitalWrite(13, (( command[2] >> 5) & 0x01) );
digitalWrite(12, (( command[2] >> 4) & 0x01) );
digitalWrite(11, (( command[2] >> 3) & 0x01) );
digitalWrite(10, (( command[2] >> 2) & 0x01) );
digitalWrite(9, (( command[2] >> 1) & 0x01) );
digitalWrite(8, (command[2] & 0x01) );
digitalWrite(7, (( command[3] >> 7) & 0x01) );
digitalWrite(6, (( command[3] >> 6) & 0x01) );
digitalWrite(5, (( command[3] >> 5) & 0x01) );
digitalWrite(4, (( command[3] >> 4) & 0x01) );
digitalWrite(3, (( command[3] >> 3) & 0x01) );
digitalWrite(2, (( command[3] >> 2) & 0x01) );
digitalWrite(1, (( command[3] >> 1) & 0x01) );
digitalWrite(0, (command[3] & 0x01) );
}
// Reads all 6 analog input ports, builds 8 byte packet, send via RS232.
void analogReadPort()
{
// Read Each Analog Pin
int pin0 = analogRead(0);
int pin1 = analogRead(1);
int pin2 = analogRead(2);
int pin3 = analogRead(3);
int pin4 = analogRead(4);
int pin5 = analogRead(5);
//Build 8-Byte Packet From 60 Bits of Data Read
char output0 = (pin0 & 0xFF);
char output1 = ( ((pin1 << 2) & 0xFC) | ( (pin0 >> 8) & 0x03) );
char output2 = ( ((pin2 << 4) & 0xF0) | ( (pin1 >> 6) & 0x0F) );
char output3 = ( ((pin3 << 6) & 0xC0) | ( (pin2 >> 4) & 0x3F) );
char output4 = ( (pin3 >> 2) & 0xFF);
char output5 = (pin4 & 0xFF);
char output6 = ( ((pin5 << 2) & 0xFC) | ( (pin4 >> 8) & 0x03) );
char output7 = ( (pin5 >> 6) & 0x0F );
// Write Bytes To Serial Port
Serial.print(output0);
Serial.print(output1);
Serial.print(output2);
Serial.print(output3);
Serial.print(output4);
Serial.print(output5);
Serial.print(output6);
Serial.print(output7);
}
// Configure digital I/O pins to use for seven segment display
void sevenSegment_Config(unsigned char command[])
{
// Configure pins as outputs and store in sevenSegmentPins array for use in sevenSegment_Write
for(int i=2; i<10; i++)
{
pinMode(command[i], OUTPUT);
sevenSegmentPins[(i-1)] = command[i];
}
}
// Write values to sevenSegment display. Must first use sevenSegment_Configure
void sevenSegment_Write(unsigned char command[])
{
for(int i=1; i<9; i++)
{
digitalWrite(sevenSegmentPins[(i-1)], command[i]);
}
}
// Set the SPI Clock Divisor
void spi_setClockDivider(unsigned char divider)
{
switch(divider)
{
case 0:
SPI.setClockDivider(SPI_CLOCK_DIV2);
break;
case 1:
SPI.setClockDivider(SPI_CLOCK_DIV4);
break;
case 2:
SPI.setClockDivider(SPI_CLOCK_DIV8);
break;
case 3:
SPI.setClockDivider(SPI_CLOCK_DIV16);
break;
case 4:
SPI.setClockDivider(SPI_CLOCK_DIV32);
break;
case 5:
SPI.setClockDivider(SPI_CLOCK_DIV64);
break;
case 6:
SPI.setClockDivider(SPI_CLOCK_DIV128);
break;
default:
SPI.setClockDivider(SPI_CLOCK_DIV4);
break;
}
}
void spi_sendReceive(unsigned char command[])
{
if(command[2] == 1) //Check to see if this is the first of a series of SPI packets
{
spiBytesSent = 0;
spiCSPin = command[3];
spiWordSize = command[4];
// Send First Packet's 8 Data Bytes
for(int i=0; i<command[5]; i++)
{
// If this is the start of a new word toggle CS LOW
if( (spiBytesSent == 0) || (spiBytesSent % spiWordSize == 0) )
{
digitalWrite(spiCSPin, LOW);
}
// Send SPI Byte
Serial.print(SPI.transfer(command[i+6]));
spiBytesSent++;
// If word is complete set CS High
if(spiBytesSent % spiWordSize == 0)
{
digitalWrite(spiCSPin, HIGH);
}
}
}
else
{
// SPI Data Packet - Send SPI Bytes
for(int i=0; i<command[3]; i++)
{
// If this is the start of a new word toggle CS LOW
if( (spiBytesSent == 0) || (spiBytesSent % spiWordSize == 0) )
{
digitalWrite(spiCSPin, LOW);
}
// Send SPI Byte
Serial.write(SPI.transfer(command[i+4]));
spiBytesSent++;
// If word is complete set CS High
if(spiBytesSent % spiWordSize == 0)
{
digitalWrite(spiCSPin, HIGH);
}
}
}
}
// Synchronizes with LabVIEW and sends info about the board and firmware (Unimplemented)
void syncLV()
{
Serial.begin(DEFAULTBAUDRATE);
i2cReadTimeouts = 0;
spiBytesSent = 0;
spiBytesToSend = 0;
Serial.flush();
}

// Compute Packet Checksum


unsigned char checksum_Compute(unsigned char command[])
{
unsigned char checksum;
for (int i=0; i<(COMMANDLENGTH-1); i++)
{
checksum += command[i];
}
return checksum;
}
// Compute Packet Checksum And Test Against Included Checksum
int checksum_Test(unsigned char command[])
{
unsigned char checksum = checksum_Compute(command);
if(checksum == command[COMMANDLENGTH-1])
{
return 0;
}
else
{
return 1;
}
}

// Stepper Functions
#ifdef STEPPER_SUPPORT
void AccelStepper_Write(unsigned char command[]){
int steps = 0;
int step_speed = 0;
int acceleration = 0;
//Number of steps & speed are a 16 bit values, split for data transfer. Reassemble 2 bytes to an int 16
steps = (int)(command[5] << 8) + command[6];
step_speed = (int)(command[2] << 8) + command[3];
acceleration = (int)(command[7] << 8) + command[8];
steppers[command[4]].setMaxSpeed(step_speed);
if (acceleration == 0){
//Workaround AccelStepper bug that requires negative speed for negative step direction
if (steps < 0) step_speed = -step_speed;
steppers[command[4]].setSpeed(step_speed);
steppers[command[4]].move(steps);
}
else {
steppers[command[4]].setAcceleration(acceleration);
steppers[command[4]].move(steps);
}
}
#endif
void sampleContinously()
{
for(int i=0; i<iterations; i++)
{
retVal = analogRead(contAcqPin);
if(contAcqSpeed>1000) //delay Microseconds is only accurate for values less that 16383
{
Serial.write( (retVal >> 2));
delayMicroseconds(delayTime*1000000); //Delay for neccesary amount of time to achieve desired
sample rate
}
else
{
Serial.write( (retVal & 0xFF) );
Serial.write( (retVal >> 8));
delay(delayTime*1000);
}
}
}
void finiteAcquisition(int analogPin, float acquisitionSpeed, int numberOfSamples)
{
//want to exit this loop every 8ms
acquisitionPeriod=1/acquisitionSpeed;

for(int i=0; i<numberOfSamples; i++)


{
retVal = analogRead(analogPin);
if(acquisitionSpeed>1000)
{
Serial.write( (retVal >> 2));
delayMicroseconds(acquisitionPeriod*1000000);
}
else
{
Serial.write( (retVal & 0xFF) );
Serial.write( (retVal >> 8));
delay(acquisitionPeriod*1000);
}
}
}
void lcd_print(unsigned char command[])
{
if(command[2] != 0)
{
// Base Specified By User
int base = 0;
switch(command[2])
{
case 0x01: // BIN
base = BIN;
break;
case 0x02: // DEC
base = DEC;
break;
case 0x03: // OCT
base = OCT;
break;
case 0x04: // HEX
base = HEX;
break;
default:
break;
}
for(int i=0; i<command[3]; i++)
{
lcd.print(command[i+4], base);
}
}
else
{
for(int i=0; i<command[3]; i++)
{
lcd.print((char)command[i+4]);
}
}
Serial.write('0');
}
ANEXO 8. DATASHEET DEL 2N2222
PN2222A — NPN General-Purpose Amplifier
July 2014

PN2222A
NPN General-Purpose Amplifier

Features
• This device is for use as a medium power amplifier and
switch requiring collector currents up to 500mA.

TO-92
EBC

Ordering Information
Part Number Top Mark Package Packing Method
PN2222ABU PN2222A TO-92 3L Bulk
PN2222ATA PN2222A TO-92 3L Ammo
PN2222ATF PN2222A TO-92 3L Tape and Reel
PN2222ATFR PN2222A TO-92 3L Tape and Reel

Absolute Maximum Ratings(1), (2)


Stresses exceeding the absolute maximum ratings may damage the device. The device may not function or be opera-
ble above the recommended operating conditions and stressing the parts to these levels is not recommended. In addi-
tion, extended exposure to stresses above the recommended operating conditions may affect device reliability. The
absolute maximum ratings are stress ratings only. Values are at TA = 25°C unless otherwise noted.

Symbol Parameter Value Unit


VCEO Collector-Emitter Voltage 40 V
VCBO Collector-Base Voltage 75 V
VEBO Emitter-Base Voltage 6.0 V
IC Collector Current 1.0 A
TSTG Operating and Storage Junction Temperature Range -55 to 150 °C

Note:
1. These rating are based on a maximum junction temperature of 150 °C.
2. These are steady-state limits. Fairchild Semiconductor should be consulted on applications involving pulsed or
low-duty-cycle operation.

© 2004 Fairchild Semiconductor Corporation www.fairchildsemi.com


PN2222A Rev. 1.1.0
PN2222A — NPN General-Purpose Amplifier
Thermal Characteristics(3)
Values are at TA = 25°C unless otherwise noted.

Symbol Parameter Max. Unit


Total Device Dissipation 625 mW
PD
Derate Above 25°C 5.0 mW/°C
RθJC Thermal Resistance, Junction to Case 83.3 °C/W
RθJA Thermal Resistance, Junction to Ambient 200 °C/W

Note:
3. PCB size: FR-4, 76 mm x 114 mm x 1.57 mm (3.0 inch x 4.5 inch x 0.062 inch) with minimum land pattern size.

© 2004 Fairchild Semiconductor Corporation www.fairchildsemi.com


PN2222A Rev. 1.1.0 2
PN2222A — NPN General-Purpose Amplifier
Electrical Characteristics
Values are at TA = 25°C unless otherwise noted.

Symbol Parameter Conditions Min. Max. Unit


Off Characteristics
Collector-Emitter Breakdown
BV(BR)CEO IC = 10 mA, IB = 0 40 V
Voltage(4)
BV(BR)CBO Collector-Base Breakdown Voltage IC = 10 μA, IE = 0 75 V
BV(BR)EBO Emitter-Base Breakdown Voltage IE = 10 μA, IC = 0 6.0 V
ICEX Collector Cut-Off Current VCE = 60 V, VEB(off) = 3.0 V 10 nA
VCB = 60 V, IE = 0 0.01
ICBO Collector Cut-Off Current μA
VCB = 60 V, IE = 0, TA = 125°C 10
IEBO Emitter Cut-Off Current VEB = 3.0 V, IC = 0 10 nA
IBL Base Cut-Off Current VCE = 60 V, VEB(off) = 3.0 V 20 nA
On Characteristics
IC = 0.1 mA, VCE = 10 V 35
IC = 1.0 mA, VCE = 10 V 50
IC = 10 mA, VCE = 10 V 75
IC = 10 mA, VCE = 10 V,
hFE DC Current Gain 35
TA = -55°C
IC = 150 mA, VCE = 10 V(4) 100 300
IC = 150 mA, VCE = 1 V(4) 50
IC = 500 mA, VCE = 10 V(4) 40
IC = 150 mA, IB = 15 mA 0.3
VCE(sat) Collector-Emitter Saturation Voltage(4) V
IC = 500 mA, IB = 50 mA 1.0
IC = 150 mA, IB = 15 mA 0.6 1.2
VBE(sat) Base-Emitter Saturation Voltage(4) V
IC = 500 mA, IB = 50 mA 2.0
Small Signal Characteristics
IC = 20 mA, VCE = 20 V,
fT Current Gain Bandwidth Product 300 MHz
f = 100 MHz
Cobo Output Capacitance VCB = 10 V, IE = 0, f = 1 MHz 8.0 pF
Cibo Input Capacitance VEB = 0.5 V, IC = 0, f = 1 MHz 25 pF
IC = 20 mA, VCB = 20 V,
rb’Cc Collector Base Time Constant 150 pS
f = 31.8 MHz
IC = 100 μA, VCE = 10 V,
NF Noise Figure 4.0 dB
RS = 1.0 kΩ, f = 1.0 kHz
Real Part of Common-Emitter IC = 20 mA, VCE = 20 V,
Re(hie) 60 Ω
High Frequency Input Impedance f = 300 MHz
Switching Characteristics
td Delay Time VCC = 30 V, VEB(off) = 0.5 V, 10 ns
tr Rise Time IC = 150 mA, IB1 = 15 mA 25 ns
ts Storage Time VCC = 30 V, IC = 150 mA, 225 ns
tf Fall Time IB1 = IB2 = 15 mA 60 ns

Note:
4. Pulse test: pulse width ≤ 300 μs, duty cycle ≤ 2.0%.

© 2004 Fairchild Semiconductor Corporation www.fairchildsemi.com


PN2222A Rev. 1.1.0 3
PN2222A — NPN General-Purpose Amplifier
Physical Dimensions

TO-92 (Bulk)

Figure 1. 3-LEAD, TO92, JEDEC TO-92 COMPLIANT STRAIGHT LEAD CONFIGURATION (OLD TO92AM3)
Package drawings are provided as a service to customers considering Fairchild components. Drawings may change in any manner
without notice. Please note the revision and/or date on the drawing and contact a Fairchild Semiconductor representative to verify or
obtain the most recent revision. Package specifications do not expand the terms of Fairchild’s worldwide terms and conditions, specifically the
warranty therein, which covers Fairchild products.

Always visit Fairchild Semiconductor’s online packaging area for the most recent package drawings:
http://www.fairchildsemi.com/dwg/ZA/ZA03D.pdf.

For current tape and reel specifications, visit Fairchild Semiconductor’s online packaging area:
http://www.fairchildsemi.com/packing_dwg/PKG-ZA03D_BK.pdf.

© 2004 Fairchild Semiconductor Corporation www.fairchildsemi.com


PN2222A Rev. 1.1.0 4
PN2222A — NPN General-Purpose Amplifier
Physical Dimensions (Continued)

TO-92 (Ammo, Tape and Reel)

Figure 2. 3-LEAD, TO-92, MOLDED 0.200 IN LINE SPACING LEAD FORM (J61Z OPTION)
Package drawings are provided as a service to customers considering Fairchild components. Drawings may change in any manner
without notice. Please note the revision and/or date on the drawing and contact a Fairchild Semiconductor representative to verify or
obtain the most recent revision. Package specifications do not expand the terms of Fairchild’s worldwide terms and conditions, specifically the
warranty therein, which covers Fairchild products.

Always visit Fairchild Semiconductor’s online packaging area for the most recent package drawings:
http://www.fairchildsemi.com/dwg/ZA/ZA03F.pdf.

For current tape and reel specifications, visit Fairchild Semiconductor’s online packaging area:
http://www.fairchildsemi.com/packing_dwg/PKG-ZA03F_BK.pdf.

© 2004 Fairchild Semiconductor Corporation www.fairchildsemi.com


PN2222A Rev. 1.1.0 5
TRADEMARKS

The following includes registered and unregistered trademarks and service marks, owned by Fairchild Semiconductor and/or its global subsidiaries, and is not
intended to be an exhaustive list of all such trademarks.

AccuPower¥ F-PFS¥
®*
AX-CAP®* FRFET® ®
SM ®
BitSiC¥ Global Power Resource PowerTrench ®
TinyBoost
Build it Now¥ GreenBridge¥ PowerXS™ TinyBuck®
CorePLUS¥ Green FPS¥ Programmable Active Droop¥ TinyCalc¥
CorePOWER¥ Green FPS¥ e-Series¥ QFET® TinyLogic®
CROSSVOLT¥ Gmax¥ QS¥ TINYOPTO¥
CTL¥ GTO¥ Quiet Series¥ TinyPower¥
Current Transfer Logic¥ IntelliMAX¥ RapidConfigure¥ TinyPWM¥
DEUXPEED® ISOPLANAR¥ ¥ TinyWire¥
Dual Cool™ Making Small Speakers Sound Louder TranSiC¥
EcoSPARK® and Better™ Saving our world, 1mW/W/kW at a time™ TriFault Detect¥
EfficientMax¥ MegaBuck¥ SignalWise¥ TRUECURRENT®*
ESBC¥ MICROCOUPLER¥ SmartMax¥ PSerDes¥
® MicroFET¥ SMART START¥
MicroPak¥ Solutions for Your Success¥
Fairchild® SPM®
MicroPak2¥ UHC®
Fairchild Semiconductor® STEALTH¥
MillerDrive¥ Ultra FRFET¥
FACT Quiet Series¥
MotionMax¥ SuperFET®
FACT® UniFET¥
mWSaver® SuperSOT¥-3
FAST® VCX¥
OptoHiT¥ SuperSOT¥-6
FastvCore¥ VisualMax¥
OPTOLOGIC® SuperSOT¥-8
VoltagePlus¥
FETBench¥ OPTOPLANAR® SupreMOS®
FPS¥ XS™
SyncFET¥
Sync-Lock™ ௝❺™
* Trademarks of System General Corporation, used under license by Fairchild Semiconductor.

DISCLAIMER
FAIRCHILD SEMICONDUCTOR RESERVES THE RIGHT TO MAKE CHANGES WITHOUT FURTHER NOTICE TO ANY PRODUCTS HEREIN TO IMPROVE
RELIABILITY, FUNCTION, OR DESIGN. FAIRCHILD DOES NOT ASSUME ANY LIABILITY ARISING OUT OF THE APPLICATION OR USE OF ANY PRODUCT
OR CIRCUIT DESCRIBED HEREIN; NEITHER DOES IT CONVEY ANY LICENSE UNDER ITS PATENT RIGHTS, NOR THE RIGHTS OF OTHERS. THESE
SPECIFICATIONS DO NOT EXPAND THE TERMS OF FAIRCHILD’S WORLDWIDE TERMS AND CONDITIONS, SPECIFICALLY THE WARRANTY THEREIN,
WHICH COVERS THESE PRODUCTS.

LIFE SUPPORT POLICY


FAIRCHILD’S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE
EXPRESS WRITTEN APPROVAL OF FAIRCHILD SEMICONDUCTOR CORPORATION.
As used herein:
1. Life support devices or systems are devices or systems which, (a) are 2. A critical component in any component of a life support, device, or
intended for surgical implant into the body or (b) support or sustain system whose failure to perform can be reasonably expected to
life, and (c) whose failure to perform when properly used in cause the failure of the life support device or system, or to affect its
accordance with instructions for use provided in the labeling, can be safety or effectiveness.
reasonably expected to result in a significant injury of the user.

ANTI-COUNTERFEITING POLICY
Fairchild Semiconductor Corporation's Anti-Counterfeiting Policy. Fairchild's Anti-Counterfeiting Policy is also stated on our external website, www.fairchildsemi.com,
under Sales Support.
Counterfeiting of semiconductor parts is a growing problem in the industry. All manufacturers of semiconductor products are experiencing counterfeiting of their
parts. Customers who inadvertently purchase counterfeit parts experience many problems such as loss of brand reputation, substandard performance, failed
applications, and increased cost of production and manufacturing delays. Fairchild is taking strong measures to protect ourselves and our customers from the
proliferation of counterfeit parts. Fairchild strongly encourages customers to purchase Fairchild parts either directly from Fairchild or from Authorized Fairchild
Distributors who are listed by country on our web page cited above. Products customers buy either from Fairchild directly or from Authorized Fairchild Distributors
are genuine parts, have full traceability, meet Fairchild's quality standards for handling and storage and provide access to Fairchild's full range of up-to-date technical
and product information. Fairchild and our Authorized Distributors will stand behind all warranties and will appropriately address any warranty issues that may arise.
Fairchild will not provide any warranty coverage or other assistance for parts bought from Unauthorized Sources. Fairchild is committed to combat this global
problem and encourage our customers to do their part in stopping this practice by buying direct or from authorized distributors.

PRODUCT STATUS DEFINITIONS

Definition of Terms
Datasheet Identification Product Status Definition
Datasheet contains the design specifications for product development. Specifications may change
Advance Information Formative / In Design
in any manner without notice.
Datasheet contains preliminary data; supplementary data will be published at a later date. Fairchild
Preliminary First Production
Semiconductor reserves the right to make changes at any time without notice to improve design.
Datasheet contains final specifications. Fairchild Semiconductor reserves the right to make
No Identification Needed Full Production
changes at any time without notice to improve the design.
Datasheet contains specifications on a product that is discontinued by Fairchild Semiconductor.
Obsolete Not In Production
The datasheet is for reference information only.
Rev. I68

© Fairchild Semiconductor Corporation www.fairchildsemi.com


ANEXO 9. DATASHEET DEL PIC16F887
PIC16F882/883/884/886/887
Data Sheet
28/40/44-Pin, Enhanced Flash-Based 8-Bit
CMOS Microcontrollers with
nanoWatt Technology

© 2007 Microchip Technology Inc. Preliminary DS41291D


Note the following details of the code protection feature on Microchip devices:
• Microchip products meet the specification contained in their particular Microchip Data Sheet.

• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.

• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.

• Microchip is willing to work with the customer who is concerned about the integrity of their code.

• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”

Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.

Information contained in this publication regarding device Trademarks


applications and the like is provided only for your convenience The Microchip name and logo, the Microchip logo, Accuron,
and may be superseded by updates. It is your responsibility to
dsPIC, KEELOQ, KEELOQ logo, microID, MPLAB, PIC,
ensure that your application meets with your specifications.
PICmicro, PICSTART, PRO MATE, PowerSmart, rfPIC, and
MICROCHIP MAKES NO REPRESENTATIONS OR SmartShunt are registered trademarks of Microchip
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
Technology Incorporated in the U.S.A. and other countries.
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION, AmpLab, FilterLab, Linear Active Thermistor, Migratable
INCLUDING BUT NOT LIMITED TO ITS CONDITION, Memory, MXDEV, MXLAB, PS logo, SEEVAL, SmartSensor
QUALITY, PERFORMANCE, MERCHANTABILITY OR and The Embedded Control Solutions Company are
FITNESS FOR PURPOSE. Microchip disclaims all liability registered trademarks of Microchip Technology Incorporated
arising from this information and its use. Use of Microchip in the U.S.A.
devices in life support and/or safety applications is entirely at Analog-for-the-Digital Age, Application Maestro, CodeGuard,
the buyer’s risk, and the buyer agrees to defend, indemnify and dsPICDEM, dsPICDEM.net, dsPICworks, ECAN,
hold harmless Microchip from any and all damages, claims, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB,
suits, or expenses resulting from such use. No licenses are In-Circuit Serial Programming, ICSP, ICEPIC, Mindi, MiWi,
conveyed, implicitly or otherwise, under any Microchip MPASM, MPLAB Certified logo, MPLIB, MPLINK, PICkit,
intellectual property rights. PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal,
PowerInfo, PowerMate, PowerTool, REAL ICE, rfLAB,
rfPICDEM, Select Mode, Smart Serial, SmartTel, Total
Endurance, UNI/O, WiperLock and ZENA are trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
© 2007, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.

Microchip received ISO/TS-16949:2002 certification for its worldwide


headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona, Gresham, Oregon and Mountain View, California. The
Company’s quality system processes and procedures are for its PIC®
MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial
EEPROMs, microperipherals, nonvolatile memory and analog
products. In addition, Microchip’s quality system for the design and
manufacture of development systems is ISO 9001:2000 certified.

DS41291D-page ii Preliminary © 2007 Microchip Technology Inc.


PIC16F882/883/884/886/887
28/40/44-Pin Flash-Based, 8-Bit CMOS Microcontrollers with
nanoWatt Technology
High-Performance RISC CPU: Peripheral Features:
• Only 35 instructions to learn: • 24/35 I/O pins with individual direction control:
- All single-cycle instructions except branches - High current source/sink for direct LED drive
• Operating speed: - Interrupt-on-Change pin
- DC – 20 MHz oscillator/clock input - Individually programmable weak pull-ups
- DC – 200 ns instruction cycle - Ultra Low-Power Wake-up (ULPWU)
• Interrupt capability • Analog Comparator module with:
• 8-level deep hardware stack - Two analog comparators
• Direct, Indirect and Relative Addressing modes - Programmable on-chip voltage reference
(CVREF) module (% of VDD)
Special Microcontroller Features: - Fixed voltage reference (0.6V)
• Precision Internal Oscillator: - Comparator inputs and outputs externally
- Factory calibrated to ±1% accessible
- Software selectable frequency range of - SR Latch mode
8 MHz to 31 kHz - External Timer1 Gate (count enable)
- Software tunable • A/D Converter:
- Two-Speed Start-up mode - 10-bit resolution and 11/14 channels
- Crystal fail detect for critical applications • Timer0: 8-bit timer/counter with 8-bit
- Clock mode switching during operation for programmable prescaler
power savings • Enhanced Timer1:
• Power-Saving Sleep mode - 16-bit timer/counter with prescaler
• Wide operating voltage range (2.0V-5.5V) - External Gate Input mode
• Industrial and Extended Temperature range - Dedicated low-power 32 kHz oscillator
• Power-on Reset (POR) • Timer2: 8-bit timer/counter with 8-bit period
• Power-up Timer (PWRT) and Oscillator Start-up register, prescaler and postscaler
Timer (OST) • Enhanced Capture, Compare, PWM+ module:
• Brown-out Reset (BOR) with software control - 16-bit Capture, max. resolution 12.5 ns
option - Compare, max. resolution 200 ns
• Enhanced low-current Watchdog Timer (WDT) - 10-bit PWM with 1, 2 or 4 output channels,
with on-chip oscillator (software selectable programmable “dead time”, max. frequency
nominal 268 seconds with full prescaler) with 20 kHz
software enable - PWM output steering control
• Multiplexed Master Clear with pull-up/input pin • Capture, Compare, PWM module:
• Programmable code protection - 16-bit Capture, max. resolution 12.5 ns
• High Endurance Flash/EEPROM cell: - 16-bit Compare, max. resolution 200 ns
- 100,000 write Flash endurance - 10-bit PWM, max. frequency 20 kHz
- 1,000,000 write EEPROM endurance • Enhanced USART module:
- Flash/Data EEPROM retention: > 40 years - Supports RS-485, RS-232, and LIN 2.0
• Program memory Read/Write during run time - Auto-Baud Detect
• In-Circuit Debugger (on board) - Auto-Wake-Up on Start bit
• In-Circuit Serial ProgrammingTM (ICSPTM) via two
Low-Power Features: pins
• Master Synchronous Serial Port (MSSP) module
• Standby Current: supporting 3-wire SPI (all 4 modes) and I2C™
- 50 nA @ 2.0V, typical Master and Slave Modes with I2C address mask
• Operating Current:
- 11 μA @ 32 kHz, 2.0V, typical
- 220 μA @ 4 MHz, 2.0V, typical
• Watchdog Timer Current:
- 1 μA @ 2.0V, typical

© 2007 Microchip Technology Inc. Preliminary DS41291D-page 1


PIC16F882/883/884/886/887

Program
Data Memory
Memory 10-bit A/D ECCP/ Timers
Device I/O EUSART MSSP Comparators
Flash SRAM EEPROM (ch) CCP 8/16-bit
(words) (bytes) (bytes)
PIC16F882 2048 128 128 28 11 1/1 1 1 2 2/1
PIC16F883 4096 256 256 24 11 1/1 1 1 2 2/1
PIC16F884 4096 256 256 35 14 1/1 1 1 2 2/1
PIC16F886 8192 368 256 24 11 1/1 1 1 2 2/1
PIC16F887 8192 368 256 35 14 1/1 1 1 2 2/1

DS41291D-page 2 Preliminary © 2007 Microchip Technology Inc.


PIC16F882/883/884/886/887
Pin Diagrams – PIC16F882/883/886, 28-Pin PDIP, SOIC, SSOP
28-pin PDIP, SOIC, SSOP

RE3/MCLR/VPP 1 28 RB7/ICSPDAT
RA0/AN0/ULPWU/C12IN0- 2 27 RB6/ICSPCLK
RA1/AN1/C12IN1- 3 26 RB5/AN13/T1G
RA2/AN2/VREF-/CVREF/C2IN+ 4 25 RB4/AN11/P1D

PIC16F882/883/886
RA3/AN3/VREF+/C1IN+ 5 24 RB3/AN9/PGM/C12IN2-
RA4/T0CKI/C1OUT 6 23 RB2/AN8/P1B
RA5/AN4/SS/C2OUT 7 22 RB1/AN10/P1C/C12IN3-
VSS 8 21 RB0/AN12/INT
RA7/OSC1/CLKIN 9 20 VDD
RA6/OSC2/CLKOUT 10 19 VSS
RC0/T1OSO/T1CKI 11 18 RC7/RX/DT
RC1/T1OSI/CCP2 12 17 RC6/TX/CK
RC2/P1A/CCP1 13 16 RC5/SDO
RC3/SCK/SCL 14 15 RC4/SDI/SDA

TABLE 1: PIC16F882/883/886 28-PIN SUMMARY (PDIP, SOIC, SSOP)


I/O Pin Analog Comparators Timers ECCP EUSART MSSP Interrupt Pull-up Basic
RA0 2 AN0/ULPWU C12IN0- — — — — — — —
RA1 3 AN1 C12IN1- — — — — — — —
RA2 4 AN2 C2IN+ — — — — — — VREF-/CVREF
RA3 5 AN3 C1IN+ — — — — — — VREF+
RA4 6 — C1OUT T0CKI — — — — — —
RA5 7 AN4 C2OUT — — — SS — — —
RA6 10 — — — — — — — — OSC2/CLKOUT
RA7 9 — — — — — — — — OSC1/CLKIN
RB0 21 AN12 — — — — — IOC/INT Y —
RB1 22 AN10 C12IN3- — P1C — — IOC Y —
RB2 23 AN8 — — P1B — — IOC Y —
RB3 24 AN9 C12IN2- — — — — IOC Y PGM
RB4 25 AN11 — — P1D — — IOC Y —
RB5 26 AN13 — T1G — — — IOC Y —
RB6 27 — — — — — — IOC Y ICSPCLK
RB7 28 — — — — — — IOC Y ICSPDAT
RC0 11 — — T1OSO/T1CKI — — — — — —
RC1 12 — — T1OSI CCP2 — — — — —
RC2 13 — — — CCP1/P1A — — — — —
RC3 14 — — — — — SCK/SCL — — —
RC4 15 — — — — — SDI/SDA — — —
RC5 16 — — — — — SDO — — —
RC6 17 — — — — TX/CK — — — —
RC7 18 — — — — RX/DT — — — —
RE3 1 — — — — — — — Y(1) MCLR/VPP
— 20 — — — — — — — — VDD
— 8 — — — — — — — — VSS
— 19 — — — — — — — — VSS
Note 1: Pull-up activated only with external MCLR configuration.

© 2007 Microchip Technology Inc. Preliminary DS41291D-page 3


PIC16F882/883/884/886/887
Pin Diagrams – PIC16F882/883/886, 28-Pin QFN

28-pin QFN

RA0/AN0/ULPWU/C12IN0-
RA1/AN1/C12IN1-

RE3/MCLR/VPP

RB5/AN13/T1G
RB4/AN11/P1D
RB6/ICSPCLK
RB7/ICSPDAT
28
27
26
25
24
23
22
RA2/AN2/VREF-/CVREF/C2IN+ 1 21 RB3/AN9/PGM/C12IN2-
RA3/AN3/VREF+/C1IN+ 2 20 RB2/AN8/P1B
RA4/T0CKI/C1OUT 3 19 RB1/AN10/P1C/C12IN3-
RA5/AN4/SS/C2OUT 4 PIC16F882/883/886 18 RB0/AN12/INT
VSS 5 17 VDD
RA7/OSC1/CLKIN 6 16 VSS
RA6/OSC2/CLKOUT 7 15 RC7/RX/DT
10
11
12
13
14
8
9

RC4/SDI/SDA
RC0/T1OSO/T1CKI

RC6/TX/CK
RC1/T1OSI/CCP2
RC2/P1A/CCP1
RC3/SCK/SCL

RC5/SDO

DS41291D-page 4 Preliminary © 2007 Microchip Technology Inc.


PIC16F882/883/884/886/887
TABLE 2: PIC16F882/883/886 28-PIN SUMMARY (QFN)
I/O Pin Analog Comparators Timers ECCP EUSART MSSP Interrupt Pull-up Basic
RA0 27 AN0/ULPWU C12IN0- — — — — — — —
RA1 28 AN1 C12IN1- — — — — — — —
RA2 1 AN2 C2IN+ — — — — — — VREF-/CVREF
RA3 2 AN3 C1IN+ — — — — — — VREF+
RA4 3 — C1OUT T0CKI — — — — — —
RA5 4 AN4 C2OUT — — — SS — — —
RA6 7 — — — — — — — — OSC2/CLKOUT
RA7 6 — — — — — — — — OSC1/CLKIN
RB0 18 AN12 — — — — — IOC/INT Y —
RB1 19 AN10 C12IN3- — P1C — — IOC Y —
RB2 20 AN8 — — P1B — — IOC Y —
RB3 21 AN9 C12IN2- — — — — IOC Y PGM
RB4 22 AN11 — — P1D — — IOC Y —
RB5 23 AN13 — T1G — — — IOC Y —
RB6 24 — — — — — — IOC Y ICSPCLK
RB7 25 — — — — — — IOC Y ICSPDAT
RC0 8 — — T1OSO/T1CKI — — — — — —
RC1 9 — — T1OSI CCP2 — — — — —
RC2 10 — — — CCP1/P1A — — — — —
RC3 11 — — — — — SCK/SCL — — —
RC4 12 — — — — — SDI/SDA — — —
RC5 13 — — — — — SDO — — —
RC6 14 — — — — TX/CK — — — —
RC7 15 — — — — RX/DT — — — —
(1)
RE3 26 — — — — — — — Y MCLR/VPP
— 17 — — — — — — — — VDD
— 5 — — — — — — — — VSS
— 16 — — — — — — — — VSS
Note 1: Pull-up activated only with external MCLR configuration.

© 2007 Microchip Technology Inc. Preliminary DS41291D-page 5


PIC16F882/883/884/886/887
Pin Diagrams – PIC16F884/887, 40-Pin PDIP
40-pin PDIP

RE3/MCLR/VPP 1 40 RB7/ICSPDAT
RA0/AN0/ULPWU/C12IN0- 2 39 RB6/ICSPCLK
RA1/AN1/C12IN1- 3 38 RB5/AN13/T1G
RA2/AN2/VREF-/CVREF/C2IN+ 4 37 RB4/AN11
RA3/AN3/VREF+/C1IN+ 5 36 RB3/AN9/PGM/C12IN2-
RA4/T0CKI/C1OUT 6 35 RB2/AN8
RA5/AN4/SS/C2OUT 7 34 RB1/AN10/C12IN3-
RE0/AN5 8 33 RB0/AN12/INT

PIC16F884/887
RE1/AN6 9 32 VDD
RE2/AN7 10 31 VSS
VDD 11 30 RD7/P1D
VSS 12 29 RD6/P1C
RA7/OSC1/CLKIN 13 28 RD5/P1B
RA6/OSC2/CLKOUT 14 27 RD4
RC0/T1OSO/T1CKI 15 26 RC7/RX/DT
RC1/T1OSI/CCP2 16 25 RC6/TX/CK
RC2/P1A/CCP1 17 24 RC5/SDO
RC3/SCK/SCL 18 23 RC4/SDI/SDA
RD0 19 22 RD3
RD1 20 21 RD2

DS41291D-page 6 Preliminary © 2007 Microchip Technology Inc.


PIC16F882/883/884/886/887
TABLE 3: PIC16F884/887 40-PIN SUMMARY (PDIP)
I/O Pin Analog Comparators Timers ECCP EUSART MSSP Interrupt Pull-up Basic
RA0 2 AN0/ULPWU C12IN0- — — — — — — —
RA1 3 AN1 C12IN1- — — — — — — —
RA2 4 AN2 C2IN+ — — — — — — VREF-/CVREF
RA3 5 AN3 C1IN+ — — — — — — VREF+
RA4 6 — C1OUT T0CKI — — — — — —
RA5 7 AN4 C2OUT — — — SS — — —
RA6 14 — — — — — — — — OSC2/CLKOUT
RA7 13 — — — — — — — — OSC1/CLKIN
RB0 33 AN12 — — — — — IOC/INT Y —
RB1 34 AN10 C12IN3- — — — — IOC Y —
RB2 35 AN8 — — — — — IOC Y —
RB3 36 AN9 C12IN2- — — — — IOC Y PGM
RB4 37 AN11 — — — — — IOC Y —
RB5 38 AN13 — T1G — — — IOC Y —
RB6 39 — — — — — — IOC Y ICSPCLK
RB7 40 — — — — — — IOC Y ICSPDAT
RC0 15 — — T1OSO/T1CKI — — — — — —
RC1 16 — — T1OSI CCP2 — — — — —
RC2 17 — — — CCP1/P1A — — — — —
RC3 18 — — — — — SCK/SCL — — —
RC4 23 — — — — — SDI/SDA — — —
RC5 24 — — — — — SDO — — —
RC6 25 — — — — TX/CK — — — —
RC7 26 — — — — RX/DT — — — —
RD0 19 — — — — — — — — —
RD1 20 — — — — — — — — —
RD2 21 — — — — — — — — —
RD3 22 — — — — — — — — —
RD4 27 — — — — — — — — —
RD5 28 — — — P1B — — — — —
RD6 29 — — — P1C — — — — —
RD7 30 — — — P1D — — — — —
RE0 8 AN5 — — — — — — — —
RE1 9 AN6 — — — — — — — —
RE2 10 AN7 — — — — — — — —
RE3 1 — — — — — — — Y(1) MCLR/VPP
— 11 — — — — — — — — VDD
— 32 — — — — — — — — VDD
— 12 — — — — — — — — VSS
— 31 — — — — — — — — VSS
Note 1: Pull-up activated only with external MCLR configuration.

© 2007 Microchip Technology Inc. Preliminary DS41291D-page 7


PIC16F882/883/884/886/887
Pin Diagrams – PIC16F884/887, 44-Pin QFN

44-pin QFN

RC1/T1OSCI/CCP2
RC0/T1OSO/T1CKI
RC2/P1A/CCP1
RC3/SCK/SCL
RC4/SDI/SDA
RC6/TX/CK
RC5/SDO

RD3
RD2
RD1
RD0
44
43
42
41
40
39

37
36
35
34
38
RC7/RX/DT 1 33 RA6/OSC2/CLKOUT
RD4 2 32 RA7/OSC1/CLKIN
RD5/P1B 3 31 VSS
RD6/P1C 4 30 VSS
RD7/P1D 5 29 NC
VSS 6 PIC16F884/887 28 VDD
VDD 7 27 RE2/AN7
VDD 8 26 RE1/AN6
RB0/AN12/INT 9 25 RE0/AN5
RB1/AN10/C12IN3- 10 24 RA5/AN4/SS/C2OUT
RB2/AN8 11 23 RA4/T0CKI/C1OUT
12
13
14
15
16
17
18
19
20
21
22
RB7/ICSPDAT
RB3/AN9/PGM/C12IN2-

RA1/AN1/C12IN1-
RB4/AN11

RA0/AN0/ULPWU/C12IN0-

RA3/AN3//VREF+/C1IN+
RA2/AN2/VREF-/CVREF/C2IN+
RB5/AN13/T1G
NC

RB6/ICSPCLK

RE3/MCLR/VPP

DS41291D-page 8 Preliminary © 2007 Microchip Technology Inc.


ANEXO 10. DATASHEET DEL INTEGRADO 28BYJ-48
28BYJ-48 – 5V Stepper Motor

The 28BYJ-48 is a small stepper motor suitable for a large range of applications.

Rated voltage : 5VDC


Number of Phase 4
Speed Variation Ratio 1/64
Stride Angle 5.625° /64
Frequency 100Hz
DC resistance 50Ω±7%(25℃)
Idle In-traction Frequency > 600Hz
Idle Out-traction Frequency > 1000Hz
In-traction Torque >34.3mN.m(120Hz)
Self-positioning Torque >34.3mN.m
Friction torque 600-1200 gf.cm
Pull in torque 300 gf.cm
Insulated resistance >10MΩ(500V)
Insulated electricity power 600VAC/1mA/1s
Insulation grade A
Rise in Temperature <40K(120Hz)
Noise <35dB(120Hz,No load,10cm)
Model 28BYJ-48 – 5V

P.O. Box 8231 Cherrywood Tauranga New Zealand Phone: ++64 7 578 7739 Fax: ++64 7 578 7749 E-mail: enquiry@kiatronics.com
Website: www.kiatronics.com Copyright  Welten Holdings Ltd - Specifications subject to change without further notice.
ANEXO 11. DATASHEET DEL ULN2003APG
ULN2003,04APG/AFWG
TOSHIBA Bipolar Digital Integrated Circuit Silicon Monolithic

ULN2003APG,ULN2003AFWG
ULN2004APG,ULN2004AFWG

7-ch Darlington Sink Driver


ULN2003APG
ULN2004APG

The ULN2003APG/AFWG Series are high−voltage, high−current


darlington drivers comprised of seven NPN darlington pairs.
All units feature integral clamp diodes for switching inductive
loads.
Applications include relay, hammer, lamp and display (LED)
drivers.

Features ULN2003AFWG
ULN2004AFWG
z Output current (single output): 500 mA max
z High sustaining voltage output: 50 V min
z Output clamp diodes
z Inputs compatible with various types of logic
z Package Type-APG: DIP-16pin
z Package Type-AFWG: SOL-16pin

Weight
Input Base DIP16−P-300-2.54A : 1.11 g (typ.)
Type Designation
Resistor
SOL16−P-150-1.27A: 0.15 g (typ.)
ULN2003APG/AFWG 2.7 kΩ TTL, 5 V CMOS
ULN2004APG/AFWG 10.5 kΩ 6 to 15 V PMOS, CMOS

Pin Connection (top view)

1 2010-12-03
ULN2003,04APG/AFWG
Schematics (each driver)
ULN2003APG/AFWG ULN2004APG/AFWG

Note: The input and output parasitic diodes cannot be used as clamp diodes.

Absolute Maximum Ratings (Ta = 25°C)

Characteristic Symbol Rating Unit

Output sustaining voltage VCE (SUS) −0.5 to 50 V


Output current IOUT 500 mA/ch
Input voltage VIN −0.5 to 30 V
Clamp diode reverse voltage VR 50 V
Clamp diode forward current IF 500 mA
APG 1.47
Power dissipation PD W
AFWG 1.25 (Note)
Operating temperature Topr −40 to 85 °C
Storage temperature Tstg −55 to 150 °C

Note: On PCB (Test Board: JEDEC 2s2p)

2 2010-12-03
ULN2003,04APG/AFWG
Recommended Operating Conditions (Ta = −40 to 85°C)

Characteristic Symbol Test Condition Min Typ. Max Unit

Output sustaining voltage VCE (SUS) ⎯ 0 ⎯ 50 V


Duty = 10% 0 ⎯ 350
APG tpw = 25 ms
Duty = 50% 0 ⎯ 100
Output current IOUT 7 Circuits mA/ch
Ta = 85°C Duty = 10% 0 ⎯ 300
AFWG Tj = 120°C
Duty = 50% 0 ⎯ 90
Input voltage VIN ⎯ 0 ⎯ 24 V

Input voltage ULN2003A IOUT = 400 mA 2.8 ⎯ 24


VIN (ON) V
(output on) ULN2004A hFE = 800 6.2 ⎯ 24

Input voltage ULN2003A ⎯ 0 ⎯ 0.7


VIN (OFF) V
(output off) ULN2004A ⎯ 0 ⎯ 1.0
Clamp diode reverse voltage VR ⎯ ⎯ ⎯ 50 V
Clamp diode forward current IF ⎯ ⎯ ⎯ 350 mA
APG Ta = 85°C ⎯ ⎯ 0.76
Power dissipation PD W
AFWG Ta = 85°C (Note) ⎯ ⎯ 0.65

Note: On PCB (Test Board: JEDEC 2s2p)

3 2010-12-03
ULN2003,04APG/AFWG
Electrical Characteristics (Ta = 25°C unless otherwise noted)
Test
Characteristic Symbol Circuit Test Condition Min Typ. Max Unit

VCE = 50 V, Ta = 25°C ⎯ ⎯ 50
Output leakage current ICEX 1 μA
VCE = 50 V, Ta = 85°C ⎯ ⎯ 100
IOUT = 350 mA, IIN = 500 μA ⎯ 1.3 1.6
Collector−emitter saturation voltage VCE (sat) 2 IOUT = 200 mA, IIN = 350 μA ⎯ 1.1 1.3 V

IOUT = 100 mA, IIN = 250 μA ⎯ 0.9 1.1


DC Current transfer ratio hFE 2 VCE = 2 V, IOUT = 350 mA 1000 ⎯ ⎯ ⎯

Input current ULN2003A VIN = 2.4 V, IOUT = 350 mA ⎯ 0.4 0.7


IIN (ON) 3 mA
(output on) ULN2004A VIN = 9.5 V, IOUT = 350 mA ⎯ 0.8 1.2
Input current (output off) IIN (OFF) 4 IOUT = 500 μA, Ta = 85°C 50 65 ⎯ μA
IOUT = 350 mA ⎯ ⎯ 2.6
ULN2003A
Input voltage VCE = 2 V IOUT = 200 mA ⎯ ⎯ 2.0
VIN (ON) 5 V
(output on) hFE = 800 IOUT = 350 mA ⎯ ⎯ 4.7
ULN2004A
IOUT = 200 mA ⎯ ⎯ 4.4
VR = 50 V, Ta = 25°C ⎯ ⎯ 50
Clamp diode reverse current IR 6 μA
VR = 50 V, Ta = 85°C ⎯ ⎯ 100
Clamp diode forward voltage VF 7 IF = 350 mA ⎯ ⎯ 2.0 V
Input capacitance CIN ⎯ ⎯ ⎯ 15 ⎯ pF
VOUT = 50 V, RL = 125 Ω
Turn−on delay tON 8 ⎯ 0.1 ⎯
CL = 15 pF
μs
VOUT = 50 V, RL = 125 Ω
Turn−off delay tOFF 8 ⎯ 0.2 ⎯
CL = 15 pF

4 2010-12-03
ULN2003,04APG/AFWG
Test Circuit
1. ICEX 2. VCE (sat), hFE 3. IIN (ON)

4. IIN (OFF) 5. VIN (ON) 6. IR

7. VF

5 2010-12-03
ULN2003,04APG/AFWG
8. tON, tOFF

Note 1: Pulse width 50 μs, duty cycle 10%


Output impedance 50 Ω, tr ≤ 5 ns, tf ≤ 10 ns
Note 2: See below

Input Condition

Type Number R1 VIH

ULN2003A 0 3V
ULN2004A 0 8V

Note 3: CL includes probe and jig capacitance.

Precautions for Using


This IC does not include built-in protection circuits for excess current or overvoltage.
If this IC is subjected to excess current or overvoltage, it may be destroyed.
Hence, the utmost care must be taken when systems which incorporate this IC are designed.
Utmost care is necessary in the design of the output line, COMMON and GND line since IC may be destroyed
due to short−circuit between outputs, air contamination fault, or fault by improper grounding.

6 2010-12-03
ULN2003,04APG/AFWG

7 2010-12-03
ULN2003,04APG/AFWG

PD – Ta
2.00
(1) Type-APG free air
1.75 (2) Type-AFWG on PCB
(Test Board: JEDEC 2s2p)
(W)

1.50 (1)
Power dissipation PD

(2)
1.25

1.00

0.75

0.50

0.25

0
0 25 50 75 100 125 150

Ambient temperature Ta (°C)

8 2010-12-03
ULN2003,04APG/AFWG
Package Dimensions

Weight: 1.11 g (typ.)

9 2010-12-03
ANEXO 12. DATASHEET DEL ARDUINO UNO
The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a
USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to
support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC
adapter or battery to get started. The Uno differs from all preceding boards in that it does not use the FTDI
USB-to-serial driver chip. Instead, it features the Atmega8U2 programmed as a USB-to-serial converter.

"Uno" means one in Italian and is named to mark the upcoming release of Arduino 1.0. The Uno and version
1.0 will be the reference versions of Arduno, moving forward. The Uno is the latest in a series of USB
Arduino boards, and the reference model for the Arduino platform; for a comparison with previous versions,
see the index of Arduino boards.
EAGLE files: arduino-duemilanove-uno-design.zip Schematic: arduino-uno-schematic.pdf

Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
32 KB of which 0.5 KB used by
Flash Memory
bootloader
SRAM 2 KB
EEPROM 1 KB
Clock Speed 16 MHz
The Arduino Uno can be powered via the USB connection or with an external power supply. The power
source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter
can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a
battery can be inserted in the Gnd and Vin pin headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V
pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage
regulator may overheat and damage the board. The recommended range is 7 to 12 volts.

The power pins are as follows:

• VIN. The input voltage to the Arduino board when it's using an external power source (as opposed to
5 volts from the USB connection or other regulated power source). You can supply voltage through
this pin, or, if supplying voltage via the power jack, access it through this pin.
• 5V. The regulated power supply used to power the microcontroller and other components on the
board. This can come either from VIN via an on-board regulator, or be supplied by USB or another
regulated 5V supply.
• 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.
• GND. Ground pins.

The Atmega328 has 32 KB of flash memory for storing code (of which 0,5 KB is used for the bootloader); It
has also 2 KB of SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).

Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(), digitalWrite(), and
digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and
has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have
specialized functions:

• Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. TThese pins are
connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip .
• External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a
rising or falling edge, or a change in value. See the attachInterrupt() function for details.
• PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
• SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which,
although provided by the underlying hardware, is not currently included in the Arduino language.

• LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is
on, when the pin is LOW, it's off.
The Uno has 6 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By
default they measure from ground to 5 volts, though is it possible to change the upper end of their range
using the AREF pin and the analogReference() function. Additionally, some pins have specialized
functionality:

• I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library.

There are a couple of other pins on the board:

• AREF. Reference voltage for the analog inputs. Used with analogReference().
• Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to
shields which block the one on the board.

See also the mapping between Arduino pins and Atmega328 ports.

The Arduino Uno has a number of facilities for communicating with a computer, another Arduino, or other
microcontrollers. The ATmega328 provides UART TTL (5V) serial communication, which is available on
digital pins 0 (RX) and 1 (TX). An ATmega8U2 on the board channels this serial communication over USB
and appears as a virtual com port to software on the computer. The '8U2 firmware uses the standard USB
COM drivers, and no external driver is needed. However, on Windows, an *.inf file is required..

The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the
Arduino board. The RX and TX LEDs on the board will flash when data is being transmitted via the USB-to-
serial chip and USB connection to the computer (but not for serial communication on pins 0 and 1).

A SoftwareSerial library allows for serial communication on any of the Uno's digital pins.

The ATmega328 also support I2C (TWI) and SPI communication. The Arduino software includes a Wire
library to simplify use of the I2C bus; see the documentation for details. To use the SPI communication,
please see the ATmega328 datasheet.

The Arduino Uno can be programmed with the Arduino software (download). Select "Arduino Uno w/
ATmega328" from the Tools > Board menu (according to the microcontroller on your board). For details,
see the reference and tutorials.

The ATmega328 on the Arduino Uno comes preburned with a bootloader that allows you to upload new code
to it without the use of an external hardware programmer. It communicates using the original STK500
protocol (reference, C header files).

You can also bypass the bootloader and program the microcontroller through the ICSP (In-Circuit Serial
Programming) header; see these instructions for details.

The ATmega8U2 firmware source code is available . The ATmega8U2 is loaded with a DFU bootloader,
which can be activated by connecting the solder jumper on the back of the board (near the map of Italy) and
then resetting the 8U2. You can then use Atmel's FLIP software (Windows) or the DFU programmer (Mac
OS X and Linux) to load a new firmware. Or you can use the ISP header with an external programmer
(overwriting the DFU bootloader).
Rather than requiring a physical press of the reset button before an upload, the Arduino Uno is designed in a
way that allows it to be reset by software running on a connected computer. One of the hardware flow control
lines (DTR) of the ATmega8U2 is connected to the reset line of the ATmega328 via a 100 nanofarad
capacitor. When this line is asserted (taken low), the reset line drops long enough to reset the chip. The
Arduino software uses this capability to allow you to upload code by simply pressing the upload button in the
Arduino environment. This means that the bootloader can have a shorter timeout, as the lowering of DTR
can be well-coordinated with the start of the upload.

This setup has other implications. When the Uno is connected to either a computer running Mac OS X or
Linux, it resets each time a connection is made to it from software (via USB). For the following half-second or
so, the bootloader is running on the Uno. While it is programmed to ignore malformed data (i.e. anything
besides an upload of new code), it will intercept the first few bytes of data sent to the board after a
connection is opened. If a sketch running on the board receives one-time configuration or other data when it
first starts, make sure that the software with which it communicates waits a second after opening the
connection and before sending this data.

The Uno contains a trace that can be cut to disable the auto-reset. The pads on either side of the trace can
be soldered together to re-enable it. It's labeled "RESET-EN". You may also be able to disable the auto-reset
by connecting a 110 ohm resistor from 5V to the reset line; see this forum thread for details.

The Arduino Uno has a resettable polyfuse that protects your computer's USB ports from shorts and
overcurrent. Although most computers provide their own internal protection, the fuse provides an extra layer
of protection. If more than 500 mA is applied to the USB port, the fuse will automatically break the connection
until the short or overload is removed.

The maximum length and width of the Uno PCB are 2.7 and 2.1 inches respectively, with the USB connector
and power jack extending beyond the former dimension. Three screw holes allow the board to be attached to
a surface or case. Note that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even multiple
of the 100 mil spacing of the other pins.
Arduino can sense the environment by receiving input from a variety of sensors and can affect its
surroundings by controlling lights, motors, and other actuators. The microcontroller on the board is
programmed using the Arduino programming language (based on Wiring) and the Arduino
development environment (based on Processing). Arduino projects can be stand-alone or they can
communicate with software on running on a computer (e.g. Flash, Processing, MaxMSP).

Arduino is a cross-platoform program. You’ll have to follow different instructions for your personal
OS. Check on the Arduino site for the latest instructions. http://arduino.cc/en/Guide/HomePage

Once you have downloaded/unzipped the arduino IDE, you can Plug the Arduino to your PC via USB cable.

Now you’re actually ready to “burn” your


first program on the arduino board. To
select “blink led”, the physical translation
of the well known programming “hello
world”, select

File>Sketchbook>
Arduino-0017>Examples>
Digital>Blink

Once you have your skecth you’ll


see something very close to the
screenshot on the right.

In Tools>Board select

Now you have to go to


Tools>SerialPort
and select the right serial port, the
one arduino is attached to.
1. Warranties

1.1 The producer warrants that its products will conform to the Specifications. This warranty lasts for one (1) years from the date of the sale. The
producer shall not be liable for any defects that are caused by neglect, misuse or mistreatment by the Customer, including improper installation or testing,
or for any products that have been altered or modified in any way by a Customer. Moreover, The producer shall not be liable for any defects that result from
Customer's design, specifications or instructions for such products. Testing and other quality control techniques are used to the extent the producer deems
necessary.

1.2 If any products fail to conform to the warranty set forth above, the producer's sole liability shall be to replace such products. The producer's liability
shall be limited to products that are determined by the producer not to conform to such warranty. If the producer elects to replace such products, the
producer shall have a reasonable time to replacements. Replaced products shall be warranted for a new full warranty period.

1.3 EXCEPT AS SET FORTH ABOVE, PRODUCTS ARE PROVIDED "AS IS" AND "WITH ALL FAULTS." THE PRODUCER DISCLAIMS ALL OTHER
WARRANTIES, EXPRESS OR IMPLIED, REGARDING PRODUCTS, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE

1.4 Customer agrees that prior to using any systems that include the producer products, Customer will test such systems and the functionality of the
products as used in such systems. The producer may provide technical, applications or design advice, quality characterization, reliability data or other
services. Customer acknowledges and agrees that providing these services shall not expand or otherwise alter the producer's warranties, as set forth
above, and no additional obligations or liabilities shall arise from the producer providing such services.

1.5 The Arduino products are not authorized for use in safety-critical applications where a failure of the product would reasonably be expected to cause
severe personal injury or death. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the
operation of nuclear facilities and weapons systems. Arduino products are neither designed nor intended for use in military or aerospace applications or
environments and for automotive applications or environment. Customer acknowledges and agrees that any such use of Arduino products which is solely
at the Customer's risk, and that Customer is solely responsible for compliance with all legal and regulatory requirements in connection with such use.

1.6 Customer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements concerning its
products and any use of Arduino products in Customer's applications, notwithstanding any applications-related information or support that may be
provided by the producer.

2. Indemnification

The Customer acknowledges and agrees to defend, indemnify and hold harmless the producer from and against any and all third-party losses, damages,
liabilities and expenses it incurs to the extent directly caused by: (i) an actual breach by a Customer of the representation and warranties made under this
terms and conditions or (ii) the gross negligence or willful misconduct by the Customer.

3. Consequential Damages Waiver

In no event the producer shall be liable to the Customer or any third parties for any special, collateral, indirect, punitive, incidental, consequential or
exemplary damages in connection with or arising out of the products provided hereunder, regardless of whether the producer has been advised of the
possibility of such damages. This section will survive the termination of the warranty period.

4. Changes to specifications

The producer may make changes to specifications and product descriptions at any time, without notice. The Customer must not rely on the absence or
characteristics of any features or instructions marked "reserved" or "undefined." The producer reserves these for future definition and shall have no
responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The product information on the Web Site or Materials is
subject to change without notice. Do not finalize a design with this information.

The producer of Arduino has joined the Impatto Zero®


policy of LifeGate.it. For each Arduino board produced is
created / looked after half squared Km of Costa Rica’s
forest’s.
8
1
8
3
1 3 3 4

2
3 IN OUT
2 2

2
5

7
7

2
1

1
6

1 IN OUT 5

3 ON/OFF
1 4 5
2 GND NC/FB 4 2
3 3 6
4
5
6
7
8

4
2
3
1
1 2

5
2
1
3 4
5 6 1 2

4
3
3 4
3

5 6 10
1 2 9
6

8
21 7

5
(PCINT7/OC0A/OC1C)PB7
(PCINT6)PB6 20 6
24 RESET(PC1/DW) (PCINT5)PB5 19 5

4
(T1/PCINT4)PB4 18 4
(PD0/MISO/PCINT3)PB3 17 1 RESET (SCK)PB5 19 3
2 16 18 2
1

XTAL2(PC0) (PDI/MOSI/PCINT2)PB2 (MISO)PB4


1 8 1 (SCLK/PCINT1)PB1 15 (MOSI)PB3 17 1
2 1 XTAL1 (SS/PCINT0)PB0 14 10 XTAL2 (SS)PB2 16
2

3 15
P$2
P$1

(OC1)PB1
4 5 4 9 XTAL1 (ICP)PB0 14
32 AVCC (INT4/ICP1/CLK0)PC7 22 6
23 21 28 5 2 7

4
(OC1A/PCINT8)PC6 AREF (ADC5)PC5
P$2
P$1

(PCINT9/OC1B)PC5 25 20 AVCC (ADC4)PC4 27 4


4 VCC (PCINT10)PC4 26 22 AGND (ADC3)PC3 26 3

5
3 GND (AIN2/PCINT11)PC2 5 (ADC2)PC2 25 2 3 6
7 VCC (ADC1)PC1 24 1
(CTS/HWB/AIN6/TO/INT7)PD7 13 8 GND (ADC0)PC0) 23
27 UCAP (RTS/AIN5/INT6)PD6 12
31 UVCC (XCK/AIN4/PCINT12)PD5 11 (AIN1)PD7 13
30 D- (INT5/AIN3)PD4 10 (AIN0)PD6 12 8
29 D+ (TXD1/INT3)PD3 9 (T1)PD5 11 7
28 UGND (RXD1/AIN1/INT2)PD2 8 6 3 (T0)PD4 6 6
(AIN0/INT1)PD1 7 (INT1)PD3 5 5
2 1 33 PAD (OC0B/INT0)PD0 6 (INT0)PD2 4 4
(TXD)PD1 3 3
(RXD)PD0 2 2
7 2 1

7 2

8 1
ANEXO 13. DATASHEET DEL PN532 NFC/RFID
PN532/C1
NFC controller
Rev. 1.2 — 31 March 2011 Short form data sheet

1. Introduction
This document describes the NFC controller PN532. This document is a short form
version; for full specification refer to the product data sheet.

2. General description
The PN532 is a highly integrated transmission module for contactless communication at
13.56 MHZ including micro-controller functionality based on an 80C51 core. The
transmission module utilises an outstanding modulation and demodulation concept
completely integrated for different kinds of passive contactless communication methods
and protocols at 13.56 MHZ.

The PN532 support 4 different operating modes:

• Reader/writer mode supporting ISO 14443A / MIFARE® and FeliCa™ scheme


• ISO 14443B in reader/writer mode only.
• Card interface mode supporting ISO 14443A / MIFARE® and FeliCa™ scheme
• NFCIP-1 mode

Enabled in reader/ writer mode for ISO reader 14443A / MIFARE® and reader/writer mode
for ISO 14443B, the PN532’s internal transmitter part is able to drive a reader/writer
antenna designed to communicate with ISO14443A /MIFARE® and ISO14443B cards and
transponders without additional active circuitry.

The receiver part provides a robust and efficient implementation of a demodulation and
decoding circuitry for signals from ISO 14443A / MIFARE® and ISO 14443B compatible
cards and transponders. The digital part handles the complete ISO14443A framing and
error detection (Parity & CRC).

The PN532 supports MIFARE“ Classic (e.g. MIFARE® Standard) products. The PN532
supports contactless communication using MIFARE® Higher Baudrates up to 424kBaud in
both directions.

Enabled in the reader/ writer mode for FeliCa™, the PN532 transmission module supports
the FeliCa™ communication scheme. The receiver part provides a robust and efficient
implementation of the demodulation and decoding circuitry for FeliCa™ coded signals.
The digital part handles the FeliCa™ framing and error detection like CRC. The PN532
supports contactless communication using FeliCa™ Higher Baudrates up to 424 kbaud in
both directions.
Philips Semiconductors PN532/C1
NFC controller

Enabled in card mode the PN532 transmission module is able to answer to a reader/writer
command either acoording to FeliCa™ or ISO14443 A / MIFARE® card interface mode.
The PN532 generates the digital load-modulated signals and in addition with an external
circuit the answers can be send back to the reader/writer. A complete card functionality is
only possible in combination with a secure memory IC.

Additionally, the PN532 transmission module offers the possibility to communicate directly
to a second NFCIP-1 device in the NFCIP-1 mode. The NFCIP-1 mode offers different
communication transfer speeds up to 424 kbit/s according to the ECMA 340 NFCIP-1
Standard. The digital part handles the complete NFCIP-1 framing and error detection.
Transfer speeds on the RF interface above 424 kbit/s are supported by the digital part of
the PN532 module. The modulation to transmit and the demodulation to receive data at
transfer speeds has than to be done by an external circuit.

To make information exchange to the host systems several interfaces are implemented:

• SPI interface
• I2C interface
• Serial UART (similar to RS232 with 0 and PVDD voltage levels)
The PN532 embeds a low dropout voltage regulator allowing the device to be connected
directly to a battery as well as a medium power switch to supply and control the power of
the companion secure chip.

3. Features
„ 80C51 micro controller core with 40 kbyte ROM and 1 kbyte RAM
„ Highly integrated analog circuitry to demodulate and decode responses
„ Buffered output drivers to connect an antenna with minimum number of external
components
„ Integrated RF Level detector
„ Integrated data mode detector
„ Supports ISO 14443A / MIFARE®
Supports ISO 14443B in reader/writer mode only
„ Typical operating distance in reader/writer mode for communication to a
ISO14443A/MIFARE®, ISO14443B or FeliCa™ card up to 50 mm depending on the
antenna size and tuning
„ Typical operating distance in NFCIP-1 mode up to 50 mm depending on the antenna
size and tuning and power supply
„ Typical operating distance in ISO14443A / MIFARE® card or FeliCa™ card interface
mode of about 100 mm depending on the antenna size and tuning and the external
field strength
„ Supports MIFARE® Classic encryption in reader/writer mode and MIFARE® higher
transfer speed communication at 212 kbit/s and 424 kbit/s
„ Supports contactless communication according to the FeliCa™ scheme at 212 kbaud
and 424 kbaud
„ Integrated RF interface for NFCIP-1 up to 424 kBaud
„ Possibility to communicate on the RF interface above 424 kbaud using external
analog circuitry

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 2 of 25


Philips Semiconductors PN532/C1
NFC controller

„ Supported host interfaces


‹ SPI interface
‹ I2C interface
‹ High Speed Serial UART (similar to RS232 with 0 and PVDD voltage levels)
„ Flexible interrupt using IRQ pin
„ Hard reset with low power function
„ Power down mode per embedded firmware
Automatic wake up on the I2C, HSU and SPI interfaces when device is in power down
mode
„ Programmable timer
„ Internal oscillator to connect 27.12 MHz crystal
„ 2.7 to 5.4V power supply
„ Power Switch for external secure companion chip.
„ Specific IO ports for external devices control
Embedded test of absence of antenna and/or antenna tuning components by detection
of significant load impedance deviation resulting in high power consumption increase.

4. Applications
„ Mobile and portable devices
„ PC world
„ Consumer application

5. Quick reference data


Table 1: Quick reference data
Symbol Parameter Conditions Min Typ Max Unit
VBAT Battery Supply Voltage 2.7 5.4 V
ICVDD LDO output voltage VSS = 0V [1] 2.7 3.0 3.3 V
VBAT > 3.3V
PVDD Supply Voltage for host VSS = 0V [2] 1.6 3.6 V
interface PVDD < VBAT
SVDD Supply Voltage for SAM VSS = 0V 2.7 3.0 3.3 V
interface VBAT > 3.3V
(SVDD Switch
Enabled)
IHPD Hard Power Down Current VBAT=5V, RF 2 μA
level detector
off
ISPD Soft Power down Current VBAT=5V, RF 10 μA
level detector
on
IICVDD Digital Supply Current VBAT=5V, RF [1] 25 mA
level detector
on, SVDD
switch off

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 3 of 25


Philips Semiconductors PN532/C1
NFC controller

Table 1: Quick reference data …continued


Symbol Parameter Conditions Min Typ Max Unit
ISVDD SVDD Supply Current VBAT=5V, 30 mA
SVDD switch
on
IAVDD Analog Supply Current IVBAT=5V, RF [1] 6 mA
level detector
on
ITVDD Transmitter (TX) Supply During RF [1] 60 100 mA
Current VBAT=5V, 40Ω
typical TX Zload
(min. tbd)
IVBAT continuous total current Tamb = -30 to + [3] 91 140 mA
consumption 85 °C, 40Ω
typical TX Zload
(min tbd),
excluding the
secure
companion chip
Tamb operating ambient -30 +85 °C
temperature

[1] DVDD, AVDD and TVDD shall always be connected together.


[2] It is not allowed to have PVDD above VBAT
[3] The total current consumption depends also on the firmware version (different internal IC clock speed)

6. Ordering information
Table 2: Ordering information
Type number Package
Name Description Version
PN5320A3HN/C101 [1] HVQFN40 plastic, heatsink very thin quad flat package; no leads; 40terminals; SOT618-1
body 6x 6x 0.85mm
PN5321A3HN/C101 [2] HVQFN40 plastic, heatsink very thin quad flat package; no leads; 40terminals; SOT618-1
body 6x 6x 0.85mm. Type B SW is enable.

[1] 01 is the reference of the romcode version.


[2] A purchaser of this Philips IC has to take care for appropriate third party patent license.

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 4 of 25


Philips Semiconductors PN532/C1
NFC controller

7. Block diagram

DVDD
RSTPDN
PN532

SVDD
VBAT

REGULATOR SVDDswitch

POR
Ports

SIGOUT SIGIN
sam_switch_en
I2C wake-up sam_switch_overload
monitoring
UART
Xramif RAM
HSU
ROMif ROM

P34
80C51
SPI
Timer0/1
MINT

Timer2
FIFO TCB
Manager
Intc CL UART
RAM

Hostif SFRif FiFO

TIMER
PVDD

Mifare Classic Unit

Framing Gen. & Check

Signal Processing
PCR

VMID BG Sensor ADC Transmit


Control

Osc27
Generator

TVDD
Recovery

RF Antenna
Demod
Clock

Clock

Detector Driver

AVDD

Fig 1. Block diagram of PN532

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 5 of 25


Philips Semiconductors PN532/C1
NFC controller

8. Pinning information

8.1 Pin description


Table 3: PN532 Pin description
Symbol Pin Type Pad Ref Description
Voltage
DVSS 1 PWR Digital Ground
LOADMOD 2 O DVDD Load Modulation output provides digital signal for FeliCa™ and MIFARE®
card operating mode
TVSS1 3 PWR Transmitter Ground: supplies the output stage of TX1 and TX2
TX1 4 O TVDD Transmitter 1: delivers the modulated 13.56 MHZ energy carrier
TVDD 5 PWR Internal Transmitter power supply: supplies the output stage of TX1 and TX2
TX2 6 O TVDD Transmitter 2: delivers the modulated 13.56 MHZ energy carrier
TVSS2 7 PWR Transmitter Ground: supplies the output stage of TX1 and TX2
AVDD 8 PWR Internal Analog Power Supply
VMID 9 O AVDD Internal Reference Voltage: This pin delivers the internal reference voltage.
RX 10 I AVDD Receiver Input: Input pin for the reception signal, which is the load modulated
13.56 MHZ energy carrier from the antenna circuit.
AVSS 11 PWR Analog Ground
AUX1 12 O AVDD Auxiliary Output: This pin delivers analog and digital test signals.
AUX2 13 O AVDD Auxiliary Output: This pin delivers analog and digital test signals.
OSCIN 14 I AVDD Crystal Oscillator Input: input to the inverting amplifier of the oscillator.This
pin is also the input for an externally generated clock (fosc = 27.12 MHZ).
OSCOUT 15 O AVDD Crystal Oscillator output: Output of the inverting amplifier of the oscillator.
I0 16 I DVDD General purpose IO signal
Can be used by the embedded firware to select the used host interface.
I1 17 I DVDD General purpose IO signal
Can be used by the embedded firware to select the used host interface.
TESTEN 18 I DVDD Test enable pin:
When set to 1 enable the test mode.
When set to 0 reset the TCB and disable the access to the test mode.
P35 19 IO DVDD General purpose IO signal
NC 20
NC 21
NC 22
PVDD 23 PWR Pad power supply
P30 24 IO PVDD General purpose IO signal. Can be configured to act either as RX line of the
second serial interface or general purpose IO.
In test mode this signal is used as input and output test signal.
IRQ 25 O PVDD Interrupt request: Output to signal an interrupt event to the host (Port 7 bit 0)
RSTOUTN 26 IO PVDD Output reset signal. When Low it indicates that the circuit is in reset state.
NSS 27 IO PVDD Not Slave Select .
MOSI 28 IO PVDD Master Out Slave In.
MISO 29 IO PVDD Master In Slave Out .
SCK 30 IO PVDD
9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 6 of 25


Philips Semiconductors PN532/C1
NFC controller

Table 3: PN532 Pin description …continued


Symbol Pin Type Pad Ref Description
Voltage
P31 31 IO PVDD General purpose IO signal.Can be configured to act either as TX line of the
second serial interface or general purpose IO.
In test mode this signal is used as input and output test signal.
P32_INT0 32 IO PVDD General purpose IO signal. Can be used to generate an HZ state on the
output of the selected interface for the Host communication and to enter
PN532 into powerdown mode without reseting the internal state of PN532.
In test mode this signal is used as input and output test signal.
P33_INT1 33 IO PVDD General purpose IO signal. Can also be used as an interrupt source
In test mode this signal is used as input and output test signal.
P34 34 IO SVDD General purpose IO signal or clk signal for the SAM
SIGOUT 35 O SVDD Contactless communication interface output: delivers a serial data stream
according to NFCIP-1 and output signal for the SAM.
In test mode this signal is used as test signal output.
SIGIN 36 I SVDD Contactless communication interface input: accepts a digital, serial data
stream according to NFCIP-1 and input signal from the SAM.
In test mode this signal is used as test signal input.
SVDD 37 O Output power for SAM power supply. Switched on by Firmware with an
overload detection. Used as a reference voltage for SAM communication.
RSTPDN 38 I PVDD Reset and Power Down: When Low, internal current sources are switched off,
the oscillator is inhibited, and the input pads are disconnected from the
outside world.
With a negative edge on this pin the internal reset phase starts.
DVDD 39 PWR Internal Digital Power Supply
VBAT 40 PWR Main external power supply.

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 7 of 25


Philips Semiconductors PN532/C1
NFC controller

9. Functional description

9.1 CONTACT LESS MODULE


The PN532 includes a highly integrated transmission/reception module for contactless
communication at 13.56 MHz. This transmission/reception contact less (CL) module
utilises an outstanding modulation and demodulation concept completely integrated for
different kinds of contactless communication methods and protocols at 13.56 MHz.

The CL module support 4 different operating modes

• reader / writer mode supporting ISO 14443A / MIFARE® and FeliCa™ scheme
• reader / writer mode supporting ISO 14443B
• card operation mode supporting ISO 14443A / MIFARE® and FeliCa™ scheme
• NFCIP-1 mode

Enabled in reader / writer mode for ISO 14443A / MIFARE®, the CL module transmitter
part is able to drive a reader / writer antenna designed to communicate with ISO 14443A /
MIFARE® cards and transponders without additional active circuitry. The CL module
receiver part provides a robust and efficient implementation of a demodulation and
decoding circuitry for signals from ISO 14443A / MIFARE® compatible cards and
transponders. The CL module handles the complete ISO 14443A framing and error
detection (Parity & CRC).The CL module supports MIFARE® Classic (e.g. MIFARE®
Standard) products. The CL module supports contactless communication using MIFARE®
Higher transfer speeds up to 424 kbit/s in both directions.

Enabled in reader / writer mode for FeliCa™, the CL module supports the FeliCa™
communication scheme. The CL module receiver part provides a robust and efficient
implementation of the demodulation and decoding circuitry for FeliCa™ coded signals.
The CL module digital part handles the FeliCa™ framing and error detection like CRC.
The CL module supports contactless communication using FeliCa™ Higher transfer
speeds up to 424 kbit/s in both directions.

The CL module supports all layers of the ISO/IEC 14443 B reader / writer communication
scheme, given correct implementation of additional components, like oscillator, power
supply, coil etc. and provided that standardised protocols, e.g. like ISO/IEC 14443-4
and/or ISO/IEC 14443 B anticollision are correctly implemented. The use of this Philips IC
according to ISO/IEC 14443 B might infringe third party patent rights. A purchaser of this
Philips IC has to take care for appropriate third party patent licenses.

In card operation mode, the CL module is able to answer to a reader / writer command
either according to the FeliCa™ or ISO 14443A / MIFARE® card interface scheme. The
CL module generates the digital load modulated signals and in addition with an external
circuit the answer can be sent back to the reader / writer. A complete card functionality is
only possible in combination with a secure core IC using the S2C interface.

Additionally, the CL module offers the possibility to communicate directly to an NFCIP-1


device in the NFCIP-1 mode. The NFCIP-1 mode offers different communication modes
and transfer speeds up to 424kbit/s according to the Ecma 340 NFCIP-1 Standard. The
CL module digital part handles the complete NFCIP-1 framing and error detection.

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 8 of 25


Philips Semiconductors PN532/C1
NFC controller

9.1.1 Simplify block diagram

Fig 2. Memory manager shift register management.

The Analog interface handles the modulation and demodulation of the analog signals
according to the card receiving mode, reader / writer mode and NFCIP-1 mode
communication scheme.

The RF level detector detects the presence of an external RF-field delivered by the
antenna to the RX pin.

The data mode detector detects a MIFARE®, FeliCa™ or NFCIP-1 mode in order to
prepare the internal receiver to demodulate signals, which are sent to the PN512.

The communication (S2C) interface provides digital signals to support communication for
transfer speeds above 424 kbit/s and digital signals to communicate to a secure core IC.

The contactless UART handles the protocol requirements for the communication schemes
in co-operation with the host. The comfortable FIFO buffer allows a fast and convenient
data transfer from the host to the contactless UART and vice versa.

9.1.2 Feature list


• Close communication link to the analog circuitry to demodulate and decode card’s
response
• Typical MOVX access to non critical registers
• SFR register map for high frequency register access (16 Registers)
• Integrated data mode detector
• Supports ISO 14443A / MIFARE®
• Supports ISO 14443 B reader / writer functionality
• Adjustable parameters to optimize the reception according to the antenna
configuration
• Adjustable parameters to optimize the transmisssion according to the antenna
configuration and characteristics.
• typical operating distance in reader / writer mode for communication to a ISO 14443A/
MIFARE® or FeliCa™ card up to 50 mm depending on the antenna size, tuning and
power supply

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 9 of 25


Philips Semiconductors PN532/C1
NFC controller

• typical operating distance in NFCIP-1 mode up to 50 mm depending on the antenna


size and tuning and power supply
• typical operating distance in ISO 14443A / MIFARE® card or FeliCa™ card operation
mode of about 100 mm depending on the antenna size and tuning and the external
field strength
• Supports MIFARE® Classic encryption in reader / writer mode
• Supports ISO 14443A higher transfer speed communication at 212 kbit/s and
424 kbit/s
• Supports contactless communication according to the FeliCa™ scheme at 212 kbit/s
and 424 kbit/s
• Integrated RF interface for NFCIP-1 up to 424 kbit/s
• Possibility to communicate on the RF interface above 424 kbit/s using external analog
circuitry
• Support of the S2C interface
• 64 byte send and receive FIFO-buffer
• Programmable timer
• CRC Co-processor
• internal self test
• 2 interrupt sources
• Integrated RF Level detector
• Integrated RF interface for NFCIP-1 up to 424 kbit/s

9.1.3 Operating Modes


The CL module support the following operating modes:

• Reader/writer mode supporting ISO14443A / MIFARE®, Felica™ and ISO14443B


schemes.
• Card operation mode supporting ISO14443A / MIFARE® and Felica™ schemes
• NFCIP-1 mode
The modes support different transfer speeds and modulation schemes. The following
chapters will explain the different modes more in detail.

Note: All indicated modulation indexes and modes in this chapter are system parameters.
This means that beside the IC settings a suitable antenna tuning is required to achieve the
optimal performance.

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 10 of 25


Philips Semiconductors PN532/C1
NFC controller

9.1.3.1 Reader / Writer mode


Generally 3 reader/writer-operating modes are supported. The PN532 can act as a reader
/ writer for ISO14443A / MIFARE®, FeliCa™ and ISO14443B cards.

Battery

ISO 14443A/B or
PN532
Felica Card
HOST

Contactless Card

Reader/Writer

Fig 3. Reader/Writer Mode.

9.1.3.2 ISO14443A Reader / Writer Functionality


The ISO14443A / MIFARE® reader / writer mode is the general reader / writer to card
communication scheme according to the ISO14443A / MIFARE® specification. The
following diagram describes the communication on a physical level.

ISO14443A
Reader (PCD) 1. PCD to PICC 100 % ASK,
Miller Coded,
Transfer speed 106 to 424 kbit/s ISO 14443A
Card (PICC)
PN532
2. PICC to PCD, Subcarrier Load modulation,
Manchester Coded or BPSK,
Transfer speed 106 to 424 kbit/s

Fig 4. ISO14443A / MIFARE® reader/writer communication diagram.

Table 4: Communication overview for ISO14443A / MIFARE® reader/writer


Communication MIFARE® / ISO14443A MIFARE® Higher transfer speed
direction Baudrate 106kbaud 212 Kbaud 424kBaud
PN532 → card Modulation on reader 100 % ASK 100 % ASK 100 % ASK
side
bit coding Modified Miller coding Modified Modified Miller coding
Miller coding
Bitlength 128⁄ = 9.44 μs 64⁄ = 9.44μs⁄2 32⁄ = 9.44μs⁄4
13.56 13.56 13.56
Card → PN532 Modulation on card side Subcarrier load modulation subcarrier load subcarrier load
modulation modulation
Subcarrier frequency 13.56MHz⁄ 13.56MHz⁄ 13.56MHz⁄
16 16 16
bit coding Manchester coding BPSK BPSK

The contactless UART, in cooperation with the internal micro-controller of PN532 and the
external host handle the complete MIFARE® / ISO14443 A protocol.

The internal CRC coprocessor calculates the CRC value according to the definitions given
in the ISO 14443A part 3.

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 11 of 25


Philips Semiconductors PN532/C1
NFC controller

9.1.3.3 FeliCa™ Reader/Writer Functionality


The FeliCa™ mode is the general reader / writer to card communication scheme
according to the FeliCa™ specification. The following diagram describes the
communication on a physical level.

FELICA
Reader (PCD) 1. PCD to PICC 8 - 14% ASK,
Manchester Coded, FELICA
Baudrate 212 to 424 Kbaud Card (PICC)

PN532
2. PICC to PCD, >12% ASK loadmodulation,
Manchester Coded,
Baudrate 212 to 424 Kbaud

Fig 5. FeliCa™ reader / writer communication Diagram.

Table 5: Communication Overview for FeliCa™ reader/writer functionality


Communication FeliCa™ FeliCa™ Higher
direction Baudrate
Baudrate 212 Kbaud 424kBaud
PN532 ->card Modulation on reader 8 - 14 % ASK 8 - 14 % ASK
side
bit coding Manchester coding Manchester coding
Bitlength 64⁄ = 9.44μs⁄2 32⁄ = 9.44μs⁄4
13.56 13.56
Card->PN532 Modulation on card side >12% ASK >12% ASK
bit coding Manchester coding Manchester coding

The internal contactless UART, the internal µC of PN532 and the external host handle the
FeliCa™ protocol.

The Framing and coding of the FeliCa™ should be according the following table:

Table 6: FeliCa™ Framing and Coding


Preamble Sync Len n-Data CRC
00 00 00 00 00 00 B2 4D

To enable the FeliCa™ communication a 6 bytes long preamble and 2 bytes Sync bytes
are sent in order to synchronise the internal receiver. The Len byte is an indicator for the
length of the sent data bytes plus the n-data bytes. The CRC calculation is done according
to the FeliCa™ definitions with the MSB first.

To transmit data on the RF interface, the host has to send the Preamble-, Syn-, Len- and
data- bytes to the PN532. Only the internal CRC calculation is made and added internally
of the PN532

The starting value for the CRC Polynomial is 2 null bytes: (0x00), (0x00)

Example of frame sent to the field:

Table 7: FeliCa™ Framing and Coding


Preamble Sync Len 2 Data Bytes CRC
00 00 00 00 00 00 B2 4D 03 AB CD 90 35

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 12 of 25


Philips Semiconductors PN532/C1
NFC controller

9.1.4 NFCIP-1 MODE


The NFCIP-1 communication differentiates between an active and a passive
communication mode.

• Active Communication Mode means both the initiator and the target are using their
own RF field to transmit data
• Passive Communication Mode means that the target answers to an initiator command
in a load modulation scheme. The initiator is active in terms of generating the RF field.
• Initiator: generates RF field @ 13.56 MHz and starts the NFCIP
• Target: responds to initiator command either in a load modulation scheme for passive
communication mode or using a self generated and self modulated RF field for active
communication mode.

In order to fully support the NFCIP-1 standard the PN532 supports the active and passive
communication mode at the transfer speeds 106 kbit/s, 212 kbit/s and 424 kbit/s as
defined in the NFCIP-1 standard

Battery Battery

PN532 PN532

HOST HOST

Initiator: Active target: Passive or Active

Fig 6. NFCIP-1 Mode.

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 13 of 25


Philips Semiconductors PN532/C1
NFC controller

9.1.4.1 ACTIVE Communication mode


Active Communication Mode means both the initiator and the target are using their own
RF field to enable the communication.

Host 1. Initiator starts the communication Host


PN532 PN532
NFC Initiator at selected transfer speed NFC Target

Power to generate Powered for Digital


the field Communication

Host 2. Target answer Host


PN532 PN532
NFC Initiator at the same transfer speed NFC Target

Powered for Digital Power to generate


Communication the field

Fig 7. Active NFC Mode.

The following table gives an overview of the active communication modes:

Table 8: Communication Overview for active NFC


Communication 106 kbit/s 212 kbit/s 424 kbit/s 848 kbit/s 1.69 Mbit/s
direction 3.39 Mbit/s
Initiator -> Target According to According to According to digital capability to handle this
ISO14443A FeliCa™, FeliCa™, communication according to the NFC
100% ASK, 8-30 %ASK 8-30 %ASK mode
Miller Coded Manchester Coded Manchester Coded
Target -> Initiator According to According to According to digital capability to handle this
ISO14443A FeliCa™, FeliCa™, communication according to the NFC
100% ASK, 8-30 %ASK 8-30 %ASK mode
Miller Coded Manchester Coded Manchester Coded

Note: Transfer speed above 424 kbit/s are not defined in the NFCIP-1. The PN532
supports these transfer speeds only with dedicated external circuitry.

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 14 of 25


Philips Semiconductors PN532/C1
NFC controller

9.1.4.2 PASSIVE Communication mode


Passive Communication Mode means that the target answers to an initiator command in a
load modulation scheme. The initiator is active meaning generating the RF field.

Host 1. Initiator starts communication Host


PN532 PN532
NFC Initiator at selected transfer speed NFC Target

Power to generate Power for digital


the field processing

Host 2. Targets answer using load modulated data Host


PN532 PN532
NFC Initiator at the same transfer speed NFC Target

Power to generate Power for digital


the field processing

Fig 8. Passive NFC Mode.

The following table gives an overview of the active communication modes:

Table 9: Communication Overview for passive NFC


Communication 106 kbit/s 212 kbit/s 424 kbit/s 848 kbit/s 1.69 Mbit/s
direction 3.39 Mbit/s
Initiator -> Target According to According to According to digital capability to handle this
ISO14443A FeliCa™, FeliCa™, communication according to the NFC
100% ASK, 8-30 %ASK 8-30 %ASK mode
Miller Coded Manchester Coded Manchester Coded
Target -> Initiator according to according to according to digital capability to handle this
ISO14443 A FeliCa™, FeliCa™, communication according to the NFC
subcarrier load >12 % ASK, >12 % ASK, mode
modulation, Manchester Coded Manchester Coded
Manchester Coded

Note: Transfer speed above 424 kbit/s are not defined in the NFCIP-1. The PN532
supports these transfer speeds only with dedicated external circuitry.

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 15 of 25


Philips Semiconductors PN532/C1
NFC controller

9.1.4.3 NFC FRAMING AND CODING


The NFCIP-1 framing and coding in active and passive communication modes are defined
in the NFCIP-1 standard.

Table 10: NFC Framing and Coding Overview


Baudrate Framing and Coding
106 kbaud According to the ISO 14443A / MIFARE® scheme
212 kbaud According to the FeliCa™ scheme
424 kbaud or higher According to the FeliCa™ scheme

9.1.4.4 NFC Protocol Support


The NFCIP-1 protocol is not completely described in this document. For detailed
explanation of the protocol refer to the NCFCIP-1 standard. However the datalink layer is
according to the following policy:

• Speed shall not be changed while continuum data exchange in a transaction.


• More than one transaction at a time in the same operation field is prohibited.
• Transaction includes initialisation and anticollision methods and data exchange (in
continuous way, meaning no interruption by another transaction).

In order not to disturb current infrastructure based on 13.56 MHZ general rules to start
NFC communication are defined in the following way.

• Per default NFCIP-1 device is in target mode, meaning its RF field is switched off.
• The RF level detector is active
• Only if application requires the NFC device shall switch to initiator mode
• Initiator shall only switch on RF if no external RF field is detected by RF Level detector
during a time of TIDT.
• The initiator performs initialisation according to the selected mode.

9.1.5 Card operation mode


The PN532 can be addressed like a FeliCa™ or ISO 14443A / MIFARE® card. This means
that the PN532 can generate an answer in a load modulation scheme according to the
ISO 14443A / MIFARE® or FeliCa™ interface description.

Remark: The PN532 does not support a complete card protocol. This has to be handled
by a dedicated card SAM or a micro-controller. The SAM is optional.

Battery

Reader/Writer for
Felica or MIFARE PN532

HOST
and SAM
Generate RF field

Answers in Loadmodulation scheme

Fig 9. CARD Operating Mode.


9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 16 of 25


Philips Semiconductors PN532/C1
NFC controller

9.1.5.1 MIFARE® card interface mode

Table 11: MIFARE® CARD operating mode


Communication MIFARE® / ISO14443A MIFARE® Higher Baudrates
direction Transfer speed 106kbit/s 212 kbit/s 424 kbit/s
PN532 receiving Modulation on reader 100 % ASK 100 % ASK 100 % ASK
data from the side
reader / writer bit coding Modified Miller coding Modified Modified Miller coding
Miller coding
Bitlength 128⁄ = 9.44 μs 64⁄ = 9.44μs⁄2 32⁄ = 9.44μs⁄4
13.56 13.56 13.56
PN532 sending Modulation on PN532 Subcarrier load modulation subcarrier load subcarrier load
data back to the side modulation modulation
reader / writer Subcarrier frequency 13.56MHz⁄ 13.56MHz⁄ 13.56MHz⁄
16 16 16
bit coding Manchester coding BPSK BPSK

9.1.5.2 FeliCa™ card interface mode

Table 12: FeliCa™ CARD operating mode


Communication FeliCa™ FeliCa™ Higher Baudrates
direction Baudrate 212kbaud 424kBaud
PN532 receiving data Modulation on reader side 8-14 % ASK 8-14 % ASK
from the reader / writer bit coding Manchester Coding Manchester Coding
64⁄
13.56μs
32⁄
Bitlength 13.56μs
PN532 sending data Modulation on PN532 side >12% ASK, loadmodulation >12% ASK, load modulation
back to the reader / bit coding Manchester coding Manchester coding
writer

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 17 of 25


Philips Semiconductors PN532/C1
NFC controller

10. Limiting values


Table 13: Limiting values
In accordance with the Absolute Maximum Rating System (IEC 60134).
Symbol Parameter Conditions Min Max Unit
PVDD Supply Voltage -0.5 4 V
VBAT Battery Supply Voltage -0.5 6.0 V
Ptot Total power dissipation tbd mW
ITX1 Maximum current in transmitter TX1 -100 100 mA
ITX2 Maximum current in transmitter TX2 -100 100 mA
Tstg Storage temperature -55 150 °C
Tj Junction temperature 100 °C

Table 14: ESD Characteristics


Symbol Parameter Conditions Specification Value
ESDH ESD Susceptibility (Human Body model) 1500 Ohm, 100pF JESD22-A114-B 2 KV
ESDM ESD Susceptibility (Machine model) 0.75 μH, 200 pF JESD22-A114-A 200 V
ESDC ESD Susceptibility (Charge Device model) Field induced model JESC22-C101-A 1 KV

11. Recommended operating conditions


Table 15: Operating conditions
Symbol Parameter Conditions Min Typ Max Unit
Tamb Ambiant Temperature -30 +25 +85 °C
VBAT Battery Supply VSS = 0V [1], [2] 2.7 5 5.4 V
Voltage
PVDD Supply voltage from VSS=0V 1.6 1.8-3.3 3.6 V
host interface

[1] VSS represents DVSS, TVSS1, TVSS2, AVSS.


[2] Supply voltage of VBAT below 3.3 V reduces the performance (e.g. the achievable operating distance).

12. Thermal characteristics


Table 16: Thermal characteristics
Symbol Parameter Conditions Typ Unit
Rthj-a thermal resistance from junction to in free air with exposed pad soldered 35 K/W
ambient (for HVQFN40 package) on a 4 layer Jedec PCB-0.5

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 18 of 25


Philips Semiconductors PN532/C1
NFC controller

13. Characteristics
Table 17: Current Consumption
Symbol Parameter Conditions Min Typ Max Unit
Ihpd Hard Power Down Current PVDD=3V, RF level [5] 10 mA
detector off
ISPD Soft Power down Current PVDD=3V, [5] 35 mA
RF level detector on
IAVDD Analog Supply Current VBAT = 5V tbd 6 mA
PVDD=3V, RF level
detector on
IAVDDrcvo Analog Supply Current VBAT = 5V 3 5 mA
ff PVDD=3V, RF level
detector off
IPVDD Pad Supply Current [2] tbd mA
ISVDD Output Supply Current for sam_switch_en [3] 30 mA
SAM set to 1
ITVDD1,4 Transmitter Supply Current Continuous Wave, VBAT [1] [4] 602 100 mA
= 5V
IVBAT Total Supply Current Continuous Wave, VBAT [1] [4] 76,5 tbd mA
= 5V

[1] ITVDD depends on TVDD and the external circuitry connected to Tx1 and Tx2.
[2] IPVDD depends on the overall load at the digital pins.
[3] ISVDD depends on the overall load on SVDD pad.
[4] During operation with a typical circuitry the overall current is below 100 mA.
[5] ISPD and IHPD are the total currents over all supplies.
[6] Typical value using a complementary driver configuration and an antenna matched to 40 Ohm between TX1 and TX2 at 13.56 MHZ.

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 19 of 25


Philips Semiconductors PN532/C1
NFC controller

14. Application information

Battery

SVDD
PMU Secure
SIGOUT
VBAT
Core
SIGIN
DVDD
P34
4.7uF

100nF CRx 100nF


PN532 1nF
RX
AVDD R1 R2
100nF 1kΩ 2.7kΩ
VMID

Cvmid
100nF C1 and C2 are matching cap (10 to 300pF)
TVDD
4.7uF 100nF Rq are the damping resistor, few ohms
560nH
L0 C1 RQ
TX1
220pF
100nF
PVDD C0 C2
TVSS1 Antenna
TVSS2
RTSPDN C0 C2
220pF
Host - Processor

Host Interface TX2


L0 C1 RQ
560nH
IRQ

DVSS AVSS
OSCIN OSCOUT

22pF 27,12 22pF


MHZ

Fig 10. Application diagram of PN532

In the example the 27.12MHz quartz is a TAS-3225A, SMD


9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 20 of 25


Philips Semiconductors PN532/C1
NFC controller

15. Package outline

HVQFN40: plastic thermal enhanced very thin quad flat package; no leads;
40 terminals; body 6 x 6 x 0.85 mm SOT618-1

D B A

terminal 1
index area

A
E A1
c

detail X

e1 C

e 1/2 e b v M C A B y1 C y
11 20 w M C
L
21
10

Eh e2

1/2 e

1
30
terminal 1
index area 40 31
Dh X

0 2.5 5 mm

scale
DIMENSIONS (mm are the original dimensions)
A(1)
UNIT
max.
A1 b c D(1) Dh E(1) Eh e e1 e2 L v w y y1

mm 0.05 0.30 6.1 4.25 6.1 4.25 0.5


1 0.2 0.5 4.5 4.5 0.1 0.05 0.05 0.1
0.00 0.18 5.9 3.95 5.9 3.95 0.3
Note
1. Plastic or metal protrusions of 0.075 mm maximum per side are not included.

OUTLINE REFERENCES EUROPEAN


ISSUE DATE
VERSION IEC JEDEC JEITA PROJECTION

01-08-08
SOT618-1 --- MO-220 ---
02-10-22

Fig 11. Package outline HVQFN40 (SOT618-1)

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 21 of 25


Philips Semiconductors PN532/C1
NFC controller

16. Abbreviations
Table 18: Abbreviations
Acronym Description
ASK Amplitude Shift keying
PCD Proximity Coupling Device. Definition for a Card Reader/ Writer according to the
ISO 14443 Specification
PICC Proximity Cards. Definition for a contactless Smart Card according to the
ISO14443 specification
PCD -> PICC Communication flow between a PCD and a PICC according to the ISO14443A/
MIFARE®
PICC -> PCD Communication flow between a PICC and a PCD according to the ISO14443A/
MIFARE®
Initiator Generates RF field @ 13.56 MHZ and starts the NFCIP-1 communication.
Modulation Index The modulation index is defined as the voltage ratio (Vmax - Vmin) / (Vmax +
Vmin).
Loadmodulation The load modulation index is defined as the card’s voltage ratio (Vmax - Vmin) /
Index (Vmax + Vmin) measured at the card’s coil.
Target Responds to initiator command either using load modulation scheme (RF field
generated by Initiator) or using modulation of self generated RF field (no RF
field generated by initiator).

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 22 of 25


Philips Semiconductors PN532/C1
NFC controller

17. Revision history


Table 19: Revision history
Document ID Release date Data sheet status Change notice Doc. number Supersedes
2006.01.08 short form data sheet Draft 1.2 Initial version

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 23 of 25


Philips Semiconductors PN532/C1
NFC controller

18. Data sheet status

Level Data sheet status [1] Product status [2] [3] Definition
I Objective data Development This data sheet contains data from the objective specification for product development. Philips
Semiconductors reserves the right to change the specification in any manner without notice.
II Preliminary data Qualification This data sheet contains data from the preliminary specification. Supplementary data will be published
at a later date. Philips Semiconductors reserves the right to change the specification without notice, in
order to improve the design and supply the best possible product.
III Product data Production This data sheet contains data from the product specification. Philips Semiconductors reserves the
right to make changes at any time in order to improve the design, manufacturing and supply. Relevant
changes will be communicated via a Customer Product/Process Change Notification (CPCN).

[1] Please consult the most recently issued data sheet before initiating or completing a design.
[2] The product status of the device(s) described in this data sheet may have changed since this data sheet was published. The latest information is available on the Internet at
URL http://www.semiconductors.philips.com.
[3] For data sheets describing multiple type numbers, the highest-level product status determines the data sheet status.

19. Definitions Change Notification (CPCN). Philips Semiconductors assumes no


responsibility or liability for the use of any of these products, conveys no
license or title under any patent, copyright, or mask work right to these
Short-form specification — The data in a short-form specification is products, and makes no representations or warranties that these products are
extracted from a full data sheet with the same type number and title. For free from patent, copyright, or mask work right infringement, unless otherwise
detailed information see the relevant data sheet or data handbook. specified.

Limiting values definition — Limiting values given are in accordance with


the Absolute Maximum Rating System (IEC 60134). Stress above one or
more of the limiting values may cause permanent damage to the device.
21. Licenses
These are stress ratings only and operation of the device at these or at any
other conditions above those given in the Characteristics sections of the
specification is not implied. Exposure to limiting values for extended periods Purchase of Philips I2C-bus components
may affect device reliability. Purchase of Philips I2C-bus components conveys a
Application information — Applications that are described herein for any license under the Philips’ I2C-bus patent to use the
of these products are for illustrative purposes only. Philips Semiconductors components in the I2C-bus system provided the system
make no representation or warranty that such applications will be suitable for conforms to the I2C-bus specification defined by
the specified use without further testing or modification. Koninklijke Philips Electronics N.V. This specification
can be ordered using the code 9398 393 40011.

20. Disclaimers Purchase of Philips RC5 components


Purchase of Philips RC5 components conveys a license under the
Life support — These products are not designed for use in life support Philips RC5 patent to use the components in RC5 system products
appliances, devices, or systems where malfunction of these products can conforming to the RC5 standard UATM-5000 for allocation of remote
reasonably be expected to result in personal injury. Philips Semiconductors control commands defined by Koninklijke Philips Electronics N.V.
customers using or selling these products for use in such applications do so
at their own risk and agree to fully indemnify Philips Semiconductors for any
Purchase of NXP ICs with NFC technology
damages resulting from such application.
Purchase of an NXP Semiconductors IC that complies with one of the Near
Right to make changes — Philips Semiconductors reserves the right to
Field Communication (NFC) standards ISO/IEC 18092 and ISO/IEC 21481
make changes in the products - including circuits, standard cells, and/or
does not convey an implied license under any patent right infringed by
software - described or contained herein in order to improve design and/or
implementation of any of those standards. A license for the patents portfolio
performance. When the product is in full production (status ‘Production’),
of NXP B.V. for the NFC standards needs to be obtained at Via Licensing,
relevant changes will be communicated via a Customer Product/Process
the pool agent of the NFC Patent Pool, e-mail: info@vialicensing.com.

22. Contact information


For additional information, please visit: http://www.semiconductors.philips.com
For sales office addresses, send an email to: sales.addresses@www.semiconductors.philips.com

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 24 of 25


Philips Semiconductors PN532/C1
NFC controller

23. Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 General description . . . . . . . . . . . . . . . . . . . . . . 1
3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
4 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
5 Quick reference data . . . . . . . . . . . . . . . . . . . . . 3
6 Ordering information . . . . . . . . . . . . . . . . . . . . . 4
7 Block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . 5
8 Pinning information . . . . . . . . . . . . . . . . . . . . . . 6
8.1 Pin description . . . . . . . . . . . . . . . . . . . . . . . . . 6
9 Functional description . . . . . . . . . . . . . . . . . . . 8
9.1 CONTACT LESS MODULE . . . . . . . . . . . . . . . 8
9.1.1 Simplify block diagram . . . . . . . . . . . . . . . . . . . 9
9.1.2 Feature list . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
9.1.3 Operating Modes . . . . . . . . . . . . . . . . . . . . . . 10
9.1.4 NFCIP-1 MODE . . . . . . . . . . . . . . . . . . . . . . . 13
9.1.5 Card operation mode . . . . . . . . . . . . . . . . . . . 16
10 Limiting values. . . . . . . . . . . . . . . . . . . . . . . . . 18
11 Recommended operating conditions. . . . . . . 18
12 Thermal characteristics. . . . . . . . . . . . . . . . . . 18
13 Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . 19
14 Application information. . . . . . . . . . . . . . . . . . 20
15 Package outline . . . . . . . . . . . . . . . . . . . . . . . . 21
16 Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . 22
17 Revision history . . . . . . . . . . . . . . . . . . . . . . . . 23
18 Data sheet status . . . . . . . . . . . . . . . . . . . . . . . 24
19 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
20 Disclaimers. . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
21 Licenses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
22 Contact information . . . . . . . . . . . . . . . . . . . . 24

9397 750 XXXXX © Koninklijke Philips Electronics N.V. 2006. All rights reserved.

Short form data sheet Rev. 1.2 — 31 March 2011 25 of 25


ANEXO 14. DATASHEET DEL EASYVR
EasyVR
Datasheet
Release 2.0

www.veear.eu
www.veear.eu

Product Description
EasyVR is the second generation version of the successful VRbot Module. It is a multi-purpose speech
recognition module designed to easily add versatile, robust and cost effective speech recognition capabilities
to virtually any application.
The EasyVR module can be used with any host with an UART interface powered at 3.3V – 5V, such as PIC
and Arduino boards. Some application examples include home automation, such as voice controlled light
switches, locks or beds, or adding “hearing” to robots such as ROBONOVA-I and POP Bot.

EasyVR features
 A host of built-in speaker independent (SI) commands for ready to run basic controls
 Supports up to 32 user-defined Speaker Dependent (SD) triggers or commands as well as Voice
Passwords. SD custom commands can be spoken in ANY language.
 Easy-to-use and simple Graphical User Interface to program Voice Commands
 Languages currently supported for SI commands: English U.S., Italian, Japanese, German, Spanish
and French. More languages could be available in future.
 Module can be used with any host with an UART interface (powered at 3.3V - 5V)
 Simple and robust documented serial protocol to access and program through the host board

New features on EasyVR


 Two new SI languages: Spanish and French
 3 GPIO lines (IO1, IO2, IO3) that can be controlled by new protocol commands
 (Note: the GPIO are at nominal 3.0VDC level. do not connect 5VDC to these pins!)
 Audio output that supports 8 ohm speakers
 Firmware update capability with two additional lines (/XM, /RST)
 Sound playback feature:
o You can make your own sound tables using Sensory QuickSynthesis4 tool
o The new EasyVR GUI includes a command to process and download custom sound tables
to the module (overwriting existing sound table)
o NOTE: default firmware has no sound table, but can Beep using sound index 0 – always
available. Custom sounds start at index 1.
o The VoiceGP DevBoard (available separately) is required for programming the EasyVR
flash.

Datasheet (2.0) EasyVR 3


www.veear.eu

Technical specifications

Physical dimensions and pin assignment

Connector Number Name Type Description

1 GND - Ground

2 VCC I Voltage DC input


J1
3 ERX I Serial Port Receive Data (TTL level)

4 ETX O Serial Port Transmit Data (TTL level)


Differential audio output (can directly drive 8Ω
J2 1-2 PWM O
speaker)
J3 1-2 MIC I Microphone input

1 /RST I Reset

2 /XM I Reserved – leave unconnected

J4 3 IO1 I/O General purpose I/O (3.0 VDC TTL level)

4 IO2 I/O General purpose I/O (3.0 VDC TTL level)

5 IO3 I/O General purpose I/O (3.0 VDC TTL level)

Note: the GPIO (J4.3/4/5) are at nominal 3.0VDC level. Do not connect 5VDC to these pins!

4 EasyVR Datasheet (2.0)


www.veear.eu

Recommended Operating Conditions

Symbol Parameter Min Typ Max Unit


VCC Voltage DC Input 3.3 5.0 5.5 V
Ta Ambient Operating Temperature Range 0 25 70 °C
ERX Serial Port Receive Data 0 - VCC V
ETX Serial Port Transmit Data 0 - VCC V

Power Supply Requirements

Symbol Parameter Min Typ Max Unit


ISleep Sleep current <1 mA
IOper Operating current 12 mA
ISpeaker Audio playback current (with 8ohm speaker) 180 mA

Communications

Adjustable Asynchronous Serial Communication:


 Baud Rate: 9600 (default), 19200, 38700, 57600, 115200
 8 Data bits
 No parity
 1 Stop bit

Datasheet (2.0) EasyVR 5


ANEXO 15. DATASHEET HITEC HS-311
ANEXO 16. MÓDULO DE RADIOFRECUENCIA
RB-Ite-108
433 Mhz RF Link Kit

The 433MHz RF link kit is consisted of transmitter and receiver, popularly used for remote control.

Features
• Frequency: 433Mhz
• Modulation: ASK
• Receiver Data Output: High - 1/2 Vcc, Low - 0.7v
• Transmitor Input Voltage: 3-12V (high voltage = more transmitting power)

Usage

The popular link is like this: MCU -> Encoder -> Transmitter ------ Receiver -> Decoder -> MCU

Encoder and Decoder are optional, their existence is to


ANEXO 17. DATASHEET DEL INTEGRADO HT12E
HT12A/HT12E
212 Series of Encoders
Features
· Operating voltage · Minimum transmission word
- 2.4V~5V for the HT12A - Four words for the HT12E
- 2.4V~12V for the HT12E - One word for the HT12A
· Low power and high noise immunity CMOS · Built-in oscillator needs only 5% resistor
technology · Data code has positive polarity
· Low standby current: 0.1mA (typ.) at VDD=5V · Minimal external components
· HT12A with a 38kHz carrier for infrared transmission · Pair with Holtek¢s 212 series of decoders
medium · 18-pin DIP, 20-pin SOP package

Applications
· Burglar alarm system · Car alarm system
· Smoke and fire alarm system · Security system
· Garage door controllers · Cordless telephones
· Car door controllers · Other remote control systems

General Description
12
The 2 encoders are a series of CMOS LSIs for remote bits via an RF or an infrared transmission medium upon
control system applications. They are capable of encod- receipt of a trigger signal. The capability to select a TE
ing information which consists of N address bits and trigger on the HT12E or a DATA trigger on the HT12A
12-N data bits. Each address/data input can be set to further enhances the application flexibility of the 212 se-
one of the two logic states. The programmed ad- ries of encoders. The HT12A additionally provides a
dresses/data are transmitted together with the header 38kHz carrier for infrared systems.

Selection Table
Function Address Address/ Carrier Negative
Data No. Oscillator Trigger Package
Part No. No. Data No. Output Polarity

455kHz
HT12A 8 0 4 D8~D11 38kHz No 18DIP, 20SOP
resonator
RC
HT12E 8 4 0 TE No No 18DIP, 20SOP
oscillator

Note: Address/Data represents pins that can be either address or data according to the application requirement.

Rev. 1.20 1 February 20, 2009


HT12A/HT12E

Block Diagram
TE Trigger
HT12E

O S C 2 O S C 1

O s c illa to r ¸ 3 D iv id e r D a ta S e le c t D O U T
T E
& B u ffe r

¸ 1 2 C o u n te r & S y n c .
A 0
1 o f 1 2 D e c o d e r C ir c u it
1 2 T r a n s m is s io n
G a te C ir c u it
A 7 B in a r y D e te c to r

A D 8 A D 1 1 V D D V S S

DATA Trigger
HT12A
X 2 X 1

O s c illa to r ¸ 5 7 6 D iv id e r D a ta S e le c t D O U T
& B u ffe r
L /M B

¸ 1 2 C o u n te r & S y n c .
A 0
1 o f 1 2 D e c o d e r C ir c u it
1 2 T r a n s m is s io n
G a te C ir c u it
A 7
B in a r y D e te c to r

D 8 D 1 1 V D D V S S

Note: The address data pins are available in various combinations (refer to the address/data table).

Pin Assignment

8 -A d d re s s 8 -A d d re s s 8 -A d d re s s 8 -A d d re s s
4 -D a ta 4 -D a ta 4 -A d d r e s s /D a ta 4 -A d d r e s s /D a ta

N C 1 2 0 N C N C 1 2 0 N C
A 0 1 1 8 V D D A 0 2 1 9 V D D A 0 1 1 8 V D D A 0 2 1 9 V D D
A 1 2 1 7 D O U T A 1 3 1 8 D O U T A 1 2 1 7 D O U T A 1 3 1 8 D O U T
A 2 3 1 6 X 1 A 2 4 1 7 X 1 A 2 3 1 6 O S C 1 A 2 4 1 7 O S C 1
A 3 4 1 5 X 2 A 3 5 1 6 X 2 A 3 4 1 5 O S C 2 A 3 5 1 6 O S C 2
A 4 5 1 4 L /M A 4 6 1 5 L /M A 4 5 1 4 T E A 4 6 1 5 T E
A 5 6 1 3 D 1 1 A 5 7 1 4 D 1 1 A 5 6 1 3 A D 1 1 A 5 7 1 4 A D 1 1
A 6 7 1 2 D 1 0 A 6 8 1 3 D 1 0 A 6 7 1 2 A D 1 0 A 6 8 1 3 A D 1 0
A 7 8 1 1 D 9 A 7 9 1 2 D 9 A 7 8 1 1 A D 9 A 7 9 1 2 A D 9
V S S 9 1 0 D 8 V S S 1 0 1 1 D 8 V S S 9 1 0 A D 8 V S S 1 0 1 1 A D 8

H T 1 2 A H T 1 2 A H T 1 2 E H T 1 2 E
1 8 D IP -A 2 0 S O P -A 1 8 D IP -A 2 0 S O P -A

Rev. 1.20 2 February 20, 2009


HT12A/HT12E

Pin Description
Internal
Pin Name I/O Description
Connection
CMOS IN Pull-high Input pins for address A0~A7 setting
A0~A7 I
(HT12A) These pins can be externally set to VSS or left open

NMOS TRANSMISSION
GATE PROTECTION
DIODE (HT12E)
NMOS TRANSMISSION
Input pins for address/data AD8~AD11 setting
AD8~AD11 I GATE PROTECTION
These pins can be externally set to VSS or left open
DIODE (HT12E)
Input pins for data D8~D11 setting and transmission enable, active
D8~D11 I CMOS IN Pull-high low
These pins should be externally set to VSS or left open (see Note)
DOUT O CMOS OUT Encoder data serial transmission output
Latch/Momentary transmission format selection pin:
L/M I CMOS IN Pull-high Latch: Floating or VDD
Momentary: VSS
TE I CMOS IN Pull-high Transmission enable, active low (see Note)
OSC1 I OSCILLATOR 1 Oscillator input pin
OSC2 O OSCILLATOR 1 Oscillator output pin
X1 I OSCILLATOR 2 455kHz resonator oscillator input
X2 O OSCILLATOR 2 455kHz resonator oscillator output
VSS I ¾ Negative power supply, ground

VDD I ¾ Positive power supply

Note: D8~D11 are all data input and transmission enable pins of the HT12A.
TE is a transmission enable pin of the HT12E.

Approximate Internal Connections

N M O S C M O S IN
T R A N S M IS S IO N C M O S O U T O S C IL L A T O R 1
P u ll- h ig h
G A T E
E N O S C 2
O S C 1

O S C IL L A T O R 2 N M O S T R A N S M IS S IO N G A T E
P R O T E C T IO N D IO D E

X 1 X 2

V D D

Rev. 1.20 3 February 20, 2009


HT12A/HT12E

Absolute Maximum Ratings


Supply Voltage (HT12A) ............VSS-0.3V to VSS+5.5V Supply Voltage (HT12E) ...........................-0.3V to 13V
Input Voltage ................................VSS-0.3 to VDD+0.3V Storage Temperature ............................-50°C to 125°C
Operating Temperature ...........................-20°C to 75°C

Note: These are stress ratings only. Stresses exceeding the range specified under ²Absolute Maximum Ratings² may
cause substantial damage to the device. Functional operation of this device at other conditions beyond those
listed in the specification is not implied and prolonged exposure to extreme conditions may affect device reliabil-
ity.

Electrical Characteristics
HT12A Ta=25°C

Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
VDD Operating Voltage ¾ ¾ 2.4 3 5 V

3V ¾ 0.1 1 mA
ISTB Standby Current Oscillator stops
5V ¾ 0.1 1 mA
3V No load ¾ 200 400 mA
IDD Operating Current
fOSC=455kHz
5V ¾ 400 800 mA
VOH=0.9VDD (Source) -1 -1.6 ¾ mA
IDOUT Output Drive Current 5V
VOL=0.1VDD (Sink) 2 3.2 ¾ mA
VIH ²H² Input Voltage ¾ ¾ 0.8VDD ¾ VDD V
VIL ²L² Input Voltage ¾ ¾ 0 ¾ 0.2VDD V
D8~D11 Pull-high
RDATA 5V VDATA=0V ¾ 150 300 kW
Resistance

HT12E Ta=25°C

Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
VDD Operating Voltage ¾ ¾ 2.4 5 12 V

3V ¾ 0.1 1 mA
ISTB Standby Current Oscillator stops
12V ¾ 2 4 mA
3V ¾ 40 80 mA
IDD Operating Current No load, fOSC=3kHz
12V ¾ 150 300 mA
VOH=0.9VDD (Source) -1 -1.6 ¾ mA
IDOUT Output Drive Current 5V
VOL=0.1VDD (Sink) 1 1.6 ¾ mA
VIH ²H² Input Voltage ¾ ¾ 0.8VDD ¾ VDD V
VIL ²L² Input Voltage ¾ ¾ 0 ¾ 0.2VDD V
fOSC Oscillator Frequency 5V ROSC=1.1MW ¾ 3 ¾ kHz
RTE TE Pull-high Resistance 5V VTE=0V ¾ 1.5 3 MW

Rev. 1.20 4 February 20, 2009


HT12A/HT12E

Functional Description
Operation
The 212 series of encoders begin a 4-word transmission cycle upon receipt of a transmission enable (TE for the HT12E
or D8~D11 for the HT12A, active low). This cycle will repeat itself as long as the transmission enable (TE or D8~D11) is
held low. Once the transmission enable returns high the encoder output completes its final cycle and then stops as
shown below.

T E
< 1 w o rd
E n c o d e r
D O U T
4 w o rd s T r a n s m itte d 4 w o rd s
C o n tin u o u s ly

Transmission timing for the HT12E

D 8 ~ D 1 1
K e y - in
< 1 w o rd
E n c o d e r
D O U T w ith 3 8 k H z c a r r ie r

1 w o rd T r a n s m itte d 1 w o rd
C o n tin u o u s ly

Transmission timing for the HT12A (L/M=Floating or VDD)

D 8 ~ D 1 1
K e y - in ( a ll d a ta = 1 )
< 1 w o rd 7 w o rd s
E n c o d e r
D O U T
7 w o rd s T r a n s m itte d 1 w o rd
C o n tin u o u s ly
1 w o rd ( a ll d a ta = 1 )

Transmission timing for the HT12A (L/M=VSS)

Information Word
If L/M=1 the device is in the latch mode (for use with the latch type of data decoders). When the transmission enable is re-
moved during a transmission, the DOUT pin outputs a complete word and then stops. On the other hand, if L/M=0 the de-
vice is in the momentary mode (for use with the momentary type of data decoders). When the transmission enable is
removed during a transmission, the DOUT outputs a complete word and then adds 7 words all with the ²1² data code.
An information word consists of 4 periods as illustrated below.

1 /3 b it s y n c . p e r io d

p ilo t p e r io d ( 1 2 b its ) a d d r e s s c o d e p e r io d d a ta c o d e
p e r io d

Composition of information

Rev. 1.20 5 February 20, 2009


HT12A/HT12E

Address/Data Waveform
Each programmable address/data pin can be externally set to one of the following two logic states as shown below.

fO S C

"O n e "

"Z e ro "
A d d re s s /
D a ta B it

Address/Data bit waveform for the HT12E

fO S C

3 8 k H z
"O n e " c a r r ie r
D a ta B it
"Z e ro "
D a ta B it

"O n e "
A d d r e s s B it
"Z e ro "
A d d r e s s B it

Address/Data bit waveform for the HT12A

The address/data bits of the HT12A are transmitted with a 38kHz carrier for infrared remote controller flexibility.

Address/Data Programming (Preset)


The status of each address/data pin can be individually pre-set to logic ²high² or ²low². If a transmission-enable signal
is applied, the encoder scans and transmits the status of the 12 bits of address/data serially in the order A0 to AD11 for
the HT12E encoder and A0 to D11 for the HT12A encoder.
During information transmission these bits are transmitted with a preceding synchronization bit. If the trigger signal is
not applied, the chip enters the standby mode and consumes a reduced current of less than 1mA for a supply voltage of
5V.
Usual applications preset the address pins with individual security codes using DIP switches or PCB wiring, while the
data is selected by push buttons or electronic switches.
The following figure shows an application using the HT12E:

O S C 1 O S C 2
T r a n s m is s io n
D O U T m e d iu m
V D D A 0 A 1 A 2 A 3 A 4 A 5 A 6 A 7 V S S T E A D 8 A D 9 A D 1 0 A D 1 1

V D D

V S S

Rev. 1.20 6 February 20, 2009


HT12A/HT12E

The transmitted information is as shown:


Pilot A0 A1 A2 A3 A4 A5 A6 A7 AD8 AD9 AD10 AD11
&
Sync. 1 0 1 0 0 0 1 1 1 1 1 0

Address/Data Sequence
The following provides the address/data sequence table for various models of the 212 series of encoders.
Address/Data Bits
Part No.
0 1 2 3 4 5 6 7 8 9 10 11
HT12A A0 A1 A2 A3 A4 A5 A6 A7 D8 D9 D10 D11
HT12E A0 A1 A2 A3 A4 A5 A6 A7 AD8 AD9 AD10 AD11

Transmission Enable
For the HT12E encoders, transmission is enabled by applying a low signal to the TE pin. For the HT12A encoders,
transmission is enabled by applying a low signal to one of the data pins D8~D11.

Two Erroneous HT12E Application Circuits


The HT12E must follow closely the application circuits provided by Holtek (see the ²Application circuits²).
· Error: AD8~AD11 pins input voltage > VDD+0.3V

O S C 2 V D D

O S C 1 A D 1 1

T E A D 1 0
A D 9
V S S
A D 8
1 2 V

H T 1 2 E

· Error: The IC¢s power source is activated by pins AD8~AD11

1 2 V

O S C 2 V D D

O S C 1 A D 1 1

T E A D 1 0
A D 9
V S S
A D 8

H T 1 2 E

Rev. 1.20 7 February 20, 2009


HT12A/HT12E

Flowchart
· HT12A · HT12E

P o w e r o n P o w e r o n

S ta n d b y m o d e S ta n d b y m o d e

N o D a ta e n a b le ? N o T r a n s m is s io n
e n a b le d ?

Y e s Y e s

D a ta w ith c a r r ie r 4 d a ta w o rd s
s e r ia l o u tp u t tr a n s m itte d

Y e s N o T r a n s m is s io n
D a ta s till e n a b le d ?
s till e n a b le d
N o Y e s

Y e s 4 d a ta w o rd s
L /M B = G N D ? tr a n s m itte d
c o n tin u o u s ly
N o
S e n d th e S e n d ² 1 ² 7 tim e s fo r
la s t c o d e a ll o f th e d a ta c o d e s

Note: D8~D11 are transmission enables of the HT12A.


TE is the transmission enable of the HT12E.

Rev. 1.20 8 February 20, 2009


HT12A/HT12E

Oscillator Frequency vs. Supply Voltage

fO S C
(S c a le )
R O S C (W )
7 .0 0
4 7 0 k

5 1 0 k
6 .0 0
5 6 0 k

6 2 0 k
5 .0 0
6 8 0 k
7 5 0 k
4 .0 0 8 2 0 k

9 1 0 k
1 .0 M
(3 k H z )3 .0 0
1 .2 M

1 .5 M
2 .0 0
2 .0 M

1 .0 0

2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 V D D (V D C )

The recommended oscillator frequency is fOSCD (decoder) @ 50 fOSCE (HT12E encoder)


1
@ fOSCE (HT12A encoder)
3

Application Circuits

V D D 1 0 0 W
T r a n s m itte r C ir c u it

V D D
1 A 0 V D D 1 8
8 0 5 0 1 A 0 V D D 1 8
2 1 7 1 0 k W
A 1 D O U T 2 1 7
A 1 D O U T
3 1 6 4 5 5 K
A 2 X 1 1 0 0 p F 3 1 6
A 2 O S C 1
1 0 M W R O S C
4 1 5 4 A 3 O S C 2 1 5
A 3 X 2 1 0 0 p F
5 1 4 5 A 4 T E 1 4
A 4 L /M B
6 1 3 6 A 5 A D 1 1 1 3
A 5 D 1 1
7 1 2 7 A 6 A D 1 0 1 2
A 6 D 1 0
8 1 1 8 A 7 A D 9 1 1
A 7 D 9
9 1 0 9 1 0
V S S D 8 V S S A D 8

H T 1 2 A H T 1 2 E

Rev. 1.20 9 February 20, 2009


ANEXO 18. DATASHEET DEL INTEGRADO HT12D
HT12D/HT12F
212 Series of Decoders
Features
· Operating voltage: 2.4V~12V · Built-in oscillator needs only 5% resistor
· Low power and high noise immunity CMOS · Valid transmission indicator
technology · Easy interface with an RF or an infrared transmission
· Low standby current medium
· Capable of decoding 12 bits of information · Minimal external components
· Binary address setting · Pair with Holtek¢s 212 series of encoders
· Received codes are checked 3 times · 18-pin DIP, 20-pin SOP package
· Address/Data number combination
- HT12D: 8 address bits and 4 data bits
- HT12F: 12 address bits only

Applications
· Burglar alarm system · Car alarm system
· Smoke and fire alarm system · Security system
· Garage door controllers · Cordless telephones
· Car door controllers · Other remote control systems

General Description
The 212 decoders are a series of CMOS LSIs for remote ously with their local addresses. If no error or un-
control system applications. They are paired with matched codes are found, the input data codes are
Holtek¢s 212 series of encoders (refer to the encoder/de- decoded and then transferred to the output pins. The VT
coder cross reference table). For proper operation, a pin also goes high to indicate a valid transmission.
pair of encoder/decoder with the same number of ad- The 212 series of decoders are capable of decoding
dresses and data format should be chosen. informations that consist of N bits of address and 12-N
The decoders receive serial addresses and data from a bits of data. Of this series, the HT12D is arranged to pro-
programmed 212 series of encoders that are transmitted vide 8 address bits and 4 data bits, and HT12F is used to
by a carrier using an RF or an IR transmission medium. decode 12 bits of address information.
They compare the serial input data three times continu-

Selection Table
Function Address Data
VT Oscillator Trigger Package
Part No. No. No. Type
HT12D 8 4 L Ö RC oscillator DIN active ²Hi² 18DIP, 20SOP
HT12F 12 0 ¾ Ö RC oscillator DIN active ²Hi² 18DIP, 20SOP

Notes: Data type: L stands for latch type data output.


VT can be used as a momentary data output.

Rev. 1.20 1 February 20, 2009


HT12D/HT12F

Block Diagram

O S C 2 O S C 1

O s c illa to r D iv id e r
D a ta S h ift D a ta
L a tc h C ir c u it
R e g is te r

D IN B u ffe r D a ta D e te c to r

S y n c . D e te c to r C o m p a ra to r C o m p a ra to r C o n tr o l L o g ic

T r a n s m is s io n G a te C ir c u it B u ffe r V T

A d d re s s V D D V S S

Note: The address/data pins are available in various combinations (see the address/data table).

Pin Assignment
8 -A d d re s s 8 -A d d re s s 1 2 -A d d re s s 1 2 -A d d re s s
4 -D a ta 4 -D a ta 0 -D a ta 0 -D a ta
N C 1 2 0 N C N C 1 2 0 N C
A 0 1 1 8 V D D A 0 2 1 9 V D D A 0 1 1 8 V D D A 0 2 1 9 V D D
A 1 2 1 7 V T A 1 3 1 8 V T A 1 2 1 7 V T A 1 3 1 8 V T
A 2 3 1 6 O S C 1 A 2 4 1 7 O S C 1 A 2 3 1 6 O S C 1 A 2 4 1 7 O S C 1
A 3 4 1 5 O S C 2 A 3 5 1 6 O S C 2 A 3 4 1 5 O S C 2 A 3 5 1 6 O S C 2
A 4 5 1 4 D IN A 4 6 1 5 D IN A 4 5 1 4 D IN A 4 6 1 5 D IN
A 5 6 1 3 D 1 1 A 5 7 1 4 D 1 1 A 5 6 1 3 A 1 1 A 5 7 1 4 A 1 1
A 6 7 1 2 D 1 0 A 6 8 1 3 D 1 0 A 6 7 1 2 A 1 0 A 6 8 1 3 A 1 0
A 7 8 1 1 D 9 A 7 9 1 2 D 9 A 7 8 1 1 A 9 A 7 9 1 2 A 9
V S S 9 1 0 D 8 V S S 1 0 1 1 D 8 V S S 9 1 0 A 8 V S S 1 0 1 1 A 8

H T 1 2 D H T 1 2 D H T 1 2 F H T 1 2 F
1 8 D IP -A 2 0 S O P -A 1 8 D IP -A 2 0 S O P -A

Pin Description
Internal
Pin Name I/O Description
Connection
Input pins for address A0~A11 setting
A0~A11 (HT12F)
NMOS These pins can be externally set to VSS or left open.
I
Transmission Gate Input pins for address A0~A7 setting
A0~A7 (HT12D)
These pins can be externally set to VSS or left open.
D8~D11 (HT12D) O CMOS OUT Output data pins, power-on state is low.
DIN I CMOS IN Serial data input pin
VT O CMOS OUT Valid transmission, active high
OSC1 I Oscillator Oscillator input pin
OSC2 O Oscillator Oscillator output pin
VSS ¾ ¾ Negative power supply, ground

VDD ¾ ¾ Positive power supply

Rev. 1.20 2 February 20, 2009


HT12D/HT12F

Approximate internal connection circuits

N M O S
T r a n s m is s io n G a te C M O S O U T C M O S IN O s c illa to r

E N
O S C 2
O S C 1

Absolute Maximum Ratings


Supply Voltage ..........................................-0.3V to 13V Storage Temperature ............................-50°C to 125°C
Input Voltage ................................VSS-0.3 to VDD+0.3V Operating Temperature...........................-20°C to 75°C

Note: These are stress ratings only. Stresses exceeding the range specified under ²Absolute Maximum Ratings² may
cause substantial damage to the device. Functional operation of this device at other conditions beyond those
listed in the specification is not implied and prolonged exposure to extreme conditions may affect device reliabil-
ity.

Electrical Characteristics Ta=25°C

Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
VDD Operating Voltage ¾ ¾ 2.4 5 12 V

5V ¾ 0.1 1 mA
ISTB Standby Current Oscillator stops
12V ¾ 2 4 mA
IDD Operating Current 5V No load, fOSC=150kHz ¾ 200 400 mA
Data Output Source Current (D8~D11) 5V VOH=4.5V -1 -1.6 ¾ mA
IO
Data Output Sink Current (D8~D11) 5V VOL=0.5V 1 1.6 ¾ mA

VT Output Source Current VOH=4.5V -1 -1.6 ¾ mA


IVT 5V
VT Output Sink Current VOL=0.5V 1 1.6 ¾ mA
VIH ²H² Input Voltage 5V ¾ 3.5 ¾ 5 V
VIL ²L² Input Voltage 5V ¾ 0 ¾ 1 V
fOSC Oscillator Frequency 5V ROSC=51kW ¾ 150 ¾ kHz

Rev. 1.20 3 February 20, 2009


HT12D/HT12F

Functional Description
Operation Flowchart
The 212 series of decoders provides various combina- The oscillator is disabled in the standby state and acti-
tions of addresses and data pins in different packages vated when a logic ²high² signal applies to the DIN pin.
so as to pair with the 212 series of encoders. That is to say, the DIN should be kept low if there is no
The decoders receive data that are transmitted by an signal input.
encoder and interpret the first N bits of code period as
P o w e r o n
addresses and the last 12-N bits as data, where N is the
address code number. A signal on the DIN pin activates
the oscillator which in turn decodes the incoming ad- S ta n d b y m o d e
dress and data. The decoders will then check the re-
ceived address three times continuously. If the received
N o D is a b le V T &
address codes all match the contents of the decoder¢s C o d e in ? ig n o r e th e r e s t o f
th is w o r d
local address, the 12-N bits of data are decoded to acti-
vate the output pins and the VT pin is set high to indicate Y e s
a valid transmission. This will last unless the address
code is incorrect or no signal is received. A d d r e s s b its N o
m a tc h e d ?
The output of the VT pin is high only when the transmis-
sion is valid. Otherwise it is always low. Y e s

Output Type S to re d a ta
12
Of the 2 series of decoders, the HT12F has no data
output pin but its VT pin can be used as a momentary M a tc h N o
p r e v io u s s to r e d
data output. The HT12D, on the other hand, provides 4 d a ta ?
latch type data pins whose data remain unchanged until
Y e s
new data are received.

Part Data Address Output Operating N o 3 tim e s


o f c h e c k in g
No. Pins Pins Type Voltage c o m p le te d ?

HT12D 4 8 Latch 2.4V~12V Y e s

HT12F 0 12 ¾ 2.4V~12V L a tc h d a ta
to o u tp u t &
a c tiv a te V T

N o A d d re s s o r
d a ta e rro r ?

Y e s

Decoder Timing

E n c o d e r
T r a n s m is s io n
E n a b le
< 1 w o rd
E n c o d e r
D O U T
4 w o rd s T r a n s m itte d 4 w o rd s
1 4
C o n tin u o u s ly 1 4
2 c lo c k s 2 c lo c k s

D e c o d e r V T

c h e c k c h e c k

L a tc h e d
D a ta O u t

Rev. 1.20 4 February 20, 2009


HT12D/HT12F

Encoder/Decoder Cross Reference Table


Package
Decoders
Data Pins Address Pins VT Pair Encoder Encoder Decoder
Part No.
DIP SOP DIP SOP
HT12A
HT12D 4 8 Ö 18 20 18 20
HT12E
HT12A
HT12F 0 12 Ö 18 20 18 20
HT12E

Address/Data Sequence
The following table provides address/data sequence for various models of the 212 series of decoders.
Address/Data Bits
Part No.
0 1 2 3 4 5 6 7 8 9 10 11
HT12D A0 A1 A2 A3 A4 A5 A6 A7 D8 D9 D10 D11
HT12F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11

Oscillator Frequency Vs Supply Voltage

fo s c
(S c a le )
R o s c (9 )
4 .0 0

2 7 k 9
3 .5 0
3 0 k 9

3 3 k 9
3 .0 0
3 6 k 9

3 9 k 9

4 3 k 9
2 .5 0
4 7 k 9

5 1 k 9
2 .0 0 5 6 k 9
6 2 k 9
6 8 k 9
7 5 k 9
1 .5 0 8 2 k 9

1 0 0 k 9

1 2 0 k 9
(1 0 0 k H z )1 .0 0
1 5 0 k 9
1 8 0 k 9
2 2 0 k 9
0 .5 0

0 .2 5

2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 V D D (V D C )

Note: The recommended oscillator frequency is fOSCD (decoder) @ 50 fOSCE (HT12E encoder)
1
@ fOSCE (HT12A encoder).
3

Rev. 1.20 5 February 20, 2009


HT12D/HT12F

Application Circuits

R e c e iv e r C ir c u it R e c e iv e r C ir c u it

V D D
1 1 8 V D D 1 1 8
A 0 V D D A 0 V D D
2 1 7 2 1 7
A 1 V T A 1 V T
3 1 6 3 1 6
A 2 O S C 1 A 2 O S C 1
4 1 5 R O S C 4 1 5 R O S C
A 3 O S C 2 A 3 O S C 2
5 1 4 5 1 4
A 4 D IN A 4 D IN
6 1 3 6 1 3
A 5 D 1 1 A 5 A 1 1
7 1 2 7 1 2
A 6 D 1 0 A 6 A 1 0
8 1 1 8 1 1
A 7 D 9 A 7 A 9
9 1 0 9 1 0
V S S D 8 V S S A 8

H T 1 2 D H T 1 2 F

Rev. 1.20 6 February 20, 2009


ANEXO 19. DATASHEET WS2812B
WS2812
Intelligent control LED
integrated light source

Features and Benefits


l Control circuit and RGB chip are integrated in a package of 5050 components, form a complete control of pixel
point.
l Built-in signal reshaping circuit, after wave reshaping to the next driver, ensure wave-form distortion not
accumulate.
l Built-in electric reset circuit and power lost reset circuit.
l Each pixel of the three primary color can achieve 256 brightness display, completed 16777216 color full color
display, and scan frequency not less than 400Hz/s.
l Cascading port transmission signal by single line.
l Any two point the distance more than 5m transmission signal without any increase circuit.
l When the refresh rate is 30fps, low speed model cascade number are not less than 512 points, high speed mode not
less than1024 points.
l Send data at speeds of 800Kbps.
l The color of the light were highly consistent, cost-effective..
Applications
l Full-color module, Full color soft lights a lamp strip.
l LED decorative lighting, Indoor/outdoor LED video irregular screen.
General description
WS2812 is a intelligent control LED light source that the control circuit and RGB chip are integrated in
a package of 5050 components. It internal include intelligent digital port data latch and signal reshaping amplif
ication drive circuit. Also include a precision internal oscillator and a 12V voltage programmable constant curre
-nt control part, effectively ensuring the pixel point light color height consistent.
The data transfer protocol use single NZR communication mode. After the pixel power-on reset, the DIN
port receive data from controller, the first pixel collect initial 24bit data then sent to the internal data latch,
the other data which reshaping by the internal signal reshaping amplification circuit sent to the next cascade
pixel through the DO port. After transmission for each pixel,the signal to reduce 24bit. pixel adopt auto resha
-ping transmit technology, making the pixel cascade number is not limited the signal transmission, only depend
on the speed of signal transmission.
LED with low driving voltage, environmental protection and energy saving, high brightness, scattering angl
e is large, good consistency, low power, long life and other advantages. The control chip integrated in LED
above becoming more simple circuit, small volume, convenient installation.

http://www.world-semi.com
WS2812
Intelligent control LED
integrated light source

Mechanical Dimensions

PIN configuration

PIN function
NO. Symbol Function description
1 DOUT Control data signal output
2 DIN Control data signal input
3 VCC Power supply control circuit
4 NC
5 VDD Power supply LED
6 VSS Ground

Absolute Maximum Ratings

http://www.world-semi.com
WS2812
Intelligent control LED
integrated light source

Prameter Symbol Ratings Unit


Power supply voltage VCC +6.0~+7.0 V
Power supply voltage VDD +6.0~+7.0 V
Input voltage VI -0.5~VDD+0.5 V
Operation junction
Topt -25~+80 ℃
temperature
Storage temperature range Tstg -55~+150 ℃

Electrical Characteristics(TA=-20~+70℃,VDD=4.5~5.5V,VSS=0V,unless otherwise specified)


Prameter Smybol conditions Min Tpy Max Unit
Low voltage output IOL ROUT —— 18.5 —— mA
current Idout Vo=0.4V,DOUT 10 —— —— mA

Input current II VI=VDD/VSS —— —— ±1 µA

VIH DIN,SET 0.7VDD —— —— V


Input voltage level
VIL DIN,SET —— —— 0.3 VDD V

Hysteresis voltage VH DIN,SET —— 0.35 —— V

Switching characteristics(TA=-20~+70℃,VDD=4.5~5.5V,VSS=0V,unless otherwise specified)


Prameter Symbol Condition Min Tpy Max Unit
Operation frequency Fosc2 —— —— 800 —— KHz

Transmission delay CL=15pF,DIN→


tPLZ —— —— 300 ns
time DOUT,RL=10KΩ

CL=300pF,OUTR/OU
Fall time tTHZ —— —— 120 µs
TG/OUTB
Data transmission
FMAX Duty ratio50% 400 —— —— Kbps
rate
Input capcity CI —— —— —— 15 pF

http://www.world-semi.com
WS2812
Intelligent control LED
integrated light source

LED characteristic parameter

Emitting color Wavelength(nm) Luminous intensity(mcd) Current(mA) Voltage(V)

Red 620-630 550-700 20 1.8-2.2


Green 515-530 1100-1400 20 3.0-3.2
Blue 465-475 200-400 20 3.2-3.4

Data transfer time( TH+TL=1.25µs±600ns)


T0H 0 code ,high voltage time 0.35us ±150ns

T1H 1 code ,high voltage time 0.7us ±150ns

T0L 0 code , low voltage time 0.8us ±150ns

T1L 1 code ,low voltage time 0.6us ±150ns

RES low voltage time Above 50µs

Sequence chart:
T0L
0 code
T0 H

T1L
1 co de
T1H

Treset
RET co de

Cascade method:

D1 D2 D3 D4
DIN DO DIN DO DIN DO

PIX1 PIX2 PIX3

http://www.world-semi.com
WS2812
Intelligent control LED
integrated light source

Data transmission method:

reset code
>=50us reset
code

Data refresh cycle 1 Data refresh cycle 2


seco n d seco n d
first 2 4 b it first 2 4 b it th ird 2 4 b it
D1 2 4 b it th ird 2 4 b it 2 4 b it

seco n d seco n d
th ird 2 4 b it th ird 2 4 b it
D2 2 4 b it 2 4 b it

th ird 2 4 b it th ird 2 4 b it
D3

D4

Note: The data of D1 is send by MCU,and D2, D3, D4 through pixel internal reshaping amplification to
transmit.
Composition of 24bit data:
G7 G6 G5 G4 G3 G2 G1 G0 R7 R6 R5 R4 R3 R2 R1 R0 B7 B6 B5 B4 B3 B2 B1 B0

Note: Follow the order of GRB to sent data and the high bit sent at first.
Typical application circuit:

http://www.world-semi.com

También podría gustarte