Last Updated on 2015-03-20.
Scenario
If you are using an IP Intercom like 2N Helios IP or a similar Mobotix product, you might have seen that the variety of IP compatible sound modules for a simple internal doorbell is quite low. But something like this is necessary for many homes, as SIP / VoIP smartphone apps can be unreliable.
Some IP doorbells offer a hardware relais to do it the old-school way and lay wires between doorbell / sound module and intercom, but this should not be the solution for a modern intercom system in my opinion.
Solution approach
In this tutorial, I will show you how to create a sound module which can be controlled via HTTP request commands.
The Arduino Ethernet Board is a good way to achieve this, because
- there are Power over Ethernet compatible versions, or you can extend it yourself with a PoE module
- low power consumption
- reliable device
- simple coding
Although it seems a bit expensive just for usage as sound module, note you can use this piece of hardware for many other scenarios, so this money is not wasted 🙂
This is what you need:
- Arduino Ethernet Rev3 WITH PoE (A000074) (or similar / successor), preferably with PoE
- USB 2 Serial Converter (USB Mini) (A000059) (for simple connection to PC for code upload)
- Small speaker, e.g. from an old PC
- Some other accessories like Mini USB cable, RJ45 LAN cable, some short wires
Download the Arduino IDE from here and install it.
Read the Getting Started tutorial and connect your board via USB (do not forget to set the right serial port).
Within the Arduino software, use this code to create a webserver which can start the sound output:
#include <SPI.h> #include <Ethernet.h> bool soundoutputPending = false; String httprequest = ""; byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEB }; IPAddress ip(10, 1, 0, 84); EthernetServer server(80); void setup() { Ethernet.begin(mac, ip); server.begin(); } void loop() { EthernetClient client = server.available(); if (client) { boolean currentLineIsBlank = true; while (client.connected()) { if (client.available()) { char c = client.read(); httprequest += c; if (c == '\n' && currentLineIsBlank) { client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: close"); client.println(); client.println("<!DOCTYPE HTML>"); client.println("<html>"); client.println("<body>"); client.println(httprequest); client.println("</body>"); client.println("</html>"); if (httprequest.indexOf("soundOutput") > -1) soundoutputPending = true; httprequest = ""; break; } if (c == '\n') { currentLineIsBlank = true; } else if (c != '\r') { currentLineIsBlank = false; } } } delay(1); client.stop(); } if (soundoutputPending) { sound(); soundoutputPending = false; } } void sound() { tone(9, 200, 200); delay(300); tone(9, 300, 200); delay(300); tone(9, 400, 200); delay(300); tone(9, 500, 200); delay(300); tone(9, 600, 200); delay(300); tone(9, 800, 500); delay(300); }
Connect the speaker’s black wire to a ground pin and the red one to Pin 9. You can also use another pin number in the sound() function, but I experienced some distortion noise e.g. on 10 and 11.
Adujst e.g. IP or port settings for your needs, then upload the script to your Arduino.
To test it, open your browser and type http://[yourIp]:[yourPort]/soundOutput, e.g.: http://10.1.0.84/soundOutput
Hi, Nice to meet you.
My name is Eric Jung, at WIZnet in Korea.
We have been searching some application references in which WIZnet solution is applied, and found your project “PoE LAN Intercom doorbell sound module(https://www.dxsdata.com/2015/03/poe-lan-intercom-doorbell-sound-module)” using Ethernet Shield. In the Ethernet Shield, WIZnet’s W5100 chip is embedded. Your development looks very cool & smart.
Recently we opened WIZnet Museum (http://wiznetmuseum.com) that includes a academic-purposed collection of open projects, tutorials, articles and etc from our global customers.
As long as we have your permission, we would like to introduce your project on this website.
Hopefully, we would like to keep in touch with you for the further friendship.
Thank you very much.
Regards,
Eric.