Homepage Wiki Forum Buy



severity (level) requirement Gnublin family
Gnublin logo advanced.png Kernel compile, Toolchain All



If the 4 internal ADC-channels are not enough for your project you can get 8 more ADC channls with this module which uses an ads7830 chip. The chip communicates over I2C (TWI). You can select the address of the chip with the address pins (A0, A1)

The following article describes how to interact with this module.

Gnublin adc2.jpeg

Read out the voltage value on channel 1

root@gnublin:~# gnublin-adcmod -c 1

Readout the voltage on channel 2

root@gnublin:~# gnublin-adcmod -c 2

and so on. The reference voltage for the GNUBLIN-Tool is 2.5 V.Only the jumper by REF_IN is allowed to be set.


For beginners its better to use the module of the shop. You don't have to build up the whole module and you can just start here. If you are used to build circuits with AD-Converters so you can build your own module. The pin configuration is as shown here:



Like mentioned before the ads7830 has two pins to select the address.

A0 A1 I2C-Address
GND GND 0x48
VCC GND 0x49

For Beginners

If you get the module of the shop and you are using the Gnublin Distribution you can go ahead with these steps:


At first you have to connect the module like shown above. The red wire of the ribbon cable has to be by GPIO0 / GPIO1 of the GNUBLIN.

It's realy important that the ground of the signals which you want to measure is connected to the GND-Port of the ADC.

For an fast and easy use of the ADC there is an short program. The program is already installed in the distribution.

root@gnublin:~# gnublin-adcmod

Setting the Address

It's important to use the right address.The default address is set to 0x48. If you will to read the voltage of the module with the address 0x49 on Channel 0 you type this command:

root@gnublin:~# gnublin-adcmod -c 0 -a 49

If you don't relay know the right address of your module you can use I2C-Tools to check it:

i2cdetect -y 1

Differential Measurement

You have also the option to measure the difference between two pins.

root@gnublin:~# gnublin-adcmod -c 1 -d

This command gets the difference between pin 1 and two. The parameter -d enables the differential measurement while -c set the first pin. The second pin is selected automatically.

It's important that the Ground of the two signals is connected to the ground of the ADC to get the right value.

Following combinations are possible:

Channel 1 Channel 2
1 2
3 4
5 6
7 8

Other options

You get an overview of all possible options of the GNUBLIN-Tool by using the help command:

root@gnublin:~# gnublin-adcmod -h
This Script prints out the value of a selected adc-channel of the gnublin-adc-module
-h Show this help
-b show raw output
-j Convert output to json format
-c <x> Select ADC Channel (1 - 8 possible, default is 1)
-d enables differential mesurement between pears, only possible [1,2], [3,4], [5,6] [7,8]
first channel is given by -c, second channel is selectet automaticaly
-a <ADDRESS> I2C-Address of the module (default is 0x48)
channel=2, I2C-Address=0x48 print value in json format:
gnublin-adcmod -j -a 0x48 -c 2
channel=7, I2C-Address=0x4A print value in normal format:
gnublin-adcmod -a 0x4A -c 7

For Advanced users

Information to the Configuration

Power supply

2.7V - 3.6 V

Reference Voltage

On the one hand you can connect the pin over a capacitor (1 µF) to ground (Vref Pin --> Capacitor-->Ground) in this case the chip uses his internal reference voltage of 2.5V. On the other hand you can connect an external reference voltage to this pin in this case it's important that to know the limit of 0,05V - Vdd.

On the module are two jumpers to set the right reference voltage. The jumper with the tag REF_IN uses the internal reference voltage of 2.5V. The jumper with the tag REF_3.3V uses the supply voltage of 3.3V as reference.

Caution: Only one jumper is allowed to be set.


We noticed that the chip is very sensitive to noises on the power supply! You will see this by the variation of the ADC value.


The driver for the ads7830 is a light variation of the driver of the ads7828 chip. The only difference of these two chips is the resolution (ads7830 = 8 bit, ads7828 = 12 bit). Therefore the register access has only to be limited to 8 bit. The driver is already implemented in the community kernel.

Accessing the chip

To access the chip there are three ways:

  1. Directly over the I2C bus via C
  2. Directly over the I2C bus wit the I2C-Tools
  3. Using the driver

You should decide you to use the driver. This way is more confortable and the common way.

The driver for the ads7830 gives for every AD-Pin driver attributes in the sysfs. These are files like the device file which are interfaces for the driver. These files can just be read with fread which returns the value read by the driver.

In other languages