Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 01:15 27 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : RP2040 Pico Temperature sensor Not supported

     Page 2 of 3    
Author Message
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 1781
Posted: 07:04am 19 Sep 2022
Copy link to clipboard 
Print this post

An odd thing, on the PicoMiteVGA the value returned is proportional to CPUSPEED. Implausibly low at 126Mhz - below ambient.


"4.9.5. Temperature Sensor
The temperature sensor measures the Vbe voltage of a biased bipolar diode, connected to the fifth ADC channel
(AINSEL=4). Typically, Vbe = 0.706V at 27 degrees C, with a slope of -1.721mV per degree. Therefore the temperature
can be approximated as follows:
T = 27 - (ADC_voltage - 0.706)/0.001721
As the Vbe and the Vbe slope can vary over the temperature range, and from device to device, some user calibration
may be required if accurate measurements are required.
The temperature sensor’s bias source must be enabled before use, via CS.TS_EN. This increases current consumption
on ADC_AVDD by approximately 40 ?A.

*** NOTE
The on board temperature sensor is very sensitive to errors in the reference voltage. If the ADC returns a value of
891 this would correspond to a temperature of 20.1°C. However if the reference voltage is 1% lower than 3.3 V then
the same reading of 891 would correspond to 24.3°C. You would see a change in temperature of over 4°C for a small
1% change in reference voltage. Therefore if you want to improve the accuracy of the internal temperature sensor it
is worth considering adding an external reference voltage."
Edited 2022-09-19 17:06 by phil99
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5726
Posted: 07:20am 19 Sep 2022
Copy link to clipboard 
Print this post

It's easy to put a finger on the RP2040. If the logo is burned into your finger tip then its too hot. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8579
Posted: 08:04am 19 Sep 2022
Copy link to clipboard 
Print this post

  Quote  An odd thing, on the PicoMiteVGA the value returned is proportional to CPUSPEED. Implausibly low at 126Mhz - below ambient


Measure the exact voltage on ADC_VREF and then set OPTION VCC to that value. This will give you the most accurate value. NB: if you are using the optional LM4040 as a 3V reference you will get a crazy negative temperature unless you do this.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3658
Posted: 08:15am 19 Sep 2022
Copy link to clipboard 
Print this post

  stanleyella said  I use opera. win10. manual msword pdf.

Then DO NOT DO THAT!

Use a PDF viewer with search feature, as has been advised.

You are making your life VERY hard, just by not doing as advised.

John
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5726
Posted: 09:13am 19 Sep 2022
Copy link to clipboard 
Print this post

I very rarely use Edge as my browser, only as a PDF reader - something that I find it to be very good for. :)  It saves having to have another application just to read PDFs.
My browsers of choice are Pale Moon and De-Googled Chromium.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2287
Posted: 10:11am 19 Sep 2022
Copy link to clipboard 
Print this post

  JohnS said  
  stanleyella said  I use opera. win10. manual msword pdf.

Then DO NOT DO THAT!

Use a PDF viewer with search feature, as has been advised.

You are making your life VERY hard, just by not doing as advised.

John


this appears to be the default behavior of MS Windows these days, have noticed it when having to use other people's computers (i use Linux myself). i suspect that installing a 3rd party reader (Adobe, Foxit, etc) and persuading the operating system to use it as the new default is beyond the abilities of many Windows users - certainly Windows does not go out of its way to make changing the defaults easy for the user.


cheers,
rob   :-)
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1642
Posted: 01:30pm 19 Sep 2022
Copy link to clipboard 
Print this post

  Glen0 said  PicoMite User Manual
MMBasic Ver 5.07.04
Rev 3
Pg 130

PIN( TEMP )


Thank you sir. That was not difficult was it?
I just got to check the rp2040 data sheet and is the pin supported in mmbasic picomite,
which I did without success.
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3015
Posted: 01:39pm 19 Sep 2022
Copy link to clipboard 
Print this post

"Without success" in attempting exactly what, and which variety of "without success"?
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1642
Posted: 01:48pm 19 Sep 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  I very rarely use Edge as my browser, only as a PDF reader - something that I find it to be very good for. :)  It saves having to have another application just to read PDFs.
My browsers of choice are Pale Moon and De-Googled Chromium.


I use Chromium for RPi. I am not the only win user who does not use edge :)
Yet I am happy with Defender.
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1642
Posted: 02:07pm 19 Sep 2022
Copy link to clipboard 
Print this post

  lizby said  "Without success" in attempting exactly what, and which variety of "without success"?

