Monday, July 30, 2012

Moving code to github

It has been a bit of a slow process, but I am in the middle of trying to move everything to github.com
I have been taking too many breaks to update apps and incorporate my various devices so I can easily share the code and make changes no matter what device I have, Phone/Tablet/Laptop/Desktop.

I only have one of my Arduino Sketches online (DAX10Gateway) and it hasn't had much activity. I have been working on my home Android needs instead and you can see that by the rest of the projects that are on github.

I hope to be following up with more Arduino projects soon. Android only gets me so far and I will need to interact with the real world again....The project list is getting larger, time is ALWAYS the issue....Until then....

Saturday, April 28, 2012

DAX10 Motion Sensor Is Working

I have upgraded my Motion Sensor Client to be Ethernet based as opposed to being hard wired to the DAX10Gateway Controller. It really didn't take much at all. I had all the motion code already figured out. I just had to strip the LCD code since they overlapped in I/O pins. I may add it back in, but through a breadboard so I can route a few of the pins differently.

I used the Ethernet example for the Web Client to confirm I could issue requests to the DAX10Gateway over the Ethernet. This proved relatively easy. I then found my Motion test sketch I had previously made to proof out the PIR sensor functionality. As I mentioned earlier, this also had some LCD proof code but that was easily stripped out. I have posted my sketch to my box.net account for download.

The Web Client code was barely modified from the example. I pretty much just merged it in between the motion code and made the client requests where the motion code used to toggle an output pin.

Next Steps: I want to embed a serial command line processor to allow programming the sensor. I would like the Server IP and delay to be configurable

Sunday, January 29, 2012

Fun with Sensors

I have been playing with my Arduinos a lot more lately. I have mostly been experimenting with sensors making sure I am getting a fairly good handle on the various types of inputs/outputs and how to use them.

I started with just simple buttons, LEDs and a couple capacitive touch sensors. The digital (Buttons/LED) were easy and straight-forward for me. I was able to find a simple wiring example for the capacitive touch sensor which made it simple as well. After experimenting/playing with various configurations, I had an "LED Bar" lighting up based on the amount of pressure I provided.

I now have 3 different arduinos(Arduino Uno, Arduino Ethernet and Arduino Duemilanova) running different sketches on my desk. The Uno is running one of my random sketches for buttons, LEDs, capacitive touch and one of my X10 door/window sensors. In addition to all those inputs/outputs, I connected a CD4017BE IC (Decade Counter - Basically a Sequencer 1-10) which is sequencing through 10 LEDs based on a clock cycle that occurs every loop cycle in the sketch. The lights are flashing really fast.

