Analog-Digital-Wandler RAK16001 für WisBlock neben einem Schema: analoges Signal, 8-Bit-ADC, I2C

Analog to Digital Converter: How Does an ADC Module Read Analog Sensors?

You have a sensor that puts out somewhere between 0.5 and 2.5 volts, and a microcontroller that only understands numbers. Between the two sits an analog to digital converter: it measures the voltage on its input, compares it with a reference voltage and hands back an integer. An ADC module such as the RAKwireless RAK16001 does exactly that for up to eight inputs and sends the results to your controller over I2C.

So the short answer to the question in the title is this: the module samples the sensor voltage, divides the range between 0 volts and the reference voltage into fixed steps and reports which step the reading falls into. Whether that number ends up as a usable temperature, tank level or pressure depends on details that many tutorials skip: resolution, reference voltage, the type of input and what kind of signal your sensor actually produces. Below, we walk through those points one at a time, using real numbers from the converter chip’s datasheet.

Analog to digital converter RAK16001 for WisBlock beside a diagram: analog signal, 8-bit ADC, I2C
You wire analog signals to CH0 through CH7 on the RAK16001, and its 8-bit ADC passes the values on over I2C.

What is an analog to digital converter?

An analog to digital converter, usually shortened to ADC or A/D converter, turns a continuous quantity, most often an electrical voltage, into a digital number. The physical world is analog: a temperature probe changes its resistance smoothly, a pressure sensor changes its output voltage without steps. A processor, on the other hand, can only work with discrete values. The converter is the bridge between the two.

Many microcontrollers already include a built-in ADC. There are still good reasons to add a separate chip or a ready-made ADC module: the internal converter often has only a few free pins, a reference that drifts with the supply, or it isn’t brought out at all on a radio module. An external converter adds channels, a defined reference voltage and a cleaner separation between the analog front end and the rest of the electronics.

The output number is at first just a code, for example 154. It’s neither a voltage nor a temperature. Your software converts it into volts using the reference voltage, and then into the real measured quantity using the sensor’s transfer curve.

How does an ADC work?

Every conversion starts with a sample. A small capacitor inside the converter’s input is briefly connected to the sensor voltage and charges up to that value. It’s then disconnected and holds the voltage while the actual comparison runs. On the ADS7830, the chip on the RAK16001, the datasheet lists this sampling capacitor at a typical 25 pF.

The ADS7830 uses successive approximation (SAR). It first checks whether the held voltage is above or below half the reference voltage and sets the most significant bit accordingly. Then it halves the remaining range and checks again. After eight of these comparisons, the 8-bit result is complete. The method is fast and frugal, which suits battery-powered devices.

This is where quantization happens: the continuous voltage gets mapped onto the nearest of a finite number of steps. Anything between two steps is lost. On an ideal converter, this quantization error is at most half a step, and it’s the reason resolution matters so much.

The second key figure is the sampling rate, meaning how many conversions per second the converter can deliver. For a signal that changes over seconds or minutes, a few readings per second are plenty. For vibration or audio, you need at least twice the frequency of the fastest signal component, and in practice a lot more.

ADC resolution: what do 8, 12 and 16 bits mean?

Resolution tells you how many steps the converter divides its input range into. An 8-bit converter has 2 to the power of 8, or 256 codes from 0 to 255, a 12-bit converter has 4,096 and a 16-bit converter 65,536. The size of one step, often called the LSB, is the reference voltage divided by the number of codes. The table below shows this for a 2.5 V reference, which is what the ADS7830 provides internally.

Resolution Number of codes Step size at 2.5 V reference
8 bits 256 approx. 9.77 mV
10 bits 1,024 approx. 2.44 mV
12 bits 4,096 approx. 0.61 mV
16 bits 65,536 approx. 0.038 mV

Each extra bit halves the step size. Whether you need that depends on the sensor. If it swings 2 volts across its full measuring range, an 8-bit converter splits that swing into roughly 205 steps. For a tank level in percent or a battery voltage, that’s more than enough. For a sensor that maps its entire range onto a few millivolts, such as a strain gauge bridge, it’s far too coarse. Signals like that need an amplifier and a 16-bit or 24-bit converter.

