Skip to content

input module

doomke edited this page Aug 17, 2023 · 11 revisions

Description

Uses a specified input pin to continually acquire, convert and monitor the voltage applied. The input is averaged by default, with 500 to 1000 ms usually sufficient to cancel out noise on the ADC. Voltage values are delivered as double, this datatype is maintained through all conversions. Several conversion options are available, up to 16 conversions can be applied sequentially. The converted input can be checked for boundary violations, which will trigger an internal event that other modules can react on.

Settings

setting type range description
averageTime integer ≥ 0 average interval (in ms) that the voltage will be averaged for
updateTime integer ≥ 0 interval (in ms) between data points when streaming (converted) values to the server
pin integer > 0 number of the pin the voltage is applied to[1]
rangeChecking boolean module will check for boundary violations of the converted value if true
deadMicroSeconds integer ≥ 0 time in microseconds that a range check will not occur for after a boundary violation was detected[2]
loBound integer lower boundary of the value range, lower values will trigger a boundary violation[2],[3]
hiBound integer higher boundary of the value range, higher values will trigger a boundary violation[2],[3]
isBinary boolean if true a boundary violation will only be detected if the previous violation was of the opposite type[2]
  1. not available for all pins: ADC2 is cannot be used when WiFi is active. Check for the specific pinout of the board in use.
  2. only available if rangeChecking is true.
  3. behavior changes depending on deadMicroSeconds and isBinary.

Command Keys

key type range description
getStatus boolean send the current status if true
averageTime integer ≥ 0 set the averaging time to the specified value (in ms)
updateTime integer ≥ 0 set the update interval to the specified value (in ms)
stream boolean start streaming value to the server if true or stop when false

Status

"controlId":"thermistor",
"status":
{
    "averageTime":1000,
    "updateTime":2000,
    "stream":true,
    "inputState":22.35
}

Note that inputState always holds the last converted value, unless isBinary is true. In that case, false will be reported if the last boundary violation was for the lower boundary instead (and true if it was for the upper boundary).

Events

  • input trigger low – issued when a value (after conversion) lower than loBound is measured. Event does not occur if rangeChecking is false, an input event already occurred within the time defined by deadMicroSeconds or if isBinary is true and the output was low before
  • input trigger high – issued when a value (after conversion) lower than hiBound is measured. Event does not occur if rangeChecking is false, an input event already occurred within the time defined by deadMicroSeconds or if isBinary is true and the output was high before

Conversions

Several conversion modules to convert the voltage to a different value are available. Conversions will be carried out in the order they are entered. Available conversions:

Thermistor

A measured resistance of a Thermistor (NTC) is converted into a temperature. Known parameters of the NTC need to be provided.

  • tempNormal – normal temperature at which the normal resistance of the NTC was measured. Unit of measurement must be same as for beta and relative to absolute zero. Output unit is determined by this (use Kelvin ... or Rankine if you absolutely must use Fahrenheit).
  • resNormal – normal resistance of the NTC at normal temperature. Unit of measurement must be same as for the input resistance.
  • beta – beta value of the NTC. Unit of measurement must match that of the normal temperature.

Resistance by voltage divider

A simple voltage divider is used to calculate the (variable) resistance connected to the input. Reference for applied voltage as well as a known resistor are needed.

  • refVoltage – voltage in applied to the voltage divider. Unit of measurement must match input value (without conversion: mV)
  • refResistor – resistance of the reference resistor. Unit of measurement determines output unit (example: 10 kΩ -> output in kΩ)

Voltage by voltage divider

A simple voltage divider with two known resistors is used to break down a larger voltage to a smaller value. The smaller value is measured and converted to the (reconstructed) original voltage.

  • refOne – resistance of the first resistor of the voltage divider. Unit of measurement must match with refTwo.
  • refTwo – resistance of the second resistor of the voltage divider, measured voltage is the voltage drop over this resistor. Unit of measurement must match refOne.

Map

Linear conversion of the input value from a specified input range (inMin,inMax) to a specified output range (outMin,outMax).

  • inMin – minimal value of the input range. Unit of measurement must match inMax and the input value. This value must not be subceeded.
  • inMax – maximal value of the input range. Unit of measurement must match inMin and the input value. This value must not be exceeded.
  • outMin – minimal value of the output range. Unit of measurement must match outMax. This value will not be subceeded for the given input range.
  • outMax – maximal value of the output range. Unit of measurement must match inMax. This value will not be exceeded for the given input range.

Offset

Add a specified offset (positive or negative) to the input value.

  • offsetValue – value added to the input. Positive and negative values possible. Unit of measurement must match input.

Multiplication

Multiply the input with a specified value.

  • multiplicator – value that the input gets multiplied with. Be aware that the unit of measurement will change unless this value is unitless.

General

Guides

Principle of Operation

Modules

Software Hardware
camera camera
infoLED infoLED
input input
macro macro
output output
servo servo
socket socket
stepper stepper
WiFi wifi

Clone this wiki locally