SlideShare une entreprise Scribd logo
1  sur  23
Samuel de Ancos Martín – 3 de Abril 2014
@sdeancos – sdeancos@gmail.com
Internet Of Things
y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
¿Quien Soy?
Samuel de Ancos Martín
Senior Software Developer en carriots.com
@sdeancos
http://www.deancos.com
sdeancos@gmail.com
11
¿Y que quiero contaros?
1.- Internet Of Things
2.- Raspberry Pi
Ejemplo Practico
3.- Mundo Real
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
IoT
22
Internet Of Things
Aunque es un concepto discutido desde principios de los 90, fue en
1999 Kevin Ashton quien propuso el nombre Internet Of Things
durante sus investigaciones sobre RFID en el MIT.
Cofundador AUTO-ID Center – Estandarización global RFID.
¿Todo conectado?
Umm... ¡IoT!
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
33
Internet Of Things
El IoT es el mundo en el que cada objeto tiene una identidad
virtual propia y capacidad potencial para integrarse e
interactuar de manera independiente en la Red con cualquier
otro individuo, ya sea una máquina (M2M) o un humano.
Aunque es un concepto discutido desde principios de los 90, fue en
1999 Kevin Ashton quien propuso el nombre Internet Of Things
durante sus investigaciones sobre RFID en el MIT.
¿Que define?
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
44
Internet Of Things
Historia de Internet
Hace 20 años Últimos 10 años Hacia donde vamos
Información
Social
Things
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
55
Internet Of Things
El número de cosas conectadas a internet sobrepasó en 2008 el
número de habitantes del planeta. Se estima que habrá 50.000
millones de dispositivos conectados en 2020.
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
66
Internet Of Things
¿Por que ahora?
✔ Placas de HW libre
✔ Abaratamiento de sensores
✔ Mejora en las comunicaciones
✔ Plataformas de Internet Of Things
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
77
¿Y que tiene que ver todo
esto con RaspberryPi?
¡Vamos a crear nuestro
Thing con RaspberryPi y
un pequeño circuito!
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
88
Raspberry Pi
Raspberry Pi es un ordenador de placa reducida o (placa única) (SBC) de 
bajo  costo,  creado  por  la  Fundación  Raspberry  Pi,  con  el  objetivo  de 
estimular la enseñanza de ciencias de la computación en las escuelas.
­ Wikipedia
IoT
Platform
Sms / EmailStream
Logic
Sistema de Alarma casero
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
99
Creando una sistema de alarma
casero con Raspberry Pi e Internet
1.- Diseño de circuito
2.- Implementación software
3.- Interactuando con Internet
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
1010
Diseño de circuito
La receta
1 x Raspberry Pi.
1 x Protoboard.
1 x Resistencia. (200 KΩ – 10 KΩ)
1 x Foto Sensor.
1 x Condensador. (1uF)
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
1111
Implementación Software
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
#-*-coding:utf8-*-
from RPi import GPIO
from time import mktime, sleep
from datetime import datetime
from Client import Client
DEVICE = "YOUR DEVICE's ID_DEVELOPER HERE"
API_KEY = "YOUR API_KEY HERE"
LDR_LIMIT = 600
PI_PIN = 4
def rc_time():
measurement = 0
GPIO.setup(PI_PIN, GPIO.OUT)
GPIO.output(PI_PIN, GPIO.LOW)
sleep(0.1)
GPIO.setup(PI_PIN, GPIO.IN)
while GPIO.input(PI_PIN) == GPIO.LOW:
measurement += 1
return measurement
def main():
GPIO.setmode(GPIO.BCM)
lights = 'OFF'
client = Client(API_KEY)
while True:
timestamp = int(mktime(datetime.utcnow().timetuple()))
if rc_time() > LDR_LIMIT:
new_lights = 'OFF'
print "Lights OFF"
else:
new_lights = 'ON'
print "Lights ON"
if lights is not new_lights:
lights = new_lights
data = {"protocol": "v2",
"device": DEVICE,
"at": timestamp,
"data": {"light": lights}}
response = client.send(data)
print response.read()
if __name__ == '__main__':
main()
1212
Plataforma IoT
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
¿Que es una plataforma de Internet Of Things?
Es una plataforma diseñada diseñada para proyectos del
Internet de las Cosas (IoT) y de Máquina a Máquina (M2M)
Conecta dispositivos a Internet e Internet a los dispositivos
INTERNET
1313
Plataforma IoT
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
¿Que nos aporta?
Recopilación y almacenamiento de datos
Construcción de aplicaciones en la nube
Despliegue de prototipos y proyectos reales
EN LA NUBE
ALMACEN DE DATOS
LOGICA
1414
Plataforma IoT
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
1515
Plataforma IoT
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
1616
Plataforma IoT
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
1717
Implementación Software
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
#-*-coding:utf8-*-
from json import dumps
from urllib2 import urlopen, Request
class Client (object):
api_url = "http://api.carriots.com/streams"
def __init__(self, api_key=None):
self.api_key = api_key
self.content_type = "application/vnd.carriots.api.v2+json"
self.headers = {'User-Agent': 'Raspberry-Carriots',
'Content-Type': self.content_type,
'Accept': self.content_type,
'Carriots.apikey': self.api_key}
self.data = None
def send(self, data):
self.data = dumps(data)
request = Request(Client.api_url, self.data, self.headers)
response = urlopen(request)
return response
1818
DEMO
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
Mundo Real
Beer Flowmeter
1919
Lectura y almacenamiento
en tiempo real de caudal
de cerveza
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
Mundo Real
Prototipo
SmartCity
Varias decenas
de sensores
RaspberryPi
Como gateway
2020
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
Mundo Real
Stuffed IoT Toy
Muñeco conectado.
Puede interactuar con la nube:
- Twitter
- Dropbox
- Habla
- Video
2121
https://www.carriots.com/cool_project/domokun_iot_example_internet_stuffed_toy
Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi
Samuel de Ancos Martín @sdeancos 
sdeancos@gmail.com
¿Preguntas?
2222

