PHPackages                             volantus/mcp3008 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. volantus/mcp3008

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

volantus/mcp3008
================

PHP library for reading values from the A/D converter MCP3008

0.1.2(8y ago)0271GNUv3PHPPHP ^7.0

Since Jan 3Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Volantus/MCP3008)[ Packagist](https://packagist.org/packages/volantus/mcp3008)[ RSS](/packages/volantus-mcp3008/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

MCP3008 PHP library
===================

[](#mcp3008-php-library)

[![Latest Stable Version](https://camo.githubusercontent.com/457ff3059e1a9545fb8622b00b5ac002926766da6ddbb215a8918c0687a3a8be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766f6c616e7475732f6d6370333030382e737667)](https://packagist.org/packages/volantus/mcp3008)[![Build status](https://camo.githubusercontent.com/ae2c10efc54f88b56e5ce702d3ff8f2a7547e20e718b471926510a7789b9b3de/68747470733a2f2f6170692e7472617669732d63692e6f72672f566f6c616e7475732f4d4350333030382e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Volantus/php-pigpio)

PHP library for reading values from the A/D converter MCP3008

Dependencies
------------

[](#dependencies)

The library requires one of the following dependencies to be installed:

- **[berry-spi](https://github.com/Volantus/berry-spi) extension**: Native direct communication
- **[volantus/php-pigpio](https://github.com/Volantus/php-pigpio) composer library**: For using Pigpio daemon socket

Installation
------------

[](#installation)

The library may be installed using Composer:

```
composer require volantus/mcp3008
```

Usage
-----

[](#usage)

All measurements are done through the Reader class.

The constructor requires an SpiInterface object and the ADC reference voltage, which is 3.3 per default on Raspberry.

#### Using Pigpio daemon (socket)

[](#using-pigpio-daemon-socket)

If you want to use the native SPI channels (recommended), you may use the `RegularSpiDevice`:

```
use Volantus\MCP3008\Reader;
use Volantus\Pigpio\Client;
use Volantus\Pigpio\SPI\RegularSpiDevice;

$spiInterface = new RegularSpiDevice(new Client(), 1, 32000, 0);
$reader = new Reader($spiInterface, 3.3);
```

If you want to use any other GPIO Pins instead, please use the `BitBaningSpiDevice`:

```
use Volantus\MCP3008\Reader;
use Volantus\Pigpio\Client;
use Volantus\Pigpio\SPI\BitBangingSpiDevice;

$spiInterface = new BitBangingSpiDevice(new Client(), 12, 16, 20, 21, 32000);
$reader = new Reader($spiInterface, 3.3);
```

#### Using direct communication via berry-spi extension:

[](#using-direct-communication-via-berry-spi-extension)

If you want to use the native SPI channels (recommended), you may use the `RegularInterface`:

```
use Volantus\BerrySpi\RegularInterface;
use Volantus\MCP3008\Reader;

$spiInterface = new RegularInterface(1, 32000, 0);
$reader = new Reader($spiInterface, 3.3);
```

If you want to use any other GPIO Pins instead, please use the `BitBangingInterface`:

```
use Volantus\BerrySpi\BitBangingInterface;
use Volantus\MCP3008\Reader;

$spiInterface = new BitBangingInterface(12, 16, 20, 21, 32000, 0);
$reader = new Reader($spiInterface, 3.3);
```

#### Reading values

[](#reading-values)

Reading values is done by channel and value is returned as `Measurement` object:

```
// Reading value of ADC channel 4
$value = $reader->read(4);

// Getting the raw value, e.g. 789
$value->getRawValue();

// Getting the calculated voltage depending on reference voltage
// e.g. 2.54V in case of 3.3V ref. voltage
$value->calculateVoltage();
```

SPI Opening/Closing behaviour
-----------------------------

[](#spi-openingclosing-behaviour)

Per default the reader opens the SPI interface in the constructor and closes it in the destructor. But only if needed, so you are free to control it by yourself:

```
$spiInterface = new RegularInterface(1, 32000, 0);
$spiInterface->open();

$reader = new Reader($spiInterface, 3.3);

$spiInterface->close();
unset($reader);
```

Contribution
============

[](#contribution)

Contribution in form of bug reports, suggestions or pull requests is highly welcome!

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~19 days

Total

5

Last Release

2972d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e5f2b3a418d646c33138ef3878bb38e2e384b5029ceff82dbc033117a24f150d?d=identicon)[SkydiveMarius](/maintainers/SkydiveMarius)

---

Top Contributors

[![marius-meissner](https://avatars.githubusercontent.com/u/4172752?v=4)](https://github.com/marius-meissner "marius-meissner (14 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/volantus-mcp3008/health.svg)

```
[![Health](https://phpackages.com/badges/volantus-mcp3008/health.svg)](https://phpackages.com/packages/volantus-mcp3008)
```

###  Alternatives

[wesbos/burner-email-providers

A list of burner email providers.

1.2k189.1k2](/packages/wesbos-burner-email-providers)[verbb/super-table

Super-charge your content builders and create nested Matrix fields.

3141.6M22](/packages/verbb-super-table)[ampproject/amp-toolbox

A collection of AMP tools making it easier to publish and host AMP pages with PHP.

73616.7k1](/packages/ampproject-amp-toolbox)[pugx/shortid-php

An implementation of shortid in PHP

52588.5k3](/packages/pugx-shortid-php)[eklundkristoffer/seedster

24757.6k5](/packages/eklundkristoffer-seedster)[sylius/promotion

Flexible promotion management for PHP applications.

28477.8k9](/packages/sylius-promotion)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
