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

Internet of Things, Android Things, and other things

Denys
January 18, 2017

Internet of Things, Android Things, and other things

1. Introduction to Internet of things
2. Overview Android Things platform from Google
3. Basic knowledge about key things of embedded
4. Comparison regular IoT approaches with Android Thing and Weave platform

Denys

January 18, 2017
Tweet

Other Decks in Programming

Transcript

  1. One application platform build.gradle dependencie: provided 'com.google.android.things:androidthings:0.1-devpreview' AndroidManifest: <uses-library android:name="com.google.android.things"/>

    AndroidManifest intent filter of .AppActivity: <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>
  2. Platform permissions & restrictions Google API - AdMob - Android

    Pay - Firebase App Indexing - Firebase Authentication - Firebase Dynamic Links - Firebase Invites - Firebase Notifications - Maps - Play Games - Search - Sign-In - Cast - Drive - Firebase Analytics - Firebase Cloud Messaging (FCM) - Firebase Crash Reporting - Firebase Crash Reporting - Firebase Realtime Database - Firebase Remote Config - Firebase Storage - Fit - Instance ID - Location - Nearby - Places - Mobile Vision Displays are optional. The same UI toolkit as for traditional Android applications. No NavigationBar naither StatusBar All normal and dangerous permissions declared in your app's manifest are granted System features - CalendarContract - ContactsContract - DocumentsContract - DownloadManager - MediaStore - NotificationManager - Settings - Telephony - UserDictionary - VoicemailContract - Available - Unavailable
  3. User-Space Drivers Developers drivers Sensors - Sensors measure and report

    the conditions of the physical environment. The Android sensor framework implements sensor fusion to combine the raw data from multiple physical sensors into a single virtual sensor. This is particularly common with motion sensors, such as accelerometers and gyroscopes. Connecting your sensor to the framework with a user driver allows the data it produces to be included in sensor fusion. HID - Human Interface Devices (HID) provide user input to apps. Touch pads, keyboards, and game controllers are all examples of devices that provide this type of input. Input user drivers let devices interact with the enhanced input framework APIs, such as Gesture Support or Drag and Drop. GPS - GPS provides high accuracy physical location information to apps. Integrating the location results from GPS devices with a user driver allows the framework to connect that data with other location sources, such as WiFi, and Google's Fused Location Provider.
  4. GPIO General Purpose Input/Output (GPIO) pins provide a programmable interface

    to read the state of a binary input device (such as a pushbutton switch) or control the on/off state of a binary output device (such as an LED).
  5. GPIO PeripheralManagerService manager = new PeripheralManagerService(); List<String> portList = manager.getGpioList();

    /** * Output example **/ Gpio gpioOut = manager.openGpio(GPIO_NAME_OUT); // GPIO_NAME_OUT is a String value from portList can be any GPIO pin gpioOut.setDirection(Gpio.DIRECTION_OUT_INITIALLY_HIGH); // Gpio.DIRECTION_OUT_INITIALLY_LOW gpioOut.setActiveType(Gpio.ACTIVE_LOW); gpioOut.setValue(true); /** * Input example or “interuption” **/ Gpio gpioIn = manager.openGpio(GPIO_NAME_IN); // GPIO_NAME_IN is a String value from portList can be any GPIO pin gpioIn.setDirection(Gpio.DIRECTION_IN); gpioIn.setActiveType(Gpio.ACTIVE_LOW); gpioIn.setEdgeTriggerType(Gpio.EDGE_BOTH); // EDGE_NONE, EDGE_RISING, EDGE_FALLING gpioIn.registerGpioCallback(mGpioCallback); // GpioCallback Sensetive to lifecycle private GpioCallback mGpioCallback = new GpioCallback() { @Override public boolean onGpioEdge(Gpio gpio) { boolean isButtonPressed = gpio.getValue(); return true; } @Override public void onGpioError(Gpio gpio, int error) { Log.w(TAG, gpio + ": Error event " + error); } };
  6. PWM Pulse Width Modulation (PWM) is a common method used

    to apply a proportional control signal to an external device using a digital output pin. For example, servo motors use the pulse width of an incoming PWM signal to determine their rotation angle. LCD displays adjust their brightness based on a PWM signal's average value.
  7. UART Complex peripheral devices such as GPS modules, LCD displays,

    and XBee radios typically use Universal Asynchronous Receiver Transmitter (UART) ports (often simply called serial ports) to communicate. It is asynchronous in that there are no clock signals. Data frame. Usually it’s 8N1
  8. i2c The Inter-Integrated Circuit (IIC or I2C) bus connects simple

    peripheral devices with small data payloads. Sensors and actuators are common use cases for I2C. Examples include accelerometers, thermometers, LCD displays, and motor drivers. I2C is a synchronous serial interface System Management Bus (SMBus)
  9. SPI Serial Peripheral Interface (SPI) devices are typically found where

    fast data transfer rates are required. SPI is well suited for high-bandwidth use cases such as external non-volatile memory and graphical displays. 1. Idle Level 2. Leading Edge 3. Trailing Edge
  10. UserSpace driver. Sensor example UserSensor custom = UserSensor.builder() .setName("MySensor") .setVendor("MyCompany")

    .setCustomType(Sensor.TYPE_DEVICE_PRIVATE_BASE, "com.example.mysensor", Sensor.REPORTING_MODE_CONTINUOUS) .setDriver(mDriver) .build(); public class SensorDriverService extends Service { UserSensor mAccelerometer; @Override public void onCreate() { super.onCreate(); ... UserDriverManager manager = UserDriverManager.getManager(); // Create a new driver implementation mAccelerometer = ...; // Register the new driver with the framework manager.registerSensor(mAccelerometer); } @Override public void onDestroy() { super.onDestroy(); ... UserDriverManager manager = UserDriverManager.getManager(); // Unregister the driver when finished manager.unregisterSensor(mAccelerometer); } } UserSensorDriver mDriver = new UserSensorDriver() { // Sensor data values float x, y, z; @Override public UserSensorReading read() { try { // ...read the sensor hardware... // Return a new reading return new UserSensorReading(new float[]{x, y, z}); } (catch Exception e) { // Error occurred reading the sensor hardware throw new IOException("Unable to read sensor"); } } };
  11. Weave is a communications platform that includes the Weave Device

    SDK and the Weave Server to enable OEM manufactures to connect their devices to Google cloud services. Support: - Light Device - Outlet Device - Television - HVAC Controller - Wall Switch Features: - IoT Developer Console - Weave Developer app - Command-line tools and simulators - OEM metrics Consist of: - Weave Device SDK Linux Qualcomm QCA4010 Marvell MW302 - Weave Server Google Weave