際際滷

際際滷Share a Scribd company logo
Internet Of Things and Use Cases:
Tech Talk Session
By: Nashet Ali
KSS Session and Tech Talk-2019 on IOT.pptx
KSS Session and Tech Talk-2019 on IOT.pptx
KSS Session and Tech Talk-2019 on IOT.pptx
KSS Session and Tech Talk-2019 on IOT.pptx
KSS Session and Tech Talk-2019 on IOT.pptx
KSS Session and Tech Talk-2019 on IOT.pptx
KSS Session and Tech Talk-2019 on IOT.pptx
KSS Session and Tech Talk-2019 on IOT.pptx
KSS Session and Tech Talk-2019 on IOT.pptx
IoT  Simple Demo
MQTT
AWS
IoT
Write
Static S3
Site
Read
SMS
Amazon
CloudFront
Android Things
KSS Session and Tech Talk-2019 on IOT.pptx
Operating System
- Customized version of Android OS
- announced at Google I/O 2015, codename: Brillo
- based on Android 7.0+ (currently 8.0+)
- kiosk mode
- theoretically supports devices with 64 MB RAM
- Bluetooth Low Energy support*
- custom Launcher for IoT configuration
- Single application mode
automatically boots into main application
* Feb 2018 - Android Things is still in beta
Operating System
- Customized version of Android OS
- light version Google Play Services
- no app store - apps installed via ROM updates
- drivers for peripheral devices
Operating System
Android Things
Thinned down Android OS with a custom
launcher and KIOSK mode
ROM updates
- Google generates initial image
- Handles update integrity/signing verification
- OTA updates
- Automatically reverts
previous version if update fails
Operating System
* display is entirely optional
Hardware
- SOM architecture
- Base board + certified modules
- Custom hardware through pins/connectors/serials
SOM - System-on-a-chip
SiP - System-in-package (stacked SOMs)
- Easy certification (CE - EU declaration of conformity)
Supported platforms
Android vs Android Things
- There is no Play Store
- Users cannot install apps on their own
- App updates provided with OTA updates
- No system application drawer
- No notifications
- UI is optional
Smart home
Firebase cloud:
 fast
 callbacks
 All mobile platforms
