Computerized Lighting Controller +Voice Activated

Computerized Lighting Controller +Voice Activated

This project happened in Phases, over the course of about 7 years. It first started when I simply wanted to control multiply lights with my computer, from main lights to track lighting for video editing to black lights and Lava Lamps.

Today I have added voice recognition with multiply microphones for full coverage and envisioning a future of voice and cognitive recognition.

Phase I
I built this in 1998 I believe. It cost about $70 and you had to solder everything on the board. Was about 150 solder points, so it took awhile. I don’t remember where I ordered it from, but if you search for Kit 74 relay board you will find it. It plugs into the parallel port and came with DOS, yes DOS and windows software. Being rather antiquated I turned for a Linux source and found it.

k74-1.0.tar.gz – I found on Quozl’s Open Source Page. He has some other very interesting projects.

[shashin type=”photo” id=”286″ size=”large” columns=”1″ order=”user” position=”center”]
After a simple compile process I was up in running in Linux. You simply execute commands like this:

k74 0 toggle – Toggles relay 1 on or off.
k74 0 set – Turns relay 1 on.
k74 1 clear – Turns relay 2 off.

This was great, but I wanted shortcut keys, so I wanted Function Keys. I started using just the console, so I will explain that first. I loaded this on startup:

loadkeys -s keymap

And keymap file contained this:

keycode 59 = F1
string F1 = “/sleep/k74 0 toggle”
string F2 = “/sleep/k74 1 toggle”

On down the line, you get the idea. This is done by a simple Pentium 75mhz machine with a 2 gig hard drive running Debian Linux. Today, I have upgraded a little, running a P 1.4 ghz and the machine combos as my media server.

Phase II – 2001
After hours of search how to change the keymap in X-Windows, I found a program called “xbindkeys” and its setup utility “xbindkeys-config”. There HomePage. And also available on the Debian tree. I am running IceWM, switched from “Blackbox” because of a few different features.

So, I bound my Function keys and have easy access to turn my lights on and off again. I login as a normal user so I had to configure “sudo” to work as this program requires root access to the parallel port. Or you can make a user/group owner of your port, either way.

Now this relay board says it can handle 110 voltage, but the relays I just didn’t trust. It requires 12 volt for the coils, so I am also using the 12V to power my lighting packs. Basically I bought a junction box from Home Depot that can accept 2 receptacles, 4 plugs. Wired some heavy duty relays in them, 12 volt coil. I have line voltage coming in on a 14 AWG wire into the relays and directly to the receptacles. So its in a nice plastic box. Each relay now has 2 plugs to plug whatever I want into them.
[shashin type=”photo” id=”288″ size=”large” columns=”1″ order=”user” position=”center”]

So that’s it, estimated cost of the relay board now is about $50-$60, soldering required.
Junction Boxes, Receptacles, & Covers cost about $6.
2 Relays for about $8.

I built 2 of these boxes, controlling 4 separate switches, and up to 8 lights. Got a black light, lava type lamp, rope lighting, and main halogen light. Rope lighting from the ceiling provides excellent lighting for movies, editing, computer work, etc.

Phase III – 2004-2005
I finally converted everything, slowly, to rack mount and have started soundproofing the rack using grill cloth to cover and secure 6 inch insulation on the sides. I still need a Lexan door and blowers for the back need wiring.

[shashin type=”photo” id=”287″ size=”large” columns=”1″ order=”user” position=”center”]

The Relay Board is on top behind my Netgear router and APC has an upgraded 12 Amp Hour battery. Another thing that got upgraded were the wires going to the receptacles for the lights. They are now CAT5 so that I can power 7 devices now with 1 cheap wire you can get anywhere. In the Picture you can see the Cat5 striped and going into the board. Pin 1 is Neg 12V and Pins 2-8 are the first 7 relays. I have wired 2 RJ-45 ports for each controller for pass though ability.
[shashin type=”photo” id=”289,290″ size=”large” columns=”1″ order=”user” position=”center”]
Again each controller has 2 – 12V relays, so the first one uses only Pins 1-3. I wrote all over the plug with a perm marker so I don’t accidentally plug it into my network, that would probably fry most NIC ports.

Phase IV – 2005 Voice Command for my lighting controller
Its probably from watching too much Star Trek and hearing them issue voice commands for just about everything that inspired me. Especially for Lights on and Light off. Its great to be able to turn multiply lights on and off my simple voice commands. It took a lot of searching to find packages for Linux that were easy to setup and actually worked. I stumbled upon a program called Perlbox-Voice. Its a great Front end for Sphinx2 and Festival text to speech engine. The 2 best tools for the job. Its easy to setup, it has an interface to write the words or phrase command and then you write what you want that command to execute. So for “Lights on” it will execute a script that turns off any other light I have and turn on my rope lighting. For “Full Lights” it does the apposite. Lights off etc…

I have a DAK Super Directional Mic & simple dynamic mic plugged into a Behringer Eurorack MX 1604A, and into my Mic input of my Linux box. Be sure to keep the levels low for the output, I usually peak at about -30db. Line levels such as 0db or +4db could fry your Mic input amp on your sound card.
[shashin type=”photo” id=”291″ size=”large” columns=”1″ order=”user” position=”center”]
If I am across the room I have to make sure I speak firm, if I am near the Mic, normal volume is good. With Sphinx2 working as a back end voice recognition engine, it works great in noisy environments. I have a full duplex sound card so I can be playing music on the same computer pretty loud and still turn my lights on and off as long as my voice is a little louder than the music. It works GREAT.

With the second microphone it picks up my voice even better if I happen to be facing another location than the mic. I plan on adding some Behringer Omni-directional microphones soon to cover the room perfectly, but for now its working better than expected. Perlbox-voice also uses Festival Text to Speech engine so it will talk back to me if I wish, its quite scarry. =)

I started adding more voice commands to turn off some of the hard drives in my media computer (Currently 4). They can produce a lot of heat and I use simple Linux commands to unmount the drives and “hdparm” put the drive in sleep mode. I also have a “sleep mode” voice command that will turn off my lights in 2 minutes and then wake me up when I need to get up. It does other little things like turn off the monitor, and back on again in the morning with music. Next I will be added voice commands to tell it time of day I want to wake up.

I have also entertained the thought of having multi phrases for the same command. Like “Turn off drive 2” and “Shutdown drive 2” and “drive 2 shutdown” for the same command. Once you get to many commands, you could easily forget the exact phrase to turn off the thing! Then comes for the next piece of software, cognitive recognition for it to extract the words you say and “UNDERSTAND” what you want it to do.
Maybe even brainwave EEGs to control it next, I can’t wait!

There comes a point when its actually practical to have voice commands for certain tasks. Using the keyboard to execute hundreds of commands would be cumber sum. Voice Activation could be the wave of the future for the growing need and use of computers in our everyday lives. But they really need to understand what we want for them to become truly useful.