Oslo, Norway, February 7th, 2003
I'm the kind of guy that uses time and money (not that much money)
to set up a servo controlled camera inside my home. I'm the kind of guy
that thinks it's cool to use five different technologies in order to see
the inside of my livingroom from anywhere on the planet. I like words
like J2EE, Streaming Video, Flash MX Communication
Server and Remote Method Invocation. And that's not all!
I'm also the kind of guy that wants to tell the whole world about it.
At least every nerd out there willing to listen. So yes! I'm a nerd! Now
let's get into the juicy details of the CasaCam project. Wohoo!
The CasaCam is a Logitech
QuickCam Pro 3000 mounted on two servos, one on top of the other,
thus providing pan and tilt functionality. This means I can turn the camera
180 degrees both horizontally and vertically. If the camera is placed
against a wall, it can practically see everything inside the room. The
video from the camera is streamed to the a web page on the Internet, and
I can also control the servos through that page. The page looks like this:
At some point in time I found out I wanted to use my computer to move something
in the physical world. I found out how to control RC servos, i.e. small electrical
motors designed for remote controlled airplanes and cars. But the servos alone
didn't satisfy me. I wanted them to move something, and I came up with the controllable
web cam idea. That still wasn't good enough. What's the point of moving a web
cam with servos, when you can do it with your hands? It had to be done trough
Internet! That idea opened for a bunch of new ideas; burglar alarm, video surveillance,
pet nanny, live videoconferences etc etc. Yes, now we have a project!
in the third phase of this project. When I first started I was grabbing
pictures every 10 seconds using Sun's
Media Framework and a Jakarta-Tomcat Web
Server. Sadly it turned out to be a pain to use JSPs,
session handling, automatic refreshing without cashing and the likes.
So I turned over to the dark side: Microsoft
IIS server and ASPs. I still
java program to talk to the serial port in order
to turn the servos, but now the ASP's and the server talked through a
database. That required three major technology components delivered by
three different companies and a database as communication channel between
them. I didn't like it.
the thumbnails to see larger versions:
How it works
latest solution uses Macromedia Flash
technology to stream video. I still need Java for the servo control
part, but it's done beautifully
by having the Flash sliders make direct calls to an Enterprise
Java Bean (over RMTP).
This requires Flash
and a J2EE server, but hey, you don't get anything for nothing. Besides,
This is how it works. On my stationary PC at home I have installed a JBoss
J2EE server. This server contains an EJB that uses Sun's
Communications API to open a connection to the serial port. On
the serial port I have connected a servo controller chip called FT639 supplied
This tiny thing can control up to five servos to the direction specified
I have only two servos attached to it. For power supply I use a simple
220V AC to 4,5V DC transformer. This feeds both the chip and servos.
On top of the JBoss server I have installed
Remoting Components. This is a simple application, which installs
as a EAR (Enterprise Archive). With this on your J2EE server your Flash
applications can speak directly to any EJB. The way the application works
now every time someone moves the slide bars a call is made to the my CasaCam
EJB on the JBoss server. This EJB then sends the new servo position to
the servo controller chip, and the servos react.
To share the slider between simultaneous users (i.e. if several people
are using the CasaCam, and one moves the slider, the slider moves
in all user screens), I use Macromedias' Flash
Communication Server MX. This
is something Macromedia calls Shared Components, and it works like
a charm. Why haven't people made games with this?! I also use the
Communication server to publish the video stream from my computer
to whoever opens
the viewer application. The Communication server also installs on
of the JBoss server.
Here is a schema
giving an overview of the technologies and how they are connected:
Here is a list of stuff you will need if you want
to make your own casacam.
1. Web camera with USB connection. Preferably one with drivers included
in Windows, which goes for most Logitech cameras.
2. Two RC servoes of any brand. They should be quite strong (torque >
3 kg/cm). You can find such here.
3. A servo controller for minimum two servos. You won't find one in
your local supermarket. I recommend using the FT639 with
the FT639 circuit
board from FerretTronics.
4. Serial cable, 9 pin. This one is easy, just grab the scissors and
go to work on an old mouse that you probably have lying in your drawer.
you don't have an old mouse lying around, you're obviuosly not a nerd
and should abort the project immediately.
5. Power supply. At first I used +5V directly from my desktop, but when
I later wanted to work on my laptop I had to buy what they in Norway call
a battery eliminator. It's simply a 220V AC to 4.5V DC converter. There's
a picture of it here.
6. Depending on how you want your CasaCam to look you should have the
necessary nuts, bolts, box, struts, bars, paint, tape, etc etc. I've made
two versions. The first you can see at the top of this page. It only requires
some sort of base to mount the first servo on, but it's sort of an ugly
duckling. The latest version is a bit more streamlined, but it requires
a bit more hardware. You can see detailed pictures further up.
1. Macromedia Flash MX, Flash Communication Server MX and Flash Remoting.
You can get trial versions for all of these on the Macromedia site.
2. Your own J2EE server. There are bundle of free ones out there, just
take a pick. I use JBoss.
3. Sun's Java Communications
API for communication with ther servo controller
through the serial port.
4. CasaCam.zip. This is all my code! Both Java and Flash.
You can use it to guide you while your making your own.
Give it at try
OK, get this, the camera runs in my livingroom. I'm a nerd, not an
exhibitionist! If I know you, or you have reason to believe I would
give you access to look inside my home, send me an email. I might give
you a user name and password, in which case you can give the CasaCam
a try. To mail
use the link at the top of the page.