A common misconception: resolution is not accuracy. According to its datasheet, the ADS7830 has a maximum linearity error of ±0.5 LSB and an offset of up to 1 LSB. On top of that come the reference tolerance, sensor noise and interference picked up on the wiring. Ten decimal places on a display don’t create information the converter never measured.

How do you read an analog sensor’s output?

Start with your sensor’s datasheet and find out what kind of signal it delivers. An ADC always measures a voltage, against ground or between two inputs; everything else has to be translated into one first.

The easiest sensors have a voltage output, such as 0 to 2 V or 0.5 to 2.5 V. Check that this range stays below the converter’s reference voltage. On the RAK16001 with its 2.5 V reference, anything above about 2.49 V reads as code 255. The sensor then looks saturated even though it’s working correctly.

Resistive sensors like NTC thermistors or potentiometers don’t produce a voltage, they present a resistance. You need a voltage divider with a fixed resistor to get a measurable voltage. Make sure that voltage also stays below 2.5 V: a potentiometer wired between 3.3 V and ground will otherwise sweep through a range in the top quarter of its travel that the converter can no longer resolve.

Industrial signals like 0 to 10 V or 4 to 20 mA can’t go straight into the converter. A 3:1 divider, for example 30 kΩ over 10 kΩ, brings 10 V down to 2.5 V. A current signal is converted with a sense resistor: 20 mA through 120 Ω gives 2.4 V, and 4 mA gives 0.48 V. Both approaches also need protection against overvoltage and reverse polarity, because the ADS7830 tolerates no more than its supply voltage plus 0.2 V on an input. The RAK16001 has unpopulated pads (R3 to R20) for your own dividers, which are not active out of the box.

One last point is source impedance. The sampling capacitor has to charge in a short time. If your sensor sits behind very high-value resistors, it can’t fully do that, and the reading comes out too low or jumps between channels. A small capacitor right at the input that supplies charge during sampling, or a buffer amplifier, solves this.

How do you convert ADC values to voltage?

The basic formula is short: voltage = code × reference voltage ÷ 256. Texas Instruments explicitly defines the ADS7830’s step size as the reference divided by 256. Plenty of online examples divide by 255 instead, which introduces an error of about 0.4 percent at 8 bits.

Say the converter returns code 154. With a 2.5 V reference, that gives 154 × 2.5 ÷ 256 = 1.504 V. If there’s a voltage divider in front of the input, you also multiply by the divider ratio. With 30 kΩ and 10 kΩ, that’s (30 + 10) ÷ 10 = 4, so the voltage at the divider input was about 6.02 V.

The second step applies the sensor’s transfer curve. Take an example sensor that outputs 0.5 V at 0 units and 2.5 V at 100 units. Its span is 2 V. The conversion is: (measured voltage − 0.5) ÷ 2 × 100. So 1.504 V becomes 50.2 units. A single converter step of 9.77 mV corresponds to just under 0.49 units here. Don’t pretend to more than half a unit of resolution on your display.

Two edge cases deserve their own handling in code. Code 0 may mean the sensor really outputs 0 V, but it can also mean a wire has come loose. Code 255 can be a genuine maximum or an overdriven input. Don’t pass these values on as valid readings without checking; flag them as out of range instead.

RAK16001 analog to digital converter beside the math: 8-bit, 2.5 V divided by 256 is about 9.77 mV
At 8 bits, the RAK16001 splits its 2.5 V reference into 256 steps, so each step is worth about 9.77 mV.

What is an ADC reference voltage?

The reference voltage is the yardstick the converter compares every input voltage against. It sets the top of the measuring range and therefore the size of every step. If it’s off, every reading is off by the same proportion, no matter how many bits the converter has.

The ADS7830 can run from an internal 2.5 V reference or an external one, and according to RAKwireless the RAK16001 is designed around the internal 2.5 V reference. The datasheet guarantees it between 2.48 and 2.52 V from −40 to +85 °C, roughly ±0.8 percent, with a typical drift of 15 ppm per degree. At the top of the scale, that tolerance amounts to about two codes. If you want better accuracy, calibrate once against a known voltage and a good multimeter, then store the correction factor.

