An Easy Robot

February 3rd, 2008 by wd5gnr


This little robot is made with two perf boards from Radio Shack (one of them cut into two for the sides). This board is easy to work with because it has a grid of holes. It is very easy to make nice straight cuts (or even just score and snap). It is also perfect for drilling exact holes. Basswood and polyurethane glue holds it all together (along with a few screws).

The drive consists of two Futuba RC servos modified for continuous rotation and a caster wheel from Home Depot in the rear. The tires are 2.25″ RC aircraft tires.

A 4xAA holder under the top deck powers the motors. The 9V battery on the top is just for the electronics.

The electronics is the GP3 board which has been programmed by the GP3EZ software so programming the robot is simple point and click.

The sensor is a Panasonic IR sensor tuned for about 38kHz. The IR LED is pulsed through a 2N2222 with the GP3’s PWM at 32kHz which is close enough that it works. A piece of antistatic foam pushed into a pin header blocks the sensor from seeing the LED directly. When something is in front of the bot, it sees the IR bounce off of it. It would be easy to add more LEDs (for example, two on the corners). The sensors could be paralleled or just connected to more I/O pins.

Here’s the software (dumped out to HTML by GP3EZ; the real software is all constructed using GP3EZ’s point and click interface):

Step # Tag Condition Action Next Notes
1 Start Always LED Off
PWM: 200 freq=32766
  Start IR and reset LED (for when we finish turning)
2 MainLoop Input: XXXXXXX0 LED On object Check IR sensor
3   Always Pulse: pin 7 2000   Drive forward
4   Always Pulse: pin 6 1000   Drive forward
5   After 20 ms   MainLoop Servo delay (20ms)
6 object Always   back (set bookmark) We detected something, so back up a little.
7 turn Always Set Loop A to 20   Start turning (just under 1/2 second)
8 turn0 Always Pulse: pin 7 2000   pulse motors the same way
9   Always Pulse: pin 6 2000   Inserted step
10   After 20 ms   turn0 (Loop A) Pause and loop for 2 seconds
11   Input: XXXXXXX1   Start If sensor shows clear (high) then go back to forward motion
12   Always   turn Sensor wasn’t clear so do some more turns
13 back Always Set Loop A to 100   Back up for about 2 seconds
14 back0 Always Pulse: pin 7 1000   Turn motors in reverse
15   Always Pulse: pin 6 2000    
16   After 20 ms   back0 (Loop A) Delay and loop
17   Always   {last bookmark} Go back to caller

The table is easy to understand. The step number should be obvious. The “Tag” is a label that names a particular step so you can refer to it later. Each step has 3 major parts:

  1. Condition - This must be true for the step to execute. Many of the steps are marked “always” and some are marked “After xxx milliseconds”. These will always execute, of course. Note the lines that work with the IR sensor, however. They only execute when a specific condition is true.
  2. Action - When the condition occurs, this is what will happen. The GP3EZ can output digital values, PWM, pulses, and do a variety of other tasks as part of the action. If you are connected to a PC (the robot isn’t) you can write data to a file or execute external commands.
  3. Next - When a step executes, this column tells the program where to go next (which is usually the next step).

The note field is just a comment and is ignored by GP3EZ.

Note that the GP3EZ supports looping and subroutines. For example, at the “object” tag, there is a transfer (in the next field) to the tab “back”. The notation says that a “bookmark” is set. If you find the back label, you’ll see it does several steps and then goes to the “last bookmark.” This is nothing more than a subroutine call and return. You can see examples of looping in the object and back routines which generate a specific number of motor pulses.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Real Word Control with Visual Basic Express 2008

December 23rd, 2007 by wd5gnr

Have you ever wanted to control or sense real world events? The AWC GP3 makes it easy to do many different kind of sensing and control projects from a computer with a standard serial port or a USB serial adapter. The GP3EZ software (free) allows you to do a lot of projects with no programming at all. However, it is easy to use the board from VB, Java, C++, even Windows Scripting Host!

Here’s a tutorial on using the board using Visual Basic Express 2008 which is free from Microsoft. Its easy!

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Resource Editing for Visual Studio Express

December 20th, 2007 by wd5gnr

Microsoft provides several “Visual Studio Express” tools for free download. These are slightly limited versions of their popular development tools for C++, C#, and Visual Basic.

I enjoy having these tools for free, and most of the missing features I don’t notice. Except for one: resource editing. If you want to add icons or menus to your C++ programs, you’ll have to manually munge up an RC file. Or do you?

I went looking for an open source resource editor. Of course, I could just break down and install my real copies of Visual C++ or even break out some other commercial resource editors I have, but I wanted a free solution to go along with the free Visual Studio Express product.

I looked pretty hard and I couldn’t find a single tool that did what I wanted. However, I did find two tools that together would do the job.

The first tool is the excellent XN Resource Editor. What doesn’t this tool do? It will create menus, icons, dialogs, cursors, and everything else you can think of. Oh yeah, but while it will read RC files, I couldn’t find any way to make it save an RC file! It will, however, do a nice job saving to a binary res file.

