Monday, February 17, 2014

for (;;) { GoodNews(); BadNews(); }

Ever feel like you're stuck in an infinite loop?

Lots going on… let's start with some Good News; I think I got a subscription to Make: Magazine. Nifty. I'll know for sure when the first one shows up…

More Good News: I wired up my Adafruit TTL JPEG camera to an Uno for testing. Not having a Windows workstation I found that Winebottler could sort-of run the windows-only CommTool. The only thing you need to remember to do is create a symlink for com1 to whatever your tty port is:

ln -s /dev/tty.usbmodemfa131 com1

in the 'dosdevices' folder of the app definition. To see that folder just highlight the commtool.app (or whatever you called it in wine bottler) and choose 'Show Package Contents' and navigate down into it.

I did some fakery with copying the serial output to another softserial port to another Arduino so I could check that the bytes sent/received were as the adafruit protocol cheat sheet suggested. They did (mostly, I think) and the camera also output NTSC video to an old analog colour monitor I have from my Apple II days.

Here is where the Bad News starts. I never did get the commtool working right, it would issue commands, and I could see the return bytes, but I don't think they ever made it back to commtool. Maybe one day I'll bother to gram VMWare Fusion and all that jazz, but not today. Needless to say I spent a day futzing around with serial ports and basically cloning some of commtools functionality to test the camera, which worked. But it did waste a lot of time.

More Bad News: No matter what I did, I couldn't coax any colour signal out of the NTSC port. I spent a lot of time looking at every VC0706 data sheet and thread I could find, fiddling with saturation and other parameters, but it looked pure monochrome. I wasn't until the end of that adventure that I found this post:

http://forums.adafruit.com/viewtopic.php?f=25&t=41050&p=203980&hilit=monochrome+camera#p203980

Guess what? It only outputs monochrome, so it was working 100% right from the start!

I'm sure the product description changed in the year since I bought it, because that's not a detail I'd overlook when the entire purpose was to take the NTSC signal into a video-to-USB frame grabber for the Beaglebone Black, as a way to do colour detection of the goal gates in the autonomous robot race here in Calgary. One gate is blue, one gate is green. Oh well...

The only way to get colour images is to take a jpeg snapshot and stream it out at 38400 serial. Yuck, and not happening… that is WAY to slow for my tastes.

So I guess that means this $40 camera is now going back into the project box. I might use it as a 'backup camera' for the rover, since it does have one final interesting function (and reason #2 I bought it): It has motion detection built in.

So from a stop, set the motion detection mode, and see if it triggers in some short time interval. If it does, then there is something moving behind the rover, where it has fewer and shorter range sensors. In this mode I wouldn't actually ever use either the NTSC video or JPEG imagery functions, just wait for the serial trigger to fire.

So now the rover is essentially 'blind' until I find a replacement camera system. I'm thinking that I might purchase a webcam, as the prices have come down a lot since the good ol' days and I know that I can go direct into the Beaglebone for video via USB.

Then some Good News happened to me. I sat down this morning to write out the code for the low-mounted infrared pan sensors, which would have Atmel AT Tiny 85's as controllers. As I was cleaning up from the camera debacle I found an old Sharp IR sensor, one that I thought I had fried. On a lark I plugged it in and pointed it at the iSight camera on the iMac. I could see that it was emitting IR light, and a multimeter test showed it was actually not dead at all.

That saved me the purchase cost of a replacement IR sensor, or about $15, which got me thinking that I could now justify purchasing two webcams for stereo vision. I'll have to play around a bit to see if this is wise, since I'm not sure I have the CPU power left to do feature matching across two images.

But it's worth a shot, no?



No comments:

Post a Comment