December 18, 2008, 1:56 pm

Candy Cam, Part II: Audio & Video

If you haven't seen it already, check out Part I about Seven's Candy Cam

Since the original idea was just a bell and a camera to watch Seven, I decided to get one of those indoor/outdoor "security" cameras with the IR emitters. That way at night with the lights off Seven would still be visible.

The security cameras output an NTSC composite video feed which doesn't hook directly to a computer. Fortunately I had a KWorld USB thingamabob around which, besides having an ATSC tuner, has S-Video and Composite input. I wasn't sure if the device would be supported on Linux, and since my Linux laptop is old and slow anyway, I chose to use Windoze for the camera.

In the past when I've setup a video feed I always had everyone connecting to my computer at home. Of course that quickly saturated my bandwidth. In this day & age I expected there must be an easier way than me setting up some relay off another of my servers on a fast connection. A quick google search turned up several possibilities. The top of the list was Ustream so I gave them a try. They are free and I liked how they had somehow managed to get Flash to handle everything so I didn't have to install any software. The downside was that they had no way to let me choose which input I wanted to use on the USB capture card. It took quite a bit of battling with the crappy software that came with the USB device before I was finally able to get off the tuner and choose the composite input. Once I did that Ustream was up and running and streaming my camera.

The night vision on the camera didn't work very well though, it tended to make a bright spotlight right in the center. Plus being a cheap camera the colors were very washed out even during the day. The next morning I got out my old Sony Video 8 Pro camera to see if it would look better. It looked a lot better. But unfortunately it had a narrower field of view and I had to set it up right in front of a doorway in order to use it. I had to rearrange the entire dining room in order to turn everything so I could get a good angle with the camera. I also now have to leave the dining room lights on constantly to provide enough light for the camera. Fortunately they are compact fluorescents.

Audio

After adding Elmo to the display, I realized I was going to have include audio in the stream. The security camera I had picked up also has a built-in microphone. I patched the audio into the USB capture card too, but because of some bug in Windoze, Flash, or the Ustream software, I couldn't choose the USB device as the audio source. After repatching it into the laptop's built-in sound card I had the audio up and running too.

Elmo however is quite loud. Obnoxiously loud. Plus having the microphone picking up any noise around it bothered me a bit too. In order to deal with both problems I picked up a cheap 4 channel mixer from Radio Shack. I disconnected Elmo's speaker and tied it directly into one channel. I also did the same with Santa. The output was patched straight into the Windoze laptop's sound card. This also had the advantage of making Elmo slightly more understandable in the video stream. Elmo's circuitry tended to cause a lot of pops and clicks on the audio feed though when he wasn't talking. The quickest way I could think of to deal with it was to play music in the background. I patched the output from the Ubuntu laptop and started up a CLI based mp3 player called mp3blaster. Once the music was playing the pops and clicks were much less noticable.

One of the things I lost by removing the microphone was the jingling of the bells. The sound you hear now is simulated. When the program triggers the LEGO to jingle the bells, it also plays a sound file so that the video stream hears bells too. I still need to digitize my pachinko machine hitting a jackpot and play that when the candy machine is triggered.

See Also

December 16, 2008, 5:19 pm

Seven's Candy Cam: How it works

I'll be posting this in multiple parts because there's so much going on. If you haven't seen it, check out Seven's Candy Cam

This all started out because I was ordering some electronic stuff and decided to order a couple of Arduino boards to see how they worked and what they could do. After I got them I was amazed with how simple they were to setup and started doing some searches of things other people had done with them. I stumbled onto a site where a guy had used a servo to ring a bell whenever someone visited his site. I thought that was cool and I might do something similar with Wishzilla.

A couple of days later I was thinking about it more and I had the idea that maybe it would be fun if I setup a web cam and I rigged up something so whenever the bell rang a treat or something would drop for Seven. And why not throw a webcam on it?

Over the last week this has evolved from bells and a webcam to watch the dog eat into a crazy mess of interactive toys, all controllable by visitors to the site.



