How to connect a TMP36 temp sensor?

How to connect a TMP36 temperature sensor ?
I only get values below zero (-50°C)
I follow the tutorial but still got issues.

1 Like

First of all, welcome to the Cayenne Community!

Could you let know what else you have?
Raspberry Pi (1, 2b, 3b, Zero) and Operating System
Arduino (Uno, Mega, Yun, …)
ADC - MCP3008, ADS1x15, …

As we work through this photos and screen captures will be valuable if you are able to do such things.

Again, welcome,


1 Like

Hi Ian, thanks for your quick reply
More information :
MCP3008 + TMP36

1 Like

I’m going to have to do some research on this as I’m not use to the RPi 1b. In the mean time here is where im going to start-

I have to go to the job that pays the bills right now, maybe someone else (@ats1080s, @bestes, others) can throw in their thoughts.


1 Like

Thanks Ian for your Help

1 Like

And here-

1 Like


Looking at your setup, it looks ok to me. I can’t see all the exact connections, but I can’t see anything wrong either. I put together a MCP3008, TMP36, and a photoresister and things seem ok on my end.

Here is a photo of my setup, you might compare it to what you have.

Also, here is my extensions page, I guessing yours is showing 0.0 for whatever channel your TMP36 is on.

Are you able to test your sensor as shown on the Adafruit link I posted above?


1 Like

I don’t get the opportunity to chech yet the TMP36, but will try to do it by next week.
I’ll review my connections and let you know.
Another question, if I move to the new Raspberry, do you thik it will solve my problem ?

It shouldn’t matter which version of the Pi you are using.


That said if you have the option to exchange parts that can certainly help isolate where problem lies. But, unless you have the means, I wouldn’t go out and buy all new parts just yet.

Here is a Fritzing I did of the exact circuit a couple months ago for a tutorial.

Good luck,


Hello Ian

The good news is that the TMP36 is working well, I checked it this afternoon.
I tried to reinstall cayenne on Raspberry, follow again the set up but still have the same issue.
When I stated to add the 3008 extension I set “SPI Chpi-select 0” other choice is 1 ? is it correct ?
I copy you the GPIO page I have, can you something wrong ?
And I review my connection according to what you sent aerlier.

additionnal question:
MOS1 : must be set as Input or output ? low/high ?
MISO : must be set as Input or output ? low/high ?
SCLK : must be set as Input or output ? low/high ?


If you hooked MCP3008 pin 10 (CS/SHDN) to your RPi physical pin 24 (GPIO 8/ CE0) then yes that is correct. CE0 stands for chip enable channel 0. Chip enable and chip select are terms that are used interchangeably. If you were hooked to physical pin 26 (GPIO 7/ CE1) then you would select chip select 1 when installing your extension device.

Good news! No need to worry about any of this. When the SPI bus is enabled and the SPI kernel is loaded all that is handled by the SPI interface. The SPI was enabled by Cayenne when Cayenne was installed.

Hope this helps.


import time
import spidev   
spi = spidev.SpiDev()

def Read(channel):
   adc = spi.xfer2([1,(8+channel)<<4,0])
   data = ((adc[1]&3) << 8) + adc[2]
   return data

while True:,0)   # address SPI buss 0, Chip Select 0- MCP3008 open
   z1 = Read(0)
   z2 = Read(1)
   z3 = Read(2)
   z4 = Read(3)
   z5 = Read(4)
   z6 = Read(5)
   z7 = Read(6)
   z8 = Read(7),1)   # address SPI buss 0, Chip Select 1- MCP3008 standby

-when the Chip Select toggles CS0 to CS1, the chip on channel 0 goes into a low power state. :wink:

I hope that helps!

Take a look at the second portion of the following post to see how to get code to format properly-


TY Ian. It was driving me nuckin’ futz!

1 Like

Anytime sir.


WOW! I just got my Charlotte remote unit working with the MCP3008 driver last night! I spent less than 1 hour figuring it out- it was relatively painless!

This software is AWESOME! -Just turn on the Pi SPI buss, select "Add New Device or Widget, then select “Extentions/Analog Converter/MCP3008”, and walk through the prompts.

THEN, go back to “Add New Device”, select Analog/Generic, -then walk through the prompts that ask (the MCP3008 NOW shows up), -the Chip Select number (0, 1) and the channel number (0-7)!
Then, add the desktop widget setup/icon display.
Easy peasy! 4 stars! I’m blown away!

Golly! I just got my HomePCB done, and I’ve posted all the sourcing/parts, and the CAD files.

If THIS doesn’t just twist yer poopoo! I think it’s pretty kewl! The MyDevice software is just totally groovin! Awesome! I’m so stoked!

-the biggest difference between software and hardware is:
every time I hit “compile”, -it takes a week and costs me $68!

Now, I gotta figure out how to tie everything together- argh!

-most of the sensor inputs will be for a burglar alarm…gotta figure out how to make those zones as “HOME”, “AWAY”, “24 Hour” and “Bypass”

of course I can’t get a Zero at a reasonable price. They’re selling for $20 on Ebay, and AdaFruit only sells them in a package of unwanted accessories… :frowning: Argh!