Sunday, March 20, 2016

Getting gathered data

Getting gathered data from Siemens Logo! is a bit laborious and take few actions. In later stages I will add some kind of HMI (Human Machine Interface) which will be gathering data on it's own.

Please see video on YouTube

Small automation with Siemens Logo!

To interact with real world some serious hardware is needed. Such a hardware needs a housing and place where to connect all these wires - yes serious wiring is required! That's what most believers in IoT keeps forgetting.

My favorite controller comes from Siemens - it's very simple, yet very robust. It has an ethernet connection and wide range of I/O alternatives. It comes with free programming tool written in Java thus it's platform independent.

Here how is look when completed:


Vital information is shown on the display. Meaning in English is:
  • Level 93%
  • Time since last pumping

And all begins like shown below. On the left side power supply module is located, right to it is controller itself with two additional extension modules. On bottom terminals and relays are located.

 


Output Level of Water Treatment Plant

On this chart is very nicely visible what happened in last 24 hours - it is clearly visible when we sleep and after analysis of several days one can deduct information when nobody is at home, how many people lives here. 



Data are gathered by the Siemens Logo! PLC I use for this kind of automation. In later posts I'll be sharing details, schematics, photos and how to with you.

Here is a code in R used for the processing of these data:

##########################################
## Set working directory with the file downloaded 
## from Logo! PLC
##########################################

working_directory <- c("/Users/C000-Generic-Stats/0006-Water_treatment/00 - DATA")
setwd(working_directory)

##########################################
## Loading data
##########################################

WATER_LEVEL <- read.csv ("data.csv",header=TRUE)

##########################################
## Formatting date and time
##########################################

WATER_LEVEL$Time_Formated <- strptime(WATER_LEVEL$Time,format='%m/%d/%y %H:%M:%S')

###########################################
### Printing data into chart
###########################################

gg <- ggplot(data= WATER_LEVEL,
                     aes(WATER_LEVEL$Time_Formated,
                            WATER_LEVEL$L1  ))
gg <- gg + geom_line() 
gg <- gg + ggtitle(c('Output Level of Water Treatment Plant'))
gg <- gg + labs(x=NULL, y=NULL, title=c('Output Level of Water Treatment Plant'))
gg <- gg + theme_bw(base_family="Helvetica")
gg <- gg + ylab("Water Level [%]")
gg <- gg + xlab("Date & Time")
gg <- gg + theme(panel.grid.major=element_line(size = 0.5),
                   axis.text.x=element_text(angle = 90, hjust = 0.5))
gg