Read temperature with TMP-36 and WiPy ADC

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
Gabi
Posts: 18
Joined: Sat Mar 05, 2016 3:29 pm

Read temperature with TMP-36 and WiPy ADC

Post by Gabi » Tue Mar 22, 2016 9:28 pm

Hi,
I just received my wipy and my 2 TMP36 sensors and I wanted to test them.

So, I have configure my ADCs on the wipy on GP2 and GP5 and I got some weird values: they were around 1800-2000.

Now, I have read all of the messages here: http://forum.micropython.org/viewtopic. ... 251&p=1167 with much attention, I understood that these values means a temperature around 100°C...As this is still winter, I think there is a problem :D

In fact, it is around 18-20°c in my appartment so I should have around 600.

Since I just bought the sensors and the wipy I was wondering if I missed something (some configuration maybe) or if that just my sensors that are KO or if I needed other components.

I am kind of new in electronical stuff so I might be missing something huge... :oops:

FYI, I use the wipy extension board with a 3.7V/650mAh Lipo battery. Also, when I read some other input also meant to be ADC, I read some 500 values, I was also wondering if that was normal.

Thank you for the help/feedback :)

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Read temperature with TMP-36 and WiPy ADC

Post by danicampora » Tue Mar 22, 2016 10:36 pm

Hi Gabi,

Welcome to the forum!

Could you share the code that you are using to read the ADC's value? What's the software running on your WiPy? Type os.uname() to ge it.

When using the expansion board... Are all the jumpers installed? Maybe the jumper connected to the battery sense pin is not there...

Cheers,
Daniel

Gabi
Posts: 18
Joined: Sat Mar 05, 2016 3:29 pm

Re: Read temperature with TMP-36 and WiPy ADC

Post by Gabi » Fri Apr 01, 2016 6:53 pm

Hi Daniel,
Thank you very much for your reply :) (and sorry for the late answer, I did not see it before ^^")

Here are the software running on my WiPys:
(sysname='WiPy', nodename='WiPy', release='1.0.0', version='v1.4.6-21-gff736d6 on 2015-09-27', machine='WiPy with CC3200')
and
(sysname='WiPy', nodename='WiPy', release='1.2.0', version='v1.6-89-g440d33a on 2016-02-27', machine='WiPy with CC3200')

Here is my code I use to read the ADC:
[code]from machine import ADC

adc = ADC()
apin = adc.channel(pin='GP3')
apin()[/code]

This is the very frist step of my program, I wanted to test and check it before going any further ;)

I am just reading the value returned by the ADC and then I check if the value means something.

Regarding the jumpers, if you mean the wires between the expansion board od my breadboard (so the sensor), I have connected the 3v3 and the ground to the left en right pin of the sensor and the GP3 to the middle one that is returning the temperature read.

If you mean the 7 little plastic thing on the expansion board they are all on the board (it is exactly like https://pbs.twimg.com/media/CSPkhU8WIAUe26z.jpg:large but with my WiPy board on it and not on the side).

Thank you :)

Gabi
Posts: 18
Joined: Sat Mar 05, 2016 3:29 pm

Re: Read temperature with TMP-36 and WiPy ADC

Post by Gabi » Fri Apr 22, 2016 10:34 am

Gabi wrote:Hi Daniel,
Thank you very much for your reply :) (and sorry for the late answer, I did not see it before ^^")

Here are the software running on my WiPys:
(sysname='WiPy', nodename='WiPy', release='1.0.0', version='v1.4.6-21-gff736d6 on 2015-09-27', machine='WiPy with CC3200')
and
(sysname='WiPy', nodename='WiPy', release='1.2.0', version='v1.6-89-g440d33a on 2016-02-27', machine='WiPy with CC3200')

Here is my code I use to read the ADC:

Code: Select all

from machine import ADC

adc = ADC()
apin = adc.channel(pin='GP3')
apin()
This is the very frist step of my program, I wanted to test and check it before going any further ;)

I am just reading the value returned by the ADC and then I check if the value means something.

Regarding the jumpers, if you mean the wires between the expansion board od my breadboard (so the sensor), I have connected the 3v3 and the ground to the left en right pin of the sensor and the GP3 to the middle one that is returning the temperature read.

If you mean the 7 little plastic thing on the expansion board they are all on the board (it is exactly like https://pbs.twimg.com/media/CSPkhU8WIAUe26z.jpg:large but with my WiPy board on it and not on the side).

Thank you :)
Hi, I am allowing myslef to re-ask someone support on this :)

@danicampora any feedback?

Thank you.

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Read temperature with TMP-36 and WiPy ADC

Post by danicampora » Fri Apr 22, 2016 12:24 pm

Hello,

As stated in the docs, the maximum input on the ADC pins (when used in ADC mode) is 1.4V. What value are you feeding into GP3 (or any of the other ADC pins)? If you put more than 1.5V when the pin is in ADC mode you will damage it.

Cheers,
Daniel

Gabi
Posts: 18
Joined: Sat Mar 05, 2016 3:29 pm

Re: Read temperature with TMP-36 and WiPy ADC

Post by Gabi » Fri Apr 22, 2016 4:44 pm

danicampora wrote:Hello,

As stated in the docs, the maximum input on the ADC pins (when used in ADC mode) is 1.4V. What value are you feeding into GP3 (or any of the other ADC pins)? If you put more than 1.5V when the pin is in ADC mode you will damage it.

Cheers,
Daniel
Hello,
Yes, I saw that already and my calculation will take that into account :)

The TMP36 has an output from 0.1V (-40°C) to 2.0V (150°C) so it could be higher than 1.5V but then it would mean the tempaerature is way above 50°C and that is not possible where I live ^^

Here is the exact output: http://wiki.mchobby.be/images/a/ae/TMP36-Graph.png

Maybe is it due to noises...I will try to put a capacitor and see if it give better results.

I'll keep you posted.

Thank you :)

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Read temperature with TMP-36 and WiPy ADC

Post by Roberthh » Sat Apr 23, 2016 6:31 am

Hello @gabi. First of all I would place a voltage divider (2 resistors e.g. 2 x 100kOhm) between the TMP-36 and the WiPy protecting the WiPy. That will resulting a changed voltage range. A 2:1 divider (2 identical resistor values) would then result in a range of 0.05 to 1 V.
Sample schematics here: https://github.com/robert-hh/drawer_for ... o_wipy.jpg
A 1 V reading results in a value of about 2700 on WIPy.
Secondly, I would just grab a voltmeter and measure what I expect.
Robert
https://github.com/robert-hh/drawer_for ... o_wipy.jpg

Post Reply