The other two arduinos are now working together connected through a digital output => input. I am using the Duemilanova to read a PIR (IR motion) sensor and translate that into a digital output. Essentially, I am using the Duemilanova as a timing IC (don't currently have any of these). That digital output from the Duemilanova is  connected to an input on the third arduino, the Ethernet, which is running my Home Automation, DAX10Gateway, sketch. I tweaked it to read the input from the Duemilanova and send an X10 command to turn the light on/off over my desk in the basement. With the 5 minute timer, it seems to keep the light on as long as I am in my desk/office area. I have also confirmed, using shorter timeouts, that the light will go off automatically when there is no motion. There is about a 7-9 ft range on the sensor and with how the desk is laid out and where the sensor is hung, you pretty much have to be at my desk for it to trigger the light.

My next steps will be to expand this to multiple PIR sensors so I can control all the areas, already set up with X10 control, automatically based on movement.

Saturday, November 5, 2011

DAX10Gateway Minor Update

Well it has been a long time since I have written any Arduino code. I took a new job and we moved to Saint Paul. Once we got situated a bit, I got a chance to get my X10 hardware in place and resurrected my DAX10Gateway sketch. After an avr-gcc compiler update that screwed my Ubuntu 11.10 from reliably using the Ethernet library, I had to build up another box with Ubuntu 11.04. It seems to be functional with the Ethernet library and is what I am using now to upload any Arduino sketches.

I decided it was time to look at the code more in depth and see how difficult it was going to be to add dimmer functionality. I couldn't really remember how I had written the code so I was a bit nervous. Once I got it open though, I found my memory came flooding back to me. I immediately remembered how I processed the command, found the location and copied/pasted about 5 or 6 lines of code, changed two characters and saved it. The gateway now supported sending a Bright or Dim command to the X10 Firecracker.

I also got my Android client up and running on my phone and tablet recently to enjoy the DAX10Gateway. The gateway really is no good without a client to send commands through it and the browser doesn't really do for a client. I updated my Android client today as well to support the Bright/Dim functionality to make sure I was getting the full potential now. I have been enjoying being able to control my living room lights as it has worked until today, but not having the Dimmer functionality was annoying. I almost never want those lights on all the way now that I have the option and not supporting it from the client felt limiting.

I have uploaded my new version of the DAX10Gateway to my box.net account. You can download the file here. I am hoping to expand on the Dimmer functionality. Maybe add another parameter that defines how many dim/bright commands to chain together. I am going to play with a few ideas between the client and the Arduino and will hopefully have a good solution sooner rather than later.

Until then....

Saturday, March 19, 2011

It's Spring Already!

I wish this was a project update, but just a post to prove I haven't abandoned these projects, I just haven't had the time.


Tuesday, January 25, 2011

DAX10Gateway Development is complete for the 1.0 Release

I have achieved my first major milestone and am not only posting here about my Arduino Hardware/Code adventure but also here on my Android Project Blog. I have a Simple Android Client that I am using to control my house through the Arduino.

I used the base Ethernet Library to use 2 webservers, one on Port 80 and the other on 8080.
The different ports are for the different intended clients. 80 is for Android and 8080 for web browsers. As the HTTP request comes in, the Arduino processes the characters inline and evaluates the request into the necessary parameters for X10. When the HTTP request has completed, the X10 command is sent to the CM17A firecracker device or Ignored if unsuccessfully parsed.

There isn't much to the request and it is only accessible over my local LAN since it is so very simple. It is good for quick processing, but not good for security. I am hoping to add a little bit of code to at least attempt to hide the request so I can feel better about exposing this to the internet and being confident nobody else will want to put in the effort to control my lights and maybe a few computers/printers/TVs.

I have tested everything from a web browser, Chrome, and through a Simple Android Client I have posted on my Android blog.

Below is the final sketch for preview(.txt file) or download(.pde) as well as the X10Firecracker.h/.cpp library files I used to interface with the CM17A.

Thursday, January 20, 2011

X10 Integration off to a Great Start

My X10 CM17A(Firecracker - "Wireless Computer Interface") Serial to RF Transmitter arrived today. I was pretty excited when I got home, grabbed the mail and saw there was a little package in there. I immediately checked the name to ensure it wasn't the wife's package, but luckily it had my name.

As soon as dinner was done, play time with the kids was exhausted and they went to bed, I was able to sit down and start connecting the Firecracker device to see how it all worked. I first hooked it up to my computer's serial port and downloaded bottlerocket through Ubuntu's Package Manager. I found a quick tutorial online about using bottlerocket and I started sending commands through the terminal and was able to successfully control the transceiver with on and off commands.

Next I grabbed the X10Firecracker example sketch within the Arduino IDE, stripped out most of the code, added a couple lines to cause the commands to toggle between on/off every 10 seconds. Initially I had some issues getting the Firecracker wired to the Arduino, but eventually I found a comment on one of the sites how the Firecracker's ground wire assignment was wrong and everybody was propagating the same error through all their posts. Eventually I got the wires put together correctly and was able to get a lamp to toggle on and off by my modified example sketch.

Finally, I opened one of my serial sketches that was a command line parser. I added in the command to be managed based on the Serial Commands I sent and was able to control the lamp now through my PCs serial terminal.

I believe I am at the point where I am ready to start integrating the webserver functionality in. I will probably do this in stages. I am already thinking about two baselines. I will use some of the webduino code for a quick a simple interface but I don't think the interface really suits my functionality. I will also start building one from scratch using the base Ethernet library. I have been down a few paths with this technique, but I am sticking to it as I think it provides me the best method for providing a clean interface for the desired functionality. Either way, I will have to resolve my loop issues.

As soon as I can control it through the Ethernet interface I will post some more code and maybe even some pictures of my configuration. Hopefully I will be able to figure out my Ethernet interface before the rest of my hardware arrives. I would love to be able to just plug in a bunch more hardware, update my configurations and be controlling multiple devices over my local LAN.

As a side note, I also stumbled upon an old Bluetooth dongle that I had for an old MS Keyboard and Mouse that broke years ago but the dongle still works. I downloaded the wiimote drivers, white board app and a couple other miscellaneous apps and toyed with my wiimote as my PC mouse. I may have to build myself some custom IR devices to see what I can get out of that wiimote.