An analog-to-digital converter (ADC, A/D, A–D, or A-to-D) is a device that converts a continuous physical quantity (usually voltage) to a digital number that represents the quantity’s amplitude.

Using an ADC Interface in Driver

Configuring driver.json

To use an ADC interface in a driver, you need to have an input with type "adc" in the driver.json:

"models": [],
"inputs": {
"adc": {
"type": "adc"

In the JSON configuration above, the first "adc" is just the name of the ADC interface (you can change it to something else if you want to),
which will be used as the key to get the interface instance in the driver.
And the "type": "adc" informs Ruff framework to distribute an ADC interface instead of others.

Writing a Driver

'use strict';

var driver = require('ruff-driver');

module.exports = driver({
attach: function (inputs) {
this._adc = inputs['adc'];
exports: {
// Example: a method that appends unit 'v' to got voltage number.
getInputVoltage: function (callback) {
this._adc.getVoltage(function (error, voltage) {
if (error) {

callback(undefined, voltage + 'v');

API References



Ruff available: v1.6.0
Ruff Lite available: v0.6.0

Get the voltage of the interface.