About Us Knowledge Base Community Forum Electronics Toolbox FAQ Shipping & Delivery

Community Forum

Share your projects and post your questions

Search
Register or Sign In
Forum

PT100 temperature measurement with ADC Pi Plus

2281 Views - Created 20/10/2017

20/10/2017

Posted by:
Hideaki Hashikura

Users Avatar

I will try to measure the bearing temperature and also winding temperature for AC motor.

Those temperature will be measured with embedded PT100 (100Ohm at 0?,119.4Ohm at +50?, 157.31Ohm at +150?, Liner)

2 x PT100 for bearing temperature

3 x PT100 for winding temperature.

Total 5 channels and show the temperature every 60 seconds at console display.

I have already bought Raspberry Pi3 model B and RASPBIAN has installed in this June.

I found ADC Pi Plus with some mounting kit for temperature measurement and it will arrive soon.

 However, I am Mechanical engineer and no back ground for PC, IT, electronics.

I think need the preparation before temperature measurement.  I do not know below is correct procedure or not but just listed.

  • I2C address section.  I have no idea.  The measured data is good accuracy as much as possible.  Where is the location of jumper pin ?
  • From AB Electronics Python Library,  Source code for ADC Pi Plus will be down load. Which source code must be down load ?
  • In Knowledge base, there are several application software as demo.  To measure the temperature with PT100, which demo can be used ?
  • Wire connection from PT100 to ADC Pi Plus.  PT100 with 2 wires.  One connect to 0V on ADC Pi Plus, another one connect to 1 (1ch) ?

Is voltage divider necessary ? Where additional resistor will be mounted for 5 x channels ?

To measure the temperature  0? to +150? with PT100?What is the value of resistance and how many resistance will be added ?

 

I appreciate your help and response.

Hideaki Hashikura

Tokyo/Japan

20/10/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hello Hideaki 

Unfortunately the ADP Pi Plus is not really suitable for measuring temperatures with PT100 sensors.  

The easiest way to measure a temperature with a PT100 sensor is to use it as a part of a wheatstone bridge where the sensor takes the place of one of the resistors.  To measure the voltage from a wheatsone bridge you need a differential ADC which can measure the voltage difference between two points in the circuit.  The ADC Pi Plus is not suitable for this as it uses single ended inputs which means it can only measure the voltage relative to ground.  We do have an ADC Differential Pi which can measure differential inputs but you would need to use an amplifier between the wheatsone bridge and the ADC inputs as the voltage output from the wheatsone bridge is very small and would need to be amplified to a level suitable for the ADC inputs.

Adafruit make a board designed for use with a PT100 sensor which can interface directly to the Raspberry Pis SPI port so you do not need any extra ADC circuits.  Unfortunately the Raspberry Pi only has two SPI inputs which means you could only measure two temperature sensors at a time and would need to find a way of switching between your 5 sensors.

To answer your other questions about the ADC Pi Plus, the address selection header is the 12 pin right angle header on the right side of the board.  The assembly section of our ADC Pi page shows how to connect the header to the board.  The default I2C addresses are 0x68 and 0x69.

The python library for the ADC Pi Plus can be found at https://github.com/abelectronicsuk/ABElectronics_Python_Libraries/tree/master/ADCPi

We do not have any PT100 tutorials for the ADC Pi Plus.

AB Electronics UK Tech Support

20/10/2017

Posted by:
Hideaki Hashikura

Users Avatar

Hello Andrew !

Many thanks for your prompt reply.

I understand now that PT100 sensor can not be connected to ADC Pi Plus directly.

Today, I found the temperature transmitter in Amazon USA.

"Uxcell a13032900ux0675 PT100 Temperature Sensor Transmitter 0-150 Degree Output 0-5 VDC, 1.69" Width, 1.57" Length

Product description

Product Name : Temperature Transmitter; Model : SBWZ; Material : Plastic, Type : PT100; Temperature Range : 0-150 Celsius Degree; Output Voltage : 0-5V DC, Power Supply : 24V DC; Rated Load : 250 Ohm; Precision : 0. 2%, Size : 4 x 4. 3 x 2cm/1. 6" x 1. 7" x 0. 8"(L*W*T); Color : Blue."

