Skip to content
Philippe Coval edited this page Aug 23, 2018 · 14 revisions

EXTRA: MCUs

MICRO CONTROLLERS:

In IoT domain Micro controllers (MCU) are very popular, because of low cost and low consumption.

Arduino boards are very popular in academics or DiY communities, then API were ported to other micro controllers than Atmel, like espresif ESP8266, ESP32 etc.

Mozilla's is supporting Arduino API trough this SDK project:

The supported language to program MCU webthings is currently C/C++.

Note that IoT.js is also targeting constrained devices (like ARTIK05x on TizenRT or STM32 on NuttX).

DEMO:

"Smart Orchid Demo" showed a light controller and arduino moisture sensor:

A moisture sensor is just plugged on analog pin (and +5v GND, the digital pin was not used here, but it can be used for other boards without analog like RaspberryPi and use potentiometer as "hardware threshold").

Watch video for more:

webthing-esp8266-webapp-20180602rzr

RGB LAMP: ON ESP8266

Developing webthing on Arduino APIs or compatible platforms such as Espressif ESP8266 or ESP32

Once your have setup build tool, Developing is pretty straight forward, and it has been covered elsewhere:

The RGB Lamp code is upstreamed at:

LEVELSENSOR: ON ARDUINO

Since I shared a slightly more advanced example that handle ADC port, it was used to monitor the moisture of the ground of a plant, or any analogic sensor:

To rebuild, just use GNU make:

git clone https://github.com/mozilla-iot/webthing-arduino ; cd webthing-arduino
make

for reference a docker file has been upstreamed:

sudo apt-get install docker.io # Or adapt
$sudo docker build https://github.com/mozilla-iot/webthing-arduino.git
# AVR Memory Usage
# ----------------
# Device: atmega2560
# Program:   40136 bytes (15.3% Full)
# (.text + .data + .bootloader)
# Data:       1451 bytes (17.7% Full)
# (.data + .bss + .noinit)

If you prefer you can setup IDE and do the manual configuration.

Note, hardware side, I used an Arduino mega with Ethernet Shield

( same one in this IoTivity 1.2 "arduino switch" demo )

STATUS

Related Upstreamed contributions:

For reference code was developed in this repo: (but most of it is upstreamed)

Possible open tasks:

  • TODO: refactor to handle Arduino's WiFi shield too
  • TODO: port iotjs to arduino/ESP and compare performance

INDEX

Clone this wiki locally