Currently the system is using 1 Windoze laptop, 1 Ubuntu laptop, an additional 15" monitor, a LEGO RCX, an Arduino, an Elmo Live! toy, a D.J. Mixin' Santa decoration, a LEGO 9volt train, X10 for the Christmas lights, a little USB TV capture device, an automatic dog feeder, a 4 channel mixer from Radio Shack, and my ancient Sony Video 8 Pro camera. Why do I feel like I left something out?

The web server

An important consideration was making sure that the site would be unaffected by any glitches with my rig at home. This meant I didn't want the processes trying to connect to some IP at home or dependent on a daemon running locally all the time. I wanted to make it as simple as possible so I didn't have to keep coming back and checking which piece of software had crashed.

What I decided to do was make a FIFO on the web server which the Wishzilla software would attempt to open in non-blocking mode and then write a line to. Doing it this way meant it didn't have to open any sockets or have an IP address hardcoded into it that might change. The software running at home does an ssh into the Wishzilla server and does the reading from the FIFO. Very simple.

To be continued...

In the coming parts I'll show how the components are wired up and what software is running on them.

December 6, 2007, 12:57 pm

Warm Floors Cubed

I've had a Rubik's cube floating around the office at Warm Floors since almost as long as I've worked there. It was given to me by the owner of the company after he picked it up at some computer show. It's a fairly standard cube except that it is covered in Microsoft ads. It's slightly harder to solve than a standard cube because you have to make sure the center tile is rotated the right way.

The poor cube got trashed because the other people in the office got tired of me always solving it. It ended up covered in red stickers on every side for a while, and then when they tired of that they pulled all the red stickers off which took off several of the original Microsoft stickers too.

Over the weekend I decided it was time to do something new with the cube, so I made new stickers with employee faces on it. I also threw in a Santa face since it happens to be Christmas time and they had just put up decorations at Warm Floors.

It's even harder to solve now, since once the faces are all mixed up it's hard to tell which piece goes with which person. But it's not impossible. I found solving the Santa side first was easiest since once he's done the rest pretty much fall into place.

I think it turned out really cool, and if it wasn't so much work cutting out all the stickers, it would be neat to make lots of them with different pictures for stocking stuffers.

July 21, 2007, 10:15 am

I cut off one head and two grow back in its place

After many years of junk collecting, I have acquired a large number of Matrox Millennium II cards. These cards have a rather unique feature in that you can put more than one of them in a computer and use them at the same time. Those of you that used to run NeXTSTEP/OPENSTEP no doubt recognize this card. In all I have five of the Millennium II cards. I also have an AGP Millennium G200 which also supports the multi-card feature.

In order for this to be a "worthwhile" demonstration, I decided I would try out OPENSTEP, Linux, and Windows XP. I cobbled together a stand of sorts to arrange the six monitors. It's nothing special, I expect this to be a temporary setup so ergonomics weren't much of a factor. I can't look at the monitors on top for long because they are so high that it strains my neck.

The motherboard I chose is an older Tyan S2460 with dual Athlon 1200 processors. The monitors I'm using are three 15" monitors and three 17" monitors. The 17" monitors are all identical, the 15" monitors are two random CRTs and an IBM T55D digital LCD.

To start off I thought I'd boot KNOPPIX and get the disk partitioned while I wait for the latest Ubuntu distro to download. The kernel on the KNOPPIX 5.1.1 disk did not like so many cards. It would immediately reboot the computer as soon as the kernel was loaded. Without the extra cards KNOPPIX would boot fine. By the time I had given up getting KNOPPIX to boot the Ubuntu had been downloaded and burned.

Ubuntu was able to boot up fine. Interestingly, while the text console came up on the G200/T55D in the AGP slot, X11 decided that my video card was the first PCI card. Switching back and forth between X11 and the text console via the keystrokes would switch back and forth between monitors. When the text console was active the 17" monitor turned off, but when X11 was active, the T55D stayed on but the screen was blanked out.

Ubuntu did not detect the additional cards by itself. I couldn't find any GUI or control panel to let me add the additional cards or arrange them. This meant I had to delve into manually configuring X11, a task which I really loathe. I hate all that modeline and sync rate crap. I did find this guide which does a good job detailing most of the process of getting multi-head going.

