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
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.
/** * 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); } };
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.
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
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)
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
.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"); } } };
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