RTD temperature Reading

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

RTD temperature Reading

Post by Derrihj »

I've found a nice video about the RTD ,it's in two parts please take a look. He used (0°C -150°C)but i think this will be the same with my (0°C - 600°C) with a few changes in numbers and a flowchat can be created with LCD to read temperature from 0°C to around 600°C but the RTD here must be a 3 - wire type.
Part1: https://m.youtube.com/watch?v=J8eS_6PC9 ... LL&index=1

Part2: https://m.youtube.com/watch?v=AXsYHyBuY ... LL&index=2

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: RTD temperature Reading

Post by medelec35 »

Yes they are very good videos.
Derrihj wrote:
Sun Aug 30, 2020 9:56 am
but the RTD here must be a 3 - wire type.
Not necessarily true.
In this case you can use the 2,3,or 4 wire versions as only two wires are used.
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

As I was reading, they say a 4- wire is even more accurate and stable but if you say no difference i think we can look at the flowchat and we put this out of the way too ,am very sure people are in their windows waiting for the flowchat and see how things are done this will be good for all of us .Am still looking around for a good RTD datasheet that we can use with a higher Temp range fit for a cake cooker.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: RTD temperature Reading

Post by medelec35 »

I'm sure you will find it fun creating a flowchart from scratch.
There is enough information in the videos for you to succeed.
Just like a toothless budgie. :lol:
If the flowchart does not work as expected , then I would go through it with you.
Martin

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: RTD temperature Reading

Post by jgu1 »

Hi Booth!

Yes, it would be nice with a component in FC8 for the PT100. I have also been search in the web. What I found is the amplifier
Max31865, seem to be good. Honest, I am not able to create a component for this or how I could use the SPI component in FC
To read the max31865.
Have a look here: https://learn.adafruit.com/adafruit-max ... duino-code

