Skip to content

Arduino Installation and Setup for kap tx1

David Wheeler edited this page Mar 22, 2015 · 1 revision

This page describes how to install the Arduino IDE for the first time, how to install the necessary libraries and add-ons for this project, and how to build and download the project code.

The overall process is fairly straighforward:

  • Install the Arduino IDE.
  • Install GFX and SHARP Memory Display libraries from Adafruit.
  • Install support for Sparkfun's Pro Micro Arduino.
  • Download the project files
  • Compile the project and download code to the target system.

Someone with experience developing software might find the above instructions sufficient. But in order to make this project available to non-programmers, the instructions below provide step-by-step instructions with links to the relevant components.

Download the Arduino IDE

  • Visit the home page for Arduino:
  • Click the Download link in the menu bar near the top of the page.
  • Select the appropriate installer for your operating system. Download it.

I recommend using the most current version available. At the time of this writing, March 2015, this is 1.6.1

Install Arduino

Use the Getting Started instructions found on Arduino's site to install the software:

There are links there for Windows, Mac and various linux distributions. Use whichever one applies to your case.

Note: The rest of this section applies to linux installations. Please skip it if you are using Windows or Mac.

Installing for linux (and Ubuntu 14.04 in particular, which I use) is a little more complicated than you might expect. This is due to the fact that you have to install an older version first, then update the installation with the package downloaded earlier. So here are the detailed steps I followed:

sudo apt-get install arduino arduino-core

At this point you will see a dialog box asking if you want to add your user to the dialout group. Click 'add'. This gives your user id permission to open the serial port, which is key to downloading code later.

# where you saved the downloaded Arduino files
cd ~/Downloads  

# use the name of the file you downloaded
tar xf arduino-1.6.1-linux64.tar.xz    

# move old arduino files out of the way, install new.
# use filenames based on the version you downloaded.    
cd /usr/share
sudo mv arduino arduino-old
sudo mv ~/Downloads/arduino-1.6.1 arduino
cd /usr/bin
sudo mv arduino arduino-old
sudo ln -s /usr/share/arduino/arduino arduino

Now would be a good time to log out and log back in so that dialout group setting takes effect.

Launch Arduino

  • Launch the Arduino IDE

You should now see the Arduino IDE Window with a new, blank "sketch" (program).

Download and Install GFX libraries

Now that we have an Arduino development environment, we need to augment it with libraries from Adafruit that provide the LCD and graphics capabilities for the KAP transmitter.

Note: in the next few steps we download .ZIP files but there's no need to extract their contents.

At this point, start the Arduino IDE if it isn't still open from the previous step.

  • In the Arduino IDE, select Sketch -> Import Library... -> Add Library...
  • select the file we just downloaded.
  • Click OK.
  • Again, select Sketch -> Import Library... -> Add Library...
  • select the file,
  • Click OK.

Download the kap-tx1 project files

Now we'll get the source code for the kap-tx1 project and open it in the Arduino IDE.

  • Visit the kap-tx1 project home page:
  • click "Download ZIP", at the bottom of the right column.
  • Save the file
  • Extract the contents to get a directory called kap-tx-master
  • Rename kap-tx-master directory to just kap-tx
  • Move the kap-tx directory into your "Arduino" folder
    • On Linux your Arduino folder is ~/Arduino/
    • On Windows your Arduino folder is My Documents/Arduino

Compile the code (test build)

Now that the project code is in place, we should be able to compile it. At this point, though, the Arduino IDE hasn't been set up to support the Sparkfun Pro Micro board. Nonetheless, lets test the IDE and downloaded code by trying to compile it.

  • Start the Arduino IDE if it isn't open from previous steps.
  • Select File -> Open...
  • Navigate down from the Arduino directory into kap-tx1/Arduino/kaptx
  • Select the file kaptx.ino and click Open.

A new Arduino window should open, containing the project source code.

  • Click the compile icon. Near the top of the IDE, there's a line of icons. The compile icon is the one on the far left: a check mark in a circle.

Compilation takes a few seconds. After, the status message, "Done compiling." appears near the bottom of the IDE. Below that is the output from the compiler:

Sketch uses 19,814 bytes (61%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,888 bytes (92%) of dynamic memory, leaving 160 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur.

The actual messages will change as updates are made to the project.

This means we're able to build the software. The next step is to install support for our actual processor board, the Sparkfun Pro Micro.

Download and Install Sparkfun's Arduino Pro Micro support

  • Browse to Sparkfun's hookup guide for the Arduino Pro Micro:
  • Search for "Installing: Windows" or "Installing: Mac & Linux" on this page.
  • For Windows users:
    • Follow the steps 1 - 4 on that page to install the USB driver
    • Follow the instructions on installing the Arduino Addon
  • For Mac and Linux users:
    • Follow the instructions on installing the Arduino Addon

Let's test this out now.

  • Exit the Arduino IDE
  • Plug in your Arduino Pro Micro device via USB
  • Start the Arduino IDE again
  • Open the kaptx.ino file again (File->Open...)
  • Select Tools -> Board
    • You should now see "Sparkfun Pro Micro 5V/16MHz" and some other Sparkfun options.
    • Select Sparkfun Pro Micro 5V/16MHz
  • Select Tools -> Port
    • Windows: Select the COM port with a high number (e.g. COM14)
    • Linux: Select /dev/ttyACM0
  • Select Tools -> Programmer
    • This should be set to AVRISP mkII

Compile and Download to Sparkfun Pro Micro

In theory we are now ready to compile and download the actual code. Let's try it.

  • Click the download icon. (Second icon in the icon bar at the top, an arrow pointing right inside a circle.)
  • Alternatively, select File -> Download or type Control-U.

The download should proceed and you will see the message "Done uploading." after a few seconds.

If you see that, the Arduino is now running the project code!

The code is also stored internally within the Arduino module. So if you disconnect it and power it up, it will start running the program again, even if it isn't connected to the PC or the Arduino IDE.

Troubleshooting the serial connection.

Unfortunately, getting the serial port and download process to work can be problematic.

Sparkfun publishes a good troubleshooting guide:

If you are using Ubuntu 14.04 (or similar) OS, you may see a problem where the following error occurs: 'can't open device "/dev/ttyACM0": Device or resource busy' This isn't described in the troubleshooting guide from Sparkfun but I found the cause and a solution. The cause is interference from the Modem Manager. That process opens the serial port before the Arduino IDE gets a chance.

To resolve it, I uninstalled this unnecessary component:

sudo apt-get purge modemmanager

That's it. You can now build and run the project software on the intended target board. For questions or further discussion of this project, please email me or leave a comment on the KAP Forum:

You can’t perform that action at this time.