Inspired by the MAKEZINE guys I was getting more and more interested in the Open Source ARDUINO project. I was Especially interested in the SNAIL MAIL PUSH ALERT notification, previously presented by MATT RICHARDSON.
So I ended up with the idea of doing some kind of home office notification stuff. I wanted to get iPhone notifications if mail had been delivered to my office in-tray:
It works like that:
It works like that:
- mail is delivered to in-tray
- sensor connected to Arduino is detecting this action
- Arduino send’s http request to webserver
- Webserver queries PHP script / PROWL API
- Prowl is forwarding the notification to my iPhone
1 Basic Setup:
First of all I had to answer the question, which sensor type should be best, because obviously a snap action switch wouldn’t work for an in-tray. Also PIR sensors aren’t very useful – they just detect motion. LDR’s have the disadvantage of reacting to ambient light. Finally I ended up with integrated reflective sensors, in detail I choose the APDS-9103. They work on basis of an infrared LED and a photo transistor, both placed in the same housing. As soon as a reflective surface is placed to it within a 10mm range they react. This sensor type is typically used in copy machines or printers. During my testings the sensor worked perfectly. Furthermore you can get it for just about 1 Euro.
Secondly I needed a webserver, because the Arduino itself isn’t capable of doing ssl encryption, which is required by the Prowl API. I decided to choose the MAMP software, it comes along with the webserver itself, but furthermore MySQL and PHP is already included.
Thirdly I ordered the ARDUINO UNO with the ethernet shield.
Fourthly I obtained a few additional components:
- an in-tray to work on
- a 10k resistor for the photo transistor
- resistors (10k, 270) for the infrared LED
- some wires
- a housing for the Arduino
- a circuit board
- an angled piece of plastic
2 Hardware installation:
In-tray: it’s simple: drill a whole into the middle part of the in-tray, about 10mm in diameter. Glue the angled piece of plastic to the bottom of the in-tray, nearby the drilled whole. Glue the sensor to the angled piece of plastic. Solder the wires to the sensor to cover the distance towards the Ardunino. Cover the bare pieces with tape, better is heat shrink tubing. Install the wires towards the Arduino.
Arduino: You could do the wiring stuff with a breadboard or directly on the Arduino connectors. I decided to setup a permanent housing with a circuit board for future extensions. Place the etehrnet shield on top of the Arduino an connect it via RJ45 to the network.
That’s all that need’s to be done in terms of hardware.
3. Webserver Installation
Of course there are many webservers out there. For Greenhorns like me, the Mamp Server has all I need and is easy to install.
4. Prowl API
First of all you need to subscribe for a PROWL ACCOUNT. It’s for free. Download the PROWL API and follow the setup instructions. I decided to use the port 8888 within my internal network. Adapt the directory path, matching to your setup.
5 Arduino Configuration
I can provide the code sketch via eMAIL. Don’t get confused – it contains another code piece for detection activity of my network attached storage (NAS) device. What does the code for the Mail part do!? It measures a series of multiple values of the sensor input. If more than a definable amount of values are above the threshold a variable will be set to active. That’s just to be sure that not just a glitch will set the sensor active. Further more the Arduino code will just react for status changes from 0 to 1 from one period to the following one. If this is the case, the http request will be sent.
6 iPhone Setup
You just need to download the Prowl App from the App Store and enter your account details. That’s it.
If you got questions, simply shoot me a mail: spinout@freenet.de