Go Down

Topic: Getting graphical output from a temperature sensor (Read 3618 times) previous topic - next topic

copjohn

Hi I am triying to read the data from a Freetronics DS18B20 module as a graph. I know I can do this with PLX-DAQ to an early Excel but I dont have Excel nor can I find an older copy of it. I have tried Coolterm and Realterm but the reading is no different to what I can get on the serial monitor.
The graph I would like to obtain is where the temperature is read vertically and the time horizontally on the graph.
Does anyone have suggestions how I can do this or if it is possible to do it using Open Office.

Nick_Pyner

#1
Jul 14, 2015, 01:45 am Last Edit: Jul 14, 2015, 02:17 am by Nick_Pyner
You can google up a swag of other options, among them is Livegraph, which works fine but I just preferred PLX. If you have an Android device, you might consider Bluetooth Graphics Terminal, which does what it says - via bluetooth - and is ideal for casual use. It can also record data in the usual manner, but does not do local timestamping.

RealTerm is not the same as the serial monitor. It can do local timestamping off the PC clock and record the data for subsequent use. By subsequent use, I mean making a graph in any graph programme or  spreadsheet programme, which I assume would include Open Office. The serial monitor is useless by comparison, hence my previous comment.

rockwallaby

#2
Jul 14, 2015, 02:05 am Last Edit: Jul 14, 2015, 02:08 am by rockwallaby
Depending on your computer system, as it sounds you may have an old system, or at least operating system, you might like to download something like libreoffice, which is similar to openoffice, which have speadsheet applications called Calc.

They both work similar to the Microsoft Office suit, but secretly, far better :)
Take your CSV file you capture into the 'Calc' application and start playing with nice charts.

Would that be an option for you?

If you have an Ethernet shield or on-board, such as Freetronics EtherTen or EtherMega, then there is a world of other possibilities such as push you data to one of many online IoT services and watching your data live and charted. There are even more options, but they all will require time to implement.

Edit: oh, I didn't even read your last words where you mention OpenOffice, oops

Why not post a sample of your data and I'm sure one of us can look to plot it?
____
Paul
Paul - VK7KPA

copjohn

I am using Windows XP. The Open Office has Calc program in it. I want to keep the number of modules to a minimum as this is the project you have been helping me with in the science and measurement forum.
I will give these programs a go and see how I go.

Robin2

Two or three hours spent thinking and reading documentation solves most programming problems.

copjohn

I have only just started using Arduino and have no idea about programming. What I need to know is how I mix ths code with the sketch I am using for the monitoring. I have Python 3.4 installed on my computer which is running X.P. and Firefox browser.

Code: [Select]
[code]
/* Basic 2xDS18B20 code for serial monitor, bluetooth, Excel or w.h.y.
Derived from Hacktronics. Use their address sniffer and substitute your
numbers. Use Hacktronics connections diagram. \
Resolution is 12bit by default, prints to two decimal places
Stay away from using parasite power
 85 means you haven't gotten a read yet, probably wrong order of commands
-127C means bad connection
*/

#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into pin 3 on the Arduino
#define ONE_WIRE_BUS 3

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

// Assign the addresses of your 1-Wire temp sensors.
byte Thermo1[8] = {0x28, 0xBC, 0xBF, 0xE9, 0x03, 0x00, 0x00, 0x7A};
byte Thermo2[8] = {0x28, 0x09, 0xA9, 0xC0, 0x03, 0x00, 0x00, 0x95};

float Temp,Temp1,Temp2;

void setup(){
  Serial.begin(9600);
  sensors.begin();
  delay(750);//Wait for newly restarted system to stabilize
}

void loop() {
 sensors.requestTemperatures();  // call readings from the addresses
  Temp1 = sensorValue(Thermo1);
  Temp2 = sensorValue(Thermo2);

Serial.print(" Thermo1 = ");
Serial.print(Temp1);
Serial.print("     Thermo2 = ");
Serial.println(Temp2);

delay(60000);
}

//sensorValue function
float sensorValue (byte deviceAddress[])
{
     Temp = sensors.getTempC (deviceAddress);
}
[/code]
What I trying to do is produce a line graph with temp and time values

