How-To Guide

Basic notes on shells

  1. Shells (aka "command prompts", "terminals") give you a typing interface to your operating system. UNIX shells (e.g., Linux, Mac) are case-sensitive, Windows isn't. All shells are very sensitive to spacing.
  2. In Windows, shift+right click a folder in an Explorer window, then select Open Command Line Window.
  3. Basic commands: ls shows the contents of the current folder, cd folder_name changes the current folder to "folder_name", mkdir folder_name creates a new folder named "folder_name" in the current folder.
  4. Use the tab extensively to save typing: type the first few characters of a file name or a folder name, hit ,tab and it will complete the name for you.

Installing the USBTinyISP driver

  1. Windows: download the driver here. Extract to a folder of your choice. Then go to Device Manager and Update Driver for FabISP pointing to that folder.
  2. Mac: might be recognized automatically (please correct me if you know better).

Install AVR C:

AVR C is the compiler we use for our Atmel microcontrollers.

What do Neil's makefiles do? The plain make command (the one we run without any additional parameters) turns the (sort of) human-readable C code into machine code the microcontroller can understand. make program-usbtiny-fuses sets the external clock (crystal), so you should only run it if your board has such a crystal. make program-usbtiny loads the code unto the microcontroller.

Download and install WinAVR for Windows or CrossPack for Mac.

Install Python

Python is pre-installed on Mac, cygwin, and on some (all?) Linux distributions. To test your installation, open a terminal window and type python. You should see the Python header and the version number, followed by a prompt. Type exit() then hit enter to quit. If your get an error message saying python isn't recognized, you should install Python.

Also, on Windows you will need to install Python yourself.

  1. Download the latest Python 2.x version and install it. Python 2.x is still more common than 3.x (as of November 2011), and it's recommended to use it to avoid compatibility issues with existing code.
  2. Add the Python folder to the system path: Press Start and type Edit the Environment Variables. From the window that opens, click Environment Variables. In the bottom section, scroll down to PATH, double-click it, and at (at the beginning) C:\Python27 (or whatever folder you chose to install Python to).
  3. From the Windows command prompt (Start then cmd), test your installation as explained above.

Install Python Modules

When you run Neil's Python scripts you may get an error message from Python saying certain modules (e.g., serial) are not recognized and there the script cannot be run. This means you need to install the packages that contain these modules.

Simplest way to add a package to your local installation of Python is by using easy_install (or similar utilities such as apt_get or pip). Type easy_install from a terminal window to check if it's already installed. If not, go get it:

  1. Go to the Python setuptools page.
  2. Windows 64-bit: download to your Python directory, then open a command prompt at that directory and run python
  3. Windows 32-bit, Mac, cygwin: download the respective installation files and run them. If you get an error message that says something like "permission denied", you need to run the command as administrator (aka superuser). Do this by adding sudo before the command, e.g., sudo sh setuptools....
  4. On Windows, add either of the following directories to your system path: C:\Python27\Tools\Scripts\ or C:\Python27\Scripts -- inspect both to see to which one easy_install was added.
  5. Now use easy_install to install pySerial: easy_install pyserial
  6. If you use Python on cygwin, you should also install python-tk: easy_install python-tk

Install FTDI drivers

To be expanded...

  1. Install FTDI from FTDIchip site.

Debug with serial terminals

To be expanded...

  1. Find your serial port on Windows/Mac
  2. Find baud in the code.

All platforms: Arduino 1.0 (set port, board). Make sure to use release 1.0 that supports ATTiny (not 0.x)!

Windows only: PuTTY

Mac and Linux: screen . Use Ctrl+a Ctrl+\ to quit. Check the Screen manual.

Note: the serial port can only be opened by one application at a time!