Don’t confuse the reference with the supply. The RAK16001 runs on 3.3 V, but it only measures up to 2.5 V. Plug 3.3 instead of 2.5 into your formula and your readings will be 32 percent too high while still looking plausible.

The internal reference also has to be switched on. In the ADS7830’s command byte, two power-down bits determine whether the reference and the converter stay active between conversions. Check that your library enables the reference, and give it time after power-up: according to the datasheet, it needs a few dozen microseconds without an external capacitor and close to a millisecond with 1 µF before it’s stable to 8 bits.

Single-ended vs differential ADC inputs: which do you need?

With a single-ended input, the converter measures one channel’s voltage against a shared reference point. On the ADS7830, that’s the COM pin, which normally sits at ground. That gives you eight channels, CH0 through CH7. For most sensors that share the same ground, this is the right choice.

In differential mode, the chip combines channels into pairs: CH0 and CH1, CH2 and CH3, CH4 and CH5, and CH6 and CH7. It measures the difference between the two inputs, and the command byte lets you choose which channel of the pair is the positive one. That halves the channel count to four.

There’s a limit here you should know about before you buy. The ADS7830 is only pseudo-differential. According to the datasheet, the negative input must stay between −0.2 and +0.2 V, and the difference must stay between 0 and the reference voltage. The converter can’t output negative differences. That means you can’t connect a Wheatstone bridge directly, since both of its outputs sit at half the supply voltage. Differential mode mainly helps when you want to cancel out a small ground offset between the sensor and the module.

A second property applies to every input: the eight channels share a single converter that a multiplexer switches between one after another. Two channels are never measured at exactly the same instant. For slow quantities, the offset doesn’t matter. For fast, related signals, it does.

What does the RAK16001 ADC module do?

The RAK16001 is an ADC module for the RAKwireless WisBlock system. It plugs into the IO slot of a WisBlock base board and connects to the core through the 40-pin WisConnector. The board carries the Texas Instruments ADS7830 with 8-bit resolution, eight single-ended or four differential inputs and an I2C interface. The default address is 0x48 and can be changed with a jumper selection on the board. The chip itself allows up to four devices on the same bus.

The ADS7830’s sampling rate depends on the I2C clock. The often-quoted 70,000 conversions per second only apply in high-speed mode at 3.4 MHz. In fast mode at 400 kHz, the datasheet lists 10,000 conversions per second, and in standard mode at 100 kHz, 2,500. Software and channel switching reduce the usable rate further, which doesn’t matter for sensors you poll once a second.

The power design is what makes it interesting for battery-powered nodes. The module runs from the switched 3.3 V rail 3V3_S, which the WisBlock core can turn off completely via the WB_IO2 pin. Between readings, no current flows into the module at all. After switching it back on, though, you have to wait for the reference and your sensor to settle and possibly discard the first reading.

The RAK16001 is a good fit wherever several slow analog signals meet at one WisBlock node: battery voltages through dividers, potentiometers, simple sensor voltage outputs or NTC thermistors in a divider. If you need millivolt-level signals, negative voltages or very high sampling rates, a different converter is the better choice.

Where can you buy an ADC module?

Before you choose an ADC module, answer five questions. First, what signal does your sensor deliver, and over what voltage range? If it goes above the reference voltage, you need a divider or some other conditioning. Second, what resolution do you actually need? Work out how many steps fall across your sensor’s swing instead of looking only at the bit count. Third, is a single-ended input enough, or do you need true differential measurement with negative values? Fourth, how often do you need to measure, and how many channels have to be captured at nearly the same time? Fifth, does the module fit your system mechanically and electrically, meaning slot, bus, address and power supply?

For a WisBlock project with several slow sensor voltages, an 8-bit analog to digital converter like the RAK16001, with its 2.5 V reference and switchable power, is a solid foundation. If you’re looking for a suitable ADC module, you’ll find our models in the I/O modules category.

Our latest news

Scroll to top