support -
iOS/Android/
Android Things
Preparation
- SDCard min. 4 GB
- Raspberry PI ver. 3
- AC adapter
ROM flashing
- Prepare custom ROM from
Android Things Developer Console
Development
- Android Things is open source (still in preview)
link
No need to compile custom ROM & custom launcher
In most cases we only need to develop application
& services
However, we can do that by cloning:
repo init -u https://android.googlesource.com/platform/manifest -b
android-o-iot-preview-5
repo sync
Development
- If no display is available - screen mirroring from Android
e.g. Vysor link
- No emulator is provided at this stage (preview)
- UI can be developed as a regular Android app
android:required="false"
Development
- Steep learning curve
(easy for a mobile-developer)
- Use usual Android UI, libraries & tools
- Kotlin / RxJava etc.
- Apps developed in
Android Studio
- Built-in security
Development - ADB over Wifi
Find raspberry ip address:
Development - Permissions / Wifi
- Permissions are granted at app boot
(no Android 6.0+ runtime permission support)
- Usually you need to restart the device after adding a new
permission
- After connecting to a WiFi network - AT reconnects that network on
boot
You need to restart the device if WiFi network is unavailable on
device boot (or go to AT launcher)
Development - GPIO pins
private fun turnOnDiodeVoltage() {
val peripheralService = PeripheralManagerService()
try {
val mLedGpio = peripheralService.openGpio("BCM18")
mLedGpio?.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW)
mLedGpio?.value = true
} catch (e: IOException) {
Log.e("THINGS", "Error on PeripheralIO", e)
}
}
Development - Firebase sign-in
mAuth = FirebaseAuth.getInstance()
mAuth?.signInWithEmailAndPassword( "smart@home.pl", "abchome")
?.addOnCompleteListener( this) { task ->
if (task.isSuccessful) {
val database = FirebaseDatabase.getInstance()
val diodeDBFieldRef = database.getReference( "diode")
} else {
Log.w( "THINGS", "signInWithEmail:failure" , task.exception)
}
}
Development - Firebase events
diodeRef.addValueEventListener( object : ValueEventListener {
override fun onDataChange (dataSnapshot: DataSnapshot) {
val isDiodeTurnedOn = dataSnapshot.getValue(Boolean:: class.java)
}
override fun onCancelled (error: DatabaseError) {
Log.w("THINGS!", "Failed to read value." , error.toException())
}
})
Development
Peripherals
- Buttons
- Motors
- Display
- Keyboards
- Matrix keyboards
- Diodes
- Switches
- Other DOM
Android Things IoT examples on GitHub - link
Peripherals - matrix keypad
CONTRIB DRIVERS - matrixkeypad
sample
public class BoardDefaults {
private static final String DEVICE_RPI3 = "rpi3";
public static String[] getRowPins() {
return new String[]
{"BCM27", "BCM5", "BCM6", "BCM26"};
}
public static String[] getColPins() {
return new String[] {"BCM16", "BCM24", "BCM23"};
}
}
public class MatrixKeypadActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
mMatrixKeypadDriver = new MatrixKeypadInputDriver(
BoardDefaults.getRowPins(),
BoardDefaults.getColPins(),
new int[] {KeyEvent.KEYCODE_NUMPAD_1, KeyEvent.KEYCODE_NUMPAD_2,
KeyEvent.KEYCODE_NUMPAD_3, KeyEvent.KEYCODE_NUMPAD_4,
KeyEvent.KEYCODE_NUMPAD_5, KeyEvent.KEYCODE_NUMPAD_6,
KeyEvent.KEYCODE_NUMPAD_7, KeyEvent.KEYCODE_NUMPAD_8,
KeyEvent.KEYCODE_NUMPAD_9, KeyEvent.KEYCODE_NUMPAD_MULTIPLY,
KeyEvent.KEYCODE_NUMPAD_0, KeyEvent.KEYCODE_NUMPAD_ENTER});
mMatrixKeypadDriver.register();
}
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { ... }
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { ... }
@Override protected void onDestroy() {
mMatrixKeypadDriver.close();
}
}
Drivers
- Contrib drivers open source (link)
- GPS drivers
- Human Input Device (HID) drivers
- Sensor drivers
- Custom drivers written in C/C++
UserDriverManager class
- Is responsible for registering/unregistering new user devices
- Available methods:
- registerGpsDriver(GpsDriver)
- registerInputDriver(InputDriver)
- registerSensorDriver(UserDriver)
- unregisterGpsDriver() //without arguments, because there can be only one
GPSDriver
- unregisterInputDriver(InputDriver) //there can be multiple InputDrivers
- unregisterSensorDriver(UserSensor) //there can be multiple UserSensors
- Unregister method should be called in onDestroy() method
How new device registration works?
How new device registration works?
GPS drivers
- External GPS device connected to an Android Things device
through a UART connection
- Support for GPS modules which return location data in the NMEA
format
- NMEA GPRMC (Recomennded Minimum Navigation) structure:
$GPRMC, <Time>,<Status>,<Latitude>,<Longitude>,<Speed>,<Angle>,<Date>,
<Variation>,<Integrity>,<Checksum>
- GPS support is possible with using GpsDriver class, included into
Android Things SDK
GPS drivers
Human Input Device (HID) drivers
- Support for peripherals like buttons, controller joysticks and
keyboards
- Peripherals can be connected to the board via UART, GPIO, I2C,
etc.
- InputDriver class allows to tie own human interactions to the
standard Android input
Human Input Device (HID) drivers
Sensors drivers
- Support for multiple types of sensors, like accelerometer,
gyroscope, magnetic field, etc.
- UserSensorDriver class contains methods for handling low power
and sleep mode
- Support for custom sensors types which are not already supported
in Android (wind speed, water pH levels, motion detection, etc.)
Sensors drivers
Sensors drivers
Sensors drivers - custom device types
Sensors drivers - unregister device
- Each new created sensor should be unregister in onDestroy()
method
Custom C/C++ drivers
- The native PIO APIs let you write C/C++ code to control GPIO,
PWM, I2C, SPI, UART peripherals
- Native drivers can be used in a Java code
- The Native PIO API contains the same classes as Standard
Android Things API
- Android Things application can be write purely in C/C++
Custom C/C++ drivers - getting started
- Firstable, clone the Android Things Native repo (link)
- Move cloned files to the native module in your project
- Edit CMakeLists.txt file and add the following lines:
- Add the following arch to the native module build.gradle
Custom C/C++ drivers - example
Custom C/C++ drivers - example
OpenWeave protocol
- standard for device communication
- built by Nest/Google
- connect devices via QR codes
- weave automatically takes care
of updates
- offline connection between devices
& secure cloud connection
- C++ core, Local & Cloud API
- low adoption level
Weave protocol
- open source:
https://github.com/openweave/openweave-core
KSS Session and Tech Talk-2019 on IOT.pptx
Links
- Android Things - https://developer.android.com/things,
supported hardware - link
- Weave protocol - https://developer.android.com/things, nest
weave - link,
- Developer console - https://developer.android.com/studio,
releases (currently preview - 6.1)
- Raspberry Pi AT docs - https://developer.android.com/studio
- Android Things Native - https://dzone.com/articles/how-to-
build-an-android-mobile-application-gradle
- Android Things Native examples -
https://dzone.com/articles/how-to-build-an-android-mobile-
application-gradle
Next steps
1. Go to console.aws.amazon.com/iot  Play with it!
2. Stay up to date with AWS IoT aws.amazon.com/iot-platform/
3. Start your first IoT project - aws.amazon.com/iot-platform/getting-started
4. Try some IoT examples - github.com/awslabs/aws-iot-examples
5. Get an AWS IoT Button
KSS Session and Tech Talk-2019 on IOT.pptx
Ad

