Skip to content

Actuator

Philippe Coval edited this page Jul 7, 2019 · 9 revisions

ACTUATORS

INTRODUCTION:

In IoT and embedded world, sensors and actuators are key components to interact with the external physical world, which is the base of many use cases or Concepts.

While there is only two types of operations:

  • READ: Measuring some physical amount of energy
  • WRITE: Delivering some energy to some device that can alter an established situation

Some devices are combining both, that's the reason sometimes actuators are sometimes mixed with sensors.

To avoid any ambiguity I'll use those 2 terms:

  • Sensor for reading input data (sensing)
  • Actuator for writing output data (acting)

In WoT context, those two elements are defined as properties which could be readable or writable, other semantics are also used: BooleanProperty, OnOffProperty, BinarySensor, SwitchOnOff, don't be confused.

Note that when real time monitoring is needed (for Sensor) you may consider to use webthing-node which is fully supporting websockets (this is demonstrated by "Clap Sensor" part of "Smart Orchid" demo).

DEMO:

To illustrate Concept, watch Sensor part of the "Smart Orchid" demo video:

web-of-things-agriculture-20180712rzr.webm

The simplest use case is just basic interaction from the RaspberryPi's button to the artik ARTIK05x's LED.

To recap here are all elements we will explain in following chapters:

  • ARTIK05s on board LED is simplest Actuator running on IoT.js and TizenRT
  • "Button sensor" on RaspberryPi is simplest sensor running on IoT.js on RaspberryPi, (connected to earlier Actuator via Gateway)
  • "Clap sensor" using webthing-node (on RaspberryPI)
  • "Ambient Light" and "Temperature" using generic-sensor-lite connected to RaspberryPi
  • "Moisture" Level Sensor on Extra Arduino MCU board
  • Actuator RGB Lamp on ESP8266 MCU

IO

IO.js

GPIO

General Purpose Input/Output interface is widely used digital communication (on/off):

NodeJS is supporting this with different external implementations, the most generic one is using "sysfs" (Linux kernel interface and thus provide genericity among different hardware (ARTIK, RPi etc):

While IoT.js uses a built in module, which can be optionally enabled at built time:

Unfortunately API are not aligned, so I made an abstraction class to provide portability:

Note Raspberry Pi users might be used to "WiringPi" library, it can be installed also as Node.js module:

To avoid rewriting GPIO calls, a wrapper class can be also used for IoT.js:

ON/OFF ACTUATORS:

LED ACTUATOR:

There are two onboard buttons that can be used on ARTIK 05x board, check following IoT.js code (made for TizenRT but portable to other OS):

RELAY ACTUATOR:

If you can turn on a LED then code is same to control a relay that can power an other device. All you need is to use or build an electronic circuit or use standalone module, like "Flex RaspberryPi's hat":

flex-hat

"Smart Orchid Demo" was using Gateway's GPIO Adapter, and relay is turning an USB fan (powered by 5V source).

Setup is done using the web UI:

Configure adapter as:

  • FlexRelay is GPIO "05" (aka Pin but in reality pin29) as "output/out"
  • FlexRedLed : 26 as ouput
  • FlexGreenLed : 19 as output
  • FlexBlueLed : 13 as output
  • FlexButton is GPIO "11" in input (active low)

Input GPIO need an extra configuration using BCM tool:

sudo cat /sys/kernel/debug/gpio
#|  gpio-11  (                    |sysfs               ) in  lo IRQ
which gpio || sudo apt-get install wiringpi ; gpio -g mode 11 up 
sudo grep 'gpio-11' /sys/kernel/debug/gpio
#| gpio-11  (                    |sysfs               ) in  hi IRQ

Then add each resources:

Watch previously explanations for ARTIK10 (to prototype an IoTivity thing but it's same problem):

RASPBERRY PI

Note that Pi's GPIOs input mode can be configured externally, using gpio tool. IoT.js and npm's gpio module are not (yet) supporting this.

For example check Pi Hats like TrafficPHat (and its 3 buttons mini hat):

project="webthing-iotjs"
url="https://github.com/rzr/${project}"
branch="master"

mkdir -p "${url}/${branch}"
cd "${url}/${branch}"

git clone --recursive --depth 1 -b "$branch" "$url" && cd "$project"
make start/board/traffic-phat

PWM:

Pulse width modulation can be used to produce sounds using buzzers, or control servo motors

PWM ON EDISON:

Intel edison is supporting PWM, A passive buzzer can be connected on PWM0 (aka GPIO12) pin and ground.

Experimental Robot:

curl https://webthing-iotjs-robot.glitch.me/properties
#| {"Hand":0,"Arm":0,"Shoulder":0,"Body":0}

curl -X PUT -d '{ "Hand": 45 }' https://webthing-iotjs-robot.glitch.me/properties/Hand
#| {"Hand":45}

curl https://webthing-iotjs-robot.glitch.me/properties
#| {"Hand":45,"Arm":0,"Shoulder":0,"Body":0}

Notes to follow about XR View and CAD design (GLTF)...

PWM RESOURCES:

LICENSE: CC-BY-SA-4.0

INDEX

Clone this wiki locally