Of course, you could just leave it at that and let Visual Studio include the .res file. So I guess you can just use one tool. But I wanted an RC file that I could easily manipulate — at least for strings and IDs.

That’s when I downloaded Resource Hacker. This tool is made to load resources from just about anywhere. You can do certain things with those resources (although you can’t actually edit them). However, this tool will save a proper RC file.

So the steps are:

1. Use XN Resource Editor to create your resources
2. Save resources as a .RES file
3. Open the .RES file with Resource Hacker
4. Save as a .RC file
5. Add the RC file to your Visual Studio project.

You may have to touch up your RC file a little if you get any errors (for example, include winuser.h).

XN can read an RC file, so you can “round trip” by reading the file from step 4 into XN, making changes, and then repeating steps 2 through 4.

Enjoy!

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Fix the dotNet Framework

December 1st, 2007 by wd5gnr

Well somehow I got the .Net framework 2.0 buggered. It wouldn’t uninstall, but it wouldn’t install either. Visual Studio would complain when it started and several other programs too.

I finally found this free tool that will forcefully remove all traces of a given version of the .Net framework. After that, I was able to install it again.

Works great! Kudos to the author.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

DIY Server Rack

November 24th, 2007 by wd5gnr

Don’t want to spend a lot of money on a rack? Neither did these guys!

Pretty cool. A little black spray paint….

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Visual Studio Express 2008: VB, C++, and C# for Free

November 21st, 2007 by wd5gnr

If you are doing Windows development, there’s no reason not to use Microsoft’s excellent Visual Studio tools now that the “Express” versions are free. These products are the usual Microsoft Visual Studio that aren’t lacking many features at all. You can download Visual Basic, C++, C#, and a Web Development tool — all free.

http://www.microsoft.com/express/

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Alternative to Spy++

November 13th, 2007 by wd5gnr


I used to use the full blown Microsoft developers tools, but lately I’ve been using the express versions along with some open source development tools. In general, I don’t miss much about the Microsoft compiler. But I have to admit that I miss some of the tools.

A few weeks ago, I started getting a mysterious error message on my computer. It was a dialog box complaining about the flash installation. There was no hint of which program was complaining though. I thought about running Spy++ — the Microsoft utility for looking at on screen Windows — and realized this computer doesn’t have a full load of Visual C++!

What I did find is Winspector. This is like a souped up version of Spy++ and its free. Winspector can show hidden windows or not. It can filter and buffer messages. It can watch messages to a window class from the Window’s creation. In short, it does everything Spy++ does plus more.

So, what was the offending program? System47, my Star Trek screen saver. Reinstalling it did the trick. I guess a recent flash upgrade broke it. Should have realized my screen saver wasn’t running. If you are a Star Trek fan (or even a science fiction fan) you really ought to download this free screen saver. It is quite the conversation piece.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

More Articles

November 10th, 2007 by wd5gnr

I miss my days writing books and magazine articles. Of course, one outlet I have for my writing is this Blog (and the Articles link over on the right side of the page — have you ever read any of those?).

However, I occasionally write something that doesn’t really fit well on the blog and I’ve been looking for someplace to put those things.

One popular option is Associated Content. You can find my page there at http://www.associatedcontent.com/al. I only have a few articles there so far — and some of those are reprints of things you’ll find on this blog anyway. But there’s some new things to and I plan to add more as time permits.

There are a few other similar services around and I may try them too. If you have any experience with sites like this, drop me a line!

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

I Give Up!

November 4th, 2007 by wd5gnr

Apparently, my server did have some sort of infection. I tried everything to remove it, but never got it to work. So I’ve now reinstalled a new OS and I’m in the process of bringing everything back on line. Sigh. A lot of work.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

Strange Problem

July 29th, 2007 by wd5gnr

I’ve had issues with all my sites lately including this one that have seemed “strange”. Well I know what’s happening now, but not why. For some reason, it has become nearly impossible to create a file or a directory with a purely numeric name. Using touch, mkdir, or even a C program to call open or SYS_open fails (errno==2) if the file name has nothing but numbers in it. Any file name that has at least one character that isn’t a number works like you’d expect. This happens on all file systems.

I’ve upgraded the kernel. The fact that it occurs on all file systems and even when directly calling the kernel makes me think it is not the C library or a corrupt file system. There are no loaded modules in the kernel (ext3 built in along with everything else needed).

Here’s a twist. The debugfs program can create directories with numeric names. I assume it is doing some direct manipulation to accomplish this — more evidence it isn’t a file system issue.

Not sure what to do next. My colocators want to wipe my hard drive and reinstall Linux (must be Microsoft trained) but I’ve told them no — I’d figure something out eventually.

Add This! BlogLines del.icio.us Digg Diigo DZone Facebook Google Google Reader Yahoo! MyWeb Netscape Netvouz reddit SlashDot Sphere StumbleUpon Technorati

« Previous Entries Next Entries »