Contenu connexe

Dernier

clases de porcinos generales de porcinos
clases de porcinos generales de porcinosclases de porcinos generales de porcinos
clases de porcinos generales de porcinos
DayanaCarolinaAP
 
LA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdf
LA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdfLA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdf
LA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdf
bcondort
 
04. Sistema de fuerzas equivalentes II - UCV 2024 II.pdf
04. Sistema de fuerzas equivalentes II - UCV 2024 II.pdf04. Sistema de fuerzas equivalentes II - UCV 2024 II.pdf
04. Sistema de fuerzas equivalentes II - UCV 2024 II.pdf
CristhianZetaNima
 

Dernier (20)

clases de porcinos generales de porcinos
clases de porcinos generales de porcinosclases de porcinos generales de porcinos
clases de porcinos generales de porcinos
 
Principales aportes de la carrera de William Edwards Deming
Principales aportes de la carrera de William Edwards DemingPrincipales aportes de la carrera de William Edwards Deming
Principales aportes de la carrera de William Edwards Deming
 
LA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdf
LA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdfLA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdf
LA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdf
 
04. Sistema de fuerzas equivalentes II - UCV 2024 II.pdf
04. Sistema de fuerzas equivalentes II - UCV 2024 II.pdf04. Sistema de fuerzas equivalentes II - UCV 2024 II.pdf
04. Sistema de fuerzas equivalentes II - UCV 2024 II.pdf
 
Ejemplos de cadenas de Markov - Ejercicios
Ejemplos de cadenas de Markov - EjerciciosEjemplos de cadenas de Markov - Ejercicios
Ejemplos de cadenas de Markov - Ejercicios
 
Voladura Controlada Sobrexcavación (como se lleva a cabo una voladura)
Voladura Controlada  Sobrexcavación (como se lleva a cabo una voladura)Voladura Controlada  Sobrexcavación (como se lleva a cabo una voladura)
Voladura Controlada Sobrexcavación (como se lleva a cabo una voladura)
 
Obras paralizadas en el sector construcción
Obras paralizadas en el sector construcciónObras paralizadas en el sector construcción
Obras paralizadas en el sector construcción
 
Falla de san andres y el gran cañon : enfoque integral
Falla de san andres y el gran cañon : enfoque integralFalla de san andres y el gran cañon : enfoque integral
Falla de san andres y el gran cañon : enfoque integral
 
CARGAS VIVAS Y CARGAS MUERTASEXPOCI.pptx
CARGAS VIVAS Y CARGAS MUERTASEXPOCI.pptxCARGAS VIVAS Y CARGAS MUERTASEXPOCI.pptx
CARGAS VIVAS Y CARGAS MUERTASEXPOCI.pptx
 
hitos del desarrollo psicomotor en niños.docx
hitos del desarrollo psicomotor en niños.docxhitos del desarrollo psicomotor en niños.docx
hitos del desarrollo psicomotor en niños.docx
 
