Thursday, 31 May 2012

Movin' Out

Moving upwards and outwards by installing the IDE on my iMac and (I hope) getting the files all on my dropbox account so I can see them from wherever. This gives me a chance to document the process.

Go to and download the Mac OS X software (v1.01 today). Open the zip file and move to the applications folder. Run it.

Open preferences and set the sketchbook location to ...dropbox/Arduino.

Go to adafruit for the individual product shields (e.g. and get the relevant libraries (e.g. today I got SD, RTClib, AFMotor, and AccelStepper). Download the zip from the github site, then copy the unzipped directory into the ...dropbox/Arduino/libraries directory. Rename the copied library to its base name, e.g. ...dropbox/Arduino/libraries/SD/.

Restart the Arduino App so it can find the libraries. This would be a good time to add it to the launch bar, or wherever.

Make sure to set Tools/Board to the Arduino UNO (or as appropriate) and Tools/Serial to /dev/tty.usbmodemfd141 (or as appropriate).

Once that was done the new installation appears to be working like a charm and the screen real estate available makes the environment much more usable!

Now for the question of how to turn a PWM output into a fairly stable voltage output. I seem to remember something about RC circuits being involved, a load resistor and an adequate capacitor to smooth it. I'll puzzle it out. has something to say about PWM, but it looks like the suggestions mess up other timekeeping functions on the board.

Sunday, 27 May 2012

Questions Remain (Answers Elude)

Answers to these questions may get added later. More questions will definitely get added. Red ones are still unresolved.

What is it about the Data Logging Shield that makes it incompatible with the Arduino MEGA? It would be really useful to have it work on that board with the additional ports. Details are now on Adafruit.

Why is the file creation time stamp on the logger not correct? provides code to get the date right with the distributed SD library. Implemented in RWSloggerV2.

Why do so many of the examples use raw output rather than sprintf() to format? Is it a code size thing for stdio.h? BareMinimum compiles to 466 Bytes with a completely null program. Add an 80 char string and print a line to serial in setup gets it to 1996 bytes. Include stdio.h for no change. sprintf() the same test line jumps it to 2066 bytes. Put a more complicated sprintf() in the loop function and it jumps to 3674 bytes, so it doesn't seem like a big problem.

How do I create libraries of my own to use in sketches? It would make the sketches a lot less cluttered if I could put my own standard setup code in a library. It really is as simple as it looks: create a .h and .cpp file and put them in the libraries file tree.

What should be the DC voltage on the power supply to the Motor Shield? I attached a 20 volt supply from an old acer laptop and ran the hobby motors up to about 6 V PWM without letting any of the smoke out. I think the driver chips are good to 24V, but not 100% sure.

What are the voltage / current ratings on the little hobby motors that come with the starter kits?

How about the steppers labelled PF35T-48L4?

Can I get the serial port window to open automatically on program start after the upload? Maybe not, but the little magnifying glass on the right at the top will open it when you push it.

The Screw Terminal Shield

Assembly went smoothly per instructions in about 15 minutes. Then the adventures began.

I didn't realize the red LED wasn't connected to anything, so I read a little farther and added a wire to link pin 13 and the LED, which snakes neatly between the pin header and the screw terminals.

I plugged it in and started using it with the Data Logger Shield, linking the 3.3 volt supply to the analog reference as suggested (green wire). This led to confusing results as the 3.3 pin was only making intermittent contact with the UNO board due to mechanical interference.

The Dremelled cutout (upper left) clears the USB port on the UNO and doesn't eat any of the proto board holes.

Adafruit recommends trimming the pins on the reset switch (lower left) but there were still clearance problems. I Dremelled the two left most pin joints flush, then cut away a bunch of the plastic from the power connector on the UNO. The package fits together much better now and the 3.3 V signal is reliably there.

Another little detail: The projecting posts from the screw terminals risk shorting to components on the breadboard when used with the Adafruit Experimentation Kit. Cutting them off short seemed like a good pre-emptive strike.

In the beginning...

I may be late to the picnic, but one of the things I'm going to do this sabbatical is figure out how to use microcontrollers for meeting a bunch of practical objectives. I'm starting out with the Arduino and got a bunch of starter stuff from Adafruit Industries. I'm going to use this space to keep notes organized and share with others when necessary. I'm certainly not expecting a big readership ;-)

The first thing I did was assemble the Arduino UNO starter kit and plug it in. Dead simple from the instructions and the software was easy to download and install on the mac from Went through most of the experiments from the guide and managed to get almost all of them implemented on the same breadboard and operating simultaneously (Blink8 -- I'll not the names of sketches I wrote or adapted in parentheses).

I followed that up with some soldering to assemble the motor shield, data logging shield, and screw terminal shield according to instructions. So far so good. Things I learned along the way:

Be very careful with component placement! Soldering one of those tiny capacitors into the wrong location makes it really hard to remove without tearing it apart, and really hard to get the leads of the bigger capacitor into the holes that are now full of solder. Really hard, but not impossible. It will be easier with some desoldering gear.

Clearances and connections are critical! Adafruit is correctly focussed on the electronics and I got a little caught out on mechanical clearances. When mounted on the starter kit Arduino UNO, the screw terminal board's bottom contacts come almost all the way down to the breadboard. Any components plugged into the power or ground line closest to the UNO will short to the screw terminal pins. Also, the USB socket and power connector on the UNO interfere with the screw terminal shield, preventing it from seating fully and producing glitchy connections on some of the pins. Easily fixed by Dremelling a cutout for the USB, flattening the reset PB pins, and taking some of the plastic off the power connector.

Line headers up straight! The instructions are clear about using the Arduino headers as an alignment holder when soldering the pin headers on a shield. The same approach lets you use another shield to line up the socket headers when soldering them to the screw terminal shield.

A magnifier and good light are essential for middle aged eyes! Already mentioned by Adafruit, but maybe not in big enough, bold enough letters ;-)