OZ8ET - Viewing Profile: Likes - Netduino Forums
   
Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

OZ8ET

Member Since 16 Dec 2011
Offline Last Active May 16 2015 05:32 AM
-----

#42403 House contyrol project using webserver and OneWire

Posted by OZ8ET on 29 December 2012 - 05:34 PM

My Home automation system  using OneWire and Web management.

My vacation house needs to be controlled for heating to avoid spending too much money on heating.

The control system has 2 states:

  • If the house is “in use”, heating must be on as long as the temperature is below a certain limit (“high-limit”). Furthermore a pump (fresh water) must be on between 06:30 and 22:30.
  • When the house is “Vacant” heating must be on only if temperature drops below a certain limit – “low-limit”. The pump must always be off.

These simple rules give us a couple of control-activators (relays). These are:

  • Relay 1 (R1) – heating on and off
  • Relay 2 (R2)– pump on and off

The rules also include a few control-indicators (Values). These are:

  • Current state (LED) –indicates if the house is “In Use” or “Vacant”
  • Temperature (TMP) – current temperature value (a measured value)
  • Low-Limit (LL) – a temperature value (a variable)
  • High-Limit (LH) – a temperature value (a variable)
  • Current time (NOW) – the time from the real-time clock
  • Pump-on (PON) – the time for pump to be switched on when “in use”
  • Pump off (POF) the time for the pump to be switched off when “in use”

In a generic forM, the rules can be set up as following:

R1 = (LED AND (TMP<=LH)) OR ((NOT LED) AND (Temp <=LL))
R2 = LED AND (NOW >=PON) AND (NOW < POF)

These rules are my “Engine” and the engine has to be run whenever en event occurs.

These events are:

  • Time change (minute interval) – from Real Time Clock
  • Temperature change (I chose 15 sec interval) from OneWire device
  • A threshold value change
  • Low Limit (LL) via the user interface (web or console)
  • High Limit (LH) via the user interface (web or console)
  • Pump-on (PON) via the user interface (web or console)
  • Pump-off (POF)  via the user interface (web or console)

From this we can see, that the “Engine” has to run whenever a time-interval of 15 sec or when a threshold change via the user interface (web or console).

Having defined the Engine, we have 2 more challenges:

  • The console: a minimal display showing the current status and a few buttons to change the threshold values.
  • The web server: a way to display the status and change the threshold values via a web browser.

The console is implemented with a display with 4 lines 20 char. Each and a 5-way button that gives me the following indications: Up, Down, Left, Right, Select.

The web server only needs to give one page. This page is a json structure with all the threshold variables  and information about connected OneWire devices and their values (temperature a.o.).

The main web page can reside on another server, but is also available in a simple form from the web server in the house automation controller.

Required changes to the threshold values, can be send as arguments with the json-request and thus be communicated to the “engine”.

The advantages of this setup are many:

  • The data on the web-page can be change without making a page request and there for looks more smooth.
  • The json request can be made from another  web server on an interval in order to collect information for later use in statistic and graphical presentations.
  • It is simple to implement, and the design of the page(s) can be changed when required without making changes to the house-controller hardware/software

Hardware design

This project has several generations behind. The following platforms has been developed and tested:

  • Single chip web-controller DK40 with one relay to control heating.
  • MSP400 based microcontroller from Olimex programmed in C++. Nice hardware but hard to program.
  • Netduino Plus with homemade Shield for display, key-control and relays.
  • Rapberry Pi with Linux and OneWire file system – easy to program – never completed the hardware required
  • Netduino Plus 2 – same hardware shields. This is the current implementation.

Netduino Plus 2:

Dot Net Micro Framwork (NETMF) with version 4.2 . Easy to program using Microsoft Visual Studio.

Homeautomation Shield:

The shield has the following facilities:

  • Connector for OneWire
  • 2 Relays with each 2 switches – Connectors
  • 4x20 LCD display
  • 5-way switch
  • Reset button
  • 2 Led’s showing Relay status.

Software design:

  • Engine
    • Main Engine logic
    • OneWire Engine
    • Engine related Web requester
  • Console
    • LCD driver
    • Keypad driver
    • Console logic/loop
  • Network
    • Http server
    • Ftp server
    • Name service
    • NTP server
  • Utilities
    • Extensions
    • Log system
    • Configuration management
  • Main
    • Initialization and main loop.

Production:

The shield was designed using Target 3001! V15 discover software for Schematic and PCB layout.

The PCB was manufactured as a prototype at Olimex.com.

Software written in Visual Studio 2010 using C#.

This version of the system has been in operation since early 2012. First using Netduino Plus FW 4.1 with CW2’s OneWire extension. After the arrival of Netduino Plus 2, the system is converted to the new platform using FW 4.2 and the build in OneWire Software.

 

 

Feel free to contact me for details.

Regards

Erik




#42381 OneWire ALPHA

Posted by OZ8ET on 29 December 2012 - 06:32 AM

Has OneWire on 4.2 been skiped as a result of the comming of NetduiinoPlus 2???

I still have a bunch of old NetduinoPlus waiting for 4.2 upgrade with OneWire.

What is the status?




#25959 Still learning, internet way to grab date and time on startup

Posted by OZ8ET on 25 March 2012 - 10:00 AM

Hi!

This morning we changed to Daylight Saving Time in EU.
Rather than using DateTime.Now to display date and time, I use DST which comes from this function:

		public static DateTime DST  
		{ 
			get 
			{
				DateTime dt = DateTime.Now;
				if (dt.Month < 3 || dt.Month > 10) return DateTime.Now;
				if (dt.Month > 3 && dt.Month < 10) return DateTime.Now.AddHours(1);
				if (dt.Month == 3)
				{	//	in march
					if ((dt.Day - (int)dt.DayOfWeek) < 25) return DateTime.Now;
					if (((int)dt.DayOfWeek == 0) && (dt.Hour < 2)) return DateTime.Now;
					return DateTime.Now.AddHours(1);
				}	//	in october
				if ((dt.Day - (int)dt.DayOfWeek) < 25) return DateTime.Now.AddHours(1);
				if (((int)dt.DayOfWeek == 0) && (dt.Hour < 2)) return DateTime.Now.AddHours(1);
				return DateTime.Now; 
			} 
		}
By the way - I use the SNTP to set the time.

Regards

OZ8ET


home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.