Sort By:  
Adafruit ADS1015 12-Bit ADC (3A4 ADS1015 12-Bit ADC)

The Raspberry Pi does not feature an Analog-to-Digital Converter (ADC), so if you want to measure analogue singals, you'll need this 12-Bit ADC!

The Adafruit 4-Channel I2C 12-Bit ADC is a high-precision ADC and features the ADS1015 chip, which provides 12-bit precision at 3300 samples/second over I2C. The chip can be configured as 4 single-ended input channels, or two differential channels. As a nice bonus, it even includes a programmable gain amplifier,with up to x16, to help boost smaller single/differential signals to the full range. We like this ADC because it can run from 2V to 5V power/logic, can measure a large range of signals and its super easy to use. It is a great general purpose 12 bit converter. 

The chip's fairly small so it comes on a breakout board with ferrites to keep the AVDD and AGND quiet and interfacing is done via I2C. The address can be changed to one of four options (see the datasheet table 5 in downloads below) so you can have up to 4 ADS1015's connected on a single 2-wire I2C bus for 16 single ended inputs. 
To get you started, we have example code for the Raspberry Pi - Simply connect GND to ground, VDD to your logic power supply, and SCL/SDA to your microcontroller's I2C port and run the example code to start reading data.
The Adafruit 4-Channel I2C 12-Bit ADC Features:
  • Wide Supply Range: 2.0V to 5.5V
  • Low Current Consumption: Continuous Mode: Only 150µA Single-Shot Mode: Auto Shut-Down
  • Programmable Data Rate: 128SPS to 3.3kSPS
  • Internal Low-Drift Voltage Reference
  • Internal Oscillator
  • Internal PGA
  • I2C Interface: Pin-Selectable Addresses
  • Can run from 2V to 5V power/logic
  • Measures a large range of signals and is super easy to use.
  • 12-bit precision at 3300 samples/second over I2C.
  • Configurable as 4 single-ended input channels, or two differential channels.
  • Includes a programmable gain amplifier, up to x16, to help boost up smaller single/differential signals to the full range.
  • Breakout Board equipped with ferrites to keep the AVDD and AGND quiet


Four Channel ADC Breakout

Example Code for the Raspberry Pi

R179.00  Inc VAT
12V 1/2" Inlet Feed Water Solenoid Valve N/C (2A2 12V solenoid valve)
Voltage: 12V DC
Rated Power: 5W
Pressure: Max 8 Bar
Operation model: Normally closed
Port Size: 1/2''
Fluid temperature: 0-100
Usage: water and low viscosity fluids
Flow characteristics: 0.2Bar>1.5L/min 1Bar>7L/min 3Bar>12L/min 8Bar>20L/min;
R189.00  Inc VAT
10-bit ADC (SPI) - 8 Channel ( 3A4 10-bit ADC 8 Channel)

The Raspberry Pi is a great computer but there's just one thing that most hardware hackers will find missing: a few inputs for connecting analog sensors. This is where the MCP3008 chip comes in handy, with eight 10-bit channels accessible over SPI. Thanks to the Raspberry Pi's SPI interfaces and its two 'Chip Select' pins available off of the main GPIO connector, the problem is solved.


  • 10-bit resolution
  • ± 1 LSB max DNL
  • ± 1 LSB max INL
  • 8 input channels
  • Analog inputs programmable as single-ended or pseudo-differential pairs
  • On-chip sample and hold
  • SPI serial interface (modes 0,0 and 1,1)
  • Single supply operation: 2.7V - 5.5V
  • 200 ksps max. sampling rate at VDD=5V
  • 75 ksps max. sampling rate at VDD=2.7V
  • Low power CMOS technology
  • 5 nA typical standby current, 2 µA max.
  • 500 µA max. active current at 5V
  • Industrial temp range: -40°C to +85°C


  • Sensor Interface
  • Process Control
  • Data Acquisition
  • Battery Operated Systems


The following sample assumes that you're running the latest official Raspbian distribution, that you're logged in as root and that you haven't yet customized Raspbian to use SPI from a Python script. By default, the kernel module managing SPI communications is not loaded on Raspbian, so let's ensure that the 'spidev' device is available.

[email protected]:/# lsmod
Module                  Size  Used by  
snd_bcm2835            12808  0  
snd_pcm                74834  1 snd_bcm2835  
snd_seq                52536  0  
snd_timer              19698  2 snd_seq,snd_pcm  
snd_seq_device          6300  1 snd_seq  
snd                    52489  5 snd_seq_device,snd_timer,snd_seq,snd_pcm,snd_bcm2835  
snd_page_alloc          4951  1 snd_pcm  

If 'spidev' device is not listed, we need to remove it from the kernel module 'blacklist' so that it's automatically loaded on the next boot:

[email protected]:/# nano /etc/modprobe.d/raspi-blacklist.conf  

