Sunday, February 21, 2016

LogoTurtle: Get Mac OS Working with the Adafruit Metro Mini

Getting a Mac to run LogoTurtle on the Logo Floor Turtle robot can be challenging. Windows users can run the LogoTurtle assembler program on the Adafruit Metro Mini right out of the box. But it was discovered that the Metro ships with a pre-loaded sketch that wreaks havoc on a Mac computer if it is not first overwritten by a simple Arduino sketch like Blink. Something about how Mac handles USB serial communication. Note that once you replace the sketch it ships with and load the Logo Assembler on one computer, you should be able to skip the Assembler and run LogoTurtle on any other Mac. If you are setting up several LogoTurtles, say, for a classroom or workshop, you might want load Blink then the Logo Assembler on all your Metros from one Mac, then any other Macs people use should be able to go straight to opening LogoTurtle and getting down to coding.

The Easy Way

Codebender.cc can get your Mac connected to your Metro without the pain of finding the right drivers yourself! I'll explain how to use Codebender and just for fun show you the hard way, too. UPDATED: Codebender is shutting down! So far there isn't another cloud based solution. Arduino Create does not support Adafruit boards. So for now, skip to The Hard Way.
  1. Go to codebender.cc in Chrome. Register.
  2. It should start this "Get started" business. It will ask to install a Codebender Chrome app, so do that.
  3. It will ask to install the drivers it needs. Basically here it is finding the right FTDI driver (see below) and getting you to install it.
  4. After that you can plug in the Metro. It will ask what type of board it is. They haven't added the Adafruit Metro as a supported board but you can just choose Arduino UNO as the Metro and UNO appear to work the same. Also choose your connection port, which will be one with "usbserial" in it.
That process basically does load the Blink program. The confirmation that you are connected blinks pin 13, so once it says connection successful and your Metro is blinking an onboard LED one second on, one second off, you should be able to leave Codebender and go load the LogoTurtle Assembler. I did and it worked. Now try sending your turtle some commands from the command window.

The Hard Way

The overview of the configuration is as follows:

  1. Install the correct FTDI Virtual Com Port driver.
  2. Install the Arduino IDE configuration for the correct Adafruit boards.

FTDI VCP Driver

Head over to the FTDI Chip site. Scroll down to the version download chart and take note that the correct version to download and install will be determined by your current Mac OS version.
Get the right FTDI VCP driver
When I had my students go get this driver I didn't realize this. Students still running 10.8 tried to install driver version 2.3 as per my instructions and were told by their Mac that it simply could not be installed. After some head scratching it dawned on me that not everyone rushes to install the latest Mac OS.

Adafruit Boards in Arduino IDE

If you haven't yet, download and install the Arduino IDE. Adafruit makes a lot of Arduino-compatible boards. To program them the Arduino IDE needs some additional configuration. Go to their Arduino setup page, scroll down to where this URL is posted, and copy it:

You can also read their instructions but I'm re-explaining them here because they are, IMHO, not very clear.
Now with that copied, go to the Arduino IDE, open Preferences (Arduino > Preferences), and find the place to paste the "Additional Boards Manager URL."
I also found that some students had an earler version of the Arduino IDE that didn't have this located in preferences, so you might have to hunt around for it. I opted for having them update Arduino to our current version 1.6.4. Once that is pasted in, go to the Boards Manager (Tools > Boards > Boards Manager).








Then scroll down to the Adafruit AVR Boards section, where you will see the Adafruit Metro among the other boards. Click Install.

Now restart the Arduino IDE so it becomes aware of this change in configuration. To make sure the configuration is set, go back to the boards selection (Tools > Boards) and make sure you see the Adafruit Metro as an option.
Now open the Blink sketch, File > Examples > Basic > Blink, make sure the Metro is selected under Tools > Boards, make sure usbserial is selected under Tools > Ports, and upload to the Metro. Look for the blinking red LED on the Metro and you are now ready to load the LogoTurtle Assembler!

No comments :