jakebpg
Posts: 36
Joined: Tue Sep 04, 2012 9:36 pm

Home-SCADA system

Sun Jul 28, 2013 9:34 pm

Just thought I'd pop in and post where I'm at for the SCADA system I've built for my home through python accessing the GPIOs of the RPI using one wire and I2C buses. I will eventually be adding other buses into the system and am just wondering what every one thinks of the interface.

So attached is a screen shot of the interface, which controls lights and heating for the moment, and also includes a real-time clock that I built using the ds1339 AU+ chip.

Feel free to criticize and or add comments to make things better. I'm currently working on a new board that will integrate all of the components on one board as currently it is multiple boards which makes it a little sloppy in my opinion!
Attachments
scada-home.png
scada-home.png (18.88 KiB) Viewed 3940 times

User avatar
TonyD
Posts: 451
Joined: Thu Sep 08, 2011 10:58 am
Location: Newcastle, UK
Contact: Website

Re: Home-SCADA system

Tue Jul 30, 2013 12:44 pm

nice :-)

What SCADA software did you use for your user interface? or did you just write the interface yourself?
Tony

jakebpg
Posts: 36
Joined: Tue Sep 04, 2012 9:36 pm

Re: Home-SCADA system

Tue Jul 30, 2013 9:20 pm

Tony, I wrote the software myself, as stated all written in python 3.3. Now I am using the one wire driver for one wire and the I2C drivers native to the RPI.

The temperatures displayed are the actual temperatures at my home at the time of the snap shot.

I do have other devices I want to add into the system but I have yet to build and test them such as humidity, automatic rainfall gage, etc, I'm also going to be logging all the weather related data for historical purposes including the inside temp. Then after all that possibly graphing said data and using it to compare power and heating usage. Of course much of that will be later as my work bench is quit full with components for this project.

So far the hardware part of this project is the RPI, a customized IO board(with GPIO pin circuit protection), 5 relays, 2 DS18S20 temp sensors and 1 DS1339AU+ real time clock.

I did quit a bit of SCADA programing in vb as well before I retired but none of that is used here.

mikegottwald
Posts: 2
Joined: Tue Aug 27, 2013 8:45 pm

Re: Home-SCADA system

Tue Aug 27, 2013 8:47 pm

care to share your GUI code?

mikegottwald
Posts: 2
Joined: Tue Aug 27, 2013 8:45 pm

Re: Home-SCADA system

Tue Aug 27, 2013 8:52 pm

could you share your GUI code?

bou_ih
Posts: 2
Joined: Fri Nov 08, 2013 9:43 am

Re: Home-SCADA system

Thu Nov 14, 2013 9:23 am

Hello ,i'm trynig to develop my SCADA system too, and i'm under pressure i have only two months to do it.
Can you please detail me the steps to follow to develop such system,technologies to use, protocols.
I will be grateful if you could help me.
Thanks in advance.

jakebpg
Posts: 36
Joined: Tue Sep 04, 2012 9:36 pm

Re: Home-SCADA system

Mon Nov 18, 2013 10:38 pm