Talig, have created a project with the Max31865 by using the spi, but doesn`t work.

viewtopic.php?f=76&t=21640

I dare, (Wish) maybe you could create one a component Martin. :wink: If you not have any component I can sent some to you :roll:

Br Jorgen

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

I have converted the code in the video to flowcode which measures Temperature fro 0°C to 150°C, in that when I order for my RTD to measure at least up to 500°C, I will just change some numbers as shown in datasheet for a range of 0°C to around 450 or 500°C. Please take a look at the code and suggest some changes or ways to do it better or even other ways of doing it as that can help people understand this topic well and how things are done in flowchat.
Attachments
RTDpt100.fcfx
(19.34 KiB) Downloaded 190 times

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

RTD table with 1° Celsius Increments.
Attachments
RTDpt100 Temperature Vs Resistance table.pdf
(88.83 KiB) Downloaded 180 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: RTD temperature Reading

Post by medelec35 »

I believe the best bet is to wait until you get the hardware,
as you will need to measure two different temperatures to get the slope value.
Then calculation can be derived from that.
We can then go over calculations within flowchart once you have completed voltage measurements.
Finally we can convert Arduino code found here. ie

Code: Select all

#include <LiquidCrystal.h>
 
//Variable decleared
float Volts; //voltage read by arduino
float tempC; //final temperature in degree celsius after calibration
float tempF; //final temperature in degree fahrenhiet after calibration
float temp1; //temperatuere before calibration
float calibration; //calibration 
float Rx; //Resistance of PT100
 
// variables that required to convert voltage into resistance
float C = 106.852; //Constant of straight line (Y = mx + C)
float slope = 48.31; // Slope of straight line (Y = mx + C)
 
 
// variables that required to convert resistance into temperatures
float R0 = 100.0; //Resistance of minimum temperature to be measured (at 0 degree)
float alpha = 0.00385; // value of alpha from datasheet
 
//pin assign ment for sensor
int Vin = A0;
 
//pin assignment for LCD
const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
 
Timer t; // Define Timer object
 
//Setup function
void setup() {
  Serial.begin(9600); // Set Baudrate at 9600
  lcd.begin(16, 2); //Start LCD
  pinMode(Vin,INPUT); // Make Vin (A0) pin as input
  
  t.every(100,takeReading); // Take reading of sensor in every 100ms
 analogReference(INTERNAL); // Taking internal reference 1.1V ADC of arduino
}
 
//loop function
void loop() {
  t.update(); // Update Timer
}
 
void takeReading(){
  // Bits to Voltage
  Volts = (analogRead(Vin)/1023.0)*1.1; //converting bits of voltage into voltage
  lcd.setCursor(0, 0);
  lcd.print("V:");
  lcd.setCursor(4,0);
  lcd.print(Volts);
  // Converting voltage to resistance
  Rx = Volts*slope+C; //y=mx+c
  lcd.setCursor(9,0);
  lcd.print("R:");
  lcd.setCursor(11,0);
  lcd.print(Rx);
  
  // Converting resistnace to temperature
  temp1= (Rx/R0-1.0)/alpha; // from Rx = R0(1+alpha*X)
  calibration=0.3+(0.005*temp1); //tolerance for class B PT100
  tempC=temp1-calibration; // Final temperature in celsius
  
  // conversion of celsius to fehrenheit
   tempF = tempC*1.8+32; //Final temperature in fehrenheit 
 //Serial.println(Volts);
 // Serial.println(Rx);
 lcd.setCursor(0,1);
 lcd.print(tempC);
 lcd.setCursor(5,1);
 lcd.print((char)223);
 lcd.setCursor(6,1);
 lcd.print("C");
 lcd.setCursor(7,1);
 lcd.print(tempF);
 lcd.setCursor(13,1);
 lcd.print((char)223);
 lcd.setCursor(14,1);
 lcd.print("F");
 Serial.println(tempC);
 delay(1000);
}
In to a flowchart.
Edit: Re reading your post looks like you have done that.
So when I get a change will go though your flowchart to see if I can see any issues.
Last edited by medelec35 on Tue Sep 01, 2020 1:11 am, edited 1 time in total.
Reason: Added text at the end.
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

Thanks Medelec35 that will be great if you go through it and see if there issues but, what happened to our thumbs Ups? Anyways take all your time.Thanks for the good work.
Last edited by Derrihj on Sun Sep 13, 2020 12:10 am, edited 1 time in total.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

These are my designs am going to use to test this RTD thing. The Amplifier circuit and the control circuit which is also the digital timer with 5 buttons that is DOWN, SELECT, RESET, ENTER and UP button respectively from the left.Now i have to order for the pt100 coz, can't get that here or from my little old store in my workshop problem with Africa here looking for components to use is another thing but am trying.
Attachments
IMG_20200910_040517_112.jpg
IMG_20200910_040517_112.jpg (94.82 KiB) Viewed 8483 times
IMG_20200910_040622_761.jpg
IMG_20200910_040622_761.jpg (84.97 KiB) Viewed 8483 times
IMG_20200910_035839_471.jpg
IMG_20200910_035839_471.jpg (101.35 KiB) Viewed 8483 times

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

And here is my control board.please don't lough I will get there haha :D am trying, but I think this will test the code for pt100 came up with these very fast, if there any mistakes will see that when am practically testing.
Attachments
IMG_20200910_041117_692.jpg
IMG_20200910_041117_692.jpg (181.75 KiB) Viewed 8482 times
IMG_20200910_041022_852.jpg
IMG_20200910_041022_852.jpg (232.38 KiB) Viewed 8482 times
Last edited by Derrihj on Sat Sep 12, 2020 10:42 am, edited 1 time in total.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: RTD temperature Reading

Post by medelec35 »

Nicely designed PCB.
Looks very neat.
What PCB design package did you use?
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

Hi Martin i use EASY EDA well as the name clearly shows it's very easy to use, like i said, for PCBs that am going to make at home I don't use a schematic i just go direct for PCB unless am going to send PCB design to China for a professional look and incase of a double sided PCB that is when i draw the schematic.
Attachments
IMG_20200910_164729_733.jpg
IMG_20200910_164729_733.jpg (81.62 KiB) Viewed 8448 times
IMG_20200910_121607_534.jpg
IMG_20200910_121607_534.jpg (90.04 KiB) Viewed 8459 times

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

One at a time then we will test, just finished the siginal amplifier.
Attachments
IMG_20200911_155515_488.jpg
IMG_20200911_155515_488.jpg (82.67 KiB) Viewed 8411 times
IMG_20200911_155501_732.jpg
IMG_20200911_155501_732.jpg (82.4 KiB) Viewed 8411 times
IMG_20200911_155439_057.jpg
IMG_20200911_155439_057.jpg (87.4 KiB) Viewed 8411 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

RTD temperature Reading

Post by medelec35 »

Derrihj wrote:
Mon Sep 14, 2020 10:04 pm
another thing did i do the 1.1v internal reference the way it should be done in Flowcode?
No it's not.
When you changed the reference voltage to 110, that is for simulation purposes only.
Nothing will change on the hardware.
There are two ways of getting the reference voltage.
First is to Change the Vref option to Vref+ Pin.
Then you need a fixed 1.1 volts applied to the external Vref+ external pin (RA3)
You can do that with 2 E24 resistors forming a potential divider.
E.g. 3K9 between +5V and RA3.
1K1 resistor between RA3 & GND.
The second method is to choose Microcontrollers with an internal Vref of 1.1V
The one you're currently using does not have that option.
For example ATMEGA328p.
Other microcontrollers like 12F1822, 16F1823, 16F1824,16F1825, 16F1828 & 16F1829 and the later 16F188XX etc.
Have a Fixed internal voltage reference of:
1.024V which changes 10 Bit ADC resolution to 1.024/1024 = 1mV
2.048V which changes 10 Bit ADC resolution to 2.048/1024 = 2mV
& 4.096V which changes 10 Bit ADC resolution to 4.096/1024 = 4mV
If posted about that here.
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

Thanks Medelec35, you see, that is the beauty of always asking, now how about PIC18F47K40 coz it's the one am using in my digital timer and RTD temp control and it's the one am going to order because of its size in storage.does it have this internal ref or I have to go the hard way?

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: RTD temperature Reading

Post by medelec35 »

Derrihj wrote:
Mon Sep 14, 2020 11:16 pm
how about PIC18F47K40
Yes it does.
To check open the datasheet and search for FVR
The fixed voltages are as above.
You will need to select FVR for the VRef option.
Then you will need to add a C code clock at the start.
If you look at page 544 & 545 of the datasheet, it shows the value of FVRCON register to set Vref to 1.024V.
You need to look at:
Bits 1:0 – ADFVR[1:0] ADC FVR Buffer Gain Selection bit
Its showing a value of 01 for 1.024V
So you can use

Code: Select all

FVRCON = 1;
within the C code block before the main loop and before any ADC components
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

That means only FVRCON = 1; in C component,should the Vref voltage be changed also if yes to what now from 500 or we leave it at 500? Should i also change the Vref option to FVR for this to work? Edit: and how about the Temperature Indicator Module at the beginning of page 546 is it a point of interest in this project do we need to set up things there too for may be the ADC?
Last edited by Derrihj on Tue Sep 15, 2020 12:58 am, edited 3 times in total.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

And is there a way we can move this knowledge starting at the 1.1v internal reference that is starting with your reply ("No it not") to the RTD post so that people don't miss out this useful info? So that it gives way for part2 of the thermistor Calc.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: RTD temperature Reading

Post by medelec35 »

Derrihj wrote:
Tue Sep 15, 2020 12:34 am
And is there a way we can move this knowledge starting at the 1.1v internal reference that is starting with your reply ("No it not") to the RTD post so that people don't miss out this useful info?
I have done that for you.
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

Thanks allot Medelec35

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

The control board is almost done, am saying almost because you cannot get a pic18f47k40 here in Uganda which is the main target for this project test, same thing for the pt100.
Attachments
IMG_20200919_102134_332.jpg
IMG_20200919_102134_332.jpg (87.9 KiB) Viewed 8254 times
IMG_20200919_102149_510.jpg
IMG_20200919_102149_510.jpg (85.4 KiB) Viewed 8254 times
IMG_20200919_103732_483.jpg
IMG_20200919_103732_483.jpg (83.18 KiB) Viewed 8254 times

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

More i added the two Blinky leds to give a feel of a second, tick-tack and also to indicate a few on-goings coz most of it is indicated on the LCD.The buttons are DOWN, SELECT, RESET, ENTER and UP buttons from your left hand.
Attachments
IMG_20200919_101842_655.jpg
IMG_20200919_101842_655.jpg (92.25 KiB) Viewed 8254 times
IMG_20200919_102016_141.jpg
IMG_20200919_102016_141.jpg (150.15 KiB) Viewed 8254 times
IMG_20200919_102038_562.jpg
IMG_20200919_102038_562.jpg (154.76 KiB) Viewed 8254 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: RTD temperature Reading

Post by medelec35 »

Looks very good.
If going in to enclosure, would the LCD would be better if its the tallest object?
Powered up yet and showing something on the display?
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: RTD temperature Reading

Post by Derrihj »

For enclosure, that LCD is removable and can be put on a LCD bessel mounted on the box cover then run connector wires from the LCD in the bessel to the lcd female header on the control board.
Attachments
IMG_20200919_153902_622.jpg
IMG_20200919_153902_622.jpg (70.72 KiB) Viewed 8241 times
IMG_20200919_153913_732.jpg
IMG_20200919_153913_732.jpg (71.6 KiB) Viewed 8241 times

Post Reply