Beruflich Dokumente
Kultur Dokumente
Director:
PH.D, MSC. Roberto Ferro Escobar
FACULTAD INGENIERA
1
TABLA DE CONTENIDO
1. INTRODUCCIN ................................................................................................. 1
2. ANTECEDENTES ................................................................................................ 3
3. JUSTIFICACIN .................................................................................................. 4
3.1. Justificacin tcnica ............................................................................................. 4
3.2. Justificacin acadmica ....................................................................................... 4
3.3. Justificacin social ............................................................................................... 5
4. OBJETIVO GENERAL ......................................................................................... 6
4.1. Objetivos especficos ........................................................................................... 6
5. PLANTEAMIENTO DEL PROBLEMA .................................................................. 7
6. ALCANCE ............................................................................................................ 8
7. LIMITACIONES ................................................................................................... 9
8. MARCO TERICO CONCEPTUAL ................................................................... 10
8.1. Seleccin de los Sensores ................................................................................. 10
8.1.1. Termmetro digital ............................................................................................. 10
8.1.1.1. Secuencia de transmisin .................................................................................. 13
8.1.2. Sensor de luz ..................................................................................................... 14
8.1.2.1. Principios de operacin del sensor de luz .......................................................... 17
8.1.3. Sensor magntico reed witch ............................................................................. 17
8.1.4. Comunicacin local de los sensores .................................................................. 18
8.2. Mdulo de comunicacin inalmbrica entre sensores ........................................ 21
8.2.1. Mdulo inalmbrico WIFI232 ............................................................................. 22
8.2.1.1. Modo de trabajo ................................................................................................. 25
8.2.1.2. Red inalmbrica ................................................................................................. 25
8.2.1.3. Encriptacin de la informacin inalmbrica ........................................................ 26
8.2.1.4. Configuracin del mdulo inalmbrico ............................................................... 27
8.2.1.5. Acceso a la interfaz web del punto de acceso.................................................... 27
8.2.1.6. Descripcin general del mdulo inalmbrico ...................................................... 28
8.3. HEC (Home Energy Controller) .......................................................................... 28
8.3.1. Conexin a la red del HEC ................................................................................. 29
8.3.2. Configuracin del HEC como Punto de Acceso y Estacin ................................ 31
8.3.3. Antena de mdulo inalmbrico ........................................................................... 33
9. DISEO DEL PROTOTIPO ............................................................................... 34
9.1. Diseo del Termmetro digital ........................................................................... 35
9.2. Sensor de luz digital........................................................................................... 36
9.3. Diseo del sensor magntico ............................................................................. 36
9.4. Diseo del HEC (Home Energy Controller) ........................................................ 38
9.5. Red de sensores ................................................................................................ 40
9.6. Interfaz hombre mquina ................................................................................... 40
10. IMPLEMENTACIN DEL DISEO .................................................................... 42
10.1. Diseo y construccin del HEC .......................................................................... 44
11. INTERFAZ HOMBRE MQUINA (IHM) ............................................................. 47
12. ANLISIS DE RESULTADOS ............................................................................ 48
13. COSTOS DEL PROYECTO ............................................................................... 49
13.1. Recursos humanos ............................................................................................ 49
13.2. Costos fijos ........................................................................................................ 49
2
14. CRONOGRAMA DE EJECUCIN DE LOS TRABAJOS.................................... 53
14.1. Tiempo de ejecucin del proyecto ...................................................................... 53
14.2. Estrategia de trabajo .......................................................................................... 53
14.3. Cronograma ....................................................................................................... 54
15. RECOMENDACIONES ...................................................................................... 55
16. COMENTARIOS ................................................................................................ 55
17. CONCLUSIONES .............................................................................................. 55
18. BIBLIOGRAFA .................................................................................................. 56
3
TABLA DE GRFICAS
1
ANEXOS
2
1. INTRODUCCIN
El valor agregado de este proyecto para la Universidad Distrital, consiste en ejecutar dos
objetivos especficos de este macro proyecto del grupo de investigacin. El primero consiste
en crear un modelo a escala de una casa en la cual este automatizado el sistema de
iluminacin y ventilacin, adems que sea verificado de forma remota el comportamiento de
los electrodomsticos presentes en ella.
1
El segundo es el desarrollo de tesis de grado las cuales estn dentro del proyecto Ciudades
Inteligentes que abarquen el tpico desarrollado en la propuesta del grupo de investigacin.
En general, la arquitectura del sistema est compuesta por una estacin de monitoreo y
coordinacin (HEC), tres estaciones locales de sensores inalmbricos y una estacin
remota. Los sensores se localizan en algn lugar dentro del prototipo formando la topologa
de red en estrella. Cada uno de estos sensores tendr la capacidad de medir una variable
ambiental en tiempo real, direccionarla hasta la estacin base por medio de la red HAN y
transmitirla a una estacin remota por el protocolo TCP/IP.
Los dispositivos estarn conectados a la red WHAN como se indica en la Grfica 8.3.2-1.
2
2. ANTECEDENTES
El montaje del saln piloto permitir emplear la domtica desarrolla y probada en el prototipo
a escala de SmartHome un saln de clase de la facultad de ingeniera.
Otro documento es (Castillo Cristiano & Montoya Crdenas, 2014)en el cual desarrollan un
dispositivo que permite iluminar una casa por medio de un sistema electrnico de bajo costo,
de este prototipo mide una variable la cual es monitorea de forma local. Un proyecto similar
desarrollaron (Cubillos Cabera & Molina Bernal, 2014) y (Trivio Paredes & Algarn
Jimnez, 2014) los cuales implementan sistema de iluminacin. Otro trabajos como
(Fonseca Rodrguez, 2007) y (Vargas Vargas, 2013) hacen la implementacin en sistemas
domticos comerciales como HRK Domotic y EMC Systems.
3
3. JUSTIFICACIN
3.1. Justificacin tcnica
Este proyecto permite implementar el concepto de SmartHome a pequea escala por medio
de un prototipo con una red de tres sensores comunicados de forma local a travs de la
estacin de monitoreo y remota con una IHM.
Integrar el conocimiento adquirido por el estudiante en los cursos de: circuitos digitales,
comunicaciones digitales, electrnica III y comunicaciones digitales, en el desarrollo de un
prototipo de implementacin en domtica a pequea escala.
Para la Universidad Distrital se ejecutan dos objetivos especficos del macro proyecto
Ciudades Inteligentes. El primer objetivo consiste en crear un modelo a escala de una casa
en la cual este automatizado el sistema de iluminacin y ventilacin, adems que sea
verificado de forma remota el comportamiento de los electrodomsticos presentes en ella.
El segundo objetivo es el desarrollo de tesis de grado las cuales estn dentro del proyecto
Ciudades Inteligentes que abarquen el tpico desarrollado en la propuesta del grupo de
investigacin.
4
3.3. Justificacin social
5
4. OBJETIVO GENERAL
Disear e implementar un modelo domtico a escala de una SmartHome, el cual permite
monitorear las variables ambientales de iluminacin, temperatura y ventilacin por medio de
sensores, estas seales son digitalizadas y llevadas a una red inalmbrica local domstica
(WHAN) hasta el controlador de energa (HEC) empleando el protocolo IEEE 802,11 y
finalmente toda la informacin recibida es concatenada y transmitida por protocolo CTP/IP
para visualizar las mediciones en una estacin remota.
6
5. PLANTEAMIENTO DEL PROBLEMA
Este proyecto se plantea desde la modalidad de trabajo de grado como monografa, donde
el conocimiento adquirido en los cursos de circuitos digitales, comunicaciones digitales,
electrnica III e instrumentacin industrial, permitirn realizar un prototipo de implementacin
domtica.
El tema de trabajo de grado est relacionado con una aplicacin en domtica y fue apoyado
por el CIDC de la universidad Distrital y el grupo LIDER1, el cual apoy el proceso desde su
grupo de semilleros de investigacin para llevar a buen trmino el trabajo y generar un valor
agregado a los estudiantes y a la universidad. Este trabajo realiza un aporte a la lnea de
investigacin domtica dentro de la facultad de ingeniera.
7
6. ALCANCE
Disear la arquitectura para un sistema de monitoreo en red NMS (por sus siglas en ingls
Networked Monitoring System) como se muestra en la Grfica 8.3.2-1.
Implementar y probar los sensores del numeral 8.1 en el entorno del prototipo. Emplear los
sensores de luz y temperatura para recolectar la informacin en tiempo real del ambiente y
digitalizarla.
Implementar y probar una red local tipo WLAN entre los sensores y el HEC empleando el
protocolo IEEE 802,11.
Visualizar de forma remota la informacin recibida por los sensores de manera que se
permita la interaccin del usuario con el sistema de comunicacin local en la SmartHome.
8
7. LIMITACIONES
No se considera la interaccin con otros dispositivos que pueda tener una SmartHome.
Es posible conectar otras estaciones que sean compatibles con el protocolo IEEE 802.11
comunicaciones para transmisin de la informacin a la estacin remota es el TCP/IP.
9
8. MARCO TERICO CONCEPTUAL
Este prototipo son los ojos y odos cando no se est en casa, o puede ayudar a hacer ms
confortable la permanencia en ella. Con sensores se medirn las variables ambientales y a
travs del protocolo TCP/IP se realiza la conexin a Internet manteniendo informado en todo
momento los eventos que tengan lugar en la SmartHome.
Informar si el sistema de ventilacin quedo encendido, la puerta est abierta, el nivel de
iluminacin en una zona especfica de la casa o conocer el momento en que la lavadora ha
terminado su ciclo de lavado. Es por esta razn que en esta seccin se justifica la seleccin
de las variables ambientales de cada uno de los sensores que fueron implementados en el
prototipo.
Las cargas elctricas ms grandes de una casa o de un edificio y a las cuales por lo general
de asigna un nico circuito elctrico son:
De esta forma se puede con solo apretar un botn, iluminar una habitacin, refrigerar la casa
en verano y calentar en invierno y poder encender la lavadora o la secadora. Para poder
ahorrar el consumo de energa en un hogar, la tendencia consiste en usar:
Las principales cargas elctricas que se pueden manipular para reducir el consumo de
energa son:
Iluminacin
Temperatura
Encender y o pagar equipos de alta potencia
Cada habitacin de una casa tiene un propsito diferente y ubicacin especfica de modo
que la temperatura de confort en cada una de ellas no ser la misma. En el caso de lugares
10
en la casa con diferente ocupacin de personas, o en el caso de viviendas ubicadas en
ambientes con estaciones, se pueden implemente sistemas inteligentes de control de
temperatura.
Durante los meses de verano, se puede medir la temperatura para configurar el sistema de
aire acondicionado o apagar la calefaccin cuando no sea necesario. En invierno, midiendo
la temperatura se puede activar el sistema de calefaccin para aumentar la temperatura.
Cuando los valores de temperatura medidos estn por encima de la temperatura ambiente, y
no est nadie en casa para confirmar el valor medido, podra deberse a un incendio, y con
este sistema generar una seal de alarma.
Para el diseo del prototipo se utiliz un sensor de temperatura DS18B20 fabricado por
Dallas Semiconductor. Este es un sensor digital, ya que entrega la medicin de temperatura
codificada en dos bytes, donde los dos primero bits son utilizados para el signo, y los otros
dos restantes son potencias de 2.
El sensor DS18B20 utiliza para transmitir la informacin una comunicacin OneWire, la cual
consiste en un protocolo que permite enviar y recibir datos utilizando una sola va (un solo
cable), a diferencia de la mayora de los protocolos que requieren dos.
11
OneWire est basado en un bus, un microcontrolador y el sensor digital de temperatura,
emplea una sola lnea de datos que puede ser tambin con la que se alimenta
elctricamente.
Para enviar un bit a 1 el microcontrolador lleva a 0 volts la lnea de dato durante 1-15
microsegundos.
Para enviar un bit a 0 el microcontrolador lleva a 0 volts la lnea de dato durante 60
microsegundos.
a)
b)
Este sensor tiene la posibilidad de configurar la resolucin, posee cuatro resoluciones las
cuales seran de 9 bits, 10 bits, 11 bits y 12 bits. Para su configuracin, existe un registro
dentro de la memoria llamada registro de configuracin. Dentro de ste, existe dos bits, los
cuales, colocando diferentes combinaciones de 0 y 1 se configura la resolucin.
12
La segunda forma se obtiene alimentando de manera normal al sensor, esto quiere
decir, colocando Vdd a 3,3 volts y GND a tierra, y utilizar DQ solamente para
comunicacin.
Integrado dentro del encapsulado se encuentra el circuito de alimentacin del modo parasito
basado en un condensador que se carga cuando hay seal a nivel alto y un sistema de
deteccin de alimentacin (Power Supply Sense). Est compuesto por una memoria ROM
de 64 bits que almacena el nmero de serie del dispositivo, un puerto OneWire, una
pequea memoria en la que se almacena la configuracin (Memory control logic) y la
temperatura una vez convertida en forma digital, un generador donde se verifica la
redundancia cclica de CRC (CRC generator) para comprobar la coherencia del valor digital
de la temperatura y el sensor de temperatura, la memoria Scratchpad y dos alarmas de nivel
que no son habilitadas para esta aplicacin.
Paso 1. Inicializacin: Todas las transmisiones en el bus OneWire comienzan con una
secuencia de inicializacin. La secuencia de inicializacin consiste en un impulso de
reposicin transmitida por el maestro, seguido de pulso presencia transmitido por el esclavo.
El pulso de presencia permite al maestro saber que los dispositivos esclavos (como el
DS18B20) y estn listos para funcionar.
13
ROM de cada dispositivo esclavo. Estos comandos tambin permiten al maestro determinar
cuntos y qu tipos de dispositivos estn presentes o si algn dispositivo ha experimentado
una condicin de alarma. Hay cinco comandos ROM, y cada comando es de 8 bits de
longitud. El dispositivo maestro debe emitir una orden apropiada ROM antes de emitir un
comando de la funcin DS18B20.
Paso 3. Comando de funcin. Despus que el maestro ha utilizado un comando ROM con el
que desea comunicarse con el DS18B20, el maestro puede emitir uno de los comandos de
funcin DS18B20. Estos comandos permiten al maestro escribir y leer desde la memoria del
DS18B20, iniciar conversiones de temperatura y determinar el modo de alimentacin.
Esta secuencia se debe seguir cada vez que se accede al sensor. Despus de emitir
cualquiera de estos comandos ROM, el dispositivo que funcione como maestro debe volver
al paso 1 en la secuencia.
Este tipo de sensor se ubica en el interior del lugar dentro de la casa que se quiere
monitorear, midiendo constantemente la luminosidad que entra por la misma en cada
momento.
14
nicamente se debe ubicar el sensor a la distancia correcta de la ventana, para que pueda
medir correctamente la cantidad de luz natural y obtener el nivel de iluminacin adicional
que debe ser suministrado.
Para el diseo del segundo sensor en el prototipo se utiliz un sensor de luz TSL 2561
fabricado por Dallas Semiconductor. Es un sensor digital de luz que puede ser configurado
para detectar rangos de luz de 0,1- 40000 lux.
El sensor tiene una interfaz digital (I2C). La corriente que consume es extremadamente baja,
alrededor de 0,6 mA cuando se encuentra censando, y menos de 15 uA @ 5 V cuando est
en modo de bajo consumo.
El sensor tiene dos diodos, uno para espectro infrarrojo y otro para espectro completo. Eso
significa que se puede medir por separado infrarrojo, espectro completo o luz visible por el
ser humano. Ambos sensores estn integrados en un circuito integrado CMOS capaz de
proporcionar respuesta sobre de 20 bits (resolucin de 16 bits). Para este caso particular el
sensor infrarrojo no es utilizado.
Tiene dos Conversores anlogo - digital integrados que convierten las corrientes de los
fotodiodos en una salida digital que representa el nivel de iluminacin medido. Esta salida
digital es la entrada al microprocesador.
15
Grfica 8.1.2-2 Configuracin de pines para el sensor de temperatura TSL 2561.
16
El sensor de luz TSL 2561 contiene dos sensores, a cada est asociado un conversor
anlogo-digital (ADC) que integra las corrientes de los dos fotodiodos.
La integracin de ambos canales ocurre simultneamente. Al finalizar el ciclo de conversin,
el resultado es transferido a los registros de canal 0 y el canal 1 de los datos,
respectivamente. Despus de la transferencia, el dispositivo comienza automticamente el
siguiente ciclo de integracin.
La comunicacin con el dispositivo se lleva a cabo a travs de un estndar Two Wire SMBus
o I2C bus serial, esto quiere decir que se puede comunicar directamente con el
microcontrolador, no se requiere ningn circuito externo para acondicionamiento de la seal
ahorrando espacio en el PCB. Puesto que la salida del TSL2561 es digital, la salida es
inmune al ruido cuando se compara con una seal analgica.
17
Las dimensiones de este sensor son: Largo 34 mm, ancho 13,50 mm y alto 8,00 mm. Tiene
una apertura de trabajo de 20 a 25 mm.
El circuito sensor reconoce entonces un cambio especfico de amplitud y genera una seal
que conmuta la salida de estado slido o la posicin "ON" y "OFF".
Parmetro Valor
Distancia de deteccin (Espacio) 15 a 25 mm
Carcasa Plstico ABS blanco
Instalacin Exterior
Dimensiones 34 mm, 13,50 mm, 8,00 mm
Tabla 2. Caractersticas fsicas del reed switch.
Caractersticas:
Juego de sensor magntico (1 Reed Switch + 1 imn + tornillos de fijacin).
Estado del Reed Switch: Normalmente Abierto (NO). Se cierra al estar cerca de un
campo magntico (imn)
Distancia de operacin: 15 25 mm
Caractersticas del cable: 24 AWG, 350mm de largo
Color carcasa: Blanco
Material carcasa: ABS
18
Universal Plug and Play (UPnP): Es un conjunto de protocolos de comunicacin que
permite a perifricos en red, como ordenadores personales, impresoras, pasarelas de
Internet, puntos de acceso Wi-Fi y dispositivos mviles, descubrir de manera transparente la
presencia de otros dispositivos en la red y establecer servicios de red de comunicacin,
comparticin de datos y entretenimiento. UPnP est diseado principalmente para redes de
hogar.
Las directrices DLNA suponen una capa de restricciones acerca de los tipos de formatos de
fichero multimedia, codificaciones y resoluciones que los dispositivos deben soportar. La
ventaja que ofrece es una fcil configuracin y gran versatilidad. Este sistema puede
funcionar tanto en redes Wi-Fi como Ethernet.
Su bajo consumo.
Su topologa de red en malla.
Su fcil integracin (se pueden fabricar nodos con muy poca electrnica).
Devices Profile for Web Services (DPWS): Define un conjunto de restricciones para
permitir la mensajera de servicios Web. Su caracterstica principal es notificar eventos,
intercambio de mensajes y descripcin de servicios. Sus objetivos son similares a los de
Universal Plug and Play (UPnP), pero adems, DPWS est totalmente alineado con la
tecnologa de servicios web, e incluye numerosos puntos de extensin para integracin.
19
Bluetooth Servicie Discovery Protocol (SDP): Es cualquier dispositivo Bluetooth que
ofrece un servicio o servicios a otros dispositivos Bluetooth. Cada servidor SDP tiene su
propia base de datos; no hay una base de datos central.
En el protocolo SDP los clientes pueden utilizan los servicios proporcionados por los
servidores. Para que hagan esto, servidores y clientes intercambiar informacin sobre los
servicios.
La base de datos SDP es simplemente un conjunto de registros que describen todos los
servicios. El dispositivo Bluetooth proporciona los medios para que otro dispositivo pueda
mirar a estos registros.
Elementos de datos: Los atributos tienen valores, y esos valores pueden tener varios tipos y
tamaos. De modo que un dispositivo que recibe un atributo sabe qu tipo y tamao que
est recibiendo, atributos se envan en elementos de datos.
WIFI (IEEE 802,11): Los protocolos IEEE 802,x definen la tecnologa de redes de rea local
(LAN). En este protocolo est compuesto por:
Es un protocolo con amplio mercado comercial y compatibilidad con otros dispositivos. Este
sistema proporciona una conexin entre dispositivos electrnicos de forma inalmbrica. Las
redes wifi poseen una serie de ventajas, entre las cuales podemos destacar:
El sistema wifi asegura la compatibilidad absoluta entre dispositivos, con lo que podra
utilizar la tecnologa wifi.
Las WIFI mezclan la comodidad de uso de las conexiones inalmbricas (como
Bluetooth), con un mayor alcance y fcil acceso WIFI en una SmartHome.
Pero como red inalmbrica, la tecnologa wifi presenta los problemas intrnsecos de
cualquier tecnologa inalmbrica. Algunos de ellos son:
Una de las desventajas que tiene el sistema wifi es una menor velocidad en
comparacin a una conexin cableada, debido a las interferencias y prdidas de seal
que el ambiente puede acarrear.
La desventaja fundamental de estas redes reside en el campo de la seguridad. Este
problema se agrava si consideramos que no se puede controlar el rea de cobertura de
una conexin, de manera que un receptor se puede conectar desde fuera de la zona de
recepcin prevista (por ejemplo: desde una vivienda vecina).
La potencia de la conexin del wifi se ver afectada por los agentes fsicos que se
encuentran a nuestro alrededor, tales como paredes. Dichos factores afectan la
potencia de compartimiento de la conexin wifi con otros dispositivos.
20
8.2. Mdulo de comunicacin inalmbrica entre sensores
Estas dos familias de mdulos incluyen todo lo necesario para conectarse a un punto de
acceso WIFI mediante programacin de puerto serial o interfaz web, que puede ser
configurada a diferentes velocidades. Disponen tambin, de puertos GPIO (General Purpose
Input Output) para su uso como activador, el cual podra ser configurado para futuras
aplicaciones.
Este mdulo tiene la capacidad de convertir tramas de datos recibidas a travs de su puerto
serie en tramas TCP, adems de contar con posibilidad de trabajar como un simple
componente con direccin IP o tambin funcionar como enrutador o como un punto de
acceso, trabaja con protocolo IEEE 802.11 b/g/n a una velocidad mxima de 110MBps.
Una vez se conectar el mdulo WIFI con el microcontador, el dispositivo tomalos datos
digitalizados de temperatura, luz o ON-OFF, y preparar el paquete de datos el cual se enva
por lo menos 100 veces por segundo desde cada tarjeta de sensores hasta el HEC, el cual
se encargar de procesar el paquete de datos y transmitirlos.
21
Para que sea inalmbrico, cada uno de los mdulos adems de poder transferir datos
usando una red LAN, tiene su propia fuente de alimentacin. Los mdulos consumen
alrededor de 350 mA, esto quiere decir que se necesita bateras de potencia baja.
Grfica 8.2.1-1 a) Vista del mdulo USR-WIFI232T. b) Mapa de pines del mdulo
22
reset
5 UART UART_RX I No conectar si no se usa
6 UART UART_TX O No conectar si no se usa
7 Interruptor de PWR_SW I, PU 0 Alimentacin apagada
potencia 1 Modo normal
8 PWM/WPS PWM_3 I/O Funcin por defecto WPS
Puede usarse con PWM/GPIO18
9 PWM/nReady PWM_2 I/O Funcin por defecto nReady
Puede usarse con PWM/GPIO12
10 PWM/nLink PWM_1 I/O Funcin por defecto nLink
Puede usarse con PWM/GPIO11
Convenciones de la tabla:
I: Entrada
O: Salida
PU: Pull-up
I/O: Entrada/salida
Tabla 5. Descripcin de los pines del mdulo inalmbrico USR-WIFI232T
nReset: Es el pin para reset del mdulo; nReset necesita una resistencia de pull-up
cuando se quiere habilitar para operacin. Si el mdulo MCU necesita hacer un reset,
se enva pulllow al menos por 10 ms.
nReload: Es el pin para configuracin del mdulo; despus de encender el mdulo, este
pin se puede dejar en cero por un tiempo menor a 3 segundos para la configuracin
Smart link, se debe esperar a la aplicacin para introducir la; Despus que el mdulo es
enciendo, este pin se puede dejar en cero por un tiempo mayor a 3 segundo para
recuperar la configuracin de fbrica.
Para estos dos pines se usan resistencias de pull up entre 5 k y 10 k.
NLink: Este pin indica el estado del mdulo; Para la configuracin Smart Link, este pin
indica que se han terminado los ajustes. Para operacin normal, este pin indica el
estado.
NReady: Es el pin indicador para xito de inicio.
WPS: Wi-Fi protect setup, sirve para conectar el mdulo al punto de acceso.
UART: Recepcin y transmisin;
GPIO_n: entrada/salida de propsito general; es un pin cuyo propsito se puede
controlar (programar) por el usuario en tiempo de ejecucin.
PWM_N: En el pin de salida PWM del mdulo. Puede configurarse tambin como el pin
GPIO.
23
+13 dBm (300
802.11n 19,95 -82dBm (300 Mbps) 0,0000063
Mbps)
Tabla 6. Parmetros el potencia y sensibilidad del mdulo USR-WIFI232T
Este mdulo cuenta con una conexin para antena externa tipo I-PEX, el mdulo debe
conectarse a una antena de 2,4G de acuerdo con el estndar IEEE.
Grfica 8.2.1-3 Conector I-PEX para antena del mdulo USR WIFI232T.
24
Grfica 8.2.1-4 Fotografa de la antena para cada una de las tarjetas de sensores.
Modo rendimiento: En este modo, el mdulo puede transmitir datos entre el dispositivo
serial y la red.
Modo de comando: En este modo, el usuario puede consultar y establecer el puerto serial y
los parmetros de red en el mdulo a travs del comando AT.
El modo seleccionado para este mdulo es el modo comando. En este modo el mdulo
requiere el puerto serial para recibir el comando AT. El usuario puede enviar comandos AT
al mdulo a travs de puerto serial, para consultar y establecer los parmetros de
configuracin y la red.
Este mdulo puede ser configurado como STA (Estacin) y AP (Punto de Acceso) con base
en el tipo de red. A continuacin se realiza la descripcin de cada configuracin.
25
STA: En la configuracin como estacin empleada para los sensores, cada terminal
conectado a la red inalmbrica (En este caso son cada uno de los dispositivos medidores de
variables ambientales, pero pueden ser tambin computadores porttiles, impresoras,
celulares y otros dispositivos).
El modo STA es el mtodo de red empelado por los sensores, como se muestra en la
Grfica de arriba, la red consiste en un router como Punto de Acceso y los dems
dispositivos como STA, en esta red el Punto de Acceso est en el centro, la comunicacin
entre los nodos STA es reenviada por el AP al usuario remoto.
En el modo AP, la tarjeta electrnica de cada sensor puede conectarse rpidamente con un
dispositivo serial para transferir datos o configuracin. Tambin, se pueden agregar mdulos
y parametrizarlos desde el entorno web. En USR-WIFI232T en configuracin AP, solo puede
conectar mximo dos dispositivos en modo STA.
WPA: Wi-Fi Protected Access oAccesoWi-Fi protegido es un sistema para proteger las
redes inalmbricas (Wi-Fi). WPA implementa la mayora del estndar IEEE 802.11.
WPA2: Wi-Fi Protected Access 2 o Acceso Protegido Wi-Fi 2, es un sistema para proteger
las redes inalmbricas (Wi-Fi); creado para corregir las vulnerabilidades detectadas en WPA.
WPA2 est basada en el nuevo estndar 802.11i. WPA, por ser una versin previa, que se
podra considerar de "migracin", no incluye todas las caractersticas del IEEE 802.11i,
mientras que WPA2 se puede inferir que es la versin certificada del estndar 802.11i.
26
sistemas de encriptacin, este proceso se realiza igual que con un Router WIFI, ya que los
parmetros de configuracin se pueden realizar desde entorno web.
Una vez dentro de la interfaz, se puede ir por cada men lateral para cambiar la
configuracin del mdulo inalmbrico. El men posee las siguientes opciones de
configuracin:
STA Setting: Con esta opcin si el dispositivo est configurado en modo estacin, se puede
pulsar la opcin Scan para qu busque automticamente el AP cercano, se debe tener en
cuenta si la red tiene algn tipo de encriptacin. Cada uno de los mdulos medidores de las
variables ambientales estar configurado como estacin.
27
Enable / Disable: Activa o desactiva las funciones de punto de acceso inalmbrico del
dispositivo.
SSID: Se utiliza para identificar la red. La mayora de los puntos de acceso tienen
valores predeterminados conocidos. Esta opcin permitir la difusin de SSID para
asociarse. Normalmente, el punto de acceso emite su SSID para que los dispositivos
inalmbricos dentro de su alcance se puedan conectar a la red. Para una red ms
segura, puede desactivar esta funcin.
El modulo de la tarjeta electrnica del HEC es el WIFI232, este es un modulo que conecta
cualquier microcontrolador a la red WIFI. Se utiliz el mdulo serial UART WIFI con
protocolo IEEE 802.11 debido a su reducido tamao, proporciona una interfaz inalmbrica
con cualquier dispositivo con puerto serial. En la siguiente fotografa se muestra el mdulo.
ste mdulo permite comunicar el sensor a la red inalmbrica. Este modulo permite la
configuracin con cualquier dispositivo con puerto serial de forma inalmbrica con la red
LAN, en este caso con la red de la SmartHome.
El usuario tiene acceso a la aplicacin solamente con una conexin a Internet, siempre y
cuando tenga un navegador web. La interfaz grfica de usuario (HIM) de la aplicacin
permite al usuario remoto llevar a cabo el monitoreo de los sensores, y la visualizacin de
28
los resultados en tiempo real. El usuario remoto puede seleccionar y verificar la medicin de
los sensores de monitorio.
En el HEC se ejecuta una aplicacin para iniciar el proceso de monitoreo, con el propsito
que el usuario remoto tenga acceso.
Estndar IEEE 802.11b: Esta funciona en la banda de frecuencia de 2,4 GHz y permite la
transmisin de datos con velocidades de 5 hasta 11 Mbps, con este estndar se puede crear
una red de trabajo inalmbrico (WLAN).
El mdulo de conexin WIFI del HEC es el USR WIFI232B el cual funciona con protocolo
IEEE 802,11 que puede conectarse a cualquier equipo con interface inalmbrica y puerto
serial para transferencia de datos.
Este mdulo WIFI USR WIFI232B se diferencia del USR WIFI232T en primer lugar porque
no es un adaptador WIFI para Arduino, sino un micro PC que incorpora un mdulo WIFI, es
decir no es un simple mdulo que necesita ser manejados como esclavos de un
microcontrolador externo, sino que en su interior alberga un microprocesador interno y una
memoria.
Aparte de los pines TX, RX, VCC y GND, dichos mdulos poseen pines GPIO para
conectarles otros dispositivos como pantallas o sensores mediante las interfaces UART, I2C,
SPI.
29
El mdulo de conexin inalmbrica es utilizado en aplicaciones de domtica y dispositivos
inteligentes. El mdulo WIFI tiene capacidad para conectar hasta 32 estaciones
simultneamente.
30
3 UART dato de transmisin UART_TXD O Si no usa la funcin
GPIO GPIO4 I/O UART, estos pines
4 UART dato recibido UART_RXD I pueden ser configurados
GPIO GPIO4 I/O como pines GPIO
5 UART enviar requisitos de UART_RTS O
datos de transmisin
GPIO GPIO5 I/O
6 UART recibir dato de UART_CTS I
permiso de transmisin
GPIO GPIO6 I/O
7 Seal de reset RESET I 0 entrada de reset
La duracin de la seal
debe durar ms de 300
ms
8 Indicador de estado WIFI nLink O 0 Conexin WIFI
disponible
9 Indicacin de estado del nReady O 0 final del proceso
mdulo 1 Arranque del mdulo
GPIO GPIO9 I/O sin finalizar
10 Restaurar configuracin nReload I El mdulo ser
GPIO GPIO10 I/O restaurado a su
configuracin de fbrica
este pin en 0 por 1 seg
11 Ethernet input + PHY_RX + I + 1,8 V interface de
12 Ethernet input - PHY_RX - I datos Ethernet
13 Ethernet Output PHY_Tx O Modo de conexin
14 Ethernet Output PHY_Tx O directa
Tabla 9. Descripcin de los pines del mdulo inalmbrico del HEC.
El HEC tiene la configuracin para funcionar como punto de acceso y estacin (AP+STA),
esta configuracin se puede realizar desde el puerto serial del mdulo de comunicaciones, y
opera como se muestra en la siguiente figura:
31
Grfica 8.3.2-1 Configuracin del mdulo como punto de acceso y estacin.
Cuando es habilitado con la configuracin AP+STA, la interface STA puede conectarse con
un Router y con un servidor TCP. Al mismo tiempo, la interface AP esta tambin activada y
permite a otros dispositivos conectarse con un servidor TCP.
Las ventajas de esta configuracin es que el usuario puede establecer conexin fcilmente y
realizar un seguimiento del dispositivo sin tener que cambiar la configuracin original de la
red. Tambin se permite establecer parmetros a travs de la red WIFI cuando el mdulo
trabaja como estacin.
Esta funcin se puede configurar en este dispositivo gracias a posee dos socket.
Grfica 8.3.2-2 Configuracin del mdulo HEC como punto de acceso y estacin.
32
8.3.3. Antena de mdulo inalmbrico
Al mdulo inalmbrico debe instalarse de una antena externa. La antena est diseada para
operar de acuerdo con el estndar IEEE 802,11 b/g/n. El rango de frecuencia de operacin
estar entre 2,4 GHz y 2,5 GHz. Cuenta con una impedancia de 50 Ohm y tiene un conector
tipo I-PEX.
33
9. DISEO DEL PROTOTIPO
Cada tarjeta de sensores fue disea para tener las tres opciones de sensores incluidas, es
decir en todas las tarjetas de sensores se puede conectar el sensor de temperatura, el
magntico, o de luz (no de manera simultnea), aunque el cdigo del microcontrolador solo
implementa un sensor usado en cada tarjeta. Se hizo de esta forma para no tener que hacer
una tarjeta diferente para cada sensor y ahorra costos en la implementacin en la impresin
de cada PCB. La conversin anloga digital de las variables medidas se realiza
directamente en cada sensor.
El puerto serial se configura a una velocidad de comunicacin de 9.600 baudios para poder
programar el microcontrolador.Se emplea para misma fuente de 3.3V de la tarjeta para
alimentar el mdulo inalmbrico.
Por esta razn, se destinan otro par de pines cualesquiera a la transmisin, aunque para ello
tenemos que importar una librera que habilite la comunicacin serie con otros pines como
es la librera Software Serial.
Para ello se importa la librera que viene de serie en el IDE y se crea un nuevo objeto serie
llamado BT1 conectado a los pines 4 y 2:
#include <SoftwareSerial.h>
SoftwareSerialBT1(4,2); // RX, TX
El programa realiza la comunicacin del microcontrolador con el modulo WIFI, el cual lee lo
que se escribe en la puerta BT1 y lo transmite a la consola serial.
34
A su vez si hay algo en la consola, lee una lnea con GetLine() y finaliza con intro antes de
enviar la lnea completa al BT1
#include <SoftwareSerial.h>
SoftwareSerialBT1(3, 2); // RX | TX
void setup()
{ Serial.begin(115200);
BT1.begin(115200);
}
void loop()
{ String B= "." ;
if (BT1.available())
{ char c = BT1.read() ;
Serial.print(c);
}
if (Serial.available())
{ char c = Serial.read();
BT1.print(c);
}
}
a) b)
Grfica 9.1-1a) Esquemtico de simulacin del sensor de temperatura DS18B20 donde R12 es de 4,7k.
b) Polarizacin del sensor con fuente externa.
El circuito integrado DS18B20 se polariza con 3,3 volts entre los pines 1 (GND) y 3 (VDC). El
pin numero 2 (DQ) es usado para realizar la transmisin de la informacin conectando una
resistencia de pull up de 4,7 kOhm entre VDC y DQ. Este pin es conectado al
microcontrolador para realizar la transmisin de informacin por medio de una comunicacin
tipo OneWire.
35
9.2. Sensor de luz digital
Para el sensor de luz, la polarizacin se realiza como lo recomienda el fabricante. Para este
caso el sensor ya incorpora estos componentes en la tarjeta del sensor, por esta razn solo
se habilitan 5 pines para polarizacin y comunicacin del sensor con el microcontrolador.
a) b)
Grfica 9.2-1 a) Esquemtico de simulacin del sensor de luz TSL2560. b) Aplicacin del circuito
recomendada por el fabricante.
Una resistencia Rpi tambin se incluye en la seal INT, que funciona para una conexin
(seal).
36
Grfica 9.3-1 a) Esquemtico de simulacin del sensor de temperatura DS18B20 donde R12 es de 4,7k.
b) Polarizacin del sensor con fuente externa.
Su principio de operacin detecta los objetos magnticos que se utilizan para accionar el
proceso de conmutacin.
La seal siempre se mantiene en 0 Volts, hasta cuando el imn cierra el circuito y en la
resistencia R11 hasta 3,3 volts que es un 1 lgico para el microcontrolador.
37
9.4. Diseo del HEC (Home Energy Controller)
El mdulo de conexin WIFI del HEC es el USR WIFI232B el cual funciona con protocolo
IEEE 802,11 que puede conectarse a cualquier equipo con interface inalmbrica y puerto
serial para transferencia de datos.
Este mdulo WIFI USR WIFI232B se diferencia del USR WIFI232T en primer lugar porque
no es un adaptador WIFI para Arduino, sino un micro PC que incorpora un mdulo WIFI, es
decir no es un simple mdulo que necesita ser manejados como esclavos de un
microcontrolador externo, sino que en su interior alberga un microprocesador interno y una
memoria.
Aparte de los pines TX, RX, VCC y GND, dichos mdulos poseen pines GPIO para
conectarles otros dispositivos como pantallas o sensores mediante las interfaces UART, I2C,
SPI.
a) b)
c)
38
d)
Grfica 9.4-1 a) Diseo del mdulo WIFI USR WIFI2323B para el HEC. b) Fuente de alimentacin para el
HEC. c) Configuracin del microcontrolador ATMega328. d) Interface Serial para configuracin y pruebas
39
programador ATMEL ICE, y finalmente se puede programar por el puerto serial con un
conversor de USB-UART desde el IDE de arduino.
La arquitectura de red que se implement con la red de sensores inalmbricos, fue tipo
estrella. Una topologa en estrella es un sistema single-hop en el que todos los nodos de
sensores inalmbricos se comunican directamente con el HEC.}
Se dise una interface de usuario que se pueda manejar fcilmente. La estacin HEC es
utilizada como intermediario entre la red de sensores e Internet. Proporciona una conexin
inalmbrica para la transferencia de datos. La estacin base (HEC) funciona como estacin
para un Router con conexin a internet y como Punto de Acceso para cada una de las
tarjetas de sensores. El servidor principal se conecta a Internet para permitir a los usuarios
remotos acceder al sistema de monitoreo.
De acuerdo con (Zualkernan, Al-Ali, Jabbar, Zabalawi, & Wasfy, 2009) la arquitectura del
hardware para una red est compuesta por:
Estacin terminal: Este es una estacin equipada con la capacidad de memoria suficiente.
Este dispositivo es utilizado el servidor hardware donde se instalar el software provisto de
conexin a internet.
40
Grfica 9.6-1 Arquitectura del sistema de monitoreo (Lpez Antn & Gala Trallero, 2012).
En (Su, Lee, & Wu, 2006) se presenta un mdulo programable con protocolo TCP/IP
donde se introduce el control de temperatura de agua a distancia.
Estos dos sistemas podran proporcionar buenas soluciones monitoreo remoto de los
sensores en el SmartHome, pero no mencionan como es la interactuar con la red de
sensores.
En (Ziya, Member, & Buhur, 2005) se presenta una solucin inalmbrica para
conectar los sensores con la SmartHome en un servidor central. Se presenta cada
sensor como un nodo que tiene comunicacin directa de forma individual. En esta
comunicacin se emplea comunicacin punto a punto.
41
10. IMPLEMENTACIN DEL DISEO
Para la implementacin del prototipo se utiliz el software Design Spark PCB 7.2, la cual es
una herramienta gratuita de diseo PCB fcil de utilizar. Design Spark PCB posee un
entorno grfico fcil de utilizar, no tiene restriccin en cuanto al tamao de la placa, nmero
de pines o capaz.2.
Este software genera el archivo de extensin DXF e IDF para la implementacin. Con este
programa fue posible realizar la agrupacin de componentes del circuito. Todos los
componentes utilizados para la creacin de PCB fueron extrados de las libreras del
programa.
El diseo del PCB para cada mdulo de luz, temperatura y sensor magntico fue realizado
tal cual se muestra en el circuito de la siguiente figura, es decir la tarjeta de sensores fue
diseara para conectar el sensor de temperatura, magntico, o de luz. Cada mdulo sensor
es totalmente inalmbrico e independiente uno de otro.
a) b)
c) d)
2
La pgina de descarga gratuita del software Design Spark PCB es https://www.rs-
online.com/designspark/pcb-software
42
e)
Grfica 9.6-2Diseo del PCB para la tarjeta electrnica. a) c) Serigrafa o silkscreen de la capa superior
del PCB. d) Pistas o caminos de cobre en la capa superior del PCB. c) Serigrafa o silkscreen de la capa
inferior del PCB. d) Print circuit Board completo. e) Fotografa del PCB.
43
10.1. Diseo y construccin del HEC
a) b)
c) d)
44
e)
Grfica 10.1-1 Diseo del PCB para el HEC con el mdulo WIFI. a) Serigrafa o silkscreen de la capa
superior del PCB. b) Pistas o caminos de cobre en la capa superior del PCB. c) Pistas o caminos de cobre
en la capa inferior del PCB d) Serigrafa o silkscreen de la capa inferior del PCB. e) Print circuit Board
completa.
La PCB para cada mdulo sensor fue construida segn el diseo, el PCB tiene una
dimensin de 4.7 x 6.5 cm, un tamao lo suficientemente pequeo para que sea fcil de
localizar dentro del hogar.
Adems la tarjeta cuenta con una terminal de carga de batera que permite cargar todos los
mdulos sin tener que extraer la batera. Tambin se cuenta con un switch de encendido /
apagado.
Se puede observar que la tarjeta incluida la batera de alimentacin tiene un tamao muy
manejable a la hora de ubicarlo en algn lugar estratgico dentro de una casa.
45
a) b)
c)
d)
Grfica 10.1-2 a) Tarjeta del sensor magntico. b) Tarjeta del sensor de temperatura. c) Tarjeta del sensor
de iluminacin. d) Tarjeta del HEC
46
11. INTERFAZ HOMBRE MQUINA (IHM)
Para la implementacin de interfaz hombre mquina se emplea una pgina en la cual se
portals.exite.com la cual cuenta con la plataforma de Murano que incluye la conectividad y
gestin de dispositivos.
47
12. ANLISIS DE RESULTADOS
La potencia consumida por cada tarjeta depende del tipo de sensor que se est utilizando y
el protocolo de transmisin empleado en cada sensor. La potencia total estimada de
operacin de cada dispositivo del prototipo se muestra en la siguiente tabla:
La tarjeta del sensor de temperatura cuando se encuentra activado consume: 24,9 mW para
un protocolo de comunicacin 802.11n. 30,07 mW para un protocolo de comunicacin
802.11g y 44.76 mW un protocolo de comunicacin 802.11b.
La tarjeta del sensor de luz cuando se encuentra activado consume: 21,93 mW para un
protocolo de comunicacin 802.11n. 27,1 mW para un protocolo de comunicacin 802.11g y
41,79 mW un protocolo de comunicacin 802.11b.
La tarjeta del sensor magntico cuando se encuentra activado consume: 19,95 mW para un
protocolo de comunicacin 802.11n. 25,12 mW para un protocolo de comunicacin 802.11g
y 39,81 mW un protocolo de comunicacin 802.11b.
Para una batera de 1300 mA-h es espera que la duracin de cada mdulo en operacin
antes de recargar la batera sea de:
41,79
= = 13,56
3,3
1300
= = 95,5
13,56
48
13. COSTOS DEL PROYECTO
13.1. Recursos humanos
Para la realizacin de este prototipo de SmartHome, se necesito del estudiante Diego Carlos
A. Mndez, quin se encarg de implementar los diseos de las tarjetas para los sistemas
de medicin de iluminacin, temperatura, on-off y comunicaciones.
Los recursos incluye el trabajo del estudiante de ingeniera, el tiempo dedicado por el
profesor director y el ingeniero asesor del grupo de investigacin.
ESTUDIANTE/
Diego Carlos
INGENIERA PONENTE 22 9 $ 15 000 $ 2 970 000
A. Mndez
ELECTRNICA
ING. MSC
Roberto DOCENTE DE
DIRECTOR 22 0,05 $ 200 000 $ 220 000
Ferro PLANTA
Escobar
Este proyecto est enfocado a realizar un prototipo acadmico, cuyo nico fin es la
implementacin a escala de una red de tres sensores para una SmartHome, es necesario
tener en cuenta el costo de los dispositivos electrnicos que se utilizaron.
49
Sensor de temperatura
DS18B20
1 1 USD $ 3 000
Sensor de luz
1 $ 20 000 $ 20 000
4 $ 8000 $ 32 000
Sensor magntico
50
1 $ 3 000 $ 3 000
3 $ 20 000 $ 60 000
1 $ 22 000 $ 22 000
Bateras
51
3 $ 5 000 $ 15 000
Conversor Serial
1 $ 10 000 $ 10 000
1 $0 $0
52
14. CRONOGRAMA DE EJECUCIN DE LOS TRABAJOS
14.1. Tiempo de ejecucin del proyecto
La fecha de inicio para la ejecucin de las actividades es el mes mayo de 2016, fecha en la
que se termin de realizar el anteproyecto, y se firm la carta de aceptacin por parte del
director del proyecto, sin embargo, el anteproyecto fue radicado hasta el junio de 2016
debido anormalidad acadmica y se incluy en el acta 13 celebrada el 22 de junio de 2016
del consejo de carrera del proyecto curricular de ingeniera electrnica.
53
14.3. Cronograma
54
15. RECOMENDACIONES
El prototipo se implement exitosamente en una vivienda con una estacin de
monitoreo y 3 estaciones (una por cada sensor). Sin embargo, debido a que
el mdulo conexin inalmbrica soporta hasta 32 estaciones, en una
implementacin mayor se debera tener en cuenta la limitacin de dispositivos
que se pueden conectar.
16. COMENTARIOS
Debido a que el protocolo de comunicaciones IEEE 802,11 empleado en el
prototipo es compatible con dispositivos mviles, es posible crear una
aplicacin mvil para monitorear las variables medidas.
Se espera que cada tarjeta de sensores tenga una vida til para operacin
continua sin que necesite reparaciones o reemplazo de dispositivos igual a
superior a cada mdulo WIFI, y de acuerdo con la hoja de datos del
fabricante, se puede estimar en 12 meses, que es el tiempo medio de vida.
17. CONCLUSIONES
55
18. BIBLIOGRAFA
56
ANEXO 1 Hoja de datos sensor de temperatura
57
DS18B20 Programmable Resolution
1-Wire Digital Thermometer
DQ 4 5 GND
SO (150 mils)
(DS18B20Z)
DQ 1 + 8 VDD
GND DQ VDD N.C. 2 7 N.C.
DS18B20
N.C. 3 6 N.C.
1 2 3 GND 4 5 N.C.
1 SOP
BOTTOM VIEW (DS18B20U)
Ordering Information appears at end of data sheet.
TO-92
(DS18B20)
1-Wire is a registered trademark of Maxim Integrated Products, Inc.
DC Electrical Characteristics
(-55C to +125C; VDD = 3.0V to 5.5V)
AC Electrical Characteristics
(-55C to +125C; VDD = 3.0V to 5.5V)
tSLOT
tREC START OF NEXT CYCLE
tLOW0
tSLOT
START OF NEXT CYCLE
tREC
tRDV
tRSTL tRSTH
PRESENCE DETECT
1-WIRE PRESENCE DETECT tPDIH
tPDLOW
Pin Description
PIN
NAME FUNCTION
SO SOP TO-92
1, 2, 6, 2, 3, 5,
N.C. No Connection
7, 8 6, 7
3 8 3 VDD Optional VDD. VDD must be grounded for operation in parasite power mode.
Data Input/Output. Open-drain 1-Wire interface pin. Also provides power to the
4 1 2 DQ
device when used in parasite power mode (see the Powering the DS18B20 section.)
5 4 1 GND Ground
Overview DQ pin when the bus is high. The high bus signal also
Figure 3 shows a block diagram of the DS18B20, and charges an internal capacitor (CPP), which then supplies
pin descriptions are given in the Pin Description table. power to the device when the bus is low. This method of
The 64-bit ROM stores the devices unique serial code. deriving power from the 1-Wire bus is referred to as para-
The scratchpad memory contains the 2-byte temperature site power. As an alternative, the DS18B20 may also be
register that stores the digital output from the temperature powered by an external supply on VDD.
sensor. In addition, the scratchpad provides access to the
1-byte upper and lower alarm trigger registers (TH and
OperationMeasuring Temperature
TL) and the 1-byte configuration register. The configura- The core functionality of the DS18B20 is its direct-to-
tion register allows the user to set the resolution of the digital temperature sensor. The resolution of the tempera-
temperature-to-digital conversion to 9, 10, 11, or 12 bits. ture sensor is user-configurable to 9, 10, 11, or 12 bits,
The TH, TL, and configuration registers are nonvolatile corresponding to increments of 0.5C, 0.25C, 0.125C,
(EEPROM), so they will retain data when the device is and 0.0625C, respectively. The default resolution at
powered down. power-up is 12-bit. The DS18B20 powers up in a low-
power idle state. To initiate a temperature measurement
The DS18B20 uses Maxims exclusive 1-Wire bus proto-
and A-to-D conversion, the master must issue a Convert
col that implements bus communication using one control
T [44h] command. Following the conversion, the resulting
signal. The control line requires a weak pullup resistor
thermal data is stored in the 2-byte temperature register
since all devices are linked to the bus via a 3-state or
in the scratchpad memory and the DS18B20 returns to its
open-drain port (the DQ pin in the case of the DS18B20).
idle state. If the DS18B20 is powered by an external sup-
In this bus system, the microprocessor (the master
ply, the master can issue read time slots (see the 1-Wire
device) identifies and addresses devices on the bus
Bus System section) after the Convert T command and
using each devices unique 64-bit code. Because each
the DS18B20 will respond by transmitting 0 while the tem-
device has a unique code, the number of devices that
perature conversion is in progress and 1 when the con-
can be addressed on one bus is virtually unlimited. The
version is done. If the DS18B20 is powered with parasite
1-Wire bus protocol, including detailed explanations of the
power, this notification technique cannot be used since
commands and time slots, is covered in the 1-Wire Bus
the bus must be pulled high by a strong pullup during the
System section.
entire temperature conversion. The bus requirements for
Another feature of the DS18B20 is the ability to oper- parasite power are explained in detail in the Powering the
ate without an external power supply. Power is instead DS18B20 section.
supplied through the 1-Wire pullup resistor through the
VPU
MEMORY
4.7k PARASITE POWER CIRCUIT CONTROL LOGIC DS18B20
DQ
TEMPERATURE
SENSOR
8-BIT CRC
GENERATOR
S = SIGN
or equal to TL or higher than or equal to TH, an alarm con- by CPP. To assure that the DS18B20 has sufficient supply
dition exists and an alarm flag is set inside the DS18B20. current, it is necessary to provide a strong pullup on the
This flag is updated after every temperature measure- 1-Wire bus whenever temperature conversions are tak-
ment; therefore, if the alarm condition goes away, the flag ing place or data is being copied from the scratchpad to
will be turned off after the next temperature conversion. EEPROM. This can be accomplished by using a MOSFET
The master device can check the alarm flag status of to pull the bus directly to the rail as shown in Figure 6. The
all DS18B20s on the bus by issuing an Alarm Search 1-Wire bus must be switched to the strong pullup within
[ECh] command. Any DS18B20s with a set alarm flag will 10s (max) after a Convert T [44h] or Copy Scratchpad
respond to the command, so the master can determine [48h] command is issued, and the bus must be held high
exactly which DS18B20s have experienced an alarm by the pullup for the duration of the conversion (tCONV)
condition. If an alarm condition exists and the TH or TL or data transfer (tWR = 10ms). No other activity can take
settings have changed, another temperature conversion place on the 1-Wire bus while the pullup is enabled.
should be done to validate the alarm condition. The DS18B20 can also be powered by the conventional
method of connecting an external power supply to the
Powering the DS18B20 VDD pin, as shown in Figure 7. The advantage of this
The DS18B20 can be powered by an external supply on method is that the MOSFET pullup is not required, and
the VDD pin, or it can operate in parasite power mode, the 1-Wire bus is free to carry other traffic during the tem-
which allows the DS18B20 to function without a local perature conversion time.
external supply. Parasite power is very useful for applica- The use of parasite power is not recommended for tem-
tions that require remote temperature sensing or that are peratures above +100C since the DS18B20 may not be
very space constrained. Figure 3 shows the DS18B20s able to sustain communications due to the higher leak-
parasite-power control circuitry, which steals power from age currents that can exist at these temperatures. For
the 1-Wire bus via the DQ pin when the bus is high. The applications in which such temperatures are likely, it is
stolen charge powers the DS18B20 while the bus is high, strongly recommended that the DS18B20 be powered by
and some of the charge is stored on the parasite power an external power supply.
capacitor (CPP) to provide power when the bus is low.
In some situations the bus master may not know whether
When the DS18B20 is used in parasite power mode, the
the DS18B20s on the bus are parasite powered or pow-
VDD pin must be connected to ground.
ered by external supplies. The master needs this informa-
In parasite power mode, the 1-Wire bus and CPP can pro- tion to determine if the strong bus pullup should be used
vide sufficient current to the DS18B20 for most operations during temperature conversions. To get this information,
as long as the specified timing and voltage requirements the master can issue a Skip ROM [CCh] command fol-
are met (see the DC Electrical Characteristics and AC lowed by a Read Power Supply [B4h] command followed
Electrical Characteristics). However, when the DS18B20 by a read time slot. During the read time slot, parasite
is performing temperature conversions or copying data powered DS18B20s will pull the bus low, and externally
from the scratchpad memory to EEPROM, the operating powered DS18B20s will let the bus remain high. If the
current can be as high as 1.5mA. This current can cause bus is pulled low, the master knows that it must supply
an unacceptable voltage drop across the weak 1-Wire the strong pullup on the 1-Wire bus during temperature
pullup resistor and is more current than can be supplied conversions.
VPU
DS18B20 DS18B20
VPU VPU VDD (EXTERNAL
GND DQ VDD GND DQ VDD SUPPLY)
P P
4.7k 4.7k
Figure 6. Supplying the Parasite-Powered DS18B20 During Figure 7. Powering the DS18B20 with an External Supply
Temperature Conversions
64-BIT Lasered ROM code ter data, which is explained in detail in the Configuration
Each DS18B20 contains a unique 64bit code (see Figure Register section. Bytes 5, 6, and 7 are reserved for inter-
8) stored in ROM. The least significant 8 bits of the ROM nal use by the device and cannot be overwritten.
code contain the DS18B20s 1-Wire family code: 28h. The Byte 8 of the scratchpad is read-only and contains the
next 48 bits contain a unique serial number. The most CRC code for bytes 0 through 7 of the scratchpad.
significant 8 bits contain a cyclic redundancy check (CRC) The DS18B20 generates this CRC using the method
byte that is calculated from the first 56 bits of the ROM described in the CRC Generation section.
code. A detailed explanation of the CRC bits is provided Data is written to bytes 2, 3, and 4 of the scratchpad using
in the CRC Generation section. The 64-bit ROM code and the Write Scratchpad [4Eh] command; the data must be
associated ROM function control logic allow the DS18B20 transmitted to the DS18B20 starting with the least signifi-
to operate as a 1-Wire device using the protocol detailed cant bit of byte 2. To verify data integrity, the scratchpad
in the 1-Wire Bus System section. can be read (using the Read Scratchpad [BEh] command)
after the data is written. When reading the scratchpad,
Memory data is transferred over the 1-Wire bus starting with the
The DS18B20s memory is organized as shown in Figure least significant bit of byte 0. To transfer the TH, TL and
9. The memory consists of an SRAM scratchpad with configuration data from the scratchpad to EEPROM, the
nonvolatile EEPROM storage for the high and low alarm master must issue the Copy Scratchpad [48h] command.
trigger registers (TH and TL) and configuration register.
Data in the EEPROM registers is retained when the
Note that if the DS18B20 alarm function is not used,
device is powered down; at power-up the EEPROM data
the TH and TL registers can serve as general-purpose
is reloaded into the corresponding scratchpad locations.
memory. All memory commands are described in detail in
Data can also be reloaded from EEPROM to the scratch-
the DS18B20 Function Commands section.
pad at any time using the Recall E2 [B8h] command. The
Byte 0 and byte 1 of the scratchpad contain the LSB and master can issue read time slots following the Recall E2
the MSB of the temperature register, respectively. These command and the DS18B20 will indicate the status of the
bytes are read-only. Bytes 2 and 3 provide access to TH recall by transmitting 0 while the recall is in progress and
and TL registers. Byte 4 contains the configuration regis- 1 when the recall is done.
SCRATCHPAD
(POWER-UP STATE)
Configuration Register received error free. The comparison of CRC values and
Byte 4 of the scratchpad memory contains the configura- the decision to continue with an operation are determined
tion register, which is organized as illustrated in Figure 10. entirely by the bus master. There is no circuitry inside the
The user can set the conversion resolution of the DS18B20 DS18B20 that prevents a command sequence from pro-
using the R0 and R1 bits in this register as shown in Table ceeding if the DS18B20 CRC (ROM or scratchpad) does
2. The power-up default of these bits is R0 = 1 and R1 = not match the value generated by the bus master.
1 (12-bit resolution). Note that there is a direct tradeoff The equivalent polynomial function of the CRC (ROM or
between resolution and conversion time. Bit 7 and bits 0 to scratchpad) is:
4 in the configuration register are reserved for internal use CRC = X8 + X5 + X4 + 1
by the device and cannot be overwritten.
The bus master can re-calculate the CRC and compare it
CRC Generation to the CRC values from the DS18B20 using the polyno-
mial generator shown in Figure 11. This circuit consists
CRC bytes are provided as part of the DS18B20s 64-bit
of a shift register and XOR gates, and the shift register
ROM code and in the 9th byte of the scratchpad memory.
bits are initialized to 0. Starting with the least significant
The ROM code CRC is calculated from the first 56 bits
bit of the ROM code or the least significant bit of byte 0
of the ROM code and is contained in the most significant
in the scratchpad, one bit at a time should shifted into the
byte of the ROM. The scratchpad CRC is calculated from
shift register. After shifting in the 56th bit from the ROM or
the data stored in the scratchpad, and therefore it chang-
the most significant bit of byte 7 from the scratchpad, the
es when the data in the scratchpad changes. The CRCs
polynomial generator will contain the recalculated CRC.
provide the bus master with a method of data validation
Next, the 8-bit ROM code or scratchpad CRC from the
when data is read from the DS18B20. To verify that data
DS18B20 must be shifted into the circuit. At this point, if
has been read correctly, the bus master must re-calculate
the re-calculated CRC was correct, the shift register will
the CRC from the received data and then compare this
contain all 0s. Additional information about the Maxim
value to either the ROM code CRC (for ROM reads) or
1-Wire cyclic redundancy check is available in Application
to the scratchpad CRC (for scratchpad reads). If the cal-
Note 27: Understanding and Using Cyclic Redundancy
culated CRC matches the read CRC, the data has been
Checks with Maxim iButton Products.
INPUT
MSB LSB
If there is only one slave on the bus, the simpler Read master must return to Step 1 (Initialization) in the transac-
ROM [33h] command can be used in place of the Search tion sequence. See the OperationAlarm Signaling sec-
ROM process. For a detailed explanation of the Search tion for an explanation of alarm flag operation.
ROM procedure, refer to Application Note 937: Book of
iButton Standards. After every Search ROM cycle, the DS18B20 Function Commands
bus master must return to Step 1 (Initialization) in the After the bus master has used a ROM command to
transaction sequence. address the DS18B20 with which it wishes to communi-
cate, the master can issue one of the DS18B20 function
Read Rom [33h]
commands. These commands allow the master to write
This command can only be used when there is one slave to and read from the DS18B20s scratchpad memory,
on the bus. It allows the bus master to read the slaves initiate temperature conversions and determine the power
64-bit ROM code without using the Search ROM proce- supply mode. The DS18B20 function commands, which
dure. If this command is used when there is more than are described below, are summarized in Table 3 and illus-
one slave present on the bus, a data collision will occur trated by the flowchart in Figure 14.
when all the slaves attempt to respond at the same time.
Convert T [44h]
Match Rom [55H]
This command initiates a single temperature conversion.
The match ROM command followed by a 64-bit ROM Following the conversion, the resulting thermal data is
code sequence allows the bus master to address a stored in the 2-byte temperature register in the scratch-
specific slave device on a multidrop or single-drop bus. pad memory and the DS18B20 returns to its low-power
Only the slave that exactly matches the 64-bit ROM code idle state. If the device is being used in parasite power
sequence will respond to the function command issued mode, within 10s (max) after this command is issued
by the master; all other slaves on the bus will wait for a the master must enable a strong pullup on the 1-Wire bus
reset pulse. for the duration of the conversion (tCONV) as described
Skip Rom [CCh] in the Powering the DS18B20 section. If the DS18B20 is
powered by an external supply, the master can issue read
The master can use this command to address all devices
time slots after the Convert T command and the DS18B20
on the bus simultaneously without sending out any ROM
will respond by transmitting a 0 while the temperature
code information. For example, the master can make all
conversion is in progress and a 1 when the conversion is
DS18B20s on the bus perform simultaneous temperature
done. In parasite power mode this notification technique
conversions by issuing a Skip ROM command followed by
cannot be used since the bus is pulled high by the strong
a Convert T [44h] command.
pullup during the conversion.
Note that the Read Scratchpad [BEh] command can
follow the Skip ROM command only if there is a single Write Scratchpad [4Eh]
slave device on the bus. In this case, time is saved by This command allows the master to write 3 bytes of data
allowing the master to read from the slave without send- to the DS18B20s scratchpad. The first data byte is written
ing the devices 64-bit ROM code. A Skip ROM command into the TH register (byte 2 of the scratchpad), the second
followed by a Read Scratchpad command will cause byte is written into the TL register (byte 3), and the third
a data collision on the bus if there is more than one byte is written into the configuration register (byte 4). Data
slave since multiple devices will attempt to transmit data must be transmitted least significant bit first. All three
simultaneously. bytes MUST be written before the master issues a reset,
or the data may be corrupted.
Alarm Search [ECh]
The operation of this command is identical to the operation Read Scratchpad [BEh]
of the Search ROM command except that only slaves with This command allows the master to read the contents of
a set alarm flag will respond. This command allows the the scratchpad. The data transfer starts with the least sig-
master device to determine if any DS18B20s experienced nificant bit of byte 0 and continues through the scratchpad
an alarm condition during the most recent temperature until the 9th byte (byte 8 CRC) is read. The master may
conversion. After every Alarm Search cycle (i.e., Alarm issue a reset to terminate reading at any time if only part
Search command followed by data exchange), the bus of the scratchpad data is needed.
iButton is a registered trademark of Maxim Integrated Products, Inc.
Copy Scratchpad [48h] following the Recall E2 command and the DS18B20 will
This command copies the contents of the scratchpad indicate the status of the recall by transmitting 0 while the
TH, TL and configuration registers (bytes 2, 3 and 4) to recall is in progress and 1 when the recall is done. The
EEPROM. If the device is being used in parasite power recall operation happens automatically at power-up, so
mode, within 10s (max) after this command is issued the valid data is available in the scratchpad as soon as power
master must enable a strong pullup on the 1-Wire bus for is applied to the device.
at least 10ms as described in the Powering the DS18B20 Read Power Supply [B4h]
section.
The master device issues this command followed by a
Recall E2 [B8h] read time slot to determine if any DS18B20s on the bus
This command recalls the alarm trigger values (TH and are using parasite power. During the read time slot, para-
TL) and configuration data from EEPROM and places the site powered DS18B20s will pull the bus low, and exter-
data in bytes 2, 3, and 4, respectively, in the scratchpad nally powered DS18B20s will let the bus remain high. See
memory. The master device can issue read time slots the Powering the DS18B20 section for usage information
for this command.
Y Y Y Y Y
N N N DEVICE(S) N
BIT 0 BIT 0
WITH ALARM
MATCH ? MATCH ?
FLAG SET ?
DS18B20 TX Y Y Y
FAMILY CODE 1
BYTE
DS18B20 Tx BIT 1
MASTER Tx
DS18B20 Tx BIT 1 DS18B20 Tx BIT 1
SERIAL NUMBER
MASTER Tx BIT 1
6 BYTES
DS18B20 Tx
BIT 1 N N BIT 1
CRC BYTE
MATCH? MATCH?
Y Y
DS18B20 Tx BIT 63
MASTER Tx
BIT 63 DS18B20 Tx BIT 63
MASTER Tx BIT 63
BIT 63 N N BIT 63
MATCH? MATCH?
Y Y
MASTER Tx FUNCTION
COMMAND (FIGURE 14)
Y Y
N PARASITE Y N PARASITE Y
POWER ? POWER ?
DS18B20 BEGINS
CONVERSION
MASTER ENABLES STRONG MASTER ENABLES STRONG
PULL-UP ON DQ PULL-UP ON DQ
DEVICE
N DS18B20 CONVERTS COPY IN N DATA COPIED FROM
CONVERTING
TEMPERATURE ?
TEMPERATURE PROGRESS ? SCRATCHPAD TO EEPROM
Y Y Y Y
MASTER BEGINS
N PARASITE Y DATA RECALL FROM MASTER Rx DATA
POWER ? E2 PROM BYTE FROM MASTER Tx TH BYTE TO
SCRATCHPAD SCRATCHPAD
MASTER MASTER
MASTER Tx TL BYTE TO
Rx 1s Rx 0s DEVICE BUSY N MASTER Tx Y
SCRATCHPAD
RECALLING RESET ?
DATA ?
MASTER Rx
SCRATCHPAD CRC
BYTE
RETURN TO INITIALIZATION
SEQUENCE (FIGURE 13)
FOR NEXT TRANSACTION
1-Wire BUS
GND
START START
OF SLOT OF SLOT
MASTER WRITE 0 SLOT
1s < TREC < MASTER WRITE 1 SLOT
60s < Tx 0 < 120s
1s
VPU
1-Wire BUS
GND
DS18B20 SAMPLES DS18B20 SAMPLES
MIN TYP MAX MIN TYP MAX
1-Wire BUS
GND
MASTER SAMPLES > 1s
MASTER SAMPLES
> 1s
15s 45s 15s
Read Time Slots read time slot, the DS18B20 will begin transmitting a 1
The DS18B20 can only transmit data to the master when or 0 on bus. The DS18B20 transmits a 1 by leaving the
the master issues read time slots. Therefore, the master bus high and transmits a 0 by pulling the bus low. When
must generate read time slots immediately after issuing transmitting a 0, the DS18B20 will release the bus by the
a Read Scratchpad [BEh] or Read Power Supply [B4h] end of the time slot, and the bus will be pulled back to
command, so that the DS18B20 can provide the request- its high idle state by the pullup resister. Output data from
ed data. In addition, the master can generate read time the DS18B20 is valid for 15s after the falling edge that
slots after issuing Convert T [44h] or Recall E2 [B8h] com- initiated the read time slot. Therefore, the master must
mands to find out the status of the operation as explained release the bus and then sample the bus state within
in the DS18B20 Function Commands section. 15s from the start of the slot.
All read time slots must be a minimum of 60s in duration Figure 17 illustrates that the sum of TINIT, TRC, and
with a minimum of a 1s recovery time between slots. A TSAMPLE must be less than 15s for a read time slot.
read time slot is initiated by the master device pulling the Figure 18 shows that system timing margin is maximized
1-Wire bus low for a minimum of 1s and then releasing by keeping TINIT and TRC as short as possible and by
the bus (see Figure 16). After the master initiates the locating the master sample time during read time slots
towards the end of the 15s period.
VPU
VIH OF MASTER
1-Wire BUS
GND
TINT > 1s TRC MASTER SAMPLES
15s
VPU
VIH OF MASTER
1-Wire BUS
GND
TINT = TRC =
SMALL SMALL MASTER SAMPLES
15s
Ordering Information
PART TEMP RANGE PIN-PACKAGE TOP MARK
DS18B20 -55C to +125C 3 TO-92 18B20
DS18B20+ -55C to +125C 3 TO-92 18B20
DS18B20/T&R -55C to +125C 3 TO-92 (2000 Piece) 18B20
DS18B20+T&R -55C to +125C 3 TO-92 (2000 Piece) 18B20
DS18B20-SL/T&R -55C to +125C 3 TO-92 (2000 Piece)* 18B20
DS18B20-SL+T&R -55C to +125C 3 TO-92 (2000 Piece)* 18B20
DS18B20U -55C to +125C 8 FSOP 18B20
DS18B20U+ -55C to +125C 8 FSOP 18B20
DS18B20U/T&R -55C to +125C 8 FSOP (3000 Piece) 18B20
DS18B20U+T&R -55C to +125C 8 FSOP (3000 Piece) 18B20
DS18B20Z -55C to +125C 8 SO DS18B20
DS18B20Z+ -55C to +125C 8 SO DS18B20
DS18B20Z/T&R -55C to +125C 8 SO (2500 Piece) DS18B20
DS18B20Z+T&R -55C to +125C 8 SO (2500 Piece) DS18B20
+Denotes a lead-free package. A + will appear on the top mark of lead-free packages.
T&R = Tape and reel.
*TO-92 packages in tape and reel can be ordered with straight or formed leads. Choose SL for straight leads. Bulk TO-92 orders
are straight leads only.
Revision History
REVISION PAGES
DESCRIPTION
DATE CHANGED
In the Absolute Maximum Ratings section, removed the reflow oven temperature value of +220C.
030107 19
Reference to JEDEC specification for reflow remains.
In the OperationAlarm Signaling section, added or equal to in the description for a TH alarm
5
condition
101207
In the Memory section, removed incorrect text describing memory. 7
In the Configuration Register section, removed incorrect text describing configuration register. 8
In the Ordering Information table, added TO-92 straight-lead packages and included a note that the
042208 2
TO-92 package in tape and reel can be ordered with either formed or straight leads.
1/15 Updated Benefits and Features section 1
For pricing, delivery, and ordering information, please contact Maxim Direct at 1-888-629-4642, or visit Maxim Integrateds website at www.maximintegrated.com.
Maxim Integrated cannot assume responsibility for use of any circuitry other than circuitry entirely embodied in a Maxim Integrated product. No circuit patent licenses
are implied. Maxim Integrated reserves the right to change the circuitry and specifications without notice at any time. The parametric values (min and max limits)
shown in the Electrical Characteristics table are guaranteed. Other parametric values quoted in this data sheet are provided for guidance.
Maxim Integrated and the Maxim Integrated logo are trademarks of Maxim Integrated Products, Inc. 2015 Maxim Integrated Products, Inc. 20
ANEXO 2 Hoja de datos sensor de luz
58
r TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
r
TAOS059N MARCH 2009
GND 3 4 SCL
Description PACKAGE FN
DUAL FLAT NO-LEAD
The TSL2560 and TSL2561 are light-to-digital (TOP VIEW)
converters that transform light intensity to a digital
signal output capable of direct I2C (TSL2561) or VDD 1 6 SDA
SMBus (TSL2560) interface. Each device com-
bines one broadband photodiode (visible plus ADDR SEL 2 5 INT
infrared) and one infrared-responding photodiode
GND 3 4 SCL
on a single CMOS integrated circuit capable of
providing a near-photopic response over an
effective 20-bit dynamic range (16-bit resolution).
PACKAGE CL
Two integrating ADCs convert the photodiode 6-LEAD ChipLED
currents to a digital output that represents the (TOP VIEW)
irradiance measured on each channel. This digital SDA 5 4 SCL
output can be input to a microprocessor where
illuminance (ambient light level) in lux is derived
using an empirical formula to approximate the INT 6 3 ADDR SEL
human eye response. The TSL2560 device
permits an SMB-Alert style interrupt, and the VDD 1 2 GND
TSL2561 device supports a traditional level style
interrupt that remains asserted until the firmware Package Drawings are Not to Scale
clears it.
While useful for general purpose light sensing applications, the TSL2560/61 devices are designed particularly
for display panels (LCD, OLED, etc.) with the purpose of extending battery life and providing optimum viewing
in diverse lighting conditions. Display panel backlighting, which can account for up to 30 to 40 percent of total
platform power, can be automatically managed. Both devices are also ideal for controlling keyboard illumination
based upon ambient lighting conditions. Illuminance information can further be used to manage exposure
control in digital cameras. The TSL2560/61 devices are ideal in notebook/tablet PCs, LCD monitors, flat-panel
televisions, cell phones, and digital cameras. In addition, other applications include street light control, security
lighting, sunlight harvesting, machine vision, and automotive instrumentation clusters.
Channel 0
Visible and IR Integrating
A/D Converter
Channel 1
VDD = 2.7 V to 3.5 V IR Only
Command ADC
ADDR SEL Address Select Interrupt INT
Register Register
SCL
Two-Wire Serial Interface
SDA
Detailed Description
The TSL2560 and TSL2561 are second-generation ambient light sensor devices. Each contains two integrating
analog-to-digital converters (ADC) that integrate currents from two photodiodes. Integration of both channels
occurs simultaneously. Upon completion of the conversion cycle, the conversion result is transferred to the
Channel 0 and Channel 1 data registers, respectively. The transfers are double-buffered to ensure that the
integrity of the data is maintained. After the transfer, the device automatically begins the next integration cycle.
Communication to the device is accomplished through a standard, two-wire SMBus or I2C serial bus.
Consequently, the TSL256x device can be easily connected to a microcontroller or embedded controller. No
external circuitry is required for signal conditioning, thereby saving PCB real estate as well. Since the output
of the TSL256x device is digital, the output is effectively immune to noise when compared to an analog signal.
The TSL256x devices also support an interrupt feature that simplifies and improves system efficiency by
eliminating the need to poll a sensor for a light intensity value. The primary purpose of the interrupt function is
to detect a meaningful change in light intensity. The concept of a meaningful change can be defined by the user
both in terms of light intensity and time, or persistence, of that change in intensity. The TSL256x devices have
the ability to define a threshold above and below the current light level. An interrupt is generated when the value
of a conversion exceeds either of these limits.
Available Options
DEVICE INTERFACE PACKAGE LEADS PACKAGE DESIGNATOR ORDERING NUMBER
TSL2560 SMBus Chipscale CS TSL2560CS
TSL2560 SMBus TMB-6 T TSL2560T
TSL2560 SMBus Dual Flat No-Lead 6 FN TSL2560FN
TSL2560 SMBus ChipLED-6 CL TSL2560CL
TSL2561 I2C Chipscale CS TSL2561CS
TSL2561 I2C TMB-6 T TSL2561T
TSL2561 I2C Dual Flat No-Lead 6 FN TSL2561FN
TSL2561 I2C ChipLED-6 CL TSL2561CL
r
2 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
Terminal Functions
TERMINAL
CS, T, FN CL TYPE DESCRIPTION
NAME PKG PKG
NO. NO.
ADDR SEL 2 3 I SMBus device select three-state
GND 3 2 Power supply ground. All voltages are referenced to GND.
INT 5 6 O Level or SMB Alert interrupt open drain.
SCL 4 4 I SMBus serial clock input terminal clock signal for SMBus serial data.
SDA 6 5 I/O SMBus serial data I/O terminal serial data I/O for SMBus.
VDD 1 1 Supply voltage.
Absolute Maximum Ratings over operating free-air temperature range (unless otherwise noted)
Supply voltage, VDD (see Note 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8 V
Digital output voltage range, VO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.5 V to 3.8 V
Digital output current, IO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 mA to 20 mA
Storage temperature range, Tstg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40C to 85C
ESD tolerance, human body model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2000 V
Stresses beyond those listed under absolute maximum ratings may cause permanent damage to the device. These are stress ratings only, and
functional operation of the device at these or any other conditions beyond those indicated under recommended operating conditions is not
implied. Exposure to absolute-maximum-rated conditions for extended periods may affect device reliability.
NOTE 1: All voltages are with respect to GND.
r
www.taosinc.com 3
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
Operating Characteristics, High Gain (16), VDD = 3 V, TA = 25C, (unless otherwise noted) (see
Notes 2, 3, 4, 5)
TSL2560T, FN, & CL
TSL2560CS, TSL2561CS
PARAMETER TEST CONDITIONS CHANNEL TSL2561T, FN & CL UNIT
MIN TYP MAX MIN TYP MAX
fosc Oscillator frequency 690 735 780 690 735 780 kHz
Ch0 0 4 0 4
Dark ADC count value Ee = 0
0, Tint = 402 ms counts
Ch1 0 4 0 4
Ch0 65535 65535
Tint > 178 ms
Ch1 65535 65535
Full scale ADC count Ch0 37177 37177
Tint = 101 ms counts
value (Note 6) Ch1 37177 37177
Ch0 5047 5047
Tint = 13.7
13 7 ms
Ch1 5047 5047
p = 640 nm, Tint = 101 ms Ch0 750 1000 1250
Ee = 36.3 W/cm2 Ch1 200
counts
p = 940 nm, Tint = 101 ms Ch0 700 1000 1300
Ee = 119 W/cm2 Ch1 820
ADC count value
p = 640 nm, Tint = 101 ms Ch0 750 1000 1250
Ee = 41 W/cm2 Ch1 190
counts
p = 940 nm, Tint = 101 ms Ch0 700 1000 1300
Ee = 135 W/cm2 Ch1 850
ADC countt value
l ratio:
ti p = 640 nm,
nm Tint = 101 ms 0 15
0.15 0 20
0.20 0.25
0 25 0.14
0 14 0 19
0.19 0.24
0 24
Ch1/Ch0 p = 940 nm,
nm Tint = 101 ms 0 69
0.69 0 82
0.82 0.95
0 95 0.70
0 70 0 85
0.85 1
Ch0 27.5 24.4
p = 640 nm,
nm Tint = 101 ms counts/
Ch1 5.5 4.6
Re Irradiance responsivity (W/
Ch0 8.4 7.4 cm2)
p = 940 nm,
nm Tint = 101 ms
Ch1 6.9 6.3
Fluorescent light source: Ch0 36 35
Tint = 402 ms Ch1 4 3.8 counts/
Rv Illuminance responsivity
Incandescent light source: Ch0 144 129 lux
Tint = 402 ms Ch1 72 67
Fluorescent light source:
0.11 0.11
ADC count value ratio: Tint = 402 ms
Ch1/Ch0 Incandescent light source:
05
0.5 0 52
0.52
Tint = 402 ms
Fluorescent light source: Ch0 2.3 2.2
Illuminance responsivity, Tint = 402 ms Ch1 0.25 0.24 counts/
Rv
low gain mode (Note 7) Incandescent light source: Ch0 9 8.1 lux
Tint = 402 ms Ch1 4.5 4.2
Fluorescent light source:
(Sensor Lux) / 0.65 1 1.35 0.65 1 1.35
Tint = 402 ms
(actual Lux),
Lux) high gain
mode (Note 8) Incandescent light source:
0.60 1 1.40 0.60 1 1.40
Tint = 402 ms
r
4 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
NOTES: 2. Optical measurements are made using small-angle incident radiation from light-emitting diode optical sources. Visible 640 nm LEDs
and infrared 940 nm LEDs are used for final product testing for compatibility with high-volume production.
3. The 640 nm irradiance Ee is supplied by an AlInGaP light-emitting diode with the following characteristics: peak wavelength
p = 640 nm and spectral halfwidth = 17 nm.
4. The 940 nm irradiance Ee is supplied by a GaAs light-emitting diode with the following characteristics: peak wavelength
p = 940 nm and spectral halfwidth = 40 nm.
5. Integration time Tint, is dependent on internal oscillator frequency (fosc) and on the integration field value in the timing register as
described in the Register Set section. For nominal fosc = 735 kHz, nominal Tint = (number of clock cycles)/fosc.
Field value 00: Tint = (11 918)/fosc = 13.7 ms
Field value 01: Tint = (81 918)/fosc = 101 ms
Field value 10: Tint = (322 918)/fosc = 402 ms
Scaling between integration times vary proportionally as follows: 11/322 = 0.034 (field value 00), 81/322 = 0.252 (field value 01),
and 322/322 = 1 (field value 10).
6. Full scale ADC count value is limited by the fact that there is a maximum of one count per two oscillator frequency periods and also
by a 2-count offset.
Full scale ADC count value = ((number of clock cycles)/2 2)
Field value 00: Full scale ADC count value = ((11 918)/2 2) = 5047
Field value 01: Full scale ADC count value = ((81 918)/2 2) = 37177
Field value 10: Full scale ADC count value = 65535, which is limited by 16 bit register. This full scale ADC count value is reached
for 131074 clock cycles, which occurs for Tint = 178 ms for nominal fosc = 735 kHz.
7. Low gain mode has 16 lower gain than high gain mode: (1/16 = 0.0625).
8. The sensor Lux is calculated using the empirical formula shown on p. 22 of this data sheet based on measured Ch0 and Ch1 ADC
count values for the light source specified. Actual Lux is obtained with a commercial luxmeter. The range of the (sensor Lux) / (actual
Lux) ratio is estimated based on the variation of the 640 nm and 940 nm optical parameters. Devices are not 100% tested with
fluorescent or incandescent light sources.
r
www.taosinc.com 5
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
r
6 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
VIH
SCL
VIL
VIH
SDA
VIL
P S S P
Stop Start Start Stop
Condition Condition t(LOWSEXT)
SCLACK SCLACK
t(LOWMEXT) t(LOWMEXT) t(LOWMEXT)
SCL
SDA
1 9 1 9
SCL
SDA A6 A5 A4 A3 A2 A1 A0 R/W D7 D6 D5 D4 D3 D2 D1 D0
1 9 1 9
SCL
SDA A6 A5 A4 A3 A2 A1 A0 R/W D7 D6 D5 D4 D3 D2 D1 D0
r
www.taosinc.com 7
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
TYPICAL CHARACTERISTICS
SPECTRAL RESPONSIVITY
0.8
Channel 0
Normalized Responsivity
Photodiode
0.6
0.4
0.2
Channel 1
Photodiode
0
300 400 500 600 700 800 900 1000 1100
Wavelength nm
Figure 4
0.8 0.8
Normalized Responsivity
Normalized Responsivity
Optical Axis
Optical Axis
0.6 0.6
0.4 0.4
0.2 0.2
0 0
90 60 30 0 30 60 90 90 60 30 0 30 60 90
Angular Displacement Angular Displacement
Figure 5 Figure 6
r
8 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
0.8 0.8
Normalized Responsivity
Normalized Responsivity
Optical Axis
Optical Axis
0.6 0.6
0.4 0.4
0.2 0.2
0 0
90 60 30 0 30 60 90 90 60 30 0 30 60 90
Angular Displacement Angular Displacement
Figure 7 Figure 8
r
www.taosinc.com 9
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
PRINCIPLES OF OPERATION
Analog-to-Digital Converter
The TSL256x contains two integrating analog-to-digital converters (ADC) that integrate the currents from the
channel 0 and channel 1 photodiodes. Integration of both channels occurs simultaneously, and upon completion
of the conversion cycle the conversion result is transferred to the channel 0 and channel 1 data registers,
respectively. The transfers are double buffered to ensure that invalid data is not read during the transfer. After
the transfer, the device automatically begins the next integration cycle.
Digital Interface
Interface and control of the TSL256x is accomplished through a two-wire serial interface to a set of registers
that provide access to device control functions and output data. The serial interface is compatible with System
Management Bus (SMBus) versions 1.1 and 2.0, and I2C bus Fast-Mode. The TSL256x offers three slave
addresses that are selectable via an external pin (ADDR SEL). The slave address options are shown in Table 1.
NOTE: The Slave and SMB Alert Addresses are 7 bits. Please note the SMBus and I2C protocols on pages 9 through 12. A read/write bit should
be appended to the slave address by the master device to properly communicate with the TSL256X device.
The TSL256X implements the following protocols of the Philips Semiconductor I2C specification:
D I2C Write Protocol
D I2C Read (Combined Format) Protocol
r
10 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
When an SMBus Block Write or Block Read is initiated (see description of COMMAND Register), the byte
following the COMMAND byte is ignored but is a requirement of the SMBus specification. This field contains
the byte count (i.e. the number of bytes to be transferred). The TSL2560 (SMBus) device ignores this field and
extracts this information by counting the actual number of bytes transferred before the Stop condition is
detected.
When an I2C Write or I2C Read (Combined Format) is initiated, the byte count is also ignored but follows the
SMBus protocol specification. Data bytes continue to be transferred from the TSL2561 (I2C) device to Master
until a NACK is sent by the Master.
The data formats supported by the TSL2560 and TSL2561 devices are:
D Master transmitter transmits to slave receiver (SMBus and I2C):
The transfer direction in this case is not changed.
D Master reads slave immediately after the first byte (SMBus only):
At the moment of the first acknowledgment (provided by the slave receiver) the master transmitter
becomes a master receiver and the slave receiver becomes a slave transmitter.
D Combined format (SMBus and I2C):
During a change of direction within a transfer, the master repeats both a START condition and the slave
address but with the R/W bit reversed. In this case, the master receiver terminates the transfer by
generating a NACK on the last byte of the transfer and a STOP condition.
For a complete description of SMBus protocols, please review the SMBus Specification at
http://www.smbus.org/specs. For a complete description of I2C protocols, please review the I2C Specification
at http://www.semiconductors.philips.com.
1 7 1 1 8 1 1
S Slave Address Wr A Data Byte A P
X X
P Stop Condition
S Start Condition
X Shown under a field indicates that that field is required to have a value of X
Master-to-Slave
Slave-to-Master
r
www.taosinc.com 11
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
1 7 1 1 8 1 1
S Slave Address Wr A Data Byte A P
1 7 1 1 8 1 1
S Slave Address Rd A Data Byte A P
1
1 7 1 1 8 1 8 1 1
S Slave Address Wr A Command Code A Data Byte A P
1 7 1 1 8 1 1 7 1 1 8 1 1
S Slave Address Wr A Command Code A S Slave Address Rd A Data Byte Low A P
1 7 1 1 8 1 8 1 8 1 1
S Slave Address Wr A Command Code A Data Byte Low A Data Byte High A P
1 7 1 1 8 1 1 7 1 1 8 1
S Slave Address Wr A Command Code A S Slave Address Rd A Data Byte Low A ...
8 1 1
Data Byte High A P
r
12 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
1 7 1 1 8 1 8 1 8 1
S Slave Address Wr A Command Code A Byte Count = N A Data Byte 1 A ...
8 1 8 1 1
Data Byte 2 A ... Data Byte N A P
1 7 1 1 8 1 1 7 1 1 8 1
S Slave Address Wr A Command Code A Sr Slave Address Rd A Byte Count = N A ...
8 1 8 1 8 1 1
Data Byte 1 A Data Byte 2 A ... Data Byte N A P
Figure 17. SMBus Block Read or I2C Read (Combined Format) Protocols
NOTE: The I2C read protocol does not use the Byte Count packet, and the Master will continue receiving Data Bytes until the Master initiates
a Stop Condition. See the Command Register on page 13 for additional information regarding the Block Read/Write protocol.
Register Set
The TSL256x is controlled and monitored by sixteen registers (three are reserved) and a command register
accessed through the serial interface. These registers provide for a variety of control functions and can be read
to determine results of the ADC conversions. The register set is summarized in Table 2.
The mechanics of accessing a specific register depends on the specific SMB protocol used. Refer to the section
on SMBus protocols. In general, the COMMAND register is written first to specify the specific control/status
register for following read/write operations.
r
www.taosinc.com 13
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
Command Register
The command register specifies the address of the target register for subsequent read and write operations.
The Send Byte protocol is used to configure the COMMAND register. The command register contains eight bits
as described in Table 3. The command register defaults to 00h at power on.
7 6 5 4 3 2 1 0
Reset Value: 0 0 0 0 0 0 0 0
NOTE: An I2C block transaction will continue until the Master sends a stop condition. See Figure 16 and Figure 17. Unlike the I2C protocol, the
SMBus read/write protocol requires a Byte Count. All four ADC Channel Data Registers (Ch through Fh) can be read simultaneously in
a single SMBus transaction. This is the only 32-bit data block supported by the TSL2560 SMBus protocol. The BLOCK bit must be set
to 1, and a read condition should be initiated with a COMMAND CODE of 9Bh. By using a COMMAND CODE of 9Bh during an SMBus
Block Read Protocol, the TSL2560 device will automatically insert the appropriate Byte Count (Byte Count = 4) as illustrated in Figure 17.
A write condition should not be used in conjunction with the Bh register.
7 6 5 4 3 2 1 0
Reset Value: 0 0 0 0 0 0 0 0
r
14 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
7 6 5 4 3 2 1 0
Reset Value: 0 0 0 0 0 0 1 0
Integration time is dependent on the INTEG FIELD VALUE and the internal clock frequency. Nominal integration
times and respective scaling between integration times scale proportionally as shown in Table 6. See Note 5
and Note 6 on page 5 for detailed information regarding how the scale values were obtained; see page 22 for
further information on how to calculate lux.
The manual timing control feature is used to manually start and stop the integration time period. If a particular
integration time period is required that is not listed in Table 6, then this feature can be used. For example, the
manual timing control can be used to synchronize the TSL256x device with an external light source (e.g. LED).
A start command to begin integration can be initiated by writing a 1 to this bit field. Correspondingly, the
integration can be stopped by simply writing a 0 to the same bit field.
r
www.taosinc.com 15
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
NOTE: Since two 8-bit values are combined for a single 16-bit value for each of the high and low interrupt thresholds, the Send Byte protocol should
not be used to write to these registers. Any values transferred by the Send Byte protocol with the MSB set would be interpreted as the
COMMAND field and stored as an address for subsequent read/write operations and not as the interrupt threshold information as desired.
The Write Word protocol should be used to write byte-paired registers. For example, the THRESHLOWLOW and THRESHLOWHIGH
registers (as well as the THRESHHIGHLOW and THRESHHIGHHIGH registers) can be written together to set the 16-bit ADC value in
a single transaction.
7 6 5 4 3 2 1 0
Reset Value: 0 0 0 0 0 0 0 0
r
16 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
NOTE: Field value of 11 may be used to test interrupt connectivity in a system or to assist in debugging interrupt service routine software.
ID Register (Ah)
The ID register provides the value for both the part number and silicon revision number for that part number.
It is a read-only register, whose value never changes.
7 6 5 4 3 2 1 0
Ah PARTNO REVNO ID
Reset Value:
r
www.taosinc.com 17
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
The upper byte data registers can only be read following a read to the corresponding lower byte register. When
the lower byte register is read, the upper eight bits are strobed into a shadow register, which is read by a
subsequent read to the upper byte. The upper register will read the correct value even if additional ADC
integration cycles end between the reading of the lower and upper registers.
NOTE: The Read Word protocol can be used to read byte-paired registers. For example, the DATA0LOW and DATA0HIGH registers (as well as
the DATA1LOW and DATA1HIGH registers) may be read together to obtain the 16-bit ADC value in a single transaction
r
18 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
Basic Operation
After applying VDD, the device will initially be in the power-down state. To operate the device, issue a command
to access the CONTROL register followed by the data value 03h to power up the device. At this point, both ADC
channels will begin a conversion at the default integration time of 400 ms. After 400 ms, the conversion results
will be available in the DATA0 and DATA1 registers. Use the following pseudo code to read the data registers:
//Address the Ch0 lower data register and configure for Read Word
Command = 0xAC //Set Command bit and Word bit
//Address the Ch1 lower data register and configure for Read Word
Command = 0xAE //Set bit fields 7 and 5
r
www.taosinc.com 19
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
//Stop integrating
Data = 0x03
WriteByte(Address, Command, Data)
r
20 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
Interrupts
The interrupt feature of the TSL256x device simplifies and improves system efficiency by eliminating the need
to poll the sensor for a light intensity value. Interrupt styles are determined by the INTR field in the Interrupt
Register. The interrupt feature may be disabled by writing a field value of 00h to the Interrupt Control Register
so that polling can be performed.
The versatility of the interrupt feature provides many options for interrupt configuration and usage. The primary
purpose of the interrupt function is to provide a meaningful change in light intensity. However, it also be used
as an end-of-conversion signal. The concept of a meaningful change can be defined by the user both in terms
of light intensity and time, or persistence, of that change in intensity. The TSL256x device implements two
16-bit-wide interrupt threshold registers that allow the user to define a threshold above and below the current
light level. An interrupt will then be generated when the value of a conversion exceeds either of these limits. For
simplicity of programming, the threshold comparison is accomplished only with Channel 0. This simplifies
calculation of thresholds that are based, for example, on a percent of the current light level. It is adequate to
use only one channel when calculating light intensity differences since, for a given light source, the channel 0
and channel 1 values are linearly proportional to each other and thus both values scale linearly with light
intensity.
To further control when an interrupt occurs, the TSL256x device provides an interrupt persistence feature. This
feature allows the user to specify a number of conversion cycles for which a light intensity exceeding either
interrupt threshold must persist before actually generating an interrupt. This can be used to prevent transient
changes in light intensity from generating an unwanted interrupt. With a value of 1, an interrupt occurs
immediately whenever either threshold is exceeded. With values of N, where N can range from 2 to 15, N
consecutive conversions must result in values outside the interrupt window for an interrupt to be generated. For
example, if N is equal to 10 and the integration time is 402 ms, then an interrupt will not be generated unless
the light level persists for more than 4 seconds outside the threshold.
Two different interrupt styles are available: Level and SMBus Alert. The difference between these two interrupt
styles is how they are cleared. Both result in the interrupt line going active low and remaining low until the
interrupt is cleared. A level style interrupt is cleared by setting the CLEAR bit (bit 6) in the COMMAND register.
The SMBus Alert style interrupt is cleared by an Alert Response as described in the Interrupt Control Register
section and SMBus specification.
To configure the interrupt as an end-of-conversion signal, the interrupt PERSIST field is set to 0. Either Level
or SMBus Alert style can be used. An interrupt will be generated upon completion of each conversion. The
interrupt threshold registers are ignored. The following example illustrates the configuration of a level interrupt:
r
www.taosinc.com 21
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
The following example pseudo code illustrates the configuration of an SMB Alert style interrupt when the light
intensity changes 20% from the current value, and persists for 3 conversion cycles:
//Enable interrupt
Command = 0x86 //Address interrupt register
Data = 0x23 //SMBAlert style, PERSIST = 3
WriteByte(Address, Command, Data)
In order to generate an interrupt on demand during system test or debug, a test mode (INTR = 11) can be used.
The following example illustrates how to generate an interrupt on demand:
// Generate an interrupt
Address = 0x39 //Slave addr also 0x29 or 0x49
Command = 0x86 //Address Interrupt register
Data = 0x30 //Test interrupt
WriteByte(Address, Command, Data)
r
22 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
Calculating Lux
The TSL256x is intended for use in ambient light detection applications such as display backlight control, where
adjustments are made to display brightness or contrast based on the brightness of the ambient light, as
perceived by the human eye. Conventional silicon detectors respond strongly to infrared light, which the human
eye does not see. This can lead to significant error when the infrared content of the ambient light is high, such
as with incandescent lighting, due to the difference between the silicon detector response and the brightness
perceived by the human eye.
This problem is overcome in the TSL256x through the use of two photodiodes. One of the photodiodes
(channel 0) is sensitive to both visible and infrared light, while the second photodiode (channel 1) is sensitive
primarily to infrared light. An integrating ADC converts the photodiode currents to digital outputs. Channel 1
digital output is used to compensate for the effect of the infrared component of light on the channel 0 digital
output. The ADC digital outputs from the two channels are used in a formula to obtain a value that approximates
the human eye response in the commonly used Illuminance unit of Lux:
CS Package
For 0 < CH1/CH0 0.52 Lux = 0.0315 CH0 0.0593 CH0 ((CH1/CH0)1.4)
For 0.52 < CH1/CH0 0.65 Lux = 0.0229 CH0 0.0291 CH1
For 0.65 < CH1/CH0 0.80 Lux = 0.0157 CH0 0.0180 CH1
For 0.80 < CH1/CH0 1.30 Lux = 0.00338 CH0 0.00260 CH1
For CH1/CH0 > 1.30 Lux = 0
The formulas shown above were obtained by optical testing with fluorescent and incandescent light sources,
and apply only to open-air applications. Optical apertures (e.g. light pipes) will affect the incident light on the
device.
extern unsigned int CalculateLux(unsigned int iGain, unsigned int tInt, unsigned int
ch0, unsigned int ch1, int iType)
r
www.taosinc.com 23
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
//****************************************************************************
//
// Copyright E 20042005 TAOS, Inc.
//
// THIS CODE AND INFORMATION IS PROVIDED AS IS WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Module Name:
// lux.cpp
//
//****************************************************************************
//
// Integration time scaling factors
//
//
// T, FN, and CL Package coefficients
//
// For Ch1/Ch0=0.00 to 0.50
// Lux/Ch0=0.03040.062*((Ch1/Ch0)^1.4)
// piecewise approximation
// For Ch1/Ch0=0.00 to 0.125:
// Lux/Ch0=0.03040.0272*(Ch1/Ch0)
//
// For Ch1/Ch0=0.125 to 0.250:
// Lux/Ch0=0.03250.0440*(Ch1/Ch0)
//
// For Ch1/Ch0=0.250 to 0.375:
// Lux/Ch0=0.03510.0544*(Ch1/Ch0)
//
// For Ch1/Ch0=0.375 to 0.50:
// Lux/Ch0=0.03810.0624*(Ch1/Ch0)
//
// For Ch1/Ch0=0.50 to 0.61:
// Lux/Ch0=0.02240.031*(Ch1/Ch0)
//
// For Ch1/Ch0=0.61 to 0.80:
// Lux/Ch0=0.01280.0153*(Ch1/Ch0)
//
// For Ch1/Ch0=0.80 to 1.30:
// Lux/Ch0=0.001460.00112*(Ch1/Ch0)
//
// For Ch1/Ch0>1.3:
// Lux/Ch0=0
//
#define K1T 0x0040 // 0.125 * 2^RATIO_SCALE
#define B1T 0x01f2 // 0.0304 * 2^LUX_SCALE
#define M1T 0x01be // 0.0272 * 2^LUX_SCALE
r
24 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
//
// CS package coefficients
//
// For 0 <= Ch1/Ch0 <= 0.52
// Lux/Ch0 = 0.03150.0593*((Ch1/Ch0)^1.4)
// piecewise approximation
// For 0 <= Ch1/Ch0 <= 0.13
// Lux/Ch0 = 0.03150.0262*(Ch1/Ch0)
// For 0.13 <= Ch1/Ch0 <= 0.26
// Lux/Ch0 = 0.03370.0430*(Ch1/Ch0)
// For 0.26 <= Ch1/Ch0 <= 0.39
// Lux/Ch0 = 0.03630.0529*(Ch1/Ch0)
// For 0.39 <= Ch1/Ch0 <= 0.52
// Lux/Ch0 = 0.03920.0605*(Ch1/Ch0)
// For 0.52 < Ch1/Ch0 <= 0.65
// Lux/Ch0 = 0.02290.0291*(Ch1/Ch0)
// For 0.65 < Ch1/Ch0 <= 0.80
// Lux/Ch0 = 0.001570.00180*(Ch1/Ch0)
// For 0.80 < Ch1/Ch0 <= 1.30
// Lux/Ch0 = 0.003380.00260*(Ch1/Ch0)
// For Ch1/Ch0 > 1.30
// Lux = 0
//
#define K1C 0x0043 // 0.130 * 2^RATIO_SCALE
#define B1C 0x0204 // 0.0315 * 2^LUX_SCALE
#define M1C 0x01ad // 0.0262 * 2^LUX_SCALE
r
www.taosinc.com 25
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
//
// first, scale the channel values depending on the gain and integration time
// 16X, 402mS is nominal.
// scale if integration time is NOT 402 msec
unsigned long chScale;
unsigned long channel1;
unsigned long channel0;
switch (tInt)
{
case 0: // 13.7 msec
chScale = CHSCALE_TINT0;
break;
case 1: // 101 msec
chScale = CHSCALE_TINT1;
break;
default: // assume no scaling
chScale = (1 << CH_SCALE);
r
26 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
break;
}
r
www.taosinc.com 27
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
return(lux);
r
28 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
VBUS VDD
0.1 F
TSL2560/
RP RP RPI TSL2561
INT
SCL
SDA
Pull-up resistors (Rp) maintain the SDAH and SCLH lines at a high level when the bus is free and ensure the
signals are pulled up from a low to a high level within the required rise time. For a complete description of the
SMBus maximum and minimum Rp values, please review the SMBus Specification at
http://www.smbus.org/specs. For a complete description of I2C maximum and minimum Rp values, please
review the I2C Specification at http://www.semiconductors.philips.com.
A pull-up resistor (RPI) is also required for the interrupt (INT), which functions as a wired-AND signal in a similar
fashion to the SCL and SDA lines. A typical impedance value between 10 k and 100 k can be used. Please
note that while Figure 18 shows INT being pulled up to VDD, the interrupt can optionally be pulled up to VBUS.
r
www.taosinc.com 29
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
3.80
0.90 0.90
0.25
0.70
2.60 0.70
0.70
0.50
0.50
6 0.21
0.50
r
30 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
2.90
1.30 1.30
0.40
0.65
1.70
0.65
0.40
1.30
0.43
0.40
0.65
0.40
0.70 0.70
r
www.taosinc.com 31
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
MECHANICAL DATA
PACKAGE CS Six-Lead Chipscale Device
TOP VIEW
PIN OUT
BOTTOM VIEW
1398
6 1
5 2
171
203 4 3
465
400 50
700 55
375 30
6 210 30
500
1750
500
Pb
375 30 500
Lead Free
NOTES: A. All linear dimensions are in micrometers. Dimension tolerance is 25 m unless otherwise noted.
B. Solder bumps are formed of Sn (96.5%), Ag (3%), and Cu (0.5%).
C. The top of the photodiode active area is 410 m below the top surface of the package.
D. The layer above the photodiode is glass and epoxy with an index of refraction of 1.53.
E. This drawing is subject to change without notice.
r
32 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
MECHANICAL DATA
PIN 1
R 0.20
2.60 6 Pls
PIN 4
3.80
Photo-Active Area
END VIEW
0.88
1.35
0.50
BOTTOM VIEW
0.90
TYP 0.90 TYP
0.60
TYP
0.30
TYP
Pb
0.30
TYP Lead Free
NOTES: A. All linear dimensions are in millimeters. Dimension tolerance is 0.20 mm unless otherwise noted.
B. The photo-active area is 1398 m by 203 m.
C. Package top surface is molded with an electrically nonconductive clear plastic compound having an index of refraction of 1.55.
D. Contact finish is 0.5 m minimum of soft gold plated over a 18 m thick copper foil pattern with a 5 m to 9 m nickel barrier.
E. The underside of the package includes copper traces used to connect the pads during package substrate fabrication. Accordingly,
exposed traces and vias should not be placed under the footprint of the TMB package in a PCB layout.
F. This package contains no lead (Pb).
G. This drawing is subject to change without notice.
Figure 24. Package T Six-Lead TMB Plastic Surface Mount Packaging Configuration
r
www.taosinc.com 33
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
MECHANICAL DATA
PACKAGE FN Dual Flat No-Lead
TOP VIEW
PIN OUT
TOP VIEW
PIN 1
VDD 1 6 DATA
2000 75
ADR 2 5 INT
GND 3 4 CLK
2000
75
Photo-Active Area
650 50
203 8
Seating Plane 650
300
BOTTOM VIEW 50
PIN 1
Pb
750 150 Lead Free
NOTES: A. All linear dimensions are in micrometers. Dimension tolerance is 20 m unless otherwise noted.
B. The photo-active area is 1398 m by 203 m.
C. Package top surface is molded with an electrically nonconductive clear plastic compound having an index of refraction of 1.55.
D. Contact finish is copper alloy A194 with pre-plated NiPdAu lead finish.
E. This package contains no lead (Pb).
F. This drawing is subject to change without notice.
r
34 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
MECHANICAL DATA
0.35 5 4
2.20 0.70 6 3
Pin 1 Marker
1.05
0.35 1 2
0.55 Photo-Active Area
SIDE VIEW
2 0.30
0.55
0.18
BOTTOM VIEW
6 0.65
4 0.35
6 R 0.18
Pb
Lead Free
NOTES: A. All linear dimensions are in millimeters. Dimension tolerance is 0.20 mm unless otherwise noted.
B. The photo-active area is 1398 m by 203 m.
C. Package top surface is molded with an electrically nonconductive clear plastic compound having an index of refraction of 1.55.
D. Contact finish is 0.1 m (minimum) to 1.0 m (maximum) of soft gold plated over a 15 m (minimum) to 30 m (maximum) thick
copper foil pattern with a 3 m (minimum) to 15 m (maximum) nickel barrier.
E. This package contains no lead (Pb).
F. This drawing is subject to change without notice.
Figure 26. Package CL Six-Lead ChipLED Plastic Surface Mount Packaging Configuration
r
www.taosinc.com 35
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
MECHANICAL DATA
TOP VIEW
B
+ 0.30
8.00
0.10
3.50 0.05
0.60
0.05
A A B
DETAIL A DETAIL B
5 Max 5 Max
0.250
1.35 0.05 0.02 1.85 0.05 0.97 0.05
Ao Bo Ko
NOTES: A. All linear dimensions are in millimeters. Dimension tolerance is 0.10 mm unless otherwise noted.
B. The dimensions on this drawing are for illustrative purposes only. Dimensions of an actual carrier may vary slightly.
C. Symbols on drawing Ao, Bo, and Ko are defined in ANSI EIA Standard 481B 2001.
D. Each reel is 178 millimeters in diameter and contains 3500 parts.
E. TAOS packaging tape and reel conform to the requirements of EIA Standard 481B.
F. In accordance with EIA standard, device pin 1 is located next to the sprocket holes in the tape.
G. This drawing is subject to change without notice.
r
36 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
MECHANICAL DATA
SIDE VIEW
5.50
0.100
1.50 R 0.20 TYP B A A
DETAIL B
DETAIL A
2.90 0.100 Ao
3.09 MAX
R 0.20 TYP
R 0.20 TYP
4.29 MAX
4.10 0.100 Bo
1.80 Ko
r
www.taosinc.com 37
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
MECHANICAL DATA
TOP VIEW
B
+ 0.30
8.00
0.10
3.50 0.05
1.00
0.25
A A B
DETAIL A DETAIL B
5 Max 5 Max
0.254
2.18 0.05 0.02 0.83 0.05 2.18 0.05
Ao Ko Bo
NOTES: H. All linear dimensions are in millimeters. Dimension tolerance is 0.10 mm unless otherwise noted.
I. The dimensions on this drawing are for illustrative purposes only. Dimensions of an actual carrier may vary slightly.
J. Symbols on drawing Ao, Bo, and Ko are defined in ANSI EIA Standard 481B 2001.
K. Each reel is 178 millimeters in diameter and contains 3500 parts.
L. TAOS packaging tape and reel conform to the requirements of EIA Standard 481B.
M. In accordance with EIA standard, device pin 1 is located next to the sprocket holes in the tape.
N. This drawing is subject to change without notice.
r
38 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
MECHANICAL DATA
TOP VIEW
B
8.0 0.2
3.50 0.05
1.00
A A B
DETAIL A DETAIL B
5 Max 5 Max
0.20
2.4 0.05 2.9 0.7
Ao Bo Ko
NOTES: A. All linear dimensions are in millimeters. Dimension tolerance is 0.10 mm unless otherwise noted.
B. The dimensions on this drawing are for illustrative purposes only. Dimensions of an actual carrier may vary slightly.
C. Symbols on drawing Ao, Bo, and Ko are defined in ANSI EIA Standard 481B 2001.
D. Each reel is 178 millimeters in diameter and contains 2500 parts.
E. TAOS packaging tape and reel conform to the requirements of EIA Standard 481B.
F. In accordance with EIA standard, device pin 1 is located next to the sprocket holes in the tape.
G. This drawing is subject to change without notice.
r
www.taosinc.com 39
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
MANUFACTURING INFORMATION
The CS, T, FN, and CL packages have been tested and have demonstrated an ability to be reflow soldered to
a PCB substrate. The process, equipment, and materials used in these test are detailed below.
The solder reflow profile describes the expected maximum heat exposure of components during the solder
reflow process of product on a PCB. Temperature is measured on top of component. The components should
be limited to a maximum of three passes through this solder reflow profile.
T2
T1
Temperature (C)
Time (sec) t3
t2
tsoak t1
r
40 www.taosinc.com
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
MANUFACTURING INFORMATION
Moisture Sensitivity
Optical characteristics of the device can be adversely affected during the soldering process by the release and
vaporization of moisture that has been previously absorbed into the package molding compound. To ensure the
package molding compound contains the smallest amount of absorbed moisture possible, each device is
dry-baked prior to being packed for shipping. Devices are packed in a sealed aluminized envelope with silica
gel to protect them from ambient moisture during shipping, handling, and storage before use.
The CS package has been assigned a moisture sensitivity level of MSL 2 and the devices should be stored under
the following conditions:
Temperature Range 5C to 50C
Relative Humidity 60% maximum
Floor Life 1 year out of bag at ambient < 30C / 60% RH
Rebaking will be required if the aluminized envelope has been open for more than 1 year. If rebaking is required,
it should be done at 90C for 3 hours.
The T, FN, and CL packages have been assigned a moisture sensitivity level of MSL 3 and the devices should
be stored under the following conditions:
Temperature Range 5C to 50C
Relative Humidity 60% maximum
Total Time 6 months from the date code on the aluminized envelope if unopened
Opened Time 168 hours or fewer
Rebaking will be required if the devices have been stored unopened for more than 6 months or if the aluminized
envelope has been open for more than 168 hours. If rebaking is required, it should be done at 90C for 4 hours.
r
www.taosinc.com 41
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N MARCH 2009
PRODUCTION DATA information in this document is current at publication date. Products conform to
specifications in accordance with the terms of Texas Advanced Optoelectronic Solutions, Inc. standard
warranty. Production processing does not necessarily include testing of all parameters.
Green (RoHS & no Sb/Br) TAOS defines Green to mean Pb-Free (RoHS compatible), and free of Bromine (Br) and
Antimony (Sb) based flame retardants (Br or Sb do not exceed 0.1% by weight in homogeneous material).
Important Information and Disclaimer The information provided in this statement represents TAOS knowledge and
belief as of the date that it is provided. TAOS bases its knowledge and belief on information provided by third parties,
and makes no representation or warranty as to the accuracy of such information. Efforts are underway to better integrate
information from third parties. TAOS has taken and continues to take reasonable steps to provide representative
and accurate information but may not have conducted destructive testing or chemical analysis on incoming materials and
chemicals. TAOS and TAOS suppliers consider certain information to be proprietary, and thus CAS numbers and other
limited information may not be available for release.
NOTICE
Texas Advanced Optoelectronic Solutions, Inc. (TAOS) reserves the right to make changes to the products contained in this
document to improve performance or for any other purpose, or to discontinue them without notice. Customers are advised
to contact TAOS to obtain the latest product information before placing orders or designing TAOS products into systems.
TAOS assumes no responsibility for the use of any products or circuits described in this document or customer product
design, conveys no license, either expressed or implied, under any patent or other right, and makes no representation that
the circuits are free of patent infringement. TAOS further makes no claim as to the suitability of its products for any particular
purpose, nor does TAOS assume any liability arising out of the use of any product or circuit, and specifically disclaims any
and all liability, including without limitation consequential or incidental damages.
TEXAS ADVANCED OPTOELECTRONIC SOLUTIONS, INC. PRODUCTS ARE NOT DESIGNED OR INTENDED FOR
USE IN CRITICAL APPLICATIONS IN WHICH THE FAILURE OR MALFUNCTION OF THE TAOS PRODUCT MAY
RESULT IN PERSONAL INJURY OR DEATH. USE OF TAOS PRODUCTS IN LIFE SUPPORT SYSTEMS IS EXPRESSLY
UNAUTHORIZED AND ANY SUCH USE BY A CUSTOMER IS COMPLETELY AT THE CUSTOMERS RISK.
LUMENOLOGY, TAOS, the TAOS logo, and Texas Advanced Optoelectronic Solutions are registered trademarks of Texas Advanced
Optoelectronic Solutions Incorporated.
r
42 www.taosinc.com
ANEXO 3 Hoja de datos modulo WIFI USR-WIFI232T
59
ANEXO 4 Hoja de datos modulo WIFI USR-WIFI232B
60