TEXTO UNICO DE LA LEY-DE-CONTRATACIONES-ESTADO.pdf
TEXTO UNICO DE LA LEY-DE-CONTRATACIONES-ESTADO.pdfTEXTO UNICO DE LA LEY-DE-CONTRATACIONES-ESTADO.pdf
TEXTO UNICO DE LA LEY-DE-CONTRATACIONES-ESTADO.pdf
 
tema05 estabilidad en barras mecanicas.pdf
tema05 estabilidad en barras mecanicas.pdftema05 estabilidad en barras mecanicas.pdf
tema05 estabilidad en barras mecanicas.pdf
 
introducción a las comunicaciones satelitales
introducción a las comunicaciones satelitalesintroducción a las comunicaciones satelitales
introducción a las comunicaciones satelitales
 
ECONOMIA APLICADA SEMANA 555555555555555555.pdf
ECONOMIA APLICADA SEMANA 555555555555555555.pdfECONOMIA APLICADA SEMANA 555555555555555555.pdf
ECONOMIA APLICADA SEMANA 555555555555555555.pdf
 
Quimica Raymond Chang 12va Edicion___pdf
Quimica Raymond Chang 12va Edicion___pdfQuimica Raymond Chang 12va Edicion___pdf
Quimica Raymond Chang 12va Edicion___pdf
 
Propuesta para la creación de un Centro de Innovación para la Refundación ...
Propuesta para la creación de un Centro de Innovación para la Refundación ...Propuesta para la creación de un Centro de Innovación para la Refundación ...
Propuesta para la creación de un Centro de Innovación para la Refundación ...
 
UNIDAD 3 ELECTRODOS.pptx para biopotenciales
UNIDAD 3 ELECTRODOS.pptx para biopotencialesUNIDAD 3 ELECTRODOS.pptx para biopotenciales
UNIDAD 3 ELECTRODOS.pptx para biopotenciales
 
Clase 7 MECÁNICA DE FLUIDOS 2 INGENIERIA CIVIL
Clase 7 MECÁNICA DE FLUIDOS 2 INGENIERIA CIVILClase 7 MECÁNICA DE FLUIDOS 2 INGENIERIA CIVIL
Clase 7 MECÁNICA DE FLUIDOS 2 INGENIERIA CIVIL
 
Comite Operativo Ciberseguridad 012020.pptx
Comite Operativo Ciberseguridad 012020.pptxComite Operativo Ciberseguridad 012020.pptx
Comite Operativo Ciberseguridad 012020.pptx
 
ARBOL DE CAUSAS ANA INVESTIGACION DE ACC.ppt
ARBOL DE CAUSAS ANA INVESTIGACION DE ACC.pptARBOL DE CAUSAS ANA INVESTIGACION DE ACC.ppt
ARBOL DE CAUSAS ANA INVESTIGACION DE ACC.ppt
 

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

En vedette (20)

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