Recommended

Android things introduction - Development for IoT
Android things introduction - Development for IoT
Bartosz Kosarzycki
Android Things - The IoT platform from Google
Android Things - The IoT platform from Google
Emmanuel Obot
Hack the Real World with ANDROID THINGS
Hack the Real World with ANDROID THINGS
DevFest DC
Android Things, from mobile apps to physical world
Android Things, from mobile apps to physical world
Stefano Sanna
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Codemotion
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...
Android Things, from mobile apps to physical world - Stefano Sanna - Giovanni...
Codemotion
Android Things Linux Day 2017
Android Things Linux Day 2017
Stefano Sanna
Connecting your phone and home with firebase and android things - James Cogga...
Connecting your phone and home with firebase and android things - James Cogga...
DroidConTLV
IoT support for .NET Core - IoT Saturday 2020
IoT support for .NET Core - IoT Saturday 2020
Mirco Vanini
Android Things, Alexey Rybakov, Technical Evangelist, DataArt
Android Things, Alexey Rybakov, Technical Evangelist, DataArt
Alina Vilk
Android Things - The IoT platform for everyone.
Android Things - The IoT platform for everyone.
DVT - Smart people. Smart solutions.
Android Things : Building Embedded Devices
Android Things : Building Embedded Devices
Emertxe Information Technologies Pvt Ltd
Android things-manchester-2018-jun
Android things-manchester-2018-jun
Carl Whalley
Zero to one with Android Things - Hieu Hua
Zero to one with Android Things - Hieu Hua
Tu Le Dinh
Build your first android things application
Build your first android things application
Keval Patel
Android Things in action
Android Things in action
Stefano Sanna
Android Things Getting Started
Android Things Getting Started
Rahul Vansh
SECON'2017, 舒亟舒于舒 于亳舒亟, Android Things + Google Weave
SECON'2017, 舒亟舒于舒 于亳舒亟, Android Things + Google Weave
SECON
IoT support for .NET Core
IoT support for .NET Core
Mirco Vanini
Linxu conj2016 96boards
Linxu conj2016 96boards
LF Events
Day 2 android internals a quick overview
Day 2 android internals a quick overview
Ahsanul Karim
IoT support for .NET (Core/5/6)
IoT support for .NET (Core/5/6)
Mirco Vanini
Presentation for IoT workshop at Sinhagad University (Feb 4, 2016) - 2/2
Presentation for IoT workshop at Sinhagad University (Feb 4, 2016) - 2/2
Bhavin Chandarana
Iot andriod app development
Iot andriod app development
AbhinavKumarMeena
Android Things Latest News / Aug 25, 2017
Android Things Latest News / Aug 25, 2017
Masahiro Hidaka
"Android Things + Google Weave" 舒亟舒于舒 于亳舒亟, Voximplant, Google Developer E...
"Android Things + Google Weave" 舒亟舒于舒 于亳舒亟, Voximplant, Google Developer E...
it-people
于亳舒亟 舒亟舒于舒 "Android Things + Google Weave"
于亳舒亟 舒亟舒于舒 "Android Things + Google Weave"
IT Event
Android Things
Android Things
Egor Andreevich
The Anti-Masterclass Live - Peak of Data & AI 2025
The Anti-Masterclass Live - Peak of Data & AI 2025
Safe Software
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g

