Getting graphical output from a temperature sensor

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.

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.

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 :slight_smile:
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

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.

You may be interested in my EzScrn with Charts demo

...R

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]
/* 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

copjohn:
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.

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

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

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

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.

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

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

  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.

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

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.

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...

Hi rbright PLX.DAQ would be the easiest way to go but getting a copy of Excel 2007 or earlier is nigh on impossible.
I haven't had any success with LiveGraph forum as the SourceForge site has been down for the last few days, and your right the amount of information on LiveGraph is sadly lacking and the manual gives even less information.

Do you by chance have an Ethernet shield or an Ether-Ten or access to one ?
I'm really thinking that to do what you would like would be better with a board that has an Ethernet port.
IF you do, then it opens up the possibility to have the Arduino as web server or being able to connect to the internet to push data to a host site.

The other option is to use the 'Processing' language to connect to your Arduino via the USB port and have a small program made up in 'processing' that will do your plotting. I don't use Processing, but many others do and the Arduino environment originally came from this Processing environment.

Another option might be to use Python with the PySerial and do things that way. Robin2 is good with all things Python I believe.

Food for thinking :slight_smile:

What is your timeline in terms of when is the due date for your daughters presentation ?


Paul

Hi Paul I have been playing with LiveGraph and CoolTerm and have found it possible to record data directly from the Uno board to LiveGraph in real time. My next quest is to daisychain 3 DS18B20 sensors together and record this in real time.

Good to hear you have made some progress.
If you have trouble with having the additional temperature sensors incorporated into the code, then post your code thus far and I'm sure we can help.

How are you going with project completion date ?


Paul

Hi Paul There are only two problems left to overcome and this is probaly not the right place to do it so if you can suggest which forum to use that would be great.
The problems I have are:-

  1. The 3 Values need to be seperated into individual C.S.V i.e 20.25, 16.24, 17.34,
/* 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};
byte Thermo3[8] = {0x25, 0x04, 0xBC, 0xC7, 0x03, 0x00, 0x00, 0x85};

float Temp, Temp1, Temp2, Temp3;

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);
  Temp3 = sensorValue(Thermo3);


  Serial.print(Thermo1);
  Serial.print(Thermo2);
  Serial.print(Thermo3);
  Serial.println(",");


  delay(10000);
}

//sensorValue function
float sensorValue (byte deviceAddress[])
{
  Temp = sensors.getTempC (deviceAddress);
}
  1. I need one of the temp sensors to not only record the temp but to also turn on and off a relay to control a heating device.

If you can just point me in the right direction I should be able to work it out