View Full Version : Webcams and the BS2

02-06-2007, 07:15 AM
Hello World!
For everyone that remembers me, I still am alive! I definitely am feeling the tight schedule of a high schooler, but I still have continued on with my love of computers and technology. I have been teaching myself to make simple computer programs with a free BASIC scripter called AutoHotKey, and I've played around with the stamp a lot lately. I had some free-time today and I wanted to start a little project to expand my knowledge. I just hope I can find the time! I have a bad habit of not finishing projects that I start...http://forums.parallax.com/images/smilies/blush.gif
I was wondering about was webcams. I have a cheap little logitec webcam, and wondered if It could be adapted and used like the Boe-Bot CMUcam. If a webcam can be adapted and used like this, I want to have live wireless video feed from the boe-bot to my computer. Then, want to be able to wirelessly control my Boe-Bot from my computer in another room. It would be a little spybot. (no pun intendedhttp://forums.parallax.com/images/smilies/turn.gif)
The big question is can I have the bs2 send video from the webcam to my computer through the serial COM port, or maybe even wirelessly. It it is even possible, The Parallax Transceiver are a little expensive for me, so is there a cheaper or free-to-build alternative?? Any Input on these ideas would be great because I have no clue where to start.

Thanks for your help,
The Nerd

the NERD, Kelie B.

·· =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
· If electricty comes from electrons, does morality come from morons?

02-06-2007, 07:43 AM
If you have a rca input on your video card there are several small (sugar cube) video cameras and their receivers for around $50 US. The BS2 is not fast enougt to send video by itself.

- Stephen

02-06-2007, 07:48 AM
So then, how does the CMUcam send video to a pc?

the NERD, Kelie B.

·· =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
· If electricty comes from electrons, does morality come from morons?

Steve Joblin
02-06-2007, 07:58 AM
The CMUCam is not just a webcam... you can read all about it·here -->·http://www.cs.cmu.edu/~cmucam/

You also may want to have a look at this... it might be what you are looking to do... http://www.jawed.com/camera/

02-06-2007, 08:44 AM
Ok, now I understand a little bit more about the CMUcam. It is mostly for motion tracking, and bitmap dumping...Not video. I supose I should go for a more direct approach. Maybe I could build a robot that is controllable via the internet. But not a simple right/left/center setup. I was thinking about having a fully driveable robot with a video uplink to my website. (www.officialnerd.com (http://www.officialnerd.com)) But the scripts on this site (www.jawed.com/camera/ (http://www.jawed.com/camera/)) seem a little...uhhh...excessive? I think it requires too many extra scripts to run. I would really like to do something like this, except a wired version: www.thinkgeek.com/geektoys/rc/8698/ (http://www.thinkgeek.com/geektoys/rc/8698/) Remember, I have no money to buy anything extra. I'm choosing wired so I can still use my webcam. The only thing to figure out now is how I'm going to set up a webcam server, and a robot control server! Will I have to learn php now? Maybe I can modify the scripts that are given on www.jawed.com/camera. I don't want all of the extra c++ and Visual basic stuff. Is there any way I can do all of this with just Basic? I know that AutoHotKey has serial support.
Alright, thanks for all of the Ideas! Keep `em coming!

the NERD, Kelie B.

·· =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
· If electricty comes from electrons, does morality come from morons?

Post Edited (Nerdy NASA boy) : 2/6/2007 1:48:52 AM GMT

02-06-2007, 08:58 AM
I have a wireless video camera that I got at Geeks mounted atop the ping sensors bracket (ping is still there). I use the Parallax receiver on the boebot with the transmitter on a homework board using a pair of pots for control. You can find example programs to do it all. My kids love it as they can watch what the boebot see on TV and drive it around.

Dale Bartel

Portland Or

Steve Joblin
02-06-2007, 07:37 PM
If you are on very limited budget, you might opt for this approach...

1. Use your BoeBot as the basic robot platform
2. Purchase a TWS-434A transmitter and RWS-434 receiver and use the set up defined here...http://www.rentron.com/Stamp_RF.htm (http://www.rentron.com/Stamp_RF.htm) Renolds Electronics sells these as does SparkFun... do some google searching to find the best price, but both units are only a few dollars.
3. Purchase a sugarcube wireless spycam like this http://cgi.ebay.com/Wireless-Mini-Spy-Camera-Spycam-Security-Cam_W0QQitemZ270087000684QQihZ017QQcategoryZ48631Q QrdZ1QQcmdZViewItem (http://cgi.ebay.com/Wireless-Mini-Spy-Camera-Spycam-Security-Cam_W0QQitemZ270087000684QQihZ017QQcategoryZ48631Q QrdZ1QQcmdZViewItem)... again, do good search on E-bay for a good price... I was able to get one for $28 including shipping
4. Take the next step using info from the sample programs attached.

As you see, I have pointed you in the right direction without giving you the complete solution so you can have some fun and challange putting it all together.

This is a good project that will give you some challange while keeping costs to a minimum.

Post Edited (Steve Joblin) : 2/6/2007 12:44:53 PM GMT

02-06-2007, 11:38 PM
Thanks a lot! This is really what I was looking for. This is right in my price range, and will do what I need it to do. I think I will wait until later to get the camera, though. I do have a question; do I need another stamp to transmit with the TWS-434A transmitter? Remember, I only have one Boe & stamp. Can the transmitter be controlled through a serial port?
I think that first I should learn how to do the server/internet side of the project first. Also, I'm going to start out with a wired version for power, video and control. It will be a little more basic to start out with, and then I can convert it to wireless later. Do I need to learn anything about php so I can control send commands to the robot remotely?
This site (www.jawed.com/camera/) gave this code, and I wondered if this was a good place to start learning?

if (isSet($dir))
$fp = fsockopen ("YOUR.IP.ADDR", 443, &$errno, &$errstr, 30);
if (!$fp)
die ($errstr);

fputs ($fp, $dir);
fclose ($fp);

This is definitely going to be a challenge and a learning experience for me.
Thanks a lot,

the NERD, Kelie B.

·· =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
· If electricty comes from electrons, does morality come from morons?

02-07-2007, 02:27 AM
Check out my post over here:

PM me if you need any help with the php.


Steve Joblin
02-07-2007, 05:19 AM
Yes, I think that you do need two stamps (one for the sending, one for the receiving)... the sending stamp program is pretty simple and could probably be done using a less expensive microcontroller (like a PICAXE)...

The idea is that you would enter your commands into the debug terminal of the IDE, send it serially to the sending stamp, then have the sending stamp serout the command to the transmitter which is picked up by the receiver on your boebot and serin to the boebot stamp.

02-07-2007, 07:13 AM
Ok, I know that eventually I'll do this wirelessly, but first I want to develop serial COM control of the stamp. The only problem is that I don’t have any experience with VisualBasic. I want to control the stamp like the last two scripts on this page ->www.jawed.com/camera/ (http://www.jawed.com/camera/) Except in BASIC, not VB. I'm downloading FreeBASIC & FBIde so that I can write an app to do this for me. I'm on dialup, so downloads take a while! This is also why I can’t use VB; its size. I just need some form of serial control other than the stamp editor's debug window. Preferably like shown on the jawed site. If there is a simpler way of doing this, please let me know. For now, I'm going to try freeBasic.
Once I figure out how the stamp is going to receive commands, I have to develop some way of controlling it from a remote machine. Will I have to set up a simple server? I do have 2 old servers that I bought from my school (Compaq proliant 800) just sitting around. Yet again, I have dialup, therefore we can’t get a static IP address. Grrrr...so many problems. This is why I'm starting out simple. For now, I'm going to develop local control of the robot, and then I'll develop remote control.
Again, thanks for all of your input!

the NERD, Kelie B.

·· =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
· If electricty comes from electrons, does morality come from morons?

02-07-2007, 07:31 AM
Check my previous post for info on just about ALL of this ^^ =P

I have dial up and i let VB download all night and i really recommend it.

Kevin Wood
02-07-2007, 09:04 AM
If you don't mind starting with a console application, and aren't afraid to tackle a new language, then here is a very simple script in TCL - Tool Command Language:

1 proc SendCmd {x} {
2 set COMMPORT "com2";
3 set fh [open $COMMPORT w+];
4 puts $fh $x;
5 close $fh;
6 }

Here's a desription of how it works:
Line 1 defines a new procedure (proc) named SendCmd, which takes 1 argument
Line 2 uses the set cmd to make the COMMPORT variable to com2 (my com port)
Line 3 sets fh (abrev. for filehandle) to the results of the command sequence in the [] brackets. Inside the brackets, you use the open command to open the file name stored in COMMPORT for writing (w+).
Line 4 puts to the filehandle the value of x. it write the contents of x to the serial port
Line 5 closes the filehandle
Line 6 closes the procedure

$ in front of a variable name means to use the value stored in the variable

set x 10 creates a variable named x, and sets it equal to 10

puts x prints x to the screen
puts $x prints 10, since it is the value stored in x

To run this interactively, you start a tcl shell, then use the source command to load it into memory. So if you save the procedure in a file called robot.tcl, when you start the tcl shell, cd into the directory where robot.tcl is located and type source robot.tcl.

Pretend your Boe-Bot program uses letters to run commands - a: go forward, b: go reverse, c: stop. To send the commands from the tcl shell (after loading the source file), type SendCmd a, then press enter, SendCmd b, SendCmd c, etc.

The code sample above is one procedure that I have been using for a Boe-Bot simulator. The simulator is built on the HomeWork board, and I use LEDS to represent motion. My simulator is very basic, but it simulates the following directions forward, forward left, forward right, reverse, reverse left, reverse right, pivot left, pivot right, and stop. I also have a piezo speaker for signaling, as well as a light sensor, temperature sensor, and a servo.

There aren't as many books available on Tcl as PHP or PERL, but it is a very powerful language. If you want to try it out, you can download an installable version from ActiveState called ActiveTcl. It's free, and it isn't too large (21mb). Then you can check out this tutorial to get you started:

www.bin-co.com/tcl/tutorial/index.php (http://www.bin-co.com/tcl/tutorial/index.php)

If you decide to try it out, download and and get ActiveTcl running. When you have that finished, post here and I'll upload my Tcl code and the BS2 code. Between the two, you should be able to get a Boe-Bot moving.