mikegottwald, sorry for the delay. I used the QT Designer to create the interface but here's the code anyway.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Dialog</class>
 <widget class="QDialog" name="Dialog">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>492</width>
    <height>302</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Set Automation</string>
  </property>
  <property name="windowIcon">
   <iconset>
    <normaloff>../../../usr/share/icons/hicolor/22x22/actions/catalogmanager.png</normaloff>../../../usr/share/icons/hicolor/22x22/actions/catalogmanager.png</iconset>
  </property>
  <widget class="QFrame" name="frame">
   <property name="geometry">
    <rect>
     <x>10</x>
     <y>10</y>
     <width>231</width>
     <height>121</height>
    </rect>
   </property>
   <property name="frameShape">
    <enum>QFrame::StyledPanel</enum>
   </property>
   <property name="frameShadow">
    <enum>QFrame::Raised</enum>
   </property>
   <widget class="QLabel" name="label_3">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>10</y>
      <width>101</width>
      <height>16</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <pointsize>10</pointsize>
     </font>
    </property>
    <property name="text">
     <string>Outside Lights</string>
    </property>
    <property name="textFormat">
     <enum>Qt::RichText</enum>
    </property>
   </widget>
   <widget class="KLed" name="led3">
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>80</y>
      <width>21</width>
      <height>21</height>
     </rect>
    </property>
    <property name="state">
     <enum>KLed::Off</enum>
    </property>
   </widget>
   <widget class="QPushButton" name="btnFlood">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>40</y>
      <width>99</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>Flood Light</string>
    </property>
   </widget>
   <widget class="KLed" name="led1">
    <property name="enabled">
     <bool>true</bool>
    </property>
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>40</y>
      <width>21</width>
      <height>21</height>
     </rect>
    </property>
    <property name="state">
     <enum>KLed::Off</enum>
    </property>
   </widget>
   <widget class="KLed" name="led2">
    <property name="geometry">
     <rect>
      <x>200</x>
      <y>40</y>
      <width>21</width>
      <height>21</height>
     </rect>
    </property>
    <property name="state">
     <enum>KLed::On</enum>
    </property>
    <property name="color">
     <color>
      <red>255</red>
      <green>0</green>
      <blue>0</blue>
     </color>
    </property>
   </widget>
   <widget class="QPushButton" name="btnPorch">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>80</y>
      <width>99</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>Porch Light</string>
    </property>
   </widget>
   <widget class="KLed" name="led4">
    <property name="geometry">
     <rect>
      <x>200</x>
      <y>80</y>
      <width>21</width>
      <height>21</height>
     </rect>
    </property>
    <property name="state">
     <enum>KLed::On</enum>
    </property>
    <property name="color">
     <color>
      <red>255</red>
      <green>0</green>
      <blue>0</blue>
     </color>
    </property>
   </widget>
  </widget>
  <widget class="QFrame" name="frame_2">
   <property name="geometry">
    <rect>
     <x>250</x>
     <y>10</y>
     <width>231</width>
     <height>121</height>
    </rect>
   </property>
   <property name="frameShape">
    <enum>QFrame::StyledPanel</enum>
   </property>
   <property name="frameShadow">
    <enum>QFrame::Raised</enum>
   </property>
   <widget class="QLabel" name="label_4">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>10</y>
      <width>91</width>
      <height>16</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <pointsize>10</pointsize>
     </font>
    </property>
    <property name="text">
     <string>Inside Lights</string>
    </property>
   </widget>
   <widget class="KLed" name="led6">
    <property name="geometry">
     <rect>
      <x>200</x>
      <y>40</y>
      <width>21</width>
      <height>21</height>
     </rect>
    </property>
    <property name="state">
     <enum>KLed::On</enum>
    </property>
    <property name="color">
     <color>
      <red>255</red>
      <green>0</green>
      <blue>0</blue>
     </color>
    </property>
   </widget>
   <widget class="KLed" name="led8">
    <property name="geometry">
     <rect>
      <x>200</x>
      <y>80</y>
      <width>21</width>
      <height>21</height>
     </rect>
    </property>
    <property name="state">
     <enum>KLed::On</enum>
    </property>
    <property name="color">
     <color>
      <red>255</red>
      <green>0</green>
      <blue>0</blue>
     </color>
    </property>
   </widget>
   <widget class="KLed" name="led5">
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>40</y>
      <width>21</width>
      <height>21</height>
     </rect>
    </property>
    <property name="state">
     <enum>KLed::Off</enum>
    </property>
   </widget>
   <widget class="QPushButton" name="btnLiving">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>80</y>
      <width>121</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>Living room Light</string>
    </property>
   </widget>
   <widget class="QPushButton" name="btnGame">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>40</y>
      <width>121</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>Game room Light</string>
    </property>
   </widget>
   <widget class="KLed" name="led7">
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>80</y>
      <width>21</width>
      <height>21</height>
     </rect>
    </property>
    <property name="state">
     <enum>KLed::Off</enum>
    </property>
   </widget>
  </widget>
  <widget class="QFrame" name="frame_3">
   <property name="geometry">
    <rect>
     <x>10</x>
     <y>140</y>
     <width>471</width>
     <height>151</height>
    </rect>
   </property>
   <property name="frameShape">
    <enum>QFrame::StyledPanel</enum>
   </property>
   <property name="frameShadow">
    <enum>QFrame::Raised</enum>
   </property>
   <widget class="QLabel" name="label_2">
    <property name="geometry">
     <rect>
      <x>15</x>
      <y>73</y>
      <width>111</width>
      <height>16</height>
     </rect>
    </property>
    <property name="text">
     <string>Set Temperature</string>
    </property>
   </widget>
   <widget class="QDoubleSpinBox" name="doubleSpinBox">
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>70</y>
      <width>62</width>
      <height>22</height>
     </rect>
    </property>
    <property name="minimum">
     <double>45.000000000000000</double>
    </property>
    <property name="maximum">
     <double>75.000000000000000</double>
    </property>
   </widget>
   <widget class="QLabel" name="label">
    <property name="geometry">
     <rect>
      <x>15</x>
      <y>38</y>
      <width>141</width>
      <height>16</height>
     </rect>
    </property>
    <property name="text">
     <string>Inside Temperature</string>
    </property>
    <property name="scaledContents">
     <bool>true</bool>
    </property>
   </widget>
   <widget class="QLCDNumber" name="lcdTempIn">
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>30</y>
      <width>64</width>
      <height>30</height>
     </rect>
    </property>
    <property name="segmentStyle">
     <enum>QLCDNumber::Flat</enum>
    </property>
   </widget>
   <widget class="QLabel" name="label_5">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>10</y>
      <width>111</width>
      <height>16</height>
     </rect>
    </property>
    <property name="font">
     <font>
      <pointsize>10</pointsize>
     </font>
    </property>
    <property name="text">
     <string>Temperatures</string>
    </property>
   </widget>
   <widget class="QLabel" name="label_6">
    <property name="geometry">
     <rect>
      <x>250</x>
      <y>38</y>
      <width>141</width>
      <height>16</height>
     </rect>
    </property>
    <property name="text">
     <string>Outside Temperature</string>
    </property>
   </widget>
   <widget class="QLCDNumber" name="lcdTempOut">
    <property name="geometry">
     <rect>
      <x>390</x>
      <y>30</y>
      <width>64</width>
      <height>30</height>
     </rect>
    </property>
    <property name="segmentStyle">
     <enum>QLCDNumber::Flat</enum>
    </property>
   </widget>
   <widget class="QPushButton" name="btnExit">
    <property name="geometry">
     <rect>
      <x>240</x>
      <y>110</y>
      <width>221</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>&Exit</string>
    </property>
   </widget>
   <widget class="KLed" name="led9">
    <property name="geometry">
     <rect>
      <x>160</x>
      <y>110</y>
      <width>21</width>
      <height>21</height>
     </rect>
    </property>
    <property name="state">
     <enum>KLed::Off</enum>
    </property>
   </widget>
   <widget class="QPushButton" name="btnHeat">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>110</y>
      <width>99</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>Heat</string>
    </property>
   </widget>
   <widget class="KLed" name="led10">
    <property name="geometry">
     <rect>
      <x>200</x>
      <y>110</y>
      <width>21</width>
      <height>21</height>
     </rect>
    </property>
    <property name="state">
     <enum>KLed::On</enum>
    </property>
    <property name="color">
     <color>
      <red>255</red>
      <green>0</green>
      <blue>0</blue>
     </color>
    </property>
   </widget>
   <widget class="QLabel" name="label_7">
    <property name="geometry">
     <rect>
      <x>250</x>
      <y>73</y>
      <width>111</width>
      <height>16</height>
     </rect>
    </property>
    <property name="text">
     <string>Last Updated @</string>
    </property>
   </widget>
   <widget class="QLabel" name="lblLastUpDate">
    <property name="geometry">
     <rect>
      <x>360</x>
      <y>73</y>
      <width>90</width>
      <height>14</height>
     </rect>
    </property>
    <property name="text">
     <string/>
    </property>
   </widget>
  </widget>
  <zorder>frame_3</zorder>
  <zorder>frame</zorder>
  <zorder>frame_2</zorder>
 </widget>
 <customwidgets>
  <customwidget>
   <class>KLed</class>
   <extends>QWidget</extends>
   <header>kled.h</header>
  </customwidget>
 </customwidgets>
 <tabstops>
  <tabstop>btnFlood</tabstop>
  <tabstop>btnPorch</tabstop>
  <tabstop>btnGame</tabstop>
  <tabstop>btnLiving</tabstop>
  <tabstop>doubleSpinBox</tabstop>
  <tabstop>btnHeat</tabstop>
  <tabstop>btnExit</tabstop>
 </tabstops>
 <resources/>
 <connections>
  <connection>
   <sender>btnExit</sender>
   <signal>clicked()</signal>
   <receiver>Dialog</receiver>
   <slot>close()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>360</x>
     <y>257</y>
    </hint>
    <hint type="destinationlabel">
     <x>245</x>
     <y>150</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>btnFlood</sender>
   <signal>clicked()</signal>
   <receiver>led1</receiver>
   <slot>on()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>99</x>
     <y>51</y>
    </hint>
    <hint type="destinationlabel">
     <x>180</x>
     <y>60</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>btnPorch</sender>
   <signal>clicked()</signal>
   <receiver>led3</receiver>
   <slot>on()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>69</x>
     <y>101</y>
    </hint>
    <hint type="destinationlabel">
     <x>180</x>
     <y>100</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>btnGame</sender>
   <signal>clicked()</signal>
   <receiver>led5</receiver>
   <slot>on()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>320</x>
     <y>61</y>
    </hint>
    <hint type="destinationlabel">
     <x>420</x>
     <y>60</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>btnLiving</sender>
   <signal>clicked()</signal>
   <receiver>led7</receiver>
   <slot>on()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>320</x>
     <y>101</y>
    </hint>
    <hint type="destinationlabel">
     <x>420</x>
     <y>100</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>btnHeat</sender>
   <signal>clicked()</signal>
   <receiver>led9</receiver>
   <slot>on()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>69</x>
     <y>261</y>
    </hint>
    <hint type="destinationlabel">
     <x>180</x>
     <y>260</y>
    </hint>
   </hints>
  </connection>
 </connections>
