1 minute read

How to Control a Relay from a Web Page

Next Article
Index

Index

128 Hacking Electronics

Shield Description URL

Motor Ardumoto shield. Dual H-bridge bidirectional motor control at up to 2A per channel. www.sparkfun.com/products/9815

Ethernet Ethernet and SD card shield. http://arduino.cc/en/Main/ArduinoEthernetShield Relay Controls four relays. Screw terminals for relay contacts. www.robotshop.com/seeedstudio-arduino-relay-shield.html LCD 16 × 2 character alphanumeric LCD shield with joystick. www.freetronics.com/products/lcd-keypad-shield

TABLE 6-1 Some Commonly Used Shields

The web site http://shieldlist.org/ will tell you which pins are used by any particular shield.

There are shields available for almost anything you could want an Arduino to do. They range from relay control to LED displays and audio file players.

Most of these are designed with the Arduino Uno in mind, but are also usually compatible with the bigger Arduino Mega and the new Arduino Leonardo.

For an encyclopedic list, that includes useful technical details about the pin usage of these shields, it can be found at http://shieldlist.org/.

Some of the author’s favorite shields are listed in Table 6-1.

How to Control a Relay from a Web Page

By using an Ethernet Shield and connecting it to your home hub, you can turn your Arduino into a tiny web server. Since it is still an Arduino, you can still attach electronics to it. So, by using the hacked toy we made in the section “How to Hack a Toy for Arduino Control” and a web interface on the Arduino, we can control our toy over our local network, or if we open up our firewall from the Internet!

Figure 6-25 shows the toy attached to the shield and Arduino along with the browser interface that we will use to control it—first on our computer (Figure 6-25b) and then from a smartphone (Figure 6-25c).

This article is from: