Home :: News archive

News Archive

29/05/2013
WiFi Controlled Relays

This article extends the previous tutorial on Bluetooth Controlled Relays, instead using WiFi to talk to our popular KTA-223 Relayduino board. Using this arrangement allows us to overcome some limitations of the previous tutorial, namely:

Cross Platform. The previous tutorial was limited to users with an Android smartphone; this article adds support for any device with a web browser.

Internet Connectivity. You don’t have to be within Bluetooth range of the KTA-223, this example gives you control from any device connected to the Internet.

Automatic Reconnection. The WiFi module is configured within software so that it will automatically reconnect to any Access Point that it has information for.

Relay Statuses (and other I/O). The Bluetooth example gives no way of checking to see if a command was successful in switching a relay. This tutorial displays the status of the 8 relays, 3 analogue inputs, and 4 digital inputs on a webpage, allowing you to monitor all of the I/O on the KTA-223.

Things You'll Need:

Hardware Setup:

  1. Solder one set of the Arduino stackable headers onto the KTA-223 Relayduino, and the other onto the WiFly Shield
  2. Install the auto-reset jumper inside the KTA-223
  3. Stack the WiFly Shield onto the KTA-223
  4. Attach the antenna
  5. Plug in the USB cable, and apply power


Software Setup:

  1. Download and install the latest version of the Arduino IDE (Windows, Mac, Linux)
  2. Download this WiFly Library. Place the files in the libraries folder of your Arduino installation.
  3. Download our custom KTA-223 sketch

Fly by Wire(less)

Launch the Arduino IDE and open the custom firmware you have downloaded. Update credentials.h with the SSID (WiFi name) and Passphrase (security key) of your access point.

Ensure tools->board is set to Arduino Duemilanove w/ ATmega328, and tools->serial port is on the correct port. Click upload to flash the sketch to the Relayduino. Open the serial monitor (tools->serial monitor). You should see the IP address display.


Point the web browser of your computer, laptop, smartphone, smart TV, gaming console, etc to this IP address. The webpage shows the status of the relays, analogue inputs, and digital inputs. The relays can be manually controlled by manipulating the provided radio buttons and pressing "submit".


Screenshots of the webpage displayed on a PC (left) and smartphone (right)

With appropriate port forwarding, the webpage could be accessed by any device connected to the internet. This would allow you to monitor/alter the I/O of the KTA-223 from anywhere in the world!

Note: the provided Arduino sketch is designed as a learning tool, and should get you up and running. Once the basics have been grasped, we encourage you alter this sketch to suit your particular application.

Stay tuned for more updates by subscribing to our News RSS and our New Products RSS using your favourite RSS reader.

-BS



Categories