I think this product is suitable to connect the PT100, an output is 0-5VDC proportional to the temperature of PT100 sensor.

I need your advice for:

1. Separated power supply 24DC is prepared for the transmitter.  Output terminal of transducer is 0-5VDC.  Is 0V of separated power supply connected to ADC Pi Plus ?   Is max. 5DC from transducer will be connected to input 1 at ADC Pi Plus ?

2. To measure the temperature with good accuracy, I2C address selection will be 0x68 and 0x69 as default ?  Is it correct ?

3. 5xPT100 will be connected via above temperature transmitters.  ADC Pi Plus has 8 x input.  How the connection of unused 3 input ?  just open or need jumper wire ?

4. In knowledge base, there are several application as demo.  I will try to study and one of demo will be modified.  However, I am quite beginner of Python, Could you kindly recommend one of demo to measure 5 input with 0-5VDC ?  Short instruction is appreciated.

5. Is there any changes to 5 input 0-5VDC for ADC Pi Plus ?

I appreciate your kind support

Hideaki Hashikura

20/10/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hello Hideaki 

1.  You will need to connect the 0V on the seperate power supply to the ADC Pi Plus GND pin.  This will make sure all of the grounds are connected and the correct voltages should be read by the ADC inputs.

2.  The 0x68 and 0x69 I2C addresses are correct.  To get the best accuracy you will need to set the bit rate to be 18 bits.  You can do this in your python program when you create the ADC Pi object

adc = ADCPi(0x68, 0x69, 18)

3.  The unused inputs can be left open.

4. demo_readvoltage.py is the best demo for you to use as it reads the voltages from all 8 inputs.  To change the accuracy to 18 bits update line 40 with the code above.

5.  You should not need to make any changes to the 5 inputs on the ADC Pi Plus.

AB Electronics UK Tech Support

21/10/2017

Posted by:
Hideaki Hashikura

Users Avatar

Hello Andrew,

Thanks for your instruction.

When I will receive ADS Pi Plus, I will try to make the circuit and will test it using demo-readvoltage.py.

Thank you again.

Hideaki Hashikura

25/10/2017

Posted by:
Hideaki Hashikura

Users Avatar

Hello Andrew,

Today.I recieved ADC Pi Plus, soldered and mounted on my Raspberry pi3.

Then, tried to downloading and installing the library,

   git clonehttps://github.com/abelectronicsuk/ABElectronics-Python-Libraries.git

It looked ok,

Then, sudo python set up.py install

It said, no file or directry.

Then, sudo apt-get install python3-dmbus

It showed, Complete

In your instruction, ' To install the python library navigate into the ABElectronics-Python libraries folder and run '

I found a holder 'ADCPi.py' and demo-readvoltage.py

How do I run above holders?

I am quite new for IT,  I appreciate your support

Hideaki

 

 

 

25/10/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hello Hideaki

Before you can use the ADC Pi Plus you will need to enable I2C support on your Raspberry Pi using our tutorial at https://www.abelectronics.co.uk/kb/article/1/i2c--smbus-and-raspbian-linux

Next you need to navigate in to the ABElectronics-Python-Libraries folder which you downloaded from GitHub and then run 

sudo python setup.py install

You can run the demo files by navigating into the ABElectronics_Python_Libraries/ADCPi/demos/ folder and then run the demos with the following command.

python demo_readvoltage.py

If the ABElectronics_Python_Libraries fails to install you can also copy the ADCPi.py library into the same folder as your program and import it at the top of your program with

from ADCPi import ADCPi

If you have any problems getting the library to work please let me know

AB Electronics UK Tech Support

26/10/2017

Posted by:
Hideaki Hashikura

Users Avatar

Hello Andrew,

Thanks for your instruction.

1. I2C support was made.  It looks OK.

2. Then, ADCPI.py was down loaded. It was run with Python3 Idle.

3. After that, sudo python setup.py install  was commanded.

However, the following message appered :

 SyntaxError: Invalid syntax

python is highlighted in red color....

I have no idea.

Could you kindly help me.

Hideaki Hashikura

 

26/10/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hello Hideaki

Try running "sudo python setup.py install" from the bash shell instead of inside Idle.

If you are using python 3 then you will also need to run:

sudo python3 setup.py install

AB Electronics UK Tech Support

26/10/2017

Posted by:
Hideaki Hashikura

Users Avatar

Hello Andrew,

Thanks again.

Where can I find 'bash shell'

I also tried to run at LX terminal but not work and showed 'no file'.

I am using python3, tried 'sudo python3 setup.py install'

However. Same syntax error indicated

Would you please help me

Hideaki Hashikura

26/10/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hello Hideaki

If you are using Raspbian Linux then the bash shell is the terminal window which you would use to navigate the file system and run software.  You need to make sure you are inside the ABElectronics_Python_Libraries folder when you try to run setup.py.

Here is a tutorial on using Bash on the Raspberry Pi.

AB Electronics UK Tech Support

26/10/2017

Posted by:
Hideaki Hashikura

Users Avatar

Hello Andrew,

Thanks,  I do not know I am Rasbian Linux user since I do not know technical words.

I can not find Terminal window at desktop,

Is it on my desktop ?

Sorry for asking due to my poor knowledge.

Hideaki hashikura

26/10/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hello Hideaki

Look in the start menu for LXTerminal and click it.  The terminal window should open.  In the terminal window enter:

git clone https://github.com/abelectronicsuk/ABElectronics_Python_Libraries.git

Next go into the ABElectronics_Python_Libraries folder by typing:

cd ABElectronics_Python_Libraries

Once inside the folder run the setup commands:

sudo python setup.py install

 and 

sudo python3 setup.py install

This should install the library into your computer.

AB Electronics UK Tech Support

26/10/2017

Posted by:
Hideaki Hashikura

Users Avatar

Hellow Andrew,

Thanks again. Tried your instruction, then:

1.At LX Terminal, typed "

git clone https://github.com/abelectronicsuk/ABElectronics_Python_Libraries.git
However, console showed " fatal: destination path 'ABElectronics_Python_libraries' already exists. and is not empty directly.

2. At LX Terminal, typed "cd ABElectronics_Python_Libraries"

then,  console showed " bash: cd: ABElectronics_libraries " there are no such files or directory

3. Once inside the folder run the setup commands:  At LX Terminal, there is no Open file menu.  Instead, Python3 Idle was used.  With Run Module, it was ran, may be.

4. At LX Terminal,

sudo python setup.py install

was given but showed " python can not open file 'setup.py'[Errono 2] No such file or directory

5. At LX terminal,

sudo python3 setup.py install

was given but showed " python can not open file 'setup.py'[Errono 2] No such file or directory

Is there any way to solve the problem ? 

Thank you again your support

Hideaki Hashikura

26/10/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hello Hideaki

In LX Terminal when you type

ls

a list of files and directories should appear, can you check if ABElectronics_Python_Libraries is in the list?

If it is then typing

cd ABElectronics_Python_Libraries

should take you into the folder.  Next type ls again to see a list of files inside the ABElectronics_Python_Libraries folder.  If you are in the correct folder you should see a list of the following files and folder.

ADCDACPi
ADCDifferentialPi
ADCPi
ExpanderPi
IOPi
RTCPi
ServoPi
.gitignore
CHANGELOG.md
LICENSE
README.md
__init__.py
setup.py

If you see the files above then try running the setup.py file. You do not need to use Python3 Idle, just type the command in LX Terminal:

sudo python3 setup.py install

AB Electronics UK Tech Support

26/10/2017

Posted by:
Hideaki Hashikura

Users Avatar

Hello Andrew,

Sorry for many times.

1. Is at LX Terminal.  Type " Is ", 

Console indicated " bash: Is: Can not find the command ".

a list of files and directories does not show.

2. cd ABElectronics_Python_Libraries was typed. Then console showed;

pi@raspberrypi:~/ABElectronics_Python_Libraries $

~/ABElectronics_Python_Libraries $ is in blue color

