Monday, July 28, 2014

Burned out my Arduino Uno

Crap.

I took apart the robot to put some Velcro on the big battery today, and I had to disassemble the electronics to get inside.  When I reassembled it, I accidentally reassembled the wiring incorrectly, without noticing it, and I short-circuited the 5 V line to GND when I connected the ultrasonic range sensor.  A minute or so after I turned on the power, I smelled something like melting plastic.

I have some spare parts to test, but I'll likely have to order at least a new Arduino Uno.

-----

Update:  Based on my test with a spare Arduino Uno R2 board, it's just the Arduino Uno R3 board that burned out.  The Arduino Motor Shield R3 board seems fine, the Wireless SD shield wasn't really being used, the ultrasonic range sensor seems more-or-less fine, and the Raspberry Pi seems fine.  A test of the robot with the Arduino Uno R2 in place seems to indicate the function is normal, though I don't recall if the Arduino application had never said usbmodem as the serial port on the Raspberry Pi.  Regardless, it seems to upload properly to the Arduino.

The burned-out Arduino Uno R3 smells kind of funny, like melted epoxy.  I ordered a couple more from Amazon; they're about $8 cheaper than at Radio Shack.

-----

On a different note, I went to a local hobby store after work today and picked up a set of soft racing tires to replace the hard tires on the robot.  These fit the wheels, and they should provide better traction.

When I mentioned that I was using them for a robot, the guy who helped me find the tires asked me to bring the robot in to show him.  Unfortunately, he'll have to wait for me to rebuild it, now that the Arduino Uno has burned out.

New Demo Video


In this new demo video, I show my Raspberry Pi Arduino Robot approaching a cardboard box and scanning it with the ultrasonic range sensor, twice.  Unfortunately, I didn't properly save the first scan image file, so it doesn't show that the distance measured was ~10 inches from the range sensor.

Also demonstrated in the video is the onboard video, shown as an inset, picture-in-picture video.  The field-of-view isn't great.  I suppose I could angle it better, but when I drive the robot at home, it's on the floor, where its angle points sort of upward and looks okay.  Also, here, I could have adjusted the FOV electronically.  However, for privacy's sake, I was also trying to block out the view of the rest of the room.

After backing out, the robot had a power glitch (described below).  Power came back after I jostled the robot a bit, and then I drove it around a while.

Some notes:

-- I've been experiencing sporadic power loss to the motors whenever I run across bumpy surfaces.  If I pick it up or otherwise move it after it loses mobility, it often regains motor mobility.  I think I may have a loose wire somewhere inside the robot platform.  The battery pack is not secured inside, so if it slides around, a connection could loosen.  I think I'll tape some velcro to the battery pack and the bottom of the robot platform, so I can secure the battery pack.

-- The angular resolution of the ultrasonic range sensor is just awful, and I don't think I can buy another one that's any better.  Just looking over sensors in roughly the same price range on Amazon and Radio Shack, I think they're all almost exactly the same cheap/inexpensive design.  It's almost not worth using such fine step sizes on the stepper motor, and I thought I was using a relatively coarse step size to begin with.  I could try making some sort of collimation device for the sensors, but then I think I'd lose distance resolution.

-- 7/28/14 Update:  It turns out there are ultrasonic range sensors that are much cheaper than the Radio Shack range sensor, but most of these seem to use four pins instead of three.  At this point, I'd rather not have to figure out how to make use of the additional pin.

-- The robot itself is still not autonomous.  I still control it from my MacBook Pro via WiFi.  Now that the ultrasonic range sensor works, at least in a rudimentary way, I think it's time to build in some basic AI.  Collision-avoidance is the obvious first step, and since the angular resolution is so poor, I can make the sensor sweep faster by taking fewer steps.

-- You can also see from the video that the wheels slip a lot on some surfaces.  If I could buy tires with better traction or just a lot less slip, I could trust velocity estimates a bit more, and maybe I could program a little drive-to-destination AI, too.  That would be one advantage in using a Raspberry Pi as the brains of this robot over just using the Arduino alone.

-- If the Arduino plus Tamiya Tank platform robot was my version 1 robot, and if this is my version 2 robot, then maybe it's about time to consider a version 3 robot.  In addition to adding AI capability, I think it's time to consider additional physical capability.  I think I'm down to maybe only one or two remaining digital I/O pins on my Arduino stack.  I might be able to add another sensor, but I wouldn't be able to add another stepper motor, servo motor, or a robot arm (which, BTW, I have already assembled from a kit!).  So, to add more stuff, I would want to expand with more digital I/O pins.  One way to do that would be to add another Arduino stack.  But how?  A possibility might arise from the fact that I chose to go with USB as my means of communication between the Raspberry Pi and the Arduino, rather than using the GPIO ports as others have done.  If I can use a USB hub off the Raspberry Pi, then theoretically, I can communicate via USB with multiple Arduino boards, provided the Arduino serial libraries and the Raspberry Pi serial libraries allow for addressing through multiple USB devices.

-- Plus, if I go with expanded physical capabilities and multiple Arduinos and a USB hub, I'll definitely have to go with yet another, larger robot platform, one that can hold larger battery packs with much higher watt-hour ratings, which means the Arduino motor shields will have to drive relays rather than provide those voltages directly.  Then I can drive more powerful motors needed to drive the larger platform, but then the larger platform can hold my robot arm...


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!