I cut & pasted the section relating to the working video card to try to bring a second one up. Both displays came up, but they are mirrors of each other! Uh... That's not what I wanted. Checking over the xorg.conf I noticed I forgot the RightOf option. Corrected the error and tried again and I had two monitors working the way I expected.

After getting two screens to work I copied & pasted to pick up the other three Millennium II cards. It again only brought up two monitors. Thinking maybe it was a limitation that I could only have two (although I've seen photos of at least five on other sites), I tried again with only the center and the left. Only got the center that time. So I tried again with only the left. Xorg complained there were no screens detected and listed out all the cards it found and said there were no Device sections for them. Wait, what's this? They're listed in decimal and I punched in hexadecimal just like I got from lspci. Changed it and now I get all five displays.

I was unable to get X11 to use the sixth display. Lots and lots of searching and fighting with the config file yielded no results. Every single time X11 fired up, it would clear the screen, pause for a second, then shut the T55D display off. The best I can tell is that no-one has ever succeeded in getting the T55D working under Linux. Ever.

The next thing to try was XP. After XP finished the text console part of the install it had no problems switching to the graphic installer. XP was quite happy to display graphics on the T55D without shutting it off. During the hardware detection phase the monitors connected to the PCI cards started snapping on one-by-one, but they did not display anything on them yet. After finishing the install all I had to do was go into the desktop properties and check that I wanted to expand my desktop onto the additional screens and drag them around to match my physical layout. I didn't have to go online and download drivers or anything. I guess that's an advantage to using older hardware, the drivers are stock. I was able to get all six screens working under XP without any hassles.

For the heck of it, I tried playing a video clip and dragging it around between the heads. I could only play it on three of the heads, the AGP and the first 2 PCI slots. On the others it would either stay black and start again when I got it back onto a working head, or else it would stop playing and WMP didn't know it had stopped. Changing the hardware acceleration options in WMP made no difference. This might be a problem with sharing IRQs, I don't know.

To install OPENSTEP I had to remove the G200/T55D. With the G200/T55D installed the graphic text console would shut the T55D off. With the card removed and the console coming up on another display, I discovered that I couldn't install OPENSTEP onto the 13gig drive I had already set aside a partition for.

OPENSTEP is so old it couldn't count high enough and wasn't able to see the partition table of the disk. I dug out a 4gig HD just to install OPENSTEP onto. Still didn't like it. Mostly installed but still had problems calculating the size during the final step. Broke out OPENSTEP on Parallels to make a disk image the same size as the partition I had set aside on the 13gig, and imaged the whole thing over. No go, wouldn't boot.

Found an option in the BIOS to change the disk type from "Other" to "DOS". Made OPENSTEP a lot happier, it realized I had more than a 200meg disk. I was able to fully install, although it still didn't see the original partition table. I let it wipe out the partition table since I expected I could recreate it, and if not I had already tried the other two operating systems anyway. (As a side note, I was able to use gpart to recover the Linux partition. I couldn't recover the XP partition since the OPENSTEP partition now overlapped it.)

Once I installed the 4.10 "beta" MGA driver OPENSTEP was happy to detect all five of the Millennium II cards. Unfortunately there was a bug in the Screen preference and I was not able to rearrange the screens to match my physical layout. I probably could have gone in and manually changed the appropriate settings, but at this point it wasn't really worth it. I was able to see that all the cards were working which was good enough.

