I went out an bought a bigger breadboard today so that I could prototype everything to make sure that it will all work together. The breadboards I have are small so a big one will be nice to have. I took some time to wire everything using wire that is cut to length so the result is a nice and neat and fairly secure breadboard. Check it out!
The light switch is not included in the picture above but it should be fairly easy to implement with an optocoupler or something attached to an Arduino pin.
The PCB is still a work in progress but it is getting close to being ready to submit to OSH Park. It has a place for the Arduino Micro, the level converter, an EEPROM if I end up needing one, the header for the router connection and a place for the iPod connector. I have also broken out many of the unused pins into headers with available 5v and GND rails next to the I/O or analog pins. If you notice anything wrong with the board or schematic please let me know!
There are a few applications or packages that I installed on the router to be able to set the serial speed and make text editing simpler. The default text editor on the version of OpenWrt I installed was vi which is somewhat not user-friendly and so I installed nano. I also installed stty and setserial and all of their dependencies. I did this manually where I basically downloaded the packages file along with the packages that I wanted to install to my computer and uploaded them to the /tmp folder on my router, ssh'ed into the router and ran opkg on the packages to install them. Change the serial speed with a command like this:
stty –F /dev/ttyS1 raw speed 9600
The problem is that each time the router is reset/ looses power this command is reset and must be executed again. To resolve tis we can add these commands to a start up script so that they are executed every time the router restarts.
The following sites were helpful:
I am using a WRT54g router which conveniently has two serial ports which are accessible through the 2x5 header footprint on the router PCB.
Not so conveniently it runs at 3.3v so I needed a level converter to interface it with my 5v Arduino Micro. One of the first things that I did was install OpenWrt and learn some basic Java scripting/ HTML. I don't know much about either but the power of Google is a great tool. I am using Dashcode to build the interface but may end up writing my own code or using an open library so that I can share that code. I had some difficulty working out how the linking worked with the project files but I finally got a web page to turn on and off an L.E.D. on the router. This was accomplished with AJAX which calls a small shell script that echos a 1, on, or a 0, off, into the special file that defines the L.E.D. state. The following will turn off the DMZ L.E.D-
echo 0 > /proc/diag/led/dmz
and alternatively on-
echo 1 > /proc/diag/led/dmz
The following sites were helpful and my code is copied or based off of theirs:
- http://www.instructables.com/id/Home-automation-server-with-router/?ALLSTEPS (Attribution Non-commercial Share Alike) (used the uhttpd server configuration on this page)