10 times less than 0% success :)
IE. I was not "spoon fed" code :(

code of picomite reading it's temperature.
I have lost interest now.
Thought it would be easy and displaying temp using gui would be a cake walk/piece of cake.
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1642
Posted: 02:18pm 19 Sep 2022
Copy link to clipboard 
Print this post

  phil99 said  An odd thing, on the PicoMiteVGA the value returned is proportional to CPUSPEED. Implausibly low at 126Mhz - below ambient.


"4.9.5. Temperature Sensor
The temperature sensor measures the Vbe voltage of a biased bipolar diode, connected to the fifth ADC channel
(AINSEL=4). Typically, Vbe = 0.706V at 27 degrees C, with a slope of -1.721mV per degree. Therefore the temperature
can be approximated as follows:
T = 27 - (ADC_voltage - 0.706)/0.001721
As the Vbe and the Vbe slope can vary over the temperature range, and from device to device, some user calibration
may be required if accurate measurements are required.
The temperature sensor’s bias source must be enabled before use, via CS.TS_EN. This increases current consumption
on ADC_AVDD by approximately 40 ?A.

*** NOTE
The on board temperature sensor is very sensitive to errors in the reference voltage. If the ADC returns a value of
891 this would correspond to a temperature of 20.1°C. However if the reference voltage is 1% lower than 3.3 V then
the same reading of 891 would correspond to 24.3°C. You would see a change in temperature of over 4°C for a small
1% change in reference voltage. Therefore if you want to improve the accuracy of the internal temperature sensor it
is worth considering adding an external reference voltage."


Thank you @Phil99. Very informative.  I power picomite from 3.3V and notice that adc changes when the usb lead is removed so I got to sort the ad ref pin.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9061
Posted: 06:31am 20 Sep 2022
Copy link to clipboard 
Print this post

Deleted your duplicate post.

I also use Opera, but I do use Foxit Reader for all my PDF stuff.

As a wee prod, and to stop you losing interest, reading the 2040 temperature is how others have pointed out, so you would have a line in your code such as: T=PIN(TEMP)
That will suck the temperature of the 2040 chip, and ram it into variable T.
Then you can display it on the screen using the GUI CAPTION command if you are using GUI controls, or the TEXT command if you are NOT using any touch controls.

GUI CAPTION and TEXT basically do the same thing on the screen, but the GUI command is monitored and controlled by MMBASIC in the background.  If you are using ANY type of GUI controls, then EVERYTHING on the screen should be a GUI control - don't mix and match, if you see what I am getting at.

So, if you were using GUI controls, you would have a line to show the temperature like this:
GUI CAPTION #1,STR$(T),100,100,L,RGB(WHITE),RGB(RED)

This will draw the temperature of the 2040 saved in variable T, on the screen at position 100,100 with a white text and red background, which stands out.
It does not really get any simpler then that, and the cake is never gonna taste any better then right now with those two lines of code.
See the manual, page 91 for a description of the GUI CAPTION command for further details.

If you just want to draw the temperature on the screen, and are NOT using any GUI buttons or controls, you can use the TEXT command to draw the same thing: TEXT 100,100,STR$(T),L,RGB(WHITE),RGB(RED)
See page 118 for details of the TEXT command.

We use the STR$ function, to convert the temperature number, into a string as the CAPTION and TEXT commands expect strings and won't work with just numbers - the interpreter will throw an "Expected a string" error if you try.

You can combine both lines into ONE command if you like, like this:

GUI CAPTION #1,STR$(PIN(TEMP)),100,100,L,RGB(WHITE),RGB(RED)

or...

TEXT 100,100,STR$(PIN(TEMP)),L,RGB(WHITE),RGB(RED)

Good luck, and don't loose hope.

EDIT: Fix some formatting.
Edited 2022-09-20 16:35 by Grogster
Smoke makes things work. When the smoke gets out, it stops!
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1642
Posted: 03:41pm 21 Sep 2022
Copy link to clipboard 
Print this post

  Grogster said  Deleted your duplicate post.

I also use Opera, but I do use Foxit Reader for all my PDF stuff.

As a wee prod, and to stop you losing interest, reading the 2040 temperature is how others have pointed out, so you would have a line in your code such as: T=PIN(TEMP)
That will suck the temperature of the 2040 chip, and ram it into variable T.
Then you can display it on the screen using the GUI CAPTION command if you are using GUI controls, or the TEXT command if you are NOT using any touch controls.

GUI CAPTION and TEXT basically do the same thing on the screen, but the GUI command is monitored and controlled by MMBASIC in the background.  If you are using ANY type of GUI controls, then EVERYTHING on the screen should be a GUI control - don't mix and match, if you see what I am getting at.

So, if you were using GUI controls, you would have a line to show the temperature like this:
GUI CAPTION #1,STR$(T),100,100,L,RGB(WHITE),RGB(RED)

This will draw the temperature of the 2040 saved in variable T, on the screen at position 100,100 with a white text and red background, which stands out.
It does not really get any simpler then that, and the cake is never gonna taste any better then right now with those two lines of code.
See the manual, page 91 for a description of the GUI CAPTION command for further details.

If you just want to draw the temperature on the screen, and are NOT using any GUI buttons or controls, you can use the TEXT command to draw the same thing: TEXT 100,100,STR$(T),L,RGB(WHITE),RGB(RED)
See page 118 for details of the TEXT command.

We use the STR$ function, to convert the temperature number, into a string as the CAPTION and TEXT commands expect strings and won't work with just numbers - the interpreter will throw an "Expected a string" error if you try.

You can combine both lines into ONE command if you like, like this:

GUI CAPTION #1,STR$(PIN(TEMP)),100,100,L,RGB(WHITE),RGB(RED)

or...

TEXT 100,100,STR$(PIN(TEMP)),L,RGB(WHITE),RGB(RED)

Good luck, and don't loose hope.

EDIT: Fix some formatting.


Thankyou for the detailed reply sir. I can read a-d to a gui dial

SETPIN GP26, AIN
cls
gui gauge #1, 120, 160, 100, wh, bk, 0, 3.3, 2, "V", wh

do
myvoltage! = PIN(GP26)
         ''text 0,0,left$(str$(myvoltage!),4)
CtrlVal(#1) =myvoltage!
loop


I use opera because it looks nice showing the pretty windows backgrounds.. sad :)
The fake vpn gets me software.
I think mmb can do nice dials etc. using trig and filled triangles.
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1642
Posted: 04:33pm 21 Sep 2022
Copy link to clipboard 
Print this post

@Grogster - I have not given up, I still enjoy using mmb but temp was just a trivial experiment to try and learn more details I would need too implement a temp display.

Picomite is new to me and after pic/avr is interesting. Totally different except there is a Basic for them and you do not get your money back... it is free software to code them.
As a new user I am referring to the manual a lot but find I have to jump around the many pages. EG. I found the scale function 2 days ago and can not find it now. That was just an example not where is it :)
Now other users will tell me the manual is perfect and I am lazy.
It seems if you got nothing good to say then say nothing
because nothing acts faster than Anadin
Edited 2022-09-22 02:45 by stanleyella
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1642
Posted: 05:30pm 21 Sep 2022
Copy link to clipboard 
Print this post

