Difference between revisions of "Preet's Relay Controller Project"

From Embedded Systems Learning Academy
Jump to: navigation, search
Line 4: Line 4:
  
 
== Overview ==
 
== Overview ==
The motivation of this project is to control a re-usable relay board over the network (or even over the internet).
+
The motivation of this project is to control a relay board over the network (or even over the internet).  More specifically, this project is an application of the relay control in the form of a sprinkler control system (SCS).  Overall, the following functionality is targeted:
 +
*  Schedule a run-time
 +
*  Select days to water
 +
*  Select run-times of each sprinkler
 +
*  Turn System On or Off
 +
*  Set 'Rainy days' when the system skips its scheduled run.
 +
 
 +
The extended functionality is the Web GUI*.  The Web interface (WI) not only allows to control SCS, but also view the logs in a graphical way.  For example, WI can request daily water-times from the SCS and plot a bar-graph to show the user the water history.
  
  
Line 10: Line 17:
 
== Features ==
 
== Features ==
 
=== Web-based Controls ===
 
=== Web-based Controls ===
The relay controller exposes its interface over a TCP/IP connection.  It provides a simple, human readable command-line interface.  This command-line interface is encapsulated in a web GUI* that provides an even simpler interface to an end-user.  The idea is that a person without any knowledge of the controller should be able to interact with the system.
+
SCS exposes its interface over a TCP/IP connection.  It provides a simple, human readable command-line interface.  This command-line interface is encapsulated in the WI that provides an even simpler interface to an end-user.  The idea is that a person without any knowledge of the controller should be able to interact with the system.
  
 
=== Logs ===
 
=== Logs ===
There are several forms of logs that get saved in the file system accessible by FAT* library.  The controller software saves the log in the on-board 1Mb SPI flash memory.  This provides capability to save data without relying on an external SD card.
+
There are several forms of logs that get saved in the file system accessible by FAT* library.  The SCS software saves the log in the on-board 1Mb SPI flash memory.  This provides capability to save data without relying on an external SD card.
  
 
==== Hourly Sensor Logs ====
 
==== Hourly Sensor Logs ====
Line 23: Line 30:
 
</code>
 
</code>
  
==== Nightly Relay Logs ====
+
==== Nightly Logs ====
Every night, a log message saves the number of minutes the relays were ON in a 24-hour period.
+
Every night, a log message saves the number of minutes SCS turned on relays in a 24-hour period.  This serves as a daily log of the number of minutes of plants were watered.
  
 
==== Debugging Logs ====
 
==== Debugging Logs ====
Line 33: Line 40:
 
== Implementation ==
 
== Implementation ==
 
=== Hardware ===
 
=== Hardware ===
In the hardware level, SJ-One Board is used with an RN-XV Wifi module. The wifi module is a simple UART based TCP/IP solution.  The software initializes the wifi module, sets up a TCP/IP port to listen to, and simply waits for data or command from UART and responds back to the command.
+
In the hardware level, the following components form SCS:
 +
SJ-One Board
 +
RN-XV Wifi module
 +
* Relays attached to GPIOs
 +
 
 +
The wifi module is a simple UART based TCP/IP solution.  The SCS software initializes RN-XV, sets up a TCP/IP port to listen to, and simply waits for data or command from UART and responds back to the command.
  
 
=== Embedded Software ===
 
=== Embedded Software ===
 
FreeRTOS template project was used to provide the software framework.  This software framework was extended by adding more command-line handlers.
 
FreeRTOS template project was used to provide the software framework.  This software framework was extended by adding more command-line handlers.
  
=== Front-End Web ===
+
=== Front-End Web Interface ===
While the relay controller software can interact with a command-line interface, a web page encapsulates command with simple buttons.  This provides a non-technical person the capability to control the system.
+
While the SCS software can interact with a command-line interface, WI encapsulates commands with simple buttons.  This provides a non-technical person the capability to control the system.
  
  

Revision as of 00:40, 20 September 2012

This article is under construction. You may have found it because you're lucky but it's not linked anywhere, and is not complete.

Overview

The motivation of this project is to control a relay board over the network (or even over the internet). More specifically, this project is an application of the relay control in the form of a sprinkler control system (SCS). Overall, the following functionality is targeted:

  • Schedule a run-time
  • Select days to water
  • Select run-times of each sprinkler
  • Turn System On or Off
  • Set 'Rainy days' when the system skips its scheduled run.

The extended functionality is the Web GUI*. The Web interface (WI) not only allows to control SCS, but also view the logs in a graphical way. For example, WI can request daily water-times from the SCS and plot a bar-graph to show the user the water history.



Features

Web-based Controls

SCS exposes its interface over a TCP/IP connection. It provides a simple, human readable command-line interface. This command-line interface is encapsulated in the WI that provides an even simpler interface to an end-user. The idea is that a person without any knowledge of the controller should be able to interact with the system.

Logs

There are several forms of logs that get saved in the file system accessible by FAT* library. The SCS software saves the log in the on-board 1Mb SPI flash memory. This provides capability to save data without relying on an external SD card.

Hourly Sensor Logs

Every hour, temperature and light sensor value is logged into a file in the format:
Timestamp, Temperature in Fahrenheit, Light Percent
9/16/2014, 76.25, 10

Nightly Logs

Every night, a log message saves the number of minutes SCS turned on relays in a 24-hour period. This serves as a daily log of the number of minutes of plants were watered.

Debugging Logs

Debugging and informational logs also get saved on demand or if the log-buffer becomes full. This can open the gate for long-term testing and debugging to ensure that the board is operating as expected.



Implementation

Hardware

In the hardware level, the following components form SCS:

  • SJ-One Board
  • RN-XV Wifi module
  • Relays attached to GPIOs

The wifi module is a simple UART based TCP/IP solution. The SCS software initializes RN-XV, sets up a TCP/IP port to listen to, and simply waits for data or command from UART and responds back to the command.

Embedded Software

FreeRTOS template project was used to provide the software framework. This software framework was extended by adding more command-line handlers.

Front-End Web Interface

While the SCS software can interact with a command-line interface, WI encapsulates commands with simple buttons. This provides a non-technical person the capability to control the system.



Testing

The testing was performed manually by verifying the command and expected output. The steps were:

  • Program the software
  • Test each command through UART interface
  • Test each command through Wifi interface



Conclusion

A very low powered relay system was developed that has capability to be controlled over the Internet. This solution is a completely encapsulated system that can be controlled by a USB/UART interface, or over a TCP/IP interface.