-
-
Notifications
You must be signed in to change notification settings - Fork 14
MCU
In IoT domain Micro controllers (MCU) are very popular, because of low cost and low consumption.
This page only focus on boards supported by webthing-iotjs:
- ARTIK05x on TizenRT
- STM32F on NuttX
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 for through 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).
So to recap, MCUs can serve WebThings API for Mozilla Gateway either in native language (C/C++) or using script runtime (IotJs, uPython, enventually Lua too?) but Gateway is too resource consuming for that.
Update: It's is working for me, I can explain more, ask me at:
IotJs is also supporting NuttX kernel on STM32F7.
Track status at:
More hints shared at:
Hints and work in progress:
git clone -b sandbox/rzr/nuttx/devel https://github.com/rzr/rzr-wip/ ; cd rzr-wip
make nuttx/devel
make iotjs/devel # Enable IoT.js on 2d build
IoTjs is running on Nucleo-f767zi on NuttX OS:
Usage:
mount -t procfs /proc ; mkdir /tmp ; mount -t tmpfs /tmp ; df
ifconfig ; ifdown eth0 ; ifconfig eth0 hw 00:80:E1:34:ff:ff;
ifconfig ifup eth0; renew eth0; ifconfig
ifconfig ping 8.8.8.8 ; ping ifconfig.me
cd /tmp/ ; wget http://ifconfig.me/ip ; cat ip
cd /tmp ; echo "console.log(process)" > p.js; iotjs p.js
- ADC: ADC0 (=ADC1_3)
- CAN: TODO
- GPIO: WIP (LED, TODO: button)
- I2C: TODO
- PWM: 4
- SPI: TODO
- UART: TODO
- http://www.nuttx.org/Documentation/NuttxPortingGuide.html#analogdrivers
- <https://youtu.be/oSowWYLDDRI# B20K>
nsh> ls -l /dev/gpout1
crw-rw-rw- 0 /dev/gpout1
nsh> gpio /dev/gpout1
Driver: /dev/gpout1
Output pin: Value=1
nsh> gpio -o 0 /dev/gpout1
Driver: /dev/gpout1
Output pin: Value=1
Writing: Value=0
Verify: Value=0
nsh> gpio -o 1 /dev/gpout1
Driver: /dev/gpout1
Output pin: Value=0
Writing: Value=1
Verify: Value=1
nsh>
- https://os.mbed.com/platforms/ST-Nucleo-F767ZI/
- PB1 @ CN12: 12th from top on right
- https://bitbucket.org/nuttx/nuttx/pull-requests/816# (Merged)
- https://github.com/pando-project/libtuv/pull/136# (Merged)
- https://github.com/pando-project/jerryscript/pull/2838# (Merged)
- https://github.com/pando-project/iotjs/pull/1867# (Merged)
- https://bitbucket.org/nuttx/nuttx/pull-requests/859/nucleo-144-regenerate-f767-netnsh/diff# (Merged)
- https://bitbucket.org/nuttx/nuttx/issues/153/crash-on-mm_takesemaphore-in-pwm_register# (Resolved)
- https://bitbucket.org/nuttx/nuttx/pull-requests/860# (Merged)
- https://github.com/pando-project/iotjs/pull/1869# (Merged)
- https://bitbucket.org/nuttx/nuttx/pull-requests/862# (Merged)
- https://bitbucket.org/nuttx/nuttx/pull-requests/898# (Merged)
- https://bitbucket.org/nuttx/nuttx/pull-requests/940/# (Open)
- https://community.st.com/s/feed/0D50X0000ArV5ykSQC#
- https://github.com/Samsung/iotjs/blob/master/docs/build/Build-for-STM32F4-NuttX.md
- https://github.com/Samsung/iotjs/blob/master/docs/targets/nuttx/stm32f4dis/IoT.js-API-Stm32f4dis.md#gpio-pin
- https://www.youtube.com/watch?v=VXsTLzI6idA# GPIO
- https://www.youtube.com/watch?v=VXsTLzI6idA
- https://bitbucket.org/nuttx/nuttx/src/master/configs/nucleo-144/README.txt
- http://nuttx.org/doku.php?id=wiki:howtos:port-drivers_stm32f7
- https://bitbucket.org/nuttx/nuttx/commits/f06a2cabb578#chg-configs/nucleo-144/src/stm32_pwm.c
TizenRT OS is also targeting lower class devices, currently hardware support is limited to a few platforms like ARTIK05x and a few others plus QEmu.
The key feature for Javascript developers is IoT.js support, this mean code can be portable from on GNU/Linux OS to contrained devices without any rebuild effort, which is is not the case of Arduino compabible devices.
Arduino is providing a C/C++ framework that would be compared to IotJs.
- TODO: port iotjs to arduino/ESP boards and compare performance
Check Concept page for overview, Gateway to get started, IotJs page to install runtime to build webthing as explained in Home page.
For further experiments check Social and Sensor, or Extra parts like WebApp (for Tizen or PWA) or MCU info about running on other microcontrollers not supported by TizenRT.
While Home focus mostly on using iotjs to build webthings (on GNU/Linux or TizenRT for ARTIK05X devices).
This document is still in draft state, but reviews are always welcome, if you try to replicate it and stuck on missing instructions I would appreciate that you file issues or even better make pull request (just edit in github) that insert "TODO marks" in following chapters, like:
- TODO: please explain more this chapter and then remove this TODO line
Community contributions are welcome at:
Support is also possible, ask in:
- https://github.com/rzr/webthing-iotjs
- irc://irc.mozilla.org/#iot
WARNING: Developement branches could break over time.
Instead of maintaining "quick and dirty" demo code, I decided to split demo in smaller independents parts (which can reused) and I am upstreaming the most I can.
Then support can be done on mainline branches (or released versions).
Note that, Upstreaming can be a slow process, so snapshots links will remain until 100% of code is upstreamed.
Licence:
Reference documentation is at:
-
Concept:
- Demo Concept and Architecture
-
Gateway:
- Getting started with Mozilla IoT gateway
-
IotJs:
- Install IoT.js needed to run webthings
-
Home:
- Welcome page to build WebThings using IotJs
-
Social:
- Notification service using Mastodon FLOSS
-
TizenRT:
- webthing-iotjs on ARTIK05x
-
Sensor: and Actuator
- Physical interactions
-
Extra hints:
- Docker: About running in container
- MCU: About microcontrollers (not supported by TizenRT)
- WebApp: Alternate browser (Tizen and PWA)
- GnuLinux: Article about Edison and other
- Raspbian: Article about RaspberryPi
- Arduino: Alt For atmel or Esprissif boards
- DigitalTwins : WiP experiments
- TODO: Work in progress