Tuesday, July 22, 2014

The range plot



After a little bit of tweaking, this is what the range plot looks like.  0 degrees is roughly straight ahead of the robot, and 90 degrees is to the left.  (Unless my memory has things reversed...)  In this scan, I'm sitting roughly in front of the robot as I'm testing out the scan, so you can see that I'm sitting roughly 20 inches in front of the robot at the height of the sensor (with the robot sitting on the table).

Unfortunately, it takes about 30 seconds or so to run through the scan and put up the plot in Python, and that's with a direct Ethernet connection to the already-slow Raspberry Pi.  Imagine how slow the response will be over wifi.  Still, it works, so that's something.  I suppose I could have bought a faster stepper motor, but I was going cheap -- <$4.  I had to tweak the delay time between steps and make the delay longer and longer, because shorter delay times caused the steps not to be always repeatable -- after multiple cycles, I ended up not returning to the same starting and stopping positions, which you don't want with a stepper motor.

Monday, July 21, 2014

Ultrasonic Range Sensor Scan Demo


Here's a video of the range sensor scanning back and forth.  I finished the code to do a twenty-one point scan across approximately 160 degrees or so in front of the robot and return a Python display of range points.  The display doesn't look all that great, in my opinion, but at least it shows if there's something pretty close to the robot.  I'll do a bit more tweaking, I guess.

Soon, I think, I'll put up more video.

Thursday, July 17, 2014

Ultrasonic range sensor in place


The proper 0.5 mm to 1/4 " shaft coupler arrived earlier this week.  The 2" stainless steel shaft that I had ordered was too tall, and the ultrasonic range sensor would have blocked the view of the Raspberry Pi camera, so I went out to Orchard Supply Hardware today and bought a package of 1/4" fluted wooden dowel pins and some wood screws.  I cut one of the pins in half, drilled a hole down the middle of each half, and then inserted one half in the shaft coupler, which I had already attached to the stepper motor.

I also bought a bunch of small circular PC boards (with solder pads) from Radio Shack, and I soldered -- rather poorly, unfortunately -- an 8-pin IC socket onto a small one, and I screwed this  PC board onto the wooden dowel pin.  Then I inserted the ultrasonic range sensor onto the IC socket on the stepper motor assembly.

You can see the photo of the assembly above.

I also remounted the Raspberry Pi camera onto the SD Card Shield with a longer standoff.  The SD Card shield doesn't really serve much of a purpose any more, other than to elevate the camera a bit higher and maybe... well, that's really about it.  I tried mounting the camera elsewhere on the top plate of the robot platform, but I couldn't really find a place I liked.

Now, I need to wire the ultrasonic range sensor with Arduino jumpers from the IC socket over to the SD Card shield, and I'll probably also use Arduino jumpers to connect the stepper motor to whatever pins are still available on the Arduino SD Card shield.  After that, I'll have to write new programs to control the stepper motor and to accumulate range data by sweeping in front of the robot and building a map of objects.

I still haven't bothered accounting for the pins, though.  This'll be really bad if it turns out I don't have enough available digital I/O pins.

Wednesday, July 9, 2014

Need to order a new shaft coupler

Got the wrong shaft coupler.  I should have ordered 5 mm instead of 3/16".  That's what I get from eyeballing the shaft OD with a ruler instead of measuring with a caliper.  Doh!

Sunday, June 29, 2014

Raspberry Pi Streaming Video

Before I forget:  Before a few days ago, I did imaging through the Raspberry Pi camera the following way:

I'd drive the robot a few feet.  Then I'd send a command to take a picture.  A picture would be sent back to me, and I'd take a look at it.  Then I'd dismiss the picture, and drive the robot a little bit more. And so on.

Tedious.

The whole thing was done via Python.  I couldn't figure out how to do streaming via Python.  So, following streaming instructions here, I set up streaming video via the from the Raspberry Pi camera to a web page.

Now, I get a live stream of the camera as I drive the robot, making it a more fun driving experience.

Unfortunately, it seems to have hosed the picamera Python library, so I don't have access vi Python.  Oh, well.  For now, I don't need or want it.  I'll have to see about reinstalling it or making it live side-by-side with streaming, if possible, if I want it back in the future.

Wednesday, June 25, 2014

Stepper motor arrived

Okay, the new stepper motor finally arrived, and I tried out the sample code linked by one of the reviewers.  It works fine, but some of the output pins used by the code are also used by the Arduino motor shield to control the motors.  I'll have to find unused pins and rewrite the stepper motor code.  I assume enough pins are available.  If not...

Now that I have the stepper motor, I have to come up with a way of mounting the ultrasonic range sensor to the motor.  First, I already attached the stepper motor to the top-front of the robot platform by reusing the long standoffs.  I tried moving the Arduino and the Raspberry Pi to another location on the top plate, but the holes really don't seem ideal for anything.  I wish the top plate had more holes for screws.

For attaching something to the stepper motor, I'll probably order this shaft coupler and this 1/4" rod. Then I'll have to find a flat platform or circuit board that can attach via 1/4" ID shaft collars or something similar, and I'll attach the range sensor to that board and wire it up to the Arduino stack.

I'm so used to looking through the McMaster-Carr catalog when ordering parts at work, but for this project, I'm looking through Amazon.com.

Friday, June 20, 2014

Waiting

No, I haven't abandoned this blog.  My next step was to add a stepper motor so I could sweep the ultrasonic sensor in a controlled fashion before the robot, in order to get a map of objects in the front.

I ordered a cheap stepper motor from Amazon.com some time ago, but the delivery time is very long.  I should get it in a couple of days... I hope.