Presentación Internet Of Things + Raspberry Pi decharlas14

  • 1. Samuel de Ancos Martín – 3 de Abril 2014 @sdeancos – sdeancos@gmail.com Internet Of Things y RaspberryPi
  • 2. Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi ¿Quien Soy? Samuel de Ancos Martín Senior Software Developer en carriots.com @sdeancos http://www.deancos.com sdeancos@gmail.com 11
  • 3. ¿Y que quiero contaros? 1.- Internet Of Things 2.- Raspberry Pi Ejemplo Practico 3.- Mundo Real Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com IoT 22
  • 4. Internet Of Things Aunque es un concepto discutido desde principios de los 90, fue en 1999 Kevin Ashton quien propuso el nombre Internet Of Things durante sus investigaciones sobre RFID en el MIT. Cofundador AUTO-ID Center – Estandarización global RFID. ¿Todo conectado? Umm... ¡IoT! Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com 33
  • 5. Internet Of Things El IoT es el mundo en el que cada objeto tiene una identidad virtual propia y capacidad potencial para integrarse e interactuar de manera independiente en la Red con cualquier otro individuo, ya sea una máquina (M2M) o un humano. Aunque es un concepto discutido desde principios de los 90, fue en 1999 Kevin Ashton quien propuso el nombre Internet Of Things durante sus investigaciones sobre RFID en el MIT. ¿Que define? Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com 44
  • 6. Internet Of Things Historia de Internet Hace 20 años Últimos 10 años Hacia donde vamos Información Social Things Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com 55
  • 7. Internet Of Things El número de cosas conectadas a internet sobrepasó en 2008 el número de habitantes del planeta. Se estima que habrá 50.000 millones de dispositivos conectados en 2020. Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com 66
  • 8. Internet Of Things ¿Por que ahora? ✔ Placas de HW libre ✔ Abaratamiento de sensores ✔ Mejora en las comunicaciones ✔ Plataformas de Internet Of Things Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com 77
  • 9. ¿Y que tiene que ver todo esto con RaspberryPi? ¡Vamos a crear nuestro Thing con RaspberryPi y un pequeño circuito! Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com 88
  • 10. Raspberry Pi Raspberry Pi es un ordenador de placa reducida o (placa única) (SBC) de  bajo  costo,  creado  por  la  Fundación  Raspberry  Pi,  con  el  objetivo  de  estimular la enseñanza de ciencias de la computación en las escuelas. ­ Wikipedia IoT Platform Sms / EmailStream Logic Sistema de Alarma casero Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com 99
  • 11. Creando una sistema de alarma casero con Raspberry Pi e Internet 1.- Diseño de circuito 2.- Implementación software 3.- Interactuando con Internet Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com 1010
  • 12. Diseño de circuito La receta 1 x Raspberry Pi. 1 x Protoboard. 1 x Resistencia. (200 KΩ – 10 KΩ) 1 x Foto Sensor. 1 x Condensador. (1uF) Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com 1111
  • 13. Implementación Software Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com #-*-coding:utf8-*- from RPi import GPIO from time import mktime, sleep from datetime import datetime from Client import Client DEVICE = "YOUR DEVICE's ID_DEVELOPER HERE" API_KEY = "YOUR API_KEY HERE" LDR_LIMIT = 600 PI_PIN = 4 def rc_time(): measurement = 0 GPIO.setup(PI_PIN, GPIO.OUT) GPIO.output(PI_PIN, GPIO.LOW) sleep(0.1) GPIO.setup(PI_PIN, GPIO.IN) while GPIO.input(PI_PIN) == GPIO.LOW: measurement += 1 return measurement def main(): GPIO.setmode(GPIO.BCM) lights = 'OFF' client = Client(API_KEY) while True: timestamp = int(mktime(datetime.utcnow().timetuple())) if rc_time() > LDR_LIMIT: new_lights = 'OFF' print "Lights OFF" else: new_lights = 'ON' print "Lights ON" if lights is not new_lights: lights = new_lights data = {"protocol": "v2", "device": DEVICE, "at": timestamp, "data": {"light": lights}} response = client.send(data) print response.read() if __name__ == '__main__': main() 1212
  • 14. Plataforma IoT Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com ¿Que es una plataforma de Internet Of Things? Es una plataforma diseñada diseñada para proyectos del Internet de las Cosas (IoT) y de Máquina a Máquina (M2M) Conecta dispositivos a Internet e Internet a los dispositivos INTERNET 1313
  • 15. Plataforma IoT Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com ¿Que nos aporta? Recopilación y almacenamiento de datos Construcción de aplicaciones en la nube Despliegue de prototipos y proyectos reales EN LA NUBE ALMACEN DE DATOS LOGICA 1414
  • 16. Plataforma IoT Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com 1515
  • 17. Plataforma IoT Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com 1616
  • 18. Plataforma IoT Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com 1717
  • 19. Implementación Software Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com #-*-coding:utf8-*- from json import dumps from urllib2 import urlopen, Request class Client (object): api_url = "http://api.carriots.com/streams" def __init__(self, api_key=None): self.api_key = api_key self.content_type = "application/vnd.carriots.api.v2+json" self.headers = {'User-Agent': 'Raspberry-Carriots', 'Content-Type': self.content_type, 'Accept': self.content_type, 'Carriots.apikey': self.api_key} self.data = None def send(self, data): self.data = dumps(data) request = Request(Client.api_url, self.data, self.headers) response = urlopen(request) return response 1818 DEMO
  • 20. Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com Mundo Real Beer Flowmeter 1919 Lectura y almacenamiento en tiempo real de caudal de cerveza
  • 21. Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com Mundo Real Prototipo SmartCity Varias decenas de sensores RaspberryPi Como gateway 2020
  • 22. Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com Mundo Real Stuffed IoT Toy Muñeco conectado. Puede interactuar con la nube: - Twitter - Dropbox - Habla - Video 2121 https://www.carriots.com/cool_project/domokun_iot_example_internet_stuffed_toy
  • 23. Internet Of Things y RaspberryPiInternet Of Things y RaspberryPi Samuel de Ancos Martín @sdeancos  sdeancos@gmail.com ¿Preguntas? 2222