@Grogster
I know, not temp just voltage ,not stable??
https://youtu.be/tmSHe1ZXyZQ

dim T!
CONST bk = RGB(BLack)
const wh = rgb(white)
const bl = rgb(blue)
const gr = rgb(green)
const cy = rgb(cyan)
const re = rgb(red)
const ma = rgb(magenta)
const ye = rgb(yellow)
const br = rgb(brown)

cls
gui gauge #1, 120, 160, 100, wh, bk, 0, 3.3, 2, "T", wh

do
 T!=PIN(TEMP)
CtrlVal(#1) =T!
loop
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1642
Posted: 06:04pm 21 Sep 2022
Copy link to clipboard 
Print this post

@Grogster... what is I am a "guru"? I am no !:@$%**ing guru! I am a newbie needing help for fox sake.
Soz mate, just thought me posting carp makes me guru??? I have 8bit experience that could be used with mmb but not experienced enough to help. And forum help picaxe, gcbasic or mmbasic is so important for unseasoned users.
Take care, stan
Edited 2022-09-22 04:32 by stanleyella
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9061
Posted: 01:15am 22 Sep 2022
Copy link to clipboard 
Print this post

  stanleyella said  @Grogster... what is I am a "guru"? I am no !:@$%**ing guru! I am a newbie needing help for fox sake.
Soz mate, just thought me posting carp makes me guru??? I have 8bit experience that could be used with mmb but not experienced enough to help. And forum help picaxe, gcbasic or mmbasic is so important for unseasoned users.
Take care, stan


What?!
At what point did I suggest or say you were a Guru?
Where are you getting that from?

Please keep your posts civil - even if you ARE really annoyed at something not working, cos getting snotty at other members never ends well for the member doing it.
Smoke makes things work. When the smoke gets out, it stops!
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 840
Posted: 02:40am 22 Sep 2022
Copy link to clipboard 
Print this post

Hey Grogster - heal boy, heal.

Stan has just noticed that his Avatar describes him as a "Guru" (automatically because of the number of posts). My interpretation is that he is denying that he is.

I too have the same problem - enough posts to elevate me to Guru status when I am nothing more than a plodding lapsed-Civil Engineer.

Cheers (in all senses of the word),


Andrew
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9061
Posted: 02:44am 22 Sep 2022
Copy link to clipboard 
Print this post

Oh, I see.

I wish he had clarified that in his post, cos it read like I had said he was one, which I did not, and so I was wondering what the hell he was on about.

Now I understand.
Smoke makes things work. When the smoke gets out, it stops!
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 840
Posted: 02:54am 22 Sep 2022
Copy link to clipboard 
Print this post

Grogs,
No offense to me but I thought that someone might clarify the ambiguity.

Andrew
 
     Page 2 of 3    
Print this page
© JAQ Software 2024