Add Sensor

Insert a new sensor or actuator into the system.

Add Sensor

Insert a new sensor or actuator into the system.

Intro

Adding a new sensor or actuator to the system is as easy as filling in a form. Once the correct details are provided the sensor will start reporting data to the ubiworx broker. If actuators are created then they can be controlled using the steps described in the sensors dashboard documentation section.

The ubiworx IoT framework allows users the ability to declare 2 types of sensors/actuators:

  • Physical sensors/actuators to monitor and control devices like an LED, GPIO or accelerometer.
  • Virtual sensors/actuators like free memory, core temperature and wifi signal.

A full list of currently suported sensors and actuators is provided bellow as well as examples on how to add and enable them.

Prerequisites

In order to add a new sensor/actuator to a gateway the following details are required:

  • The Hardware address of the sensor/actuator.
  • The hardware type:
    • iio-adc for analog
    • iio-dig for digital
  • The scale used to convert raw values into the expected range. If raw values are expected leave scale as 1, otherwise use the formula in the example bellow.

Calculating scale

Formula (maxExpectedValue - minExpectedValue) / (maxRawValue - minRawValue)

Example: Temperature

Expected value -20 to 100 degree C

raw value: 0 to 4096

Scale => (100 - (-20)) / (4096 - 0) = 0.029296875

Set the Offset to the minimum expected value, in this case -20.

Adding a new sensor or actuator:

  1. Go to the home view by clicking in the ubiworx logo or the home icon.
  2. In the main view click on the gateway you want to add the sensor.
List of gateways

List of gateways

  1. Once the view loads, click the Add button in the sensors side navigation menu.
  2. Select the type of sensor you want to add and fill in the form. Details about each field are provided bellow.
  3. Save changes:
  • Using the button, the changes are saved on the ubiworx broker and will be synced the next time the device reconnects.
  • Using the button, the changes are saved on the ubiworx broker and a sync request is sent to the gateway.

Filling in the form

Fields marked with an asterisks * are mandatory.

General info

Field Description
Type Select the type of sensor you want to add.
Name * Insert a name for the new sensor.
Unique ID * Insert a unique ID, this ID needs to be unique only to this gateway. Note: this field can NOT be changed once created
Hardware Address Identifies the address where the sensor is connected. (See examples bellow)
Hardware type Specify what type of sensor you want to create.
Possible options are:
* iio-adc - analog
* iio-dig - digital
(See examples bellow)

Range

Field Description
Min The minimum expected value.
Max The maximum expected value.

Data Sampling

Field Description
Scale The value used to convert raw date into samples in the expected range. For more details on how to calculate scale see the formula above.
Offset A number used to indicate the lowest expected value. If the min recordable temperature is -30 then the value of this field should be -30.
Sample rate The expected sample rate sent to the ubiworx broker.
Units Describe the sample value.
Filters Add filters to the sensor to extend the default sensor functionality.
Available filters:
* average(10) - function used to average a number of samples.

List of available sensors and actuators

Accelerometer

Example:

  • Type: Sensor
  • Name: Accelerometer
  • Unique ID: accel
  • Hardware address: 0;0x1D
  • Hardware type: adxl345
  • Min: 0
  • Max: 400
  • Scale: 1
  • Offset: 0

Core temperature

Reads the core temperature. This module is platform specific, use one of the hardware types bellow:

  • Galileo - hardware types: coretemp_galileo
  • Other - hardware types: coretemp

Example:

  • Type: Sensor
  • Name: Core temperature
  • Unique ID: core-temp
  • Hardware address: none
  • Hardware type: coretemp_galileo
  • Min: 0
  • Max: 100
  • Scale: 1
  • Offset: 0

Free CPU

Reports percentage idle CPU.

Example:

  • Type: Sensor
  • Name: Core Free CPU
  • Unique ID: free-cpu
  • Hardware address: none
  • Hardware type: cpufree
  • Min: 0
  • Max: 100
  • Scale: 1
  • Offset: 0

Free memory

Reports percentage free RAM.

Example:

  • Type: Sensor
  • Name: Core Free memory
  • Unique ID: free-memory
  • Hardware address: none
  • Hardware type: memfree
  • Min: 0
  • Max: 100
  • Scale: 1
  • Offset: 0

GPIO

This module is platform specific, use one of the hardware types bellow:

  • Edison - hardware types: gpio_edison
  • Other - hardware types: gpio

Example:

  • Type: Actuator
  • Name: LED
  • Unique ID: led-gpio
  • Hardware address: 2
  • Hardware type: gpio_edison
  • Min: 0
  • Max: 1
  • Scale: 1
  • Offset: 0

iio analog

Example:

  • Type: Sensor
  • Name: Vibration sensor
  • Unique ID: vib1
  • Hardware address: /sys/bus/iio/devices/iio:device0/in_voltage3_raw
  • Hardware type: iio-adc
  • Min: 0
  • Max: 100
  • Scale: 0.9875
  • Offset: 0

iio digital

Example:

  • Type: Sensor
  • Name:
  • Unique ID:
  • Hardware address: /sys/bus/iio/devices/iio:device0/in_voltage1_raw
  • Hardware type: iio-dig
  • Min: 0
  • Max: 1
  • Scale: 1
  • Offset: 0

Proximity

Reads a value from a proximity sensor. This module is platform specific, use one of the hardware types bellow:

  • Edison - hardware types: vnl4000_edison
  • Other - hardware types: vnl4000

Example:

  • Type: Sensor
  • Name: Ambient light
  • Unique ID: ambient-light
  • Hardware address: 6;19
  • Hardware type: vnl4000_edison
  • Min: 300
  • Max: 2500
  • Scale: 1
  • Offset: 0

PWM - Pulse Width Modulation

Set the speed of a fan. This module is platform specific, use one of the hardware types bellow:

  • Edison - hardware types: pwm_edison
  • Supermicro - hardware types: pwm_supermicro

Example:

  • Type: Actuator
  • Name: PWM fan
  • Unique ID: pwm-fan
  • Hardware address: 0
  • Hardware type: pwm_edison
  • Min: 0
  • Max: 100
  • Scale: 1
  • Offset: 0

Serial temperature

Reads temperature from a serial USB temperature probe.

Example:

  • Type: Sensor
  • Name: Temperature usb0
  • Unique ID: temp-usb0
  • Hardware address: /dev/ttyUSB0
  • Hardware type: sertemp
  • Min: -20
  • Max: 24
  • Scale: 1
  • Offset: 0

Wifi signal

Reads the WiFi signal strength.

Example:

  • Type: Sensor
  • Name: WiFi signal
  • Unique ID: wifi-signal
  • Hardware address: none
  • Hardware type: wifi
  • Min: -100
  • Max: 100
  • Scale: 1
  • Offset: 0