Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Actions Things: Let’s add smartness to Lights-G...

Actions Things: Let’s add smartness to Lights-GDGNewDelhi

Android Things is an Android-based embedded operating system platform by Google. Android Things lets you build professional, mass-market products on a trusted platform, without previous knowledge of embedded system design. This talk covers how to start with Android Things, Flash OS on development board and Connect devices with NXP Pico i.MX7D platform and control that using Android mobile & Google Assistant application.

You will be learning below things,
- Getting started with Android Things
- How to build and flash OS on development board
- Control devices through Google Assistant (NXP Pico i.MX7D, Breadboard, LED, Google Home, Dialogflow application, Firebase Real time database & Cloud Functions)

Jaldeep Asodariya

July 25, 2020
Tweet

More Decks by Jaldeep Asodariya

Other Decks in Technology

Transcript

  1. Actions Things: Let’s add smartness to Lights Jaldeep Asodariya Event

    Organizer, GDG Ahmedabad @jaldeepasodariy नमस्ते!
  2. Triggering Ok Google, talk to brainy things. Hey Google, let

    me talk to brainy things. Ask brainy things about power on my living room main light.
  3. How does it work? Actions on Google Dialogflow Firebase Realtime

    Database Firebase Cloud Functions Android Things Android
  4. things: build.gradle dependencies { compileOnly 'com.google.android.things:androidthings:1.0' } AndroidManifest.xml <application ...>

    <uses-library android:name="com.google.android.things" /> <activity ...> ... </activity> </application>
  5. things: build.gradle dependencies { compileOnly 'com.google.android.things:androidthings:1.0' } AndroidManifest.xml <application ...>

    <uses-library android:name="com.google.android.things" /> <activity ...> ... <!--Launch activity automatically on boot--> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.IOT_LAUNCHER" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application>
  6. MainActivity.java //Init PeripheralManager PeripheralManager mPeripheralManager = PeripheralManager.getInstance(); Gpio mGpio1IO10 =

    mPeripheralManager.openGpio("GPIO1_IO10"); // Configure the peripheral mGpio1IO10.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW); // Set it at some point later mGpio1IO10.setValue(false);
  7. MainActivity.java //Init PeripheralManager PeripheralManager mPeripheralManager = PeripheralManager.getInstance(); Gpio mGpio1IO10 =

    mPeripheralManager.openGpio("GPIO1_IO10"); // Configure the peripheral mGpio1IO10.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW); // Set it at some point later mGpio1IO10.setValue(false); // Do not forget to close gpio mGpio1IO10.close();
  8. MainActivity.java mRoomRef.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot)

    { for(DataSnapshot roomSnapshot : dataSnapshot.getChildren()) { MdlRooms objMdlRoom = roomSnapshot.getValue(MdlRooms.class); @Override public void onCancelled(@NonNull DatabaseError databaseError) { … } });
  9. MainActivity.java mRoomRef.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot)

    { for(DataSnapshot roomSnapshot : dataSnapshot.getChildren()) { MdlRooms objMdlRoom = roomSnapshot.getValue(MdlRooms.class); if(objMdlRoom.getDevices() != null) { Map<String, MdlDevices> objMap = objMdlRoom.getDevices(); ... @Override public void onCancelled(@NonNull DatabaseError databaseError) { … } });
  10. MainActivity.java mRoomRef.addValueEventListener(new ValueEventListener() { ... Map<String, MdlDevices> objMap = objMdlRoom.getDevices();

    for (MdlDevices objMdlDevices : objMap.values()) { } @Override public void onCancelled(@NonNull DatabaseError databaseError) { … } });
  11. MainActivity.java mRoomRef.addValueEventListener(new ValueEventListener() { ... Map<String, MdlDevices> objMap = objMdlRoom.getDevices();

    for (MdlDevices objMdlDevices : objMap.values()) { switch (objMdlDevices.getGpio()) { case PIN_NXPMX7D_GPIO1_IO10: ... mGpio1IO10.setValue(objMdlDevices.getTraits().isOn()); break; } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { … } });
  12. Intent Matching - Match and categorize user utterances to an

    intent. Entity Extraction - Identify key words and phrases spoken by the user. “ @
  13. Thank you! Dank je! धन्यवाद! ধন্যবাদ! ہﯾرﮑﺷ ﺎﮐ پآ! ﻲﻧﺎﺑرﮭﻣ

    ﻲﺟ نﺎھوﺗ! ေကျးဇူးတင်ပါတယ်! നന്ദി! ありがとうございました! Ευχαριστώ! Gràcies! ਤੁਹਾਡਾ ਧੰਨਵਾਦ! ಧನ್ಯವಾದ! À ringrazià ti! 谢谢! நன்றி! ధన్యవాదాలు! ¡Gracias! Faleminderit! આભાર! ขอขอบคุณ! Jaldeep Asodariya Event Organizer, GDG Ahmedabad Follow me @jaldeepasodariy