More Related Content

Similar to KSS Session and Tech Talk-2019 on IOT.pptx (20)

IoT support for .NET Core - IoT Saturday 2020
IoT support for .NET Core - IoT Saturday 2020
Mirco Vanini
Android Things, Alexey Rybakov, Technical Evangelist, DataArt
Android Things, Alexey Rybakov, Technical Evangelist, DataArt
Alina Vilk
Android Things - The IoT platform for everyone.
Android Things - The IoT platform for everyone.
DVT - Smart people. Smart solutions.
Android Things : Building Embedded Devices
Android Things : Building Embedded Devices
Emertxe Information Technologies Pvt Ltd
Android things-manchester-2018-jun
Android things-manchester-2018-jun
Carl Whalley
Zero to one with Android Things - Hieu Hua
Zero to one with Android Things - Hieu Hua
Tu Le Dinh
Build your first android things application
Build your first android things application
Keval Patel
Android Things in action
Android Things in action
Stefano Sanna
Android Things Getting Started
Android Things Getting Started
Rahul Vansh
SECON'2017, 舒亟舒于舒 于亳舒亟, Android Things + Google Weave
SECON'2017, 舒亟舒于舒 于亳舒亟, Android Things + Google Weave
SECON
IoT support for .NET Core
IoT support for .NET Core
Mirco Vanini
Linxu conj2016 96boards
Linxu conj2016 96boards
LF Events
Day 2 android internals a quick overview
Day 2 android internals a quick overview
Ahsanul Karim
IoT support for .NET (Core/5/6)
IoT support for .NET (Core/5/6)
Mirco Vanini
Presentation for IoT workshop at Sinhagad University (Feb 4, 2016) - 2/2
Presentation for IoT workshop at Sinhagad University (Feb 4, 2016) - 2/2
Bhavin Chandarana
Iot andriod app development
Iot andriod app development
AbhinavKumarMeena
Android Things Latest News / Aug 25, 2017
Android Things Latest News / Aug 25, 2017
Masahiro Hidaka
"Android Things + Google Weave" 舒亟舒于舒 于亳舒亟, Voximplant, Google Developer E...
"Android Things + Google Weave" 舒亟舒于舒 于亳舒亟, Voximplant, Google Developer E...
it-people
于亳舒亟 舒亟舒于舒 "Android Things + Google Weave"
于亳舒亟 舒亟舒于舒 "Android Things + Google Weave"
IT Event
Android Things
Android Things
Egor Andreevich
IoT support for .NET Core - IoT Saturday 2020
IoT support for .NET Core - IoT Saturday 2020
Mirco Vanini
Android Things, Alexey Rybakov, Technical Evangelist, DataArt
Android Things, Alexey Rybakov, Technical Evangelist, DataArt
Alina Vilk
Android things-manchester-2018-jun
Android things-manchester-2018-jun
Carl Whalley
Zero to one with Android Things - Hieu Hua
Zero to one with Android Things - Hieu Hua
Tu Le Dinh
Build your first android things application
Build your first android things application
Keval Patel
Android Things in action
Android Things in action
Stefano Sanna
Android Things Getting Started
Android Things Getting Started
Rahul Vansh
SECON'2017, 舒亟舒于舒 于亳舒亟, Android Things + Google Weave
SECON'2017, 舒亟舒于舒 于亳舒亟, Android Things + Google Weave
SECON
IoT support for .NET Core
IoT support for .NET Core
Mirco Vanini
Linxu conj2016 96boards
Linxu conj2016 96boards
LF Events
Day 2 android internals a quick overview
Day 2 android internals a quick overview
Ahsanul Karim
IoT support for .NET (Core/5/6)
IoT support for .NET (Core/5/6)
Mirco Vanini
Presentation for IoT workshop at Sinhagad University (Feb 4, 2016) - 2/2
Presentation for IoT workshop at Sinhagad University (Feb 4, 2016) - 2/2
Bhavin Chandarana
Iot andriod app development
Iot andriod app development
AbhinavKumarMeena
Android Things Latest News / Aug 25, 2017
Android Things Latest News / Aug 25, 2017
Masahiro Hidaka
"Android Things + Google Weave" 舒亟舒于舒 于亳舒亟, Voximplant, Google Developer E...
"Android Things + Google Weave" 舒亟舒于舒 于亳舒亟, Voximplant, Google Developer E...
it-people
于亳舒亟 舒亟舒于舒 "Android Things + Google Weave"
于亳舒亟 舒亟舒于舒 "Android Things + Google Weave"
IT Event

