Friday, April 11, 2014

Installing Arduino & Teensyduino on Ubuntu 14.04 (Trusty Tahr)

I have a Teensy 3.1 and a laptop running Ubuntu 14.04.

The Teensy website recommends using the Arduino software from http://arduino.cc/en/Main/Software instead of the repository (apt-get) presumably because the repository is out of date.

First I downloaded the Linux 32-bit version of Arduino 1.0.5 and extracted the folder to my Desktop.

I tried to run the "arduino" script in the folder but it failed with a java not found error.

drwxr-xr-x  8 --  4096 May 17  2013 .
drwxr-xr-x  3 --  4096 Apr 11 18:25 ..
-rwxr-xr-x  1 --   444 May 17  2013 arduino
drwxr-xr-x 13 --  4096 May 17  2013 examples
drwxr-xr-x  4 --  4096 May 17  2013 hardware
drwxr-xr-x  3 --  4096 May 17  2013 lib
drwxr-xr-x 18 --  4096 May 17  2013 libraries
drwxr-xr-x  3 -- 20480 May 17  2013 reference
-rw-r--r--  1 -- 37903 May 17  2013 revisions.txt
drwxr-xr-x  3 --  4096 May 17  2013 tools


*@*-Latitude-D810:~/Desktop/arduino-1.0.5$ ./arduino


./arduino: 22: ./arduino: java: not found


Ok, fair enough. Ubuntu must not have any java libs installed by default.

I found this nice stackoverflow question that deals with the dependencies required by the arduino IDE.

openjdk-6-jre is java
avr-libc and gcc-avr are c++ compiler libraries for working with atmel processors

Install all three by opening a terminal window and typing:

sudo apt-get install openjdk-6-jre avr-libc gcc-avr

168 megabytes of downloading and installing later you should be able to run the Arduino IDE using the terminal and typing "./arduino" in the folder you extracted to the desktop.


Wouldn't it be nice if you could double click the "arduino" icon (shell script) in the folder and have it run the IDE without using the command line every time?


Open a file explorer window and choose Edit>Preferences



From the "Behavior" tab select either "Run executable text files when they are opened" or "Ask each time"


Now you will be able to double click the "arduino" icon and have the script automatically execute.



Now we need to get the Arduino IDE working with the Teensy 3.1.

PJRC (maker of the teensy) has an explanation of how to install their add-on to the Arduino IDE called "Teensyduino" here.

I'm going to take you through the process step by step.

Download the Linux Installer (32 or 64-bit) from PJRC.

Once downloaded you have to change the file to be executable.
Right click on "teensyduino.32bit" (or 64bit) and choose "Properties"


 Check the "Allow executing file as program" box.

Now you should be able to double click on the "teensyduino.32bit" (or 64bit) icon and the installer will run.

Select the Arduino IDE folder and the "Next" button should activate.


Click "Next" then choose all the support libraries you want to install. I usually just install all of them.


Next we install the "udev-rules" from PJRC which let us send programs to the Teensy over the USB connection.

Save the "Linux udev rules" file to your computer from the PJRC website.



 Open the terminal again and go to where you downloaded the file and copy it to /etc/udev/rules.d/

*@*-Latitude-D810:~$ cd Downloads
*@*-Latitude-D810:~/Downloads$ ls
49-teensy.rules  arduino-1.0.5-linux32.tgz  teensyduino.32bit

*@*-Latitude-D810:~/Downloads$ sudo cp 49-teensy.rules /etc/udev/rules.d/



Now that the Teensy libraries are installed we need to start up the Arduino IDE and select the Teensy 3.1 as our development board.

Open the Arduino IDE and choose Tools>Board>Teensy 3.1




If all the above steps have been completed you should be able to plug in your Teensy 3.1 to a USB port and upload a sketch.

3 comments:

  1. Dear you have installed the arduino which has COM as its serial port and not ttyUSB. Please check.

    ReplyDelete
    Replies
    1. Not sure I understand you. The key to getting the Teensy to communicate are these lines from the udev rules file:

      ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", ENV{ID_MM_DEVICE_IGNORE}="1"
      ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", ENV{MTP_NO_PROBE}="1"
      SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", MODE:="0666"
      KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", MODE:="0666"

      Delete

all the entries

Mastodon