Put a hash character in front of the 'blacklist spi-bcm2708' statement and save the file:

#blacklist spi-bcm2708  

then, manually load the SPI device:

[email protected]:/# modprobe spidev  

The command should just complete without returning an error. Validate the list of modules:

[email protected]:/# lsmod  
Module                  Size  Used by  
spi_bcm2708             4401  0  
spidev                  5136  0  
snd_bcm2835            12808  0  
snd_pcm                74834  1 snd_bcm2835  
snd_seq                52536  0  
snd_timer              19698  2 snd_seq,snd_pcm  
snd_seq_device          6300  1 snd_seq  
snd                    52489  5 snd_seq_device,snd_timer,snd_seq,snd_pcm,snd_bcm2835  
snd_page_alloc          4951  1 snd_pcm  

The 'spidev' device should now be available.

Next, install the 'git' package. It will be needed to install other packages from Github.

apt-get install git-core  

Install the 'python-dev' package. It will be needed to compile the 'py-spidev' package.

apt-get install python-dev  

Download and compile the 'py-spidev' package.

[email protected]:/# cd /home  
[email protected]:/home# git clone git://github.com/doceme/py-spidev  
[email protected]:/home# cd py-spidev/  
[email protected]:/home# python setup.py install  

At this point, SPI is available from Python 2.7. Assuming that you have wired the MCP3008 to the Raspberry Pi's SPI bus using CE0 as the 'chip select' pin, you can read all eight analog inputs using the following Python script.

[email protected]:/home# nano adc.py  

Paste the script below in the editor and save it.

import spidev  
import time    
spi = spidev.SpiDev()  

# read SPI data from MCP3008 chip, 8 possible adc's (0 thru 7)  
def readadc(adcnum):
          if ((adcnum > 7) or (adcnum < 0)):
                  return -1
          r = spi.xfer2([1,(8+adcnum)<<4,0])
          adcout = ((r[1]&3) << 8) + r[2]
          return adcout

while True:
          for adcInput in range(0,8):
                  print "ADC(", adcInput,")=", readadc(adcInput)

To execute the script

[email protected]:/home# python adc.py  

Sample output using a 10K Ohm trimpot connected to the ADC's pin 3 and all other pins pulled down to ground using a 10k resistor.

ADC( 0 )= 0  
ADC( 1 )= 0  
ADC( 2 )= 0  
ADC( 3 )= 507  
ADC( 4 )= 0  
ADC( 5 )= 0  
ADC( 6 )= 0  
ADC( 7 )= 0  

Credits go to Jeremy for his work on the 'py-spidev' Python module which makes working with the MCP3008 straight forward. Alternatively, checkout wiringPi's SPI functions if you prefer using a 'C' API.

Related Tutorials & Samples

R59.00  Inc VAT
DC 12V 0.4N Push-Pull Open Frame Solenoid Electric Magnet Holding (1D4 solenoid push pull 12V)
This solenoid electric magnet is suitable for vending machines, office facilities, transport equipment, appliances and much more.
It can be fixed and connect load easily, heat up stablely to prolong life of product and ensure good performance.

Specification :

Input Voltage : 12V DC
Holding Force : 0.4N
Operating Temperature : -5 - 40℃ non-condensing
Operating Humidity : relative humidity 45%-85% non-condensing
Saving Temperature : -45 - 75℃ non-condensing
Saving Humidity : relative humidity 0%-95% non-condensing

Stroke : 10mm
Fram Size : 3(L)x1.2(W)x1.5(H)cm
Lead Length : 20cm

Package Includes :

1 x DC 12V 0.4N Push-Pull Open Frame Solenoid Electric Magnet
R105.01  Inc VAT
12V Electronic Door Lock Access Control for Cabinet Drawer (1D4 solenoid cabinet lock)
Voltage: DC12V
Current Draw: DC12V/60mA
Fail Secure: Locked when power off
Extension length: 9.8mm close
Lock Size: 53 x 39 x 25(mm)
Bolt Dimension: 9.8 x 9(mm)
Weight: 150g

Highly secure and easy to operate 
Fit for desk, cabinet, window or safe box
Package Includes:
1 x Electric Cabinet Lock
R209.00  Inc VAT
DC 12V Compact Siren (2A4 12V Red Siren)
Easy to install and use
12Volt - Red Cable for positive, Black for Negative.
approx 80x80x80mm
Package Includes:
1 x Siren
Great for your alarm project
R189.00  Inc VAT
3/4" 12V PP Normally Closed Type Solenoid water Valve (2A2 3/4 solenoid valve)

Material: PP
Voltage: about 12V DC
Rated power: about 5W
Operation model: normally closed (N/C)
Pressure: about 0.02 - 0.8Mpa
Port size: about G3/4
Fluid temperature: about 0-100 degrees Celsius
Usage: water and low viscosity fluids
Flow characteristics:
about 0.02Mpa>2L/min;
about 0.10Mpa>10L/min;
about 0.30Mpa>16L/min;
about 0.80Mpa>28L/min

