Outputs
For a complete list of supported output devices, see Supported Output Devices.
Outputs can generate a variety of signals that operate devices. Outputs can switch relays that operate at radio frequency using HIGH/LOW signals on GPIO pins, pulse-width modulation (PWM) signals, or 315/433 MHz signals; drive pumps and motors; execute Linux or Python commands; and more.
Finding a device in the add list~
The dropdown at the top of the page groups the supported devices by how they drive a load (Pump & Dosing, Proportional (PWM), Value Setting, On/Off Switching), with AoT's own devices listed first. The search box matches the device name, the module name, the interface, and the measurement names in your own language.
Custom Outputs~
AoT has a custom output import system that lets you create and use custom outputs within the AoT system. Custom outputs can be uploaded and imported on the [gear icon] -> Configure -> Custom Outputs page. Once imported, they can be used on the Setup -> Output page.
If you have developed a working module, consider creating a new GitHub issue or a pull request. The module may be included in the built-in set.
For examples of the proper format, you can open the built-in modules in the AoT/aot/outputs directory. Additionally, the AoT/aot/outputs/examples directory contains custom output examples.
For outputs that require a new measurement/unit, you can add them on the [gear icon] -> Configure -> Measurements page.
Output Options~
| Setting | Description |
|---|---|
| Pin (GPIO) | The GPIO pin to use for the output signal. Uses the BCM numbering scheme. |
| WiringPi Pin | The GPIO pin to use for the output signal. Uses the WiringPi numbering scheme. |
| On State | The GPIO signal state that turns the device on. HIGH sends a 3.3-volt signal, and LOW sends a 0-volt signal. If the output completes the circuit with a 3.3-volt signal to turn the device on, set this to HIGH. If a 0-volt signal turns the device on, set it to LOW. |
| Protocol | The protocol to use when transmitting over 315/433 MHz. The default is 1; if it does not work, try increasing the number. |
| UART Device | The UART device connected to the device. |
| Baud Rate | The baud rate of the UART device. |
| I2C Address | The I2C address of the device. |
| I2C Bus | The I2C bus the device is connected to. |
| Output Mode | The output mode, if supported. |
| Flow Rate | The flow rate (ml/min) for dispensing a volume. |
| Pulse Length | The pulse length to transmit over 315/433 MHz. The default is 189 ms. |
| Bit Length | The bit length to transmit over 315/433 MHz. The default is 24 bits. |
| Run as User | Selects the user under which the Linux command will run. |
On/Off (GPIO)~
An On/Off (GPIO) output switches a GPIO pin to HIGH (3.3 volts) or LOW (0 volts). This is useful for controlling electromechanical switches such as relays to turn electrical devices on and off.
A relay is an electromechanical or solid-state device that uses a small voltage signal (for example, one generated by a microprocessor) to activate a much larger voltage, keeping the low-voltage system from being exposed to the danger of high voltage.
Add and configure outputs on the Output tab. An output must be configured correctly before it can be used elsewhere in the system.
To set up a wired relay, set the "GPIO Pin" (using the BCM numbering scheme) to the pin that will switch to HIGH (5 volts) and LOW (0 volts). This is used to activate relays and other devices. On Trigger must be set to the signal state (HIGH or LOW) that turns the device on. For example, if the relay is activated when the coil's potential is 0 volts, set On Trigger to "LOW". Conversely, if the relay is activated when the coil's potential is 5 volts, set it to "HIGH".
Pulse-Width Modulation (PWM)~
Pulse-width modulation (PWM) is a modulation technique that encodes a message into a pulsing signal at a specific frequency (Hz). The average value of the voltage (and current) supplied to the load is controlled by switching between the power source and the load at a rapid rate. The longer the switch is on compared to the time it is off, the higher the total power supplied to the load.
The PWM switching frequency must be much higher than the frequency that would affect the load (the device that uses the power). In other words, the resulting waveform perceived by the load should be as smooth as possible. The power supply switching rate can vary widely depending on the load and the application. For example:
Quote
In an electric stove, switching must occur several times per minute; in a lamp dimmer, at 120 Hz; in motor drives, from a few kHz to tens of kHz; and in audio amplifiers and computer power supplies, up to tens or hundreds of kHz.
The duty cycle describes the ratio of the 'on' time to the regular interval or 'period' time. A low duty cycle means low power, because the power is off most of the time. Duty cycle is expressed as 0% for always off, 50% for off half the time and on half the time, and 100% for always on.
Pulse-Width Modulation (PWM) Options~
| Setting | Description |
|---|---|
| Library | Selects the method used to generate the PWM signal. Hardware pins can generate a PWM signal up to 30 MHz, while other (non-hardware PWM) pins can generate a PWM signal up to 40 kHz. See the table below for the hardware pins on the various Pi boards. |
| Pin (GPIO) | The GPIO pin to output the PWM signal on, using the BCM numbering scheme. |
| Frequency (Hertz) | The frequency of the PWM signal. |
| Invert Signal | Sends the inverted duty cycle to the output controller. |
| Duty Cycle | The ratio of on time to off time, expressed as a percentage (0-100). |
Non-Hardware PWM Pins~
When using non-hardware PWM pins, only certain frequencies can be used. The allowed frequencies (Hz) are 40000, 20000, 10000, 8000, 5000, 4000, 2500, 2000, 1600, 1250, 1000, 800, 500, 400, 250, 200, 100, and 50 Hz. If you try to set a frequency not in this list, the nearest frequency is used instead.
Hardware PWM Pins~
When using hardware PWM pins, an exact frequency can be set. The same PWM channel can be used on multiple GPIOs. All GPIO pins that share the same PWM channel use the most recently set frequency and duty cycle.
| BCM Pin | PWM Channel | Raspberry Pi Version |
|---|---|---|
| 12 | 0 | All models except A and B |
| 13 | 1 | All models except A and B |
| 18 | 0 | All models |
| 19 | 1 | All models except A and B |
| 40 | 0 | Compute Module only |
| 41 | 1 | Compute Module only |
| 45 | 1 | Compute Module only |
| 52 | 0 | Compute Module only |
| 53 | 1 | Compute Module only |
Peristaltic Pump~
AoT supports two peristaltic pump output modules: the Generic Peristaltic Pump Output and the Atlas Scientific EZO-PMP Peristaltic Pump.
Generic Peristaltic Pump~
You can use the Generic Peristaltic Pump Output to dispense liquid with any peristaltic pump. The most basic dispensing functions are to start dispensing, stop dispensing, or dispense for a set amount of time. If the pump speed has been measured, entering this value in the "Fastest Rate (ml/min)" setting allows the output controller to dispense a specific volume rather than simply a duration. To dispense a specific volume, you must set the output mode and specify the "Desired Flow Rate (ml/min)".
To measure the pump's flow rate, first remove all air from the pump tubing. Then instruct the pump to dispense for 60 seconds and collect the dispensed liquid. When finished, measure the amount of dispensed liquid in milliliters and enter it in the "Fastest Rate (ml/min)" setting. Once the pump's flow rate is set, you can now dispense a specific volume.
This output module works by switching a GPIO pin to HIGH or LOW to turn the peristaltic pump on and off. This is most easily implemented by using a relay in series with the pump's power supply, or by using the GPIO directly as the pump's input signal (if supported). When using a relay, it is important to design a circuit that enables the pump to switch quickly. Because the volume a pump dispenses depends on time, the faster the pump can be switched, the higher the dispensing accuracy. Many peristaltic pumps operate on DC voltage and require an AC-to-DC converter. These converters can take time to energize or de-energize as power is applied or removed, which can affect dispensing accuracy. To address this, you should switch DC power rather than AC power to eliminate these potential delays.
Atlas Scientific Peristaltic Pump~
The Atlas Scientific Peristaltic Pump is a device that combines a peristaltic pump with a microcontroller, capable of precisely dispensing a specific volume of liquid via I2C or serial communication. This pump can accept several commands, including commands to calibrate, turn on, turn off, and dispense at a specific rate. The Atlas Scientific Peristaltic Pump is a good option, but it costs more than a generic peristaltic pump.
Peristaltic Pump Options~
| Setting | Description |
|---|---|
| Output Mode | "Fastest Rate" dispenses liquid at the fastest possible rate. "Specify Flow Rate" dispenses liquid at the rate set in the "Flow Rate (ml/min)" option. |
| Flow Rate (ml/min) | The rate at which liquid is dispensed when "Specify Flow Rate" is selected in the "Output Mode" option. |
| Fastest Rate (ml/min) | The rate (ml/min) at which the pump dispenses liquid. |
| Minimum On Time (sec/min) | The minimum duration (in seconds) the pump must be on during each 60-second period. This option is only used when "Specify Flow Rate" is selected in the "Output Mode". |
Wireless 315/433 MHz~
Some 315/433 MHz wireless relays can be used. You must configure the transmitter's pin (using the BCM numbering scheme), pulse length, bit length, protocol, on command, and off command. To determine the on and off commands, connect a 315/433 MHz receiver to the Pi, then run the script below, replacing 17 with the pin the receiver is connected to (using the BCM numbering scheme). Press a button on the remote (on or off) to detect the numeric code associated with that button.
433 MHz wireless relays have been successfully tested with the SMAKN 433MHz RF transmitter/receiver and Etekcity Wireless Remote Control Electrical Outlets (see Issue 88). If you have a 315/433 MHz transmitter/receiver and wireless relay that do not work with the current code, submit a new issue including your hardware details.
Linux Command~
This option runs a terminal command when the output is turned on, turned off, or the duty cycle is set. Commands are run as the 'root' user. When you create a Linux Command output, example code is provided showing how to use the output.
Python Command~
The Python Command output works similarly to the Linux Command output, but runs Python 3 code. When you create a Python Command output, example code is provided showing how to use the output.
MQTT: TLS and CA certificates~
The MQTT outputs (On/Off, On/Off Multi, Value, and PWM) can publish to a broker over TLS. Turn on "Use TLS" and leave "TLS CA Certificate" empty to trust the system's CA store, which is what a broker with a publicly-trusted certificate (for example, Let's Encrypt) needs. A broker with a private or self-signed certificate needs the path to that CA file entered explicitly — without it, the connection is rejected during certificate verification. TLS is required whenever the broker is reached over the internet rather than a local network. The same options exist on the MQTT inputs.
Output Notes~
Wireless and command (Linux/Python) outputs: because the wireless protocol only allows one-way communication with 315/433 MHz devices, a wireless relay is assumed to be off until it is turned on, and is displayed in red (off) when added. If a wireless relay is turned on or off outside of AoT (for example, with a remote), AoT cannot verify the relay's state and displays its last known state. For example, if AoT turns a wireless relay on and you turn the relay off with the remote, AoT still assumes the relay is on.
Accepted is not the same as confirmed~
Outputs that share a gateway — LoRaWAN ones — send their commands in a single queue. A site normally has one gateway and it is half-duplex, so overlapping downlinks drown out the replies coming back from the devices. Operating several valves at once therefore answers immediately on screen while the actual transmissions go out a few seconds apart.
The "success" you see means the command was accepted for sending. Whether the device actually switched is decided by the confirmation the device sends back. If none arrives, the command is retransmitted within its window; if it never arrives, the output is marked as a communication fault and reverted.
On-time is recorded from the moment the device confirms, not from when the command was sent — only the times it actually opened and closed tell you how much water was delivered. One-way outputs, which have nothing that could confirm, are still recorded at send time.
Note
The gap between commands is set together with the RX2 data rate. Raising the data rate shortens the time each command occupies the air, which allows a shorter gap and therefore more valves operated at once. Lowering it requires lengthening the gap again — changing only one of the two saturates the gateway so it cannot hear the replies. The two values live in the LNS (ChirpStack) config and in AoT respectively, so both must be adjusted.
If a sequence step, conditional, PID, or widget still points at an output, deletion is refused and AoT tells you where it is used. Remove or repoint those references first, then delete. The same applies to deleting a whole output tab — if anything outside the tab uses a device inside it, the tab is not deleted.
Previously the output was simply deleted, and everything pointing at it was left holding a device that no longer existed. Nothing raises an error, so this is hard to notice, and an activated sequence keeps issuing commands every cycle that reach nothing.
A duplicated name is not operated by name~
If two or more outputs share a name, AoT operates none of them when you refer to that name — it asks which one you mean. Device lists show the owning tab alongside the name only in that case (v11 (Naju)); names that do not collide are shown as they are.