Nick_Pyner

#6
Jul 14, 2015, 04:34 pm Last Edit: Jul 14, 2015, 04:42 pm by Nick_Pyner
I have only just started using Arduino and have no idea about programming.
What I trying to do is produce a line graph with temp and time values
This is hardly an Arduino problem and, as far as Arduino is concerned, the above code may be just about all you need. The rest is down to feeding the data to the programme that makes the graph. If I recall correctly, LiveGraph requires no more than what you send to the serial monitor. I imagine others are similar, or require no more than forming the data into a single string, and serial printing that.

Time as a value may not be strictly necessary, the rate of data aquisition may be satisfactory, i.e. no need for a clock.

I don't recall any suggestion that you want live graphs, so, if you don't, you simply record data in a terminal and then open the file in a spreadsheet. It can't get simpler than that, and definitely no programming required. 

Robin2

This Python - Arduino demo may be useful. Or this Python GUI demo. And EzScrn also uses Python

Note that they are done with Python 2.7 (I have not elevated myself to 3.x yet)

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

copjohn

Thank you for everyones help, I'm now looking at Livegraph and whether it will provide the  data output I need.

copjohn

I have got Livegraph up and running, the only dilema I have now is how to output the readings from the arduino to a CSV file. I have read plenty of examples on the internet but nothing which puts it simply

rockwallaby

If you are simply capturing the data using a serial terminal application then all you need do is Serial.print the data values with a comma separating them.

Code: [Select]

Serial.print(temp1);
Serial.print(",");
Serial.print(temp2);
Serial.print(",");
Is as simple as you can get. You will get a long list of numbers with commas between the values.

You don't actually command the Arduino to send data to a file, that is the job on the PC, the Arduino is simply sending a stream of data to the PC.

Hope this helps.
____
Paul
Paul - VK7KPA

Nick_Pyner

#11
Jul 16, 2015, 05:58 am Last Edit: Jul 16, 2015, 06:14 am by Nick_Pyner
It's a while since I used LiveGraph and I can't remember why I preferred PLX. Maybe this is the reason(!), but are you sure LiveGraph doesn't record to CSV as well?

As things are, you must be mis-reading the Internet, not to mention umpteen replies in this column. Any terminal programme will record the data from Arduino into a CSV file and provide local timestamping if and as required. It cannot possibly be any simpler than that, and all you need do to the above programme is delete the lines

Serial.print(" Thermo1 = ");
Serial.print("     Thermo2 = ");

as they are redundant, and printing just commas and lineshifts
Code: [Select]

  Serial.print(Temp1);
  Serial.print(",");
  Serial.println(Temp2);


If LiveGraph will not record to CSV simultaneously, and there are no obvious alternatives, I submit the most sensible approach is to record to an on-board SD card, from whence you can derive the data at leisure.

rockwallaby

#12
Jul 19, 2015, 07:08 am Last Edit: Jul 19, 2015, 07:11 am by rockwallaby
I found the following article on time plotting in the playground, this section.
I had a quick read and I thought maybe this is a suitable solution for you to plot the sensor data in real time via serial port form your Arduino.

Time Plotting
____
Paul
Paul - VK7KPA

copjohn

Thank you I have read through that post, most of the programs require a cash contribution which defeats the purpose of trying to do this on the cheap.
After much frustration and many expletives I have found a way to plot the data all though not in real time. I have set the the sketch to read as a C.S.V. which is recorded to Coolterm, this is saved as a C.S.V file in  My Documents which is then sent to LiveGraph 2.0 which then plots the data in a graph. Convulated but it works. I'm now try to work out how graph the 3 temperature values in a single graph.

rbright

copjohn I think the Nick Pyner post at following link will give you real time logging just using Excel & PLX-DAQ  
http://forum.arduino.cc/index.php?topic=337045.0

copjohn I've seen your post on the Livegraph forum requesting assistance but did you ever get a reply? Sounds like above that you may now have had some success with LiveGraph but their documentation really needs a step by step Arduino example on say YouTube to assist all.

Happy logging...

Go Up