While having five or six heads is certainly cool, this was only a temporary setup. I sort of would like to find a way to justify keeping the six headed monster, it might be fun to make a nice stand (maybe out of K'Nex?). Unfortunately none of the operating systems I tried out are ones that I can sit in front of and work with all day. I don't really have any use for Windows, there aren't any programs on it that I use that much. Linux is at least a unix, but the GUI still blows. I manage around 20 Linux computers, but of them, only one is connected full time to a monitor, and that's my MythTV box. OPENSTEP 4.2 is just too dated with no USB support, no DPMS support, no modern software, etc. If I could run MacOS X with six heads, I'd probably do it, I still use a Mac with a G4 450 every day as my main computer simply because I can run it dual headed.

In the end this project was of course a stupid waste of time.

September 24, 2006, 9:41 am

Time for an episode of "Stupid Ways to Waste Time"

Yesterday I finally decided I needed to get rid of a bunch of old Macs that I took home to save from ending up in a recycler's scrap heap. They all worked so I have been resisting for years turning them in as junk since I figured there must be something they could still be used for. Most were 6100 series PPC Macs, and can run Linux and might be useful as Linux experimental test beds.

I knew I was probably never going to get around to installing Linux on them, and I have had them stacked on my utility cart since I brought them home. I could really use my utility cart back, so I setup a table in the garage and sorted through the pile to get an inventory and see how complete everything was (and to check if there was anything I really wanted to keep). I found I had a Mac Plus, 4 6100s, a 7200, a 6205, an LC II, and a IIci. I took a quick picture and posted the whole thing on Craigslist in the "free" section. I didn't really expect anyone to take anything, but it was an easy place to start before finding a place to recycle them.

It didn't take long before people were asking if they were still available. One guy claimed to be affiliated with the Boy Scouts and wanted to take them all because he could put them to good use. He of course never showed. Another guy was interested in a couple of the PPC Macs, as well as the Plus, but didn't seem to understand that he had to take it further than simply saying he was interested. He seemed to think the computers would magically materialize in his living room just by sending me an email.

By noon one guy had actually made it over and took the Plus away. I was actually quite surprised to see that be the first to go, I had thought it would be the hardest to get rid of. Unfortunately, as the day went on, it seemed that the Plus was going to be the only Mac that was going to be saved from the recycler.

Around 3pm I had the idea that maybe I could get rid of them if I turned them into arcade machines. No doubt this was going to be a stupid waste of time, but what the heck. I pulled one of the 6100s off the table and set it up on my utility cart with a 17" monochrome Radius Portrait monitor. I thought it might be neat to play some black & white vertical games on it. Plus the 21" color monitors are just too heavy to move around. I put my laptop on the cart and used it as a wireless ethernet bridge.

A little bit of searching revealed that I could still download a version of MAME old enough to run on MacOS 8.5. Of course finding the right file that actually would run wasn't easy. The first one I downloaded said it required 8.6. Well that's out, I'm not going to upgrade the OS. Another download and it didn't list any requirements, so I gave it a try and when it ran it complained it couldn't find "PowerMgrLib." More searching revealed that the 6100s don't have any kind of power manager which is why the library isn't there. But why the software even required it was beyond me.

Continuing on my quest, I tried an even older version of the emulator. This one launched and so the next thing was to get some ROMs loaded. I connected to the folder on my server that has lots of ROMs, and the poor Mac pretty much hung trying to sort and index the entire list before presenting it to me. Oops.

I rebooted the Mac, and this time I picked out ROMs one at a time on the server side, and placed them in a special folder that the Mac wouldn't choke on. I copied over Space Invaders, fired up MAME, checked the settings to try to get it to go fill the screen, and ran it. It worked!

Next I wanted to try something more popular, like Pac-Man. Digging through my ROMs I copied over everything that I thought might be related. Unfortunately none of the parts I found seemed to be complete. Either I didn't find all the parts, or the filenames in my newer ROMs weren't what this old version of MAME was expecting. I thought maybe if I tried some other really old game the ROM might be compatible, so I added Space Zap to the list.

Space Zap fired up, but sadly, it choked. Hard. And this is a very very simple game. Sound skipped and repeated, and the animation was very jerky. Half the time you couldn't see your own shots. Oh well, so much for getting rid of these as some kind of gaming machine.

Fortunately, at about 4:30 someone showed up to claim all the PPC Macs and the monitors that go with them. He showed up in a tiny little euro looking hatchback. The car was a loaner while his car was being repaired, and they only gave him the valet key and so he wasn't able to get the "trunk" opened. Neither of us could find any kind of release inside the passenger compartment either. Somehow though we managed to get everything piled inside on the seats. He is planning to personally take all the computers with him to Cambodia to give to a school there. He said he'd be taking them over one or two at a time on his trips to visit. I'm not sure how he's going to take the monitors, but he was overjoyed to get all these working computers. I was happy to finally be rid of them.

Of course, I've still got the IIci and the LC II. I haven't gotten any more emails and have deleted the ad for now. I have a feeling these two computers are going to end up at the recycler.