Voltage scaling for generic sensor thru mcp3008


As a suggestion I would like a scale on that generic sensor widget I’m using with the mcp3008 that allows scaling so it will read true voltage resolution that’s been reduced from 26vdc down to 3.3vdc. 0-26v to 0-3.3v.


Supposedly, it’s coming…
probably as part of the MQTT package.
Cayenne is still in development, so…

A heads-up on charging voltages
on a 24VDC solarPV system-
Somtimes, the charge voltage can exceed 31 volts…
and even higher voltages than 33Vdc
if the charge controller has a Battery Equalization mode.

You might want to consider
dividing that 24Vdc down to,
let’s say…2.4Vdc (divide by 10).
I personally would use a 2.2K + 22K resistors
on my voltage divider-
No need for lower or higher impedance…

The MCP3008 really doesn’t like it’s
Analog inputs to exceed Vref,
and it really doesn’t like it when Vref exceeds VDD.

Also, MCP3008 VDD dictates the data voltages on the MOSI, MISO, SCLK and CE.
The Pi and Arduino I/O require 3v3,
+5V may be fatal to the I/O lines on the Pi/Arduino.

The MCP datasheet has far more info than the Adafruit datasheet-

It’s just a good electronics design practice.


So, would you say it’s safe to figure 36v on this setup? I have 6kw 24v panels. I’m told that at peak sun they may very well put out nearly 36v, what’s your educated opinion ?

Well, seems I can only get a 1v reading now. Either the chip is bad or the spi ports are shot. Any way to test those port? I used a pot as you showed and can vary 0-1v but nothing higher. I have a Pi3 coming in tomorrow so I will be able to test the theory.

I believe the project and apppriate files are are the sd card but I’m thinking the Ip address will change for it since it will be new to the dhcp sever. Do you know the sudo command line to set a static up address?



oh- thats the PV-out (open circuit) voltage-
If you divide your A/D input voltage by 20, that would be good, too-

On the MCP3008, 10 bit
each A/D least-significant-bit = Analog volt/1024.

By dividing the input voltage more,
you make each “bit increment” smaller,
while losing a tiny bit (insignificant) of least significant bit accuracy.

So, don’t be timid about dividing your voltage…
you don’t need your V(max)
to bounce off 100% of the full scale input reading
-give your A/D converter some headroom…

If extraordinary accuracy is needed, you can use the 12-bit version
of the A/D chip, MCP3208.


Side note, I was getting 3.3v displayed before on the web but the iOS app showed 1v and float instead of volt and web displayed volt. Seems like a bug. Today I couldn’t add a tsl2561 or make other changes, I get days especially weekends where things get buggy.