Friday, February 24, 2017

Arduino Programming in ChromeOS

Are you ready to turn your Chromebook into a lean mean Arduino programming machine? No? Maybe? Great!

I've recently gotten into microcontroller programming, chasing dreams of electric guitar fueled audio bliss. Several microcontrollers have played the role of distortion effects prototype, and I haven't settled on one yet, but I can say the easiest I've found to use so far are the ones produced by Arduino. In fact, you can set up a Chromebook as development environment for programming an Arduino.

Here are the steps you'll need complete this amazing Chromebook transformation. Note that there are some risks in tweaking the setup of your machine.

First you'll need to enter developer mode, hold down escape and refresh while pressing the power button. Then on the warning boot screen, press ctrl+d.

Then, install Crouton. Here's a helpful download link: https://goo.gl/fd3zc

Then run Crouton setup by entering the terminal, which is done by hitting ctrl+alt+t then run shell (type shell followed by enter). I ran my setup like this: sudo sh ~/Downloads/crouton -r trusty -t xfce.

To run once installed, use sudo startxfce4

Now its time to get the development environment for Arduino. There are some helpful instructions here: http://playground.arduino.cc/Linux/Ubuntu

I've set up a couple of Chromebooks with the Arduino dev environment and as time has gone on, the approach has changed a bit. In my first setup, I did the following to install it:
sudo apt-get update && sudo apt-get install arduino arduino-core 
I then tried running arduino as root (sudo ./arduino ), but had the following error:

error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

Ah, there was a missing dependency, which I was able to install as follows:

sudo apt-get install libncurses5-dev

In a later version of Arduino's software, I got the following after downloading the Arduino IDE and running sudo ./install then sudo ./arduino:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/.../arduino-1.6.13/java/lib/i386/libsplashscreen.so: libX11.so.6: cannot open shared object file: No such file or directory

I resolved a sequence of errors by installing the following
sudo apt-get install libX11-6:i386
sudo apt install libxext6:i386
sudo apt-get install libxrender1:i386
sudo apt-get install libXtst6:i386
sudo apt-get install libXi6:i386
sudo apt-get install libstdc++6:i386

I also edited the audino file, which is an executable script, and removed the reference to GTKLookAndFeel. This allowed me to run the Arduino IDE without having to replace my installation of Java.

From there I've been able to compile programs and upload them to the Arduino to my hearts content. Happy coding!