SlideShare a Scribd company logo
1 of 35
Download to read offline
DIY
Home Smart Lighting
System with Micropython
August 26th, 2018 - By Tegar Imansyah
Hello!
I am Tegar Imansyah
IoT Enthusiast Enthusiast
You can find me at @tegarimansyah
2
Today’s Agenda
● What is Smart Lighting System?
● Electronics Part
● Connecting Device
● Controlling from Worldwide
3
What is it?
We will learn What is the difference of Smart Lighting System, Smart
Home and IoT.
1
What is it?
5
Source: https://blogs.intel.com/iot/2015/04/01/all-for-one-and-one-
for-all-how-the-iot-is-centralizing-intelligence-across-industries/
Source:
http://condorestates.co.uk/featured/smart-homes-ready-or-not/
Why you
Need it?
It is cool!
Make your life easier
Save our earth
6
Why not
Implement it?
Spend Extra Money!
You have no time to DIY.
7
Electronics Part
Let’s start with the first set of technical slides
2
● No Undo
● Unseen
● Broken =
Start from
Beginning
9
“ Even your code is perfect, if you are not
sure with your circuit, and your code will
not works properly
--
Tegar, 2018
10
Lighting Control - Conventional Way
11
What We Will Do
12
WEMOS d1 Mini
Based on ESp8266
80Mhz Proc
32KB RAM
Programmable
GPIO
AC 220 / 110 V DC 3.3V
Relay
13
What We Will Do
MicroPython
14
● Python programming language that is optimised to run on
microcontrollers.
● Created by Damien P. George at 2013
● Learn more https://micropython.org/
● Micropython is Installed on your microcontroller instead of
your computer
● Support REPL, Run from file and standalone.
Getting Started (on Ubuntu)
15
● Install Tools = [ esptools.py, Adafruit MicroPython Tool (ampy),
Serial Terminal ]
● Download images (http://micropython.org/download#esp8266)
● Install
○ Plug in microcontroller to your computer
○ $ esptool.py --port /dev/ttyUSB0 erase_flash
○ $ esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash
--flash_size=detect 0 esp8266-20170108-v1.8.7.bin
Getting Started (on Ubuntu)
16
● Open Serial
Terminal
● REPL active
if not blocked
Getting Started (on Ubuntu)
17
● Files on MicroPython
○ $ export AMPY_PORT=/dev/ttyUSB0
○ $ ampy run main.py # run main.py from computer in microcontroller
○ $ ampy ls # Checking file(s) on microcontroller
○ $ ampy put main.py # copy main.py from computer
● Hierarchy:
○ boot.py
○ main.py (if exist)
○ REPL
import machine - Turn On or Off
18
NeoPixel as a Table Lamp
19
Connecting Device
Connecting to the outside world
3
Connecting to WiFi
21
Connecting to Cloud Service
22
MQTT - Most Popular Pub-Sub for IoT
23
Brokertable-lamp
room-lamp
subscribe
table-lamp
subscribe
room-lamp
subscribe table-lamp
subscribe room-lamp
subscribe table-lamp
subscribe room-lamp
MQTT - Most Popular Pub-Sub for IoT
24
Brokertable-lamp
room-lamp
publish table-lamp (255,0,0)
receive table-lamp (255,0,0)
receive table-lamp (255,0,0)
Adafruit IO Topic Format
25
YOUR_USERNAME/feeds/bedroom.table-lamp
YOUR_USERNAME/feeds/bedroom.room-lamp
Receiving Data in Microcontroller
26
Receiving Data in Microcontroller
27
Apply Data to Lamp
28
Controlling from
Worldwide
The Cool Part starts here
4
IFTTT
30
IFTTT
31
Dialog Flow
32
Future Works
● Make Your Own
● Design your favourite case
● Use it for your daily
● Be creative
33
What Next?
● WiFi Setup Over The Air - Using Pico Web
● Digital Input - Physical Button
● Sensor Input (ADC, UART, I2C, etc) - Light Sensor,
PIR Sensor, Infrared Sensor
● Actuator Output (PWM) - Electrical Motor, Servo,
etc
34
35
Thanks!
Any questions?
You can find me at @tegarimansyah
Get slide and code:
https://github.com/tegarimansyah/presentation/tree/PyCon-MY-2018

More Related Content

Similar to DIY Home Smart Lighting System with Micropython - PyCon MY 2018

IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
David Fowler
 
Workshop on IoT and Basic Home Automation_BAIUST.pptx
Workshop on IoT and Basic Home Automation_BAIUST.pptxWorkshop on IoT and Basic Home Automation_BAIUST.pptx
Workshop on IoT and Basic Home Automation_BAIUST.pptx
Redwan Ferdous
 

Similar to DIY Home Smart Lighting System with Micropython - PyCon MY 2018 (20)

Neo900: Crafting The Private Phone
Neo900: Crafting The Private PhoneNeo900: Crafting The Private Phone
Neo900: Crafting The Private Phone
 
What is being exposed from IoT Devices
What is being exposed from IoT DevicesWhat is being exposed from IoT Devices
What is being exposed from IoT Devices
 
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
 
Workshop on IoT and Basic Home Automation_BAIUST.pptx
Workshop on IoT and Basic Home Automation_BAIUST.pptxWorkshop on IoT and Basic Home Automation_BAIUST.pptx
Workshop on IoT and Basic Home Automation_BAIUST.pptx
 
WET BOT (Cleaning Robot)
WET BOT (Cleaning Robot)WET BOT (Cleaning Robot)
WET BOT (Cleaning Robot)
 
Room 3 - 4 - Lê Quang Hiếu - How to be a cool dad: Leverage DIY Home Automati...
Room 3 - 4 - Lê Quang Hiếu - How to be a cool dad: Leverage DIY Home Automati...Room 3 - 4 - Lê Quang Hiếu - How to be a cool dad: Leverage DIY Home Automati...
Room 3 - 4 - Lê Quang Hiếu - How to be a cool dad: Leverage DIY Home Automati...
 
Python on pi
Python on piPython on pi
Python on pi
 
IoT: LoRa and Java on the PI
IoT: LoRa and Java on the PIIoT: LoRa and Java on the PI
IoT: LoRa and Java on the PI
 
Choose your dev platform
Choose your dev platformChoose your dev platform
Choose your dev platform
 
Esp8266 Arduino Projects List -Use Arduino for Projects.pdf
Esp8266 Arduino Projects List -Use Arduino for Projects.pdfEsp8266 Arduino Projects List -Use Arduino for Projects.pdf
Esp8266 Arduino Projects List -Use Arduino for Projects.pdf
 
UC18NA-D3D202-Dianomic-IZoratti-Introduction-To-FogLAMP.pdf
UC18NA-D3D202-Dianomic-IZoratti-Introduction-To-FogLAMP.pdfUC18NA-D3D202-Dianomic-IZoratti-Introduction-To-FogLAMP.pdf
UC18NA-D3D202-Dianomic-IZoratti-Introduction-To-FogLAMP.pdf
 
Free Mobile - when Android is not enough
Free Mobile - when Android is not enoughFree Mobile - when Android is not enough
Free Mobile - when Android is not enough
 
Pipenv - The Python Companion You Wish You Always Had
Pipenv - The Python Companion You Wish You Always HadPipenv - The Python Companion You Wish You Always Had
Pipenv - The Python Companion You Wish You Always Had
 
IoT Programmable Block
IoT Programmable BlockIoT Programmable Block
IoT Programmable Block
 
Raspberry Pi Introductory Lecture
Raspberry Pi Introductory LectureRaspberry Pi Introductory Lecture
Raspberry Pi Introductory Lecture
 
Micro Python で組み込み Python
Micro Python で組み込み PythonMicro Python で組み込み Python
Micro Python で組み込み Python
 
Programando o ESP8266 com Python
Programando o ESP8266 com PythonProgramando o ESP8266 com Python
Programando o ESP8266 com Python
 
Combining Machine Learning with Physical Computing - June 2023
Combining Machine Learning with Physical Computing - June 2023Combining Machine Learning with Physical Computing - June 2023
Combining Machine Learning with Physical Computing - June 2023
 
assignment 2_socket
assignment 2_socketassignment 2_socket
assignment 2_socket
 
Uvais
Uvais Uvais
Uvais
 

More from Tegar Imansyah

More from Tegar Imansyah (8)

Walkthrough google cloud platform
Walkthrough google cloud platformWalkthrough google cloud platform
Walkthrough google cloud platform
 
Lessons Learned for Internet of Things for Students
Lessons Learned for Internet of Things for StudentsLessons Learned for Internet of Things for Students
Lessons Learned for Internet of Things for Students
 
Lessons learned for internet of things
Lessons learned for internet of thingsLessons learned for internet of things
Lessons learned for internet of things
 
From localhost to the cloud: A Journey of Deployments
From localhost to the cloud: A Journey of DeploymentsFrom localhost to the cloud: A Journey of Deployments
From localhost to the cloud: A Journey of Deployments
 
Technology for Your Business
Technology for Your BusinessTechnology for Your Business
Technology for Your Business
 
Understanding IoT with Cloud IoT Core
Understanding IoT with Cloud IoT CoreUnderstanding IoT with Cloud IoT Core
Understanding IoT with Cloud IoT Core
 
Google Assistant - GDG Surabaya DevFest 2018
Google Assistant - GDG Surabaya DevFest 2018Google Assistant - GDG Surabaya DevFest 2018
Google Assistant - GDG Surabaya DevFest 2018
 
Understanding IoT Data Protocol - PyCon ID 2018
Understanding IoT Data Protocol - PyCon ID 2018Understanding IoT Data Protocol - PyCon ID 2018
Understanding IoT Data Protocol - PyCon ID 2018
 

Recently uploaded

Recently uploaded (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 

DIY Home Smart Lighting System with Micropython - PyCon MY 2018

  • 1. DIY Home Smart Lighting System with Micropython August 26th, 2018 - By Tegar Imansyah
  • 2. Hello! I am Tegar Imansyah IoT Enthusiast Enthusiast You can find me at @tegarimansyah 2
  • 3. Today’s Agenda ● What is Smart Lighting System? ● Electronics Part ● Connecting Device ● Controlling from Worldwide 3
  • 4. What is it? We will learn What is the difference of Smart Lighting System, Smart Home and IoT. 1
  • 5. What is it? 5 Source: https://blogs.intel.com/iot/2015/04/01/all-for-one-and-one- for-all-how-the-iot-is-centralizing-intelligence-across-industries/ Source: http://condorestates.co.uk/featured/smart-homes-ready-or-not/
  • 6. Why you Need it? It is cool! Make your life easier Save our earth 6
  • 7. Why not Implement it? Spend Extra Money! You have no time to DIY. 7
  • 8. Electronics Part Let’s start with the first set of technical slides 2
  • 9. ● No Undo ● Unseen ● Broken = Start from Beginning 9
  • 10. “ Even your code is perfect, if you are not sure with your circuit, and your code will not works properly -- Tegar, 2018 10
  • 11. Lighting Control - Conventional Way 11
  • 12. What We Will Do 12 WEMOS d1 Mini Based on ESp8266 80Mhz Proc 32KB RAM Programmable GPIO AC 220 / 110 V DC 3.3V Relay
  • 14. MicroPython 14 ● Python programming language that is optimised to run on microcontrollers. ● Created by Damien P. George at 2013 ● Learn more https://micropython.org/ ● Micropython is Installed on your microcontroller instead of your computer ● Support REPL, Run from file and standalone.
  • 15. Getting Started (on Ubuntu) 15 ● Install Tools = [ esptools.py, Adafruit MicroPython Tool (ampy), Serial Terminal ] ● Download images (http://micropython.org/download#esp8266) ● Install ○ Plug in microcontroller to your computer ○ $ esptool.py --port /dev/ttyUSB0 erase_flash ○ $ esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20170108-v1.8.7.bin
  • 16. Getting Started (on Ubuntu) 16 ● Open Serial Terminal ● REPL active if not blocked
  • 17. Getting Started (on Ubuntu) 17 ● Files on MicroPython ○ $ export AMPY_PORT=/dev/ttyUSB0 ○ $ ampy run main.py # run main.py from computer in microcontroller ○ $ ampy ls # Checking file(s) on microcontroller ○ $ ampy put main.py # copy main.py from computer ● Hierarchy: ○ boot.py ○ main.py (if exist) ○ REPL
  • 18. import machine - Turn On or Off 18
  • 19. NeoPixel as a Table Lamp 19
  • 20. Connecting Device Connecting to the outside world 3
  • 22. Connecting to Cloud Service 22
  • 23. MQTT - Most Popular Pub-Sub for IoT 23 Brokertable-lamp room-lamp subscribe table-lamp subscribe room-lamp subscribe table-lamp subscribe room-lamp subscribe table-lamp subscribe room-lamp
  • 24. MQTT - Most Popular Pub-Sub for IoT 24 Brokertable-lamp room-lamp publish table-lamp (255,0,0) receive table-lamp (255,0,0) receive table-lamp (255,0,0)
  • 25. Adafruit IO Topic Format 25 YOUR_USERNAME/feeds/bedroom.table-lamp YOUR_USERNAME/feeds/bedroom.room-lamp
  • 26. Receiving Data in Microcontroller 26
  • 27. Receiving Data in Microcontroller 27
  • 28. Apply Data to Lamp 28
  • 33. Future Works ● Make Your Own ● Design your favourite case ● Use it for your daily ● Be creative 33
  • 34. What Next? ● WiFi Setup Over The Air - Using Pico Web ● Digital Input - Physical Button ● Sensor Input (ADC, UART, I2C, etc) - Light Sensor, PIR Sensor, Infrared Sensor ● Actuator Output (PWM) - Electrical Motor, Servo, etc 34
  • 35. 35 Thanks! Any questions? You can find me at @tegarimansyah Get slide and code: https://github.com/tegarimansyah/presentation/tree/PyCon-MY-2018