Skip to content

Latest commit

 

History

History
executable file
·
115 lines (87 loc) · 9.57 KB

WebGPIO_I2C.md

File metadata and controls

executable file
·
115 lines (87 loc) · 9.57 KB

API specifications that allows WebApps to use devices connected to GPIO or I2C on single board computers. Specifications are edited by Browsers and Robotics CG.

These specifications are designed with reference to styles such as Web MIDI and corresponding Node modules.

CHIRIMEN is an open source software and open source hardware community. They are developing the environment where various electronic parts and devices can be operated from WebApps. The core of the implementations are APIs for GPIO and I2C based on Web GPIO and Web I2C specifications.

They are also developing learning / tutorial materials for beginners of WebApps and IoT technology.

The learning materials are used in seminars / courses for beginners such as Web x IoT Makers Callenge in Japan.

Note: Web × IoT Makers Challenge is hosted by the Ministry of Internal Affairs and Communications.

Activity intention

Rather than for practical IoT systems, for prototyping and learning materials / emvironments.

However, such educational / prototyping board computers and their use cases have a huge market for such as Raspberry PI, micro:bit, LattePanda, Jetson Nano etc, so it makes sense to make them web-friendly.

Implementations

There are several implementations for single board computers.

Except for B2G, WebI2C and WebGPIO are implemented by polyfills.

Localhost Node server provides GPIO and I2C pin services. Polyfill on the browser provides WebGPIO and I2C by communicating with the Node server via WebSocket. Everything works on Raspberry PI3.

Any browser that can use webSocket will work, so it will work on Firefox. It will also work on higher models after RasPi3.

conf rpi3

The polyfill on the browser operates the micro:bit pins via Web Bluetooth. A program that provides GPIO and I2C pin operations via BLE (CHIRIMEN BLE bridge) is implemented on micro:bit. WebApps runs on a browser on a PC or smartphone.

Instead of Web Bluetooth, Implementation via Web USB is also planned.

conf microbit

TY51822r3 is mbed single board computer using Nordic Semiconductor's nRF51822. The structure is almost similar to CHIRIMEN with micro:bit.

WebGPIO and WebI2C are implemented natively on B2G. The community designed an open source hardware board computer designed for Boot to Gecko (an open source version of Firefox OS). Board computer production has already ended.

Demos / Examples

Pre-prepared libraries for various Devices / Parts

As learning materials for beginners, the community has been developing drivers / libraries for various devices, especially for I2C devices. Since it is necessary to develop after understanding the specifications of individual I2C devices, it is difficult for beginners.

They are javascript libraries using WebI2C. Therefore, it is common to all board computers (RPi3, micro: bit etc) under CHIRIMEN (WebI2C) environment.

There are already over thirty drivers for well-known parts/devices available for a few dollars from amazon/ebay/aliexpress.

I2C Devices

Category Device Picture
Analog to Digital ADS1015
ADS1115
ADC and DAC PCF8591
Temperature ADT7410
Thermo Graphy AMG8833
Temperature, Pressure, Humidity BME280
Temperature, Pressure BMP180
Temperature, Pressure BMP280
Laser Ranging Sensor GP2Y0E03
Time-of-flight distance sensor VL53L0X
Gesture Sensor Grove-Gesture (PAJ7620U2)
Light Sensor Grove-Light
OledDisplay Grove-OledDisplay
Touch Sensors Grove-Touch
Color Sensor S11059
Ultraviolet (UV) light sensor VEML6070
Accelerometer Grove-Accelerometer
Accelerometer + Gyroscope MPU6050
Gyro + Accelerometer + Compass MPU9250
Addressable full-color LED NEOPIXEL
↑ driver board NEOPIXEL_I2C
Multi-channel PWM/Servo/LED driver PCA9685
PCA9685 Servo
PCA9685 PWM

GPIO Parts / Devices

Category Device Picture
LED LED
Switch Switch
DC Motor Geared Motor
Full Bridge Motor Driver L298N
L9110S
MX1508
TB6612FNG
Pyro electric Sensor

Discussion

  • The CHIRIMEN community seems to be happy with the polyfill implementations currently, is that okay?
  • Provided, they think that it is preferable that specs of APIs that access pins such as I2C and GPIO be shared with other project's implementations.
  • Are these APIs worth the W3C recommendation process? Here, polyfills should be considered a kind of implementations in the W3C recommendation process.
  • For RPi3 version, wss is used for communication with Bridge Server to enable https communication to the cloud. For this reason, browsers that have a dedicated certificate inserted are distributed. This is part of the issue discussed in https in Local Network CG. On the other hand, there is no such issues in implementation via webBluetooth or webUSB as long as relying on those security mechanisms. For native implementations, security considerations may be necessary.
  • Abstraction of communication paths (WebBluetooth, WebUSB, WebRTC, Native) and boards.
  • Consideration of conflicts and sharing across multiple tabs
  • Furthermore, for native implementation, handling conflicts with non-browser software and worker / worklet handling