Blog Navigation
Partners
Latest Activity
Phil gives the source code for implementing a MySQL singleton class in both PHP and Python.
Posted on: May 26th, 2011 by Famous Phil
On August 30, 2009, I made a blog post about my x10 home automation system, but I didn’t really cover it in depth enough to satisfy myself. Therefore, I decided to revisit the topic from that blog (which is here). This blog contains a video detailing the system that I ended up with during my University experience. I expect that my future home will be much more automated than this video shows. In order to appreciate the video, I decided to write some content to supplement what I talk about in the video, which is below.
In 2009, I came up with the first version of my light control system. This consisted of a clapper, a set of cheap computer speakers, and an audio recording of my clapping. My original system used a web interface to have the speakers (connected to the web server / site) clap when I wanted the lights to come on. This quickly became unmanageable since I couldn’t monitor the states of the lights without a webcam monitoring my room (and I wasn’t thrilled about securing a webcam in my room that could be hacked into). This lead into X10 which has done wonders for me over the course of the past two years.
Its funny remembering back to when I first got an x10 system, because the x10 website doesn’t look like your average store, it looks more like an adult site with lots of flashy banners (ha ha). I do have to admit, with x10, the initial impression was very deceiving for me, since their products are really good! Anyways, moving on, My x10 system consists of a USB transceiver module (CM15A located here) which connects to my windows server that runs a WAMP (Windows, Apache, MySQL, PHP). In addition, I have several lamp modules, appliance modules, and remote control wall switches (which wirelessly communicate to the CM15A).
As for the software, I installed the ActiveHome software onto my server (that came with the CM15A). This software installs a few application libraries (dlls) which enabled programmatic access to the CM15A to send and receive x10 commands over the power lines ran in my apartment. Using this api, I wrote a quick program that makes a command line based program that can run certain commands. I have to note that ActiveHome includes a default command line executable, but this didn’t have all the functionality that I wanted, most notably output in HTML for my web interface. With the executable I wrote, I simply have the apache web server run the command as a local user which sends the x10 signals over the power lines ran in my apartment. I should note that I considered using ASP.net which could interface with the API directly, but at the time I wasn’t very familiar with ASP.net and I wanted to use PHP. I didn’t use IIS because I didn’t have the time to go permissions hunting to figure out why PHP wasn’t allowed to run programs as a local user on the web server through IIS. Luckily a standard WAMP install that included Apache and PHP worked out of the box with little configuration. The WAMP that I used was Vertrigo.
For the IR receiver that controls my projector, I use a USB-UIRT that I found on Ebay (I didn’t feel like waiting the estimated 6 weeks at the time for a new one). Fortunately, the executable program that was included could send and receive signals from the USB-UIRT that I required, so I wrote some PHP that invokes it for the commands I used.
In 2009, I mentioned that voice control would make its way into my system. I have to admit that it did! Unfortunately, it didn’t last long because of all the bugs that I ran into. I used the Microsoft speech libraries with a program called SmartButler, which could listen for speech commands and run commands on my server. I initially used a cheap computer microphone, but quickly found that the interference in the audio made commands very inaccurate, and furthermore, if I held a conversation in the room, my lights would act up! I figured that a USB professional Condenser Microphone would fix the problem, so I quickly ordered one and integrated it into my system. This did significantly improve the quality of my system, but normal conversations would still occasionally trigger some of my web control panel controls inaccurately. The final straw that broke the camel’s back (and caused this system to get removed) was when my RA (resident advisor), Stephanie came into the room, said hello to me and my lights went out of control (since I didn’t train it for a higher pitched, female voice, I’d assume). I’d like to approach this problem in the future when I get the time to do it properly, but until then, I’ve been satisfied with web control panels that both my smartphone and computer can access.
Finally, at the very end of my video, I took a moment to show my Linksys PAP Adapter (VoIP, Voice over IP). This works through a service from voip.ms. Voip.ms is a prepaid service for VoIP adapters that allows you to buy a phone number for a very reasonable price (even 800 numbers). They also have really reasonable rates and really good control for those phone numbers. I thought I’d provide a plug for them since they are really good.
I would like to add that the Linksys adapter required an unfirewalled IP address to work properly (for incoming calls) in my experience. It does have a NAT mode for this situation, but the university firewall constantly crushed this mode. To get around this problem (and allow my web server for x10 to work properly), I implemented OpenVPN on my network and pulled in several public IP addresses and left them unfirewalled. This solution worked well for me at UB, and I documented it fairly well in my OpenVPN post.
With nothing more to mention on the topic, here is the video that details my light control system and some other stuff.
Of course, I made many bloopers in this video (I improvised a lot!), so I thought the bloopers video would be appropriate. Warning, there is a little language in it and the audio isn’t exactly balanced.
Disclaimer: I was not paid to endorse any of the products above (and I’m never paid to do that!). I like to think that when I make a recommendation, it carries a lot of weight with it, which it should!
Tags: apache, home automation, light control, linksys, php, smartbutler, usb-uirt, Voice Control, voip, wamp, x10, youtube
Posted in Hosting / Server Administration, Mobile Technology, My Site, Personal, Programming, Student Life, Technology
|| 1 Comment »
Posted on: November 24th, 2010 by Famous Phil
Breaking through a restrictive firewall with OpenVPN
Let me start off with wishing you a happy thanksgiving holiday. I was hoping to get this blog done sooner but I have been facing a shortage of time with my regular responsibilities as a student. Anyways, enough about that, this blog post is going to explain how I can break through a restrictive firewall and have a fully usable IP address from the inside of that firewall. This task took me about a month to successfully complete with about 30 consecutive hours so I felt the urge to blog it for the future me, you, the reader can benefit too I suppose. This is a huge blog so it will take a while to read.
The motivation:
I’m a huge fan of landline communication because it has a more stable and clear signal. Unfortunately, my University removed the phone lines from all the rooms and wants $300 for a telephone jack activation and $28/month for local area calling (meaning the 716 area code only). Furthermore, my parents have a calling plan that allows for extreme local calling that doesn’t include the University phone prefix. Before, they didn’t mind paying extra to call me, but now my parents would have to pay for my University phone and the privilege to call me. This just doesn’t make sense.
With this in mind, I started searching for a VoIP provider (Voice over Internet Protocol) that uses SIP (Session Initiation Protocol). For those of you who have never heard of VoIP, it is a simple way to connect a special device to the internet and get a regular telephone jack. This jack can then be connected to an old fashioned telephone (or cordless phone in my case) that can act similarly to a landline. The quality for VoIP is very comparable to a landline when connected to a land based internet connection (meaning it sucks at home), but UB has a land based connection which means it will be fine.
I tested the device at UB over the summer on a network link in a room where I’m completing my master’s project and the device worked fine (I have some control over that firewall). Unfortunately, in my on campus apartment, that connection can’t be altered in my favor. I’ve found that the provider I selected requires unsolicited incoming connections to properly work, something that I know UB would never allow for. Instead of going through Bureaucratic Bulls**t where I would surely loose, I took the alternate route, unblock the connection myself (and use it for my own computers too).
In the end, I have public IP addresses that are totally un-firewalled within my apartment where I can do trace routes and other network diagnostic tasks. I also appear like I’m in Michigan (since that is where the datacenter is).
If you want to know more about how this is done, please continue by reading more. DISCLAIMER: I WILL NOT SUPPORT ANYTHING WITHIN THIS BLOG THAT IS OF YOUR OWN FAULT… The information is provided on an AS-IS basis. I’m sure there are minor mistakes here and there since this blog is almost 12 pages long in Microsoft Word!
One last note: DO NOT ATTEMPT DOING THIS if you are a novice user or someone who doesn’t know what they’re doing! Firewalls are put up for a reason, breaking through them without having a really good reason to do so could harm you and the network you’re on in the long run, especially if you’re at work! I take no responsibility for anything that happens to you.
Tags: Firewall, OpenVPN, voip
Posted in Hosting / Server Administration, Student Life
|| 11 Comments »
Posted on: June 8th, 2009 by Famous Phil
In this post I’m going to detail my first week with the MagicJack. This device converts a USB port into a Phone Jack that is compatible with any landline phone that you might have around the house. I will touch on clarity and ease of use.
Tags: call, clearity, evdo, landline, magicjack, skype, university at buffalo, voip, yahoo
Posted in Mobile Technology, Technology
|| 3 Comments »