Recently uploaded (20)

The Anti-Masterclass Live - Peak of Data & AI 2025
The Anti-Masterclass Live - Peak of Data & AI 2025
Safe Software
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Technologies
Digital Transformation: Automating the Placement of Medical Interns
Digital Transformation: Automating the Placement of Medical Interns
Safe Software
Which Hiring Management Tools Offer the Best ROI?
Which Hiring Management Tools Offer the Best ROI?
HireME
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
Key Challenges in Troubleshooting Customer On-Premise Applications
Key Challenges in Troubleshooting Customer On-Premise Applications
Tier1 app
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
Introduction to Agile Frameworks for Product Managers.pdf
Introduction to Agile Frameworks for Product Managers.pdf
Ali Vahed
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
pcprocore
Test Case Design Techniques Practical Examples & Best Practices in Software...
Test Case Design Techniques Practical Examples & Best Practices in Software...
Muhammad Fahad Bashir
Azure AI Foundry: The AI app and agent factory
Azure AI Foundry: The AI app and agent factory
Maxim Salnikov
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Safe Software
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
Folding Cheat Sheet # 9 - List Unfolding as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding as the Computational Dual of ...
Philip Schwarz
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
mary rojas
ElectraSuite_Prsentation(online voting system).pptx
ElectraSuite_Prsentation(online voting system).pptx
mrsinankhan01
The Anti-Masterclass Live - Peak of Data & AI 2025
The Anti-Masterclass Live - Peak of Data & AI 2025
Safe Software
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Technologies
Digital Transformation: Automating the Placement of Medical Interns
Digital Transformation: Automating the Placement of Medical Interns
Safe Software
Which Hiring Management Tools Offer the Best ROI?
Which Hiring Management Tools Offer the Best ROI?
HireME
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
Key Challenges in Troubleshooting Customer On-Premise Applications
Key Challenges in Troubleshooting Customer On-Premise Applications
Tier1 app
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
Introduction to Agile Frameworks for Product Managers.pdf
Introduction to Agile Frameworks for Product Managers.pdf
Ali Vahed
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
pcprocore
Test Case Design Techniques Practical Examples & Best Practices in Software...
Test Case Design Techniques Practical Examples & Best Practices in Software...
Muhammad Fahad Bashir
Azure AI Foundry: The AI app and agent factory
Azure AI Foundry: The AI app and agent factory
Maxim Salnikov
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Safe Software
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
Folding Cheat Sheet # 9 - List Unfolding as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding as the Computational Dual of ...
Philip Schwarz
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
mary rojas
ElectraSuite_Prsentation(online voting system).pptx
ElectraSuite_Prsentation(online voting system).pptx
mrsinankhan01
Ad

