Thursday, April 24, 2014

Post 54: More about Ultrasonic Rangefinders (and Arduino)

Back in post 50, I complained about the background load variation of Linux causing me inaccurate rangefinder results. So I bought an Arduino Micro. Since I had worked in C language off and on for 20+ years, that part of the transition was no particular problem. And after a bit of trouble I got my HC-SR04 device yielding more consistent readings than I had gotten from the Pi.

I suppose many Raspberry Pi addicts started with an Arduino -- or maybe not. But there is a vast gap between them:
                                          Raspberry Pi        Arduino Micro
                     CPU speed        700MHz              16MHz
     avail. program memory       200+mb              32k (flash RAM)
                      file system       gigabytes             0
             operating system        Linux                  i/o support, boot loader

And the programming environment exists exclusively on a host computer. On my iMac it's the -- which connects via USB micro plug. This connection provides power, downloader, data-in, data-out and a pseudo console. It all "seems" pretty smooth. Arduino source programs are called "sketches." And they are kept track of conveniently on my Mac. My main problem is that program memory is flash RAM. It (necessarily) persists whether or not power is maintained. Maybe it's my setup ( / Arduino Micro) but when I compile and download a new sketch this often fails: download is supposed to do a reset (there is also a button) so the new program can take over, but this doesn't always work. Things hang in "downloading" and other problems. Irritating, but not impossible.

But this is supposed to be a Raspberry Pi blog. 

But No. 2: there are lots of systems that involve Arduinos slaved (wired or wireless) to a Pi.

Wednesday, April 16, 2014

53: I Try the "Prototyping Pi" Shield

As I grew tired of breadboard clutter and pulled out wires, I fell for Adafruit's $16 shield. Here's a pic of my still-messy setup:
The good bit: those screwed-down wires are going to stay put! The adjacent sockets are nice and tight, too.

Small complaints: it would be convenient to have extra screw (or insertion) connectors for GND, 3.3v and 5v. Also, When I screwed patch wires into the out-facing connectors the Pi footprint gets big.

Bigger complaint: Note the drawn-on red arrow and dotted line in the photo: That's the Pi camera ribbon cable. The dotted line indicates the approximate location of the camera socket beneath the shield. Before I added the shield the camera worked. But not after. As you can see, the camera is offset from the motherboard plug. Pushing the shield down twisted the ribbon and scratched off a few ribbon wires. Luckily, I have a spare cable but I'm not risking it with the Prototyping Pi. It's back to ye olde breadboard for me.

Two other thoughts:
1. Before I ever ordered the Pi camera I suspected that that cable was going to be trouble.

2. I take no pleasure in soldering. I would like a better breadboard where adding a new wire doesn't cause two previous wires to be loosened or pulled out. Any of you familiar with ZIF connectors?
ZIF standing for "zero insertion force." PCs used to come with these things so the enterprising could trade up chips when they inevitably got faster, denser or cheaper. ZIFs have fallen out of favor now that manufacturers have realized that upgrading chips diminished computer sales. But I digress.

What I'd like is a ZIF-like breadboard. The little lever above is in the open position. Once the chip was plugged in you you merely push the lever down and, voila, you have a reliable, semi-permanent circuit. Now, my perfected breadboard couldn't be just one big ZIF. Here's an off-the-cuff example:
What do you think?

Monday, April 14, 2014

52: Another Mistake of Mine

Back in post 49 I complained that the breadboard T-connector that I ordered from was wired backwards in relation to the breadboard rails. But that was only because I plugged it into the wrong end of the breadboard. The two ends are not symmetrical in relation to the positive and ground rails. So here is a picture of it plugged in correctly:

So, it's a pretty good deal after all. Except for my comments in post 45.