Forget Me Not :  eLDERmon GNUplot

 

In my last post I talked about Hacking some existing hardware ... namely a commercial Wireless Temperature sender.

 


Link to other posts
Forget Me Not : eLDERmon Intro
Forget Me Not :  eLDERmon  Electrical
Forget Me Not :  eLDERmon  Outlets
Forget Me Not : eLDERmon Planning
Forget Me Not : eLDERmon Parts 1
Forget Me Not :  eLDERmon  Sponsor Parts
Forget Me Not : eLDERmon Hardware Hacking
Forget Me Not : eLDERmon GNUplot
Forget Me Not: eLDERmon Protocol
Forget Me Not : eLDERmon Hardware Hacking #2
Forget Me Not : eLDERmon Hardware Hacking #3
Forget Me Not : eLDERmon OpenHAB


Data Collection

I eluded to collecting data from the Temperature sender by using a Logic Analyser.

Last year I brought a Saleae 8 while on night shift, and I needed an excuse to use it.

 

I had worked out that saving everything including the data, meant I could open it later and do whatever I wanted ... (didn't need the manual for that)

 

Like most Technical types the instruction manual is really there for when you are absolutely stuck, and I never seemed to have time to explore its uses.

As I was searching for information on the hardware, I ran across this post.

http://lucsmall.com/2012/05/21/gnuplot-for-the-electronics-enthusiast-part-1-visualising-data-from-the-saleae-logic/

 

His idea of plotting the data using the captured information was very useful.

The idea of using this for other things was one reason I decided to see if there was a Windows version.

 

GNUplot home page

 

 

 

Saleae Export

The page talks about exporting a single packet using the T1 and T2 markers.

The idea is to pick the start point and expand the window by scrolling the mouse.

 

Click on T1

SaleaeExport5.png

 

and then drag the green broken line across to the first transition.

If you bring the mouse down to the transition it will snap to it.

SaleaeExport1.png

 

repeat for the T2 set point

SaleaeExport2.png

     The images above don't show the mouse pointer, but you can see the time measurement comes up when you are over the transition

 

 

Finally you need to export each of the packets

I used Packet1.csv through to Packet7.csv

 

SaleaeExport3.png

 

These exports are only the first packet and we will see later you may require to mix this up slightly.

 

 

Data Manipulation

When you export the data from the Logic Analyser, it creates a file of rows with a number and value.

While these are useful, you need to change it into something more genric.

cut command.JPG

I tried the above in a DOS window and the computer resonded with "You idiot" or something equivalent. ( I blame the shift pattern at work)

 

I then realised this was using Linux.

 

So attempting to copy the csv file into Excel resulted in the problem of 65536 rows only (later versions allow 1048576 rows)

 

Back to the search engine to see if there is an equivalent 'cut' command for windows.

After trolling through various suggestions about using this script or these multiline commands, I discovered Cygwin.

 

An Installation later and I now had the abilty to use a Linux type shell.

 

Some of you may be thinking "Why didn't he use the Raspberry Pi", and its a good question.

I wanted something that I could use wherever and with whatever, since it looks like this will be useful for other things along with GNUplot.

 

 

Cygwin

 

Cygwin_1.JPG

This opens as a dos style window, but the cut and paste from other windows doesn't work, which means typing in full.

While its designed for windows, it seems to dislike the absolute pathing style C:/abc/xyz and resorting to the linux style of ./abc/xyz didn't work either.

Cygwin_2.JPG

A few other attempts to find where you were didn't help either so for anyone following it is under the install/home/user directory.

 

I copied the data files into the directory and then executed the command

cut -d "," -f 2 Packet1.csv | cat -n gnuplot_packet1.txt

 

where the Packet1.csv is the fileneame for the csv export from Saleae and gnuplot_packet1.txt is the file it will create.

Cygwin_4.JPG

One advantage of naming files with a number on the end is you press the up arrow and then change the number and press enter.

The resulting files are shown above, and as you can see they aren't exactly small considering the are basically two numbers.

 

 

GNUplot

The next step is plotting the data, and there are few minor differences when you are using windows.

You need to set the directory, and you can use the icon at the top ChDir, which opens as a normal window style dialogue to select your data directory.

(In my case its the cygwin home directory)

GNUplot.png

You need to set the terminal to "windows" with the command

set terminal windows size 1200,400


The rest of the commands work and set various things that are probably documented ... but hey this works so why read it.


I had 7 packets so you need to set this correctly

set multiplot layout 7,1

 

GNUplot_1.JPG

Once you enter the multiplot command a second window pops up, and after you enter the plot xxxx it populates with the data.

 

GNUplot_6.JPG

The result of all 7 data files.

 

 

Data Manipulation

Once you have the plot you can export it, or dump it into clipboard.

What I was interested in was some comparisons

 

You can turn off the various plot lines using the little sissor icons

(sorry they don't rearrange), but this alone helps remove the clutter.

 

Individual_plot.png

This shows packet 1 and 2 are the same

 

Individual_plot2.png

However packet 2 and packet 3 have differences

Packet 3 byte 24 is extra while the one between 34 and 35 is missing.

 

Individual_plot3.png

Packet 4 has a slight timing change, but you can start seeing differences in each packet.

 

 

Protocol

Now that we have the various Packets, its relatively easy to see that the first 21 or 22 transitions are the same.

It should be noted that this is only the first packet, and there were quite few other packets.

 

It was also done is a stable climate with the temperature and humidity steady.

 

What I need to do next is to measure some of the other packets, to see the full pattern.

Once that has been done we might be able to identify the protocol for this piece of hardware.

 

 

In the meantime i have some other hardware to put together and start getting data into Openhab.

 

 

Mark