KSS Session and Tech Talk-2019 on IOT.pptx

  • 1. Internet Of Things and Use Cases: Tech Talk Session By: Nashet Ali
  • 11. IoT Simple Demo MQTT AWS IoT Write Static S3 Site Read SMS Amazon CloudFront
  • 14. Operating System - Customized version of Android OS - announced at Google I/O 2015, codename: Brillo - based on Android 7.0+ (currently 8.0+) - kiosk mode - theoretically supports devices with 64 MB RAM - Bluetooth Low Energy support* - custom Launcher for IoT configuration - Single application mode automatically boots into main application * Feb 2018 - Android Things is still in beta
  • 15. Operating System - Customized version of Android OS - light version Google Play Services - no app store - apps installed via ROM updates - drivers for peripheral devices
  • 16. Operating System Android Things Thinned down Android OS with a custom launcher and KIOSK mode
  • 17. ROM updates - Google generates initial image - Handles update integrity/signing verification - OTA updates - Automatically reverts previous version if update fails
  • 18. Operating System * display is entirely optional
  • 19. Hardware - SOM architecture - Base board + certified modules - Custom hardware through pins/connectors/serials SOM - System-on-a-chip SiP - System-in-package (stacked SOMs) - Easy certification (CE - EU declaration of conformity)
  • 21. Android vs Android Things - There is no Play Store - Users cannot install apps on their own - App updates provided with OTA updates - No system application drawer - No notifications - UI is optional
  • 22. Smart home Firebase cloud: fast callbacks All mobile platforms support - iOS/Android/ Android Things
  • 23. Preparation - SDCard min. 4 GB - Raspberry PI ver. 3 - AC adapter
  • 24. ROM flashing - Prepare custom ROM from Android Things Developer Console
  • 25. Development - Android Things is open source (still in preview) link No need to compile custom ROM & custom launcher In most cases we only need to develop application & services However, we can do that by cloning: repo init -u https://android.googlesource.com/platform/manifest -b android-o-iot-preview-5 repo sync
  • 26. Development - If no display is available - screen mirroring from Android e.g. Vysor link - No emulator is provided at this stage (preview) - UI can be developed as a regular Android app android:required="false"
  • 27. Development - Steep learning curve (easy for a mobile-developer) - Use usual Android UI, libraries & tools - Kotlin / RxJava etc. - Apps developed in Android Studio - Built-in security
  • 28. Development - ADB over Wifi Find raspberry ip address:
  • 29. Development - Permissions / Wifi - Permissions are granted at app boot (no Android 6.0+ runtime permission support) - Usually you need to restart the device after adding a new permission - After connecting to a WiFi network - AT reconnects that network on boot You need to restart the device if WiFi network is unavailable on device boot (or go to AT launcher)
  • 30. Development - GPIO pins private fun turnOnDiodeVoltage() { val peripheralService = PeripheralManagerService() try { val mLedGpio = peripheralService.openGpio("BCM18") mLedGpio?.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW) mLedGpio?.value = true } catch (e: IOException) { Log.e("THINGS", "Error on PeripheralIO", e) } }
  • 31. Development - Firebase sign-in mAuth = FirebaseAuth.getInstance() mAuth?.signInWithEmailAndPassword( "smart@home.pl", "abchome") ?.addOnCompleteListener( this) { task -> if (task.isSuccessful) { val database = FirebaseDatabase.getInstance() val diodeDBFieldRef = database.getReference( "diode") } else { Log.w( "THINGS", "signInWithEmail:failure" , task.exception) } }
  • 32. Development - Firebase events diodeRef.addValueEventListener( object : ValueEventListener { override fun onDataChange (dataSnapshot: DataSnapshot) { val isDiodeTurnedOn = dataSnapshot.getValue(Boolean:: class.java) } override fun onCancelled (error: DatabaseError) { Log.w("THINGS!", "Failed to read value." , error.toException()) } })
  • 34. Peripherals - Buttons - Motors - Display - Keyboards - Matrix keyboards - Diodes - Switches - Other DOM Android Things IoT examples on GitHub - link
  • 35. Peripherals - matrix keypad CONTRIB DRIVERS - matrixkeypad sample public class BoardDefaults { private static final String DEVICE_RPI3 = "rpi3"; public static String[] getRowPins() { return new String[] {"BCM27", "BCM5", "BCM6", "BCM26"}; } public static String[] getColPins() { return new String[] {"BCM16", "BCM24", "BCM23"}; } }
  • 36. public class MatrixKeypadActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { mMatrixKeypadDriver = new MatrixKeypadInputDriver( BoardDefaults.getRowPins(), BoardDefaults.getColPins(), new int[] {KeyEvent.KEYCODE_NUMPAD_1, KeyEvent.KEYCODE_NUMPAD_2, KeyEvent.KEYCODE_NUMPAD_3, KeyEvent.KEYCODE_NUMPAD_4, KeyEvent.KEYCODE_NUMPAD_5, KeyEvent.KEYCODE_NUMPAD_6, KeyEvent.KEYCODE_NUMPAD_7, KeyEvent.KEYCODE_NUMPAD_8, KeyEvent.KEYCODE_NUMPAD_9, KeyEvent.KEYCODE_NUMPAD_MULTIPLY, KeyEvent.KEYCODE_NUMPAD_0, KeyEvent.KEYCODE_NUMPAD_ENTER}); mMatrixKeypadDriver.register(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { ... } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { ... } @Override protected void onDestroy() { mMatrixKeypadDriver.close(); } }
  • 37. Drivers - Contrib drivers open source (link) - GPS drivers - Human Input Device (HID) drivers - Sensor drivers - Custom drivers written in C/C++
  • 38. UserDriverManager class - Is responsible for registering/unregistering new user devices - Available methods: - registerGpsDriver(GpsDriver) - registerInputDriver(InputDriver) - registerSensorDriver(UserDriver) - unregisterGpsDriver() //without arguments, because there can be only one GPSDriver - unregisterInputDriver(InputDriver) //there can be multiple InputDrivers - unregisterSensorDriver(UserSensor) //there can be multiple UserSensors - Unregister method should be called in onDestroy() method
  • 39. How new device registration works?
  • 40. How new device registration works?
  • 41. GPS drivers - External GPS device connected to an Android Things device through a UART connection - Support for GPS modules which return location data in the NMEA format - NMEA GPRMC (Recomennded Minimum Navigation) structure: $GPRMC, <Time>,<Status>,<Latitude>,<Longitude>,<Speed>,<Angle>,<Date>, <Variation>,<Integrity>,<Checksum> - GPS support is possible with using GpsDriver class, included into Android Things SDK
  • 43. Human Input Device (HID) drivers - Support for peripherals like buttons, controller joysticks and keyboards - Peripherals can be connected to the board via UART, GPIO, I2C, etc. - InputDriver class allows to tie own human interactions to the standard Android input
  • 44. Human Input Device (HID) drivers
  • 45. Sensors drivers - Support for multiple types of sensors, like accelerometer, gyroscope, magnetic field, etc. - UserSensorDriver class contains methods for handling low power and sleep mode - Support for custom sensors types which are not already supported in Android (wind speed, water pH levels, motion detection, etc.)
  • 48. Sensors drivers - custom device types
  • 49. Sensors drivers - unregister device - Each new created sensor should be unregister in onDestroy() method
  • 50. Custom C/C++ drivers - The native PIO APIs let you write C/C++ code to control GPIO, PWM, I2C, SPI, UART peripherals - Native drivers can be used in a Java code - The Native PIO API contains the same classes as Standard Android Things API - Android Things application can be write purely in C/C++
  • 51. Custom C/C++ drivers - getting started - Firstable, clone the Android Things Native repo (link) - Move cloned files to the native module in your project - Edit CMakeLists.txt file and add the following lines: - Add the following arch to the native module build.gradle
  • 52. Custom C/C++ drivers - example
  • 53. Custom C/C++ drivers - example
  • 54. OpenWeave protocol - standard for device communication - built by Nest/Google - connect devices via QR codes - weave automatically takes care of updates - offline connection between devices & secure cloud connection - C++ core, Local & Cloud API - low adoption level
  • 55. Weave protocol - open source: https://github.com/openweave/openweave-core
  • 57. Links - Android Things - https://developer.android.com/things, supported hardware - link - Weave protocol - https://developer.android.com/things, nest weave - link, - Developer console - https://developer.android.com/studio, releases (currently preview - 6.1) - Raspberry Pi AT docs - https://developer.android.com/studio - Android Things Native - https://dzone.com/articles/how-to- build-an-android-mobile-application-gradle - Android Things Native examples - https://dzone.com/articles/how-to-build-an-android-mobile- application-gradle
  • 58. Next steps 1. Go to console.aws.amazon.com/iot Play with it! 2. Stay up to date with AWS IoT aws.amazon.com/iot-platform/ 3. Start your first IoT project - aws.amazon.com/iot-platform/getting-started 4. Try some IoT examples - github.com/awslabs/aws-iot-examples 5. Get an AWS IoT Button