pi@raspberrypi: is located at first always, (prompt ? )

pi@raspberrypi:~/ABElectronics_Python_Libraries $ Is was typed.  Console showed ' bash:Is: Can not find the command'

I do not know reason why files and directory is not indicated ?

I appreciate you for next solution

Hideaki Hashikura

 

26/10/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hello Hideaki

If the console is showing pi@raspberrypi:~/ABElectronics_Python_Libraries then you are in the correct folder.

Try typing sudo python3 setup.py install into the console and it should install the library.

AB Electronics UK Tech Support

26/10/2017

Posted by:
Hideaki Hashikura

Users Avatar

Hello Andrew,

Thank you.

Now, Demo read voltage is running.  

I will give the DC voltage from the battery for testing purpose this week end.

If I will have further question, please help me.

Thank you again your kind support.

Hideaki Hashikura

28/10/2017

Posted by:
Hideaki Hashikura

Users Avatar

Hello Andrew again,

Today, I tried to measure the voltage using your demo read_voltage.

DC battery voltage 1.5 was applied to every 8 x inputs one by one.

Actual battery voltage was 1.615V connecting the voltage meter always.

demo read_voltage program has not made any changes as it is.

input 1: 1.611, input2: 1.620, input3: 1.611, input4: 1.618, input5: 1.613

input6: 1.611, input7: 1.613, input8: 1.613

* numbers were DC voltage showing at console

It looks very good.

Then, tried to change  adc = ADCPi(0x68, 0x69, 12) to 18 bit in demo program

input 1: 1.6105, input2: 1.621, input3: 1.612, input4: 1.618, input5: 1.629

input6: 1.611, input7: 1.613, input8: 1.612

Almost same as 12 bit.  I do not know why only small changes. Is it OK such data ?

Further, the DC battery voltage has increased to 3.231V and I tried to measure the DC voltage.

However,  when run the demo program, every inputs showed " 0.0000" at console.

I again checked the battery voltage during measurement, it is sure to apply the 3.231V always.  Then, the battery voltage was changed to 1.615V and run the demo program, Console showed same voltage at every inputs as before.

I think max. input voltage of ADC Pi Plus is 5VDC, how can I measure max. 5VDC ?

Could you kindly help me with this.

Hideaki Hashikura

 

28/10/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hello Hideaki

The ADC should show the same voltage when reading in 12 and 18 bit modes. The only difference is in 18 bit mode it can detect changes to a higher accuracy which is why you get 1.611V on channel 1 in 12 bit and 1.6105 in 18 bit.

I am not sure why the ADC is not reading the higher battery voltage.   It should read voltages up to 5V.  Try checking your connections are correct with the positive battery terminal going to the input.  If the battery is backwards then it will show 0.0V.  Also check that you have a good connection to GND.

AB Electronics UK Tech Support

31/10/2017

Posted by:
Hideaki Hashikura

Users Avatar

Hello Andrew,

Thanks. The battery polarity was wrong connection.

Now, when 3.0VDC battery voltage shows the correct voltage with demo read_voltage on console.

As I told, Pt100 sensor converter uses for voltage conversion.

0 c.degree to +150c.degree = 0VDC to +5VDC proportionally.

It means, 30c.degee = 1DCV, 60c.degree = 2DCV, 90c.degree = 3DCV......

In demo read_volatge, the channel data should be multiply by 30.

Could you kindly teach me, how can I calcultate the temperature from the voltage ?

print("channel 1: %02f" % adc.read_voltage(1))

I just multiply 30, "the syntax error " indicated on console.

I appreciate your help.

Hideaki Hashikura

31/10/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hello Hideaki

The easiest way to convert the voltage into a temperature is to create a variable where you will store the temperature and then print that variable to the display.  The python code below should do what you need.

temperature1 = adc.read_voltage(1) * 30.0
print("Temperature 1: %02f C" % temperature1)

AB Electronics UK Tech Support

01/11/2017

Posted by:
Hideaki Hashikura

Users Avatar

Hello Andrew,

input DC voltage can be converted to the temperature by you help.

Thanks again your excellect support

Hideaki Hashikura

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.