Reading MCP3008 data in Particle Cloud using Raspberry Pi


I am trying to read an analog data into particle through MCP3008 connected to a Raspberry Pi 3. I am using C language to code to read the data form MCP3008 using the following libraries.
#include <wiringPi.h>
#include <mcp3004.h>

But, Particle gives me an error that these libraries does not exist. Suggestions needed in this regard. Thanks in advance.

Let me ping someone that might be able to help, @rickkas7 or @ParticleD are you able to assist?

Hello Kyle,

Is there a possibility of reading the data with any other library that are available in particle?

It does not look like anyone has ported a MCP3008 library to the Particle platform, presumably because the actual Particle devices (Photon, Electron, etc.) already have 8 channels of ADC built-in.

It should be possible to port the Adafruit MCP3008 Arduino driver to the Particle platform for use with the Raspberry Pi, but as far as I know no one has done so.

1 Like

Hello Rick,

Thanks for the suggestions. We are using Raspberry Pi to create an IOTAR application. There are many tutorials available using Particle Photon. We are trying to use the same program in the tutorial below but the hardware is PI3 instead of Photon. The problem we face now is as I explained previously in the thread. We use a POT instead of the LDR in the video. Will it be convenient if we use digital sensors instead of analog?Can you please throw some light on how to proceed with this?Thanks again!

The tutorial we follow is this:

This is an old thread, so maybe it’s not of much interest now. However, I’ve just recently started learning about particle devices, and I’ve been playing with the Raspberry Pi since I wanted to have several devices talk to each other and I only have one “real” device so far.

To read analog values from an MCP3008, I think it would work to write a normal C program using libraries like WiringPi and then have the particle script run it as process:

There might be a little extra overhead to spawn a process for every measurement, but typical applications probably don’t work the processor that hard.

I haven’t tried this yet, but I will probably be wanting my Raspberry Pi to read values from a USB temperature sensor. Having the Particle program read it directly sounds daunting, but I already have utility that can be called from a shell script.