</ui>
I do all my designing on my x86-64 machine and then transfer it to my pi. I also have the QT Designer on my pi just in case. I also have KDE fully loaded on my pi to for some of the icons and other things that maybe needed.

If you have any questions feel free to ask.

Enjoy. 8-)

jakebpg
Posts: 36
Joined: Tue Sep 04, 2012 9:36 pm

Re: Home-SCADA system

Mon Nov 18, 2013 10:42 pm

bou_ih

It all depends on what you're attempting to do and with what hardware. There are so many different aspects to SCADA programming that without knowing the specifics it would be impossible to give you any advise at all. So please more detail.

User avatar
DougieLawson
Posts: 40225
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Home-SCADA system

Mon Nov 18, 2013 11:30 pm

Have you looked at MQTT. That's an excellent protocol for connecting SCADA devices to a centralised broker which can publish that data on easy to subscribe topics. That means you can easily separate the presentation layer from the data collection layer.

It was invented by Dr Andy Stanford-Clark the IBM'er who wired his house so that it tweets. He has complete control from anywhere in the world. MQTT is becoming the protocol of choice for the "Internet of Things".

http://mqtt.org
http://mosquitto.org

Mosquitto runs on my RPi.
Here's the project I wrote this weekend using python & MQTT
https://www.ibm.com/developerworks/comm ... x_and_gpio
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Return to “Python”