Package Includes:
1 x Solenoid valve
R189.00  Inc VAT
Fingerprint Recognition Module (3A4 finger scanner)
Working principle:

Fingerprint processing includes two processes: fingerprint registration process and fingerprint matching process (fingerprint matching which is divided into fingerprint matching (1: 1) and fingerprint search (1: N) in two ways].
When the fingerprint is registered, entry twice for each fingerprint, and processed the image, composite template is stored in the module. Fingerprint matching, through the fingerprint sensor, entry the fingerprint image and processing, and then matching comparison with the module fingerprint template (if it is matched a template specified in the module, known as fingerprint matching, that is 1: 1 mode. If it is matched with multiple templates, it is called fingerprint search mode (1: N mode). The module gives the result of matching (pass or fail).


Profile: 256 bytes
Template file: 512 bytes
Power supply voltage: DC 5V
Operating current: <120mA
Peak current: <130mA
Fingerprint image input time: <0.5 seconds
Window area: 18.5 mm x 14.6 mm
Matching mode (1: 1)
Search method (1: N)
Storage capacity: 200 pieces
Security level: Five (from low to high: 1,2,3,4,5) system default 3
FAR: <0.001% (security level is 3)
Rejection rate (FRR): <1.0% (security level 3)
Search time: <1.0 seconds (1: 500 average)
Resolution: 500ppi
Host computer interface: UART (TTL logic level)
Communication baud rate (UART): (9600XN) bps Where N = 1 ~ 6 (default value N = 6, namely 57600bps)
Temperature: -25 °C to +55 °C
Relative humidity: 40% RH-85% RH (no condensation)
Storage temperature: -40 °C to +85 °C
Relative humidity: <90% H (no condensation)
Optical module (C3) overall dimensions (L × W × H): 47.65mm x 20.50mm x 21.20mm
Capacitive module dimensions: Main control board (L × W × H): 35mm x 28mm x 7mm
Sensors (L × W): 33.4mm x 20.4mm
Scratch-type module dimensions: Main control board (L × W × H): 35mm x 28mm x 7mm
Sensor board (L × W × H): 24mm x 20mm x 5mm

Host controller interface, the pins are defined as follows:

Pin DescriptionRemarks
1Finger detection power +3.6-5V
2Finger detection signal outputThe standard output is active high
3Power supply +Power + 5V
6Power supply -Power -

Module requires 2 groups of power supply, a group for serial power supply, a group for power chip power, common ground.
1,6 for the sensor chip power supply, need to be power all the time; 3,6 for the module serial power supply. When the finger near the fingerprint window, pin 2 produces a high level, when MCU receive this level, through the module serial power control circuit (transistor or MOS tube) power the module 3,4 feet.

Module and the user equipment serial communication, the interface J1 pin is defined as follows:

Pin numberNameTypeFunction
1+3.3V_ONINFinger detection power supply positive input
2TOUCHOUTFinger detection signal output terminal
3VUSBINPositive power input. (Line color: red)
4TXOUTSerial data output. TTL logic level. (Line color: green)
5RXINSerial data input. TTL logic level. (Line color: white)
6GND-Signal ground. Connected internally to the power ground. (Line color: black)
Note: In the Type field, IN means input to the module and OUT means output from the module.

Hardware connection:

Module through the serial communication interface, can be used directly with the 3.3V or 5V microcontroller to communicate: Module data transmission pin (4-pin TX) connected to the host computer data receiver (RXD), module data receiving pin (5 feet RX) connect on the position machine data transmission terminal (TXD).
To communicate with the host computer of the RS-232 level (eg PC), please add a level-shifting circuit between the module and the host computer (eg MAX232 circuit).

Serial protocol:

Using half-duplex asynchronous serial communication. The default baud rate is 57600bps and can be set to 9600 ~ 115200bps by command.
The transmitted frame format is 10 bits, a 0-level start bit, 8-bit data (LSB first) and a stop bit without parity bit.

Power-up delay time:

After the module is powered on, it takes about 200mS to initialize. During this time, the module can not respond to the host command.

Electrical parameters (all levels referenced to power / ground GND):
1. Power input:

Supply voltage (Vin)3.856VNormal operating value
Limit voltage (Vinmax)-0.3 6VExceeding this range may
cause permanent damage
Operating current (Icc)90100110mA 
Peak current (Ipeak)  150mA 

2.TXD (output, TTL logic level)
VOLIOL=-4mA 0.4VLogic 0
VOHIOH= 4mA2.43.3VLogic 1

Package includes:

1 x Fingerprint Recognition Module with cable
R549.00  Inc VAT
Per Page      1 - 8 of 8
  • 1