Trying out the Adafruit WebIDE on my Raspberry Pi

Screenshot Adafruit WebIDE

Screenshot Adafruit Learning System Raspberry Pi WebIDE

The Adafruit WebIDE is a web-based editor (Integrated Development Environment) designed to run on the Raspberry Pi similar to the Cloud9 IDE. Because it’s entirely web-based there’s no need to install any software on your computer, just launch a browser and connect to your Pi.

First I wanted to try it on Arch Linux ARM but because of lots of segmentation faults in npm, the package manager of Node.js, I was not able to completely install the IDE.

Now I will try it on Raspbian “wheezy”.

Install Raspbian on your RPi

  1. Download the latest Raspbian image from
  2. Copy the image to your Raspberry Pi SD card:
[chris@thinkpad Downloads]$ unzip
  inflating: 2012-12-16-wheezy-raspbian.img
[chris@thinkpad Downloads]$ sudo dd if=2012-12-16-wheezy-raspbian.img of=/dev/mmcblk0
3788800+0 records in
3788800+0 records out
1939865600 bytes (1.9 GB) copied, 529.273 s, 3.7 MB/s
[chris@thinkpad Downloads]$
  1. Use gparted to resize the the partitions on your SD card as you like or use sudo raspi-config and select Expand root partition to fill SD card later under Raspbian to do this.
  2. Mount the SD card and check that the serial console is enabled:
[chris@thinkpad ~]$ sudo mkdir /mnt/rpi
[chris@thinkpad ~]$ sudo mount /dev/mmcblk0p2 /mnt/rpi
[chris@thinkpad ~]$ sudo vim /mnt/rpi/etc/inittab
[chris@thinkpad ~]$ tail -n 2 /mnt/rpi/etc/inittab
#Spawn a getty on Raspberry Pi serial line
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
[chris@thinkpad ~]$ # copy other stuff to the SD card
[chris@thinkpad ~]$ sudo umount /mnt/rpi
[chris@thinkpad ~]$
  1. Boot Raspbian and open a console, I’m using no display on my Raspberry Pi but a 3V3 FTDI USB serial cable, see and for more details.

    You will need to connect the pins Ground, GPIO 14 (TXD) and GPIO 15 (RXD).

  2. Open a serial console, configuration: /dev/ttyUSB0 : 115200,8,N,1, you may need to hit a few times enter until the login prompt is visible, then login as user pi with password raspberry.

    Gtkterm RPi

    Gtkterm is a simple GTK+ terminal used to communicate with a serial port.

    You can also use screen sudo screen /dev/ttyUSB0 115200 or minicom to open the serial port.

  3. Get a network connection on your Pi via Ethernet, WiFi or 3G.

Install the Adafruit WebIDE

Update and install the dependencies:

pi@raspberrypi:~$ sudo apt-get update
pi@raspberrypi:~$ sudo apt-get upgrade
pi@raspberrypi:~$ sudo apt-get install nodejs npm redis-server git vim

Install the Adafruit-WebIDE:

pi@raspberrypi:~$ git clone git://
Cloning into 'Adafruit-WebIDE'...
remote: Counting objects: 3769, done.
remote: Compressing objects: 100% (1628/1628), done.
remote: Total 3769 (delta 2164), reused 3618 (delta 2013)
Receiving objects: 100% (3769/3769), 19.34 MiB | 734 KiB/s, done.
Resolving deltas: 100% (2164/2164), done.
pi@raspberrypi:~$ cd Adafruit-WebIDE
pi@raspberrypi:~/Adafruit-WebIDE$ mkdir tmp
pi@raspberrypi:~/Adafruit-WebIDE$ npm config set tmp tmp
pi@raspberrypi:~/Adafruit-WebIDE$ npm install

Just try it again if you get the error npm ERR! Error: failed to fetch from registry or something similar, npm is really stupid, a slow 3G connection is not fast enough for npm to install everything, probably because npm tries to download multiple packages simultaneously, this is the problem when everybody invents his own package manager, apt-get has no problem with slow network connections, it may take a bit longer but it works. It will download roughly 100 MB, I don’t know for what all these dependencies are necessary, as long as it works I don’t care.

The next problem:

> gnu-tools@0.0.8 postinstall /home/pi/Adafruit-WebIDE/node_modules/jsDAV/node_modules/gnu-tools
> node ./install.js

sh: 1: node: not found
npm ERR! error installing gnu-tools@0.0.8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
npm WARN /usr/share/doc/nodejs/README.Debian
npm WARN
npm ERR! error installing jsDAV@0.1.4

npm ERR! gnu-tools@0.0.8 postinstall: `node ./install.js`
npm ERR! `sh "-c" "node ./install.js"` failed with 127
npm ERR!
npm ERR! Failed at the gnu-tools@0.0.8 postinstall script.
npm ERR! This is most likely a problem with the gnu-tools package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls gnu-tools
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 3.2.27+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/pi/Adafruit-WebIDE
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message gnu-tools@0.0.8 postinstall: `node ./install.js`
npm ERR! message `sh "-c" "node ./install.js"` failed with 127
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/Adafruit-WebIDE/npm-debug.log
npm not ok

To fix this error we can create a symlink from /usr/bin/nodejs to /usr/bin/node and rerun npm install:

pi@raspberrypi:~/Adafruit-WebIDE$ which node
pi@raspberrypi:~/Adafruit-WebIDE$ which nodejs
pi@raspberrypi:~/Adafruit-WebIDE$ sudo ln -s /usr/bin/nodejs /usr/bin/node
pi@raspberrypi:~/Adafruit-WebIDE$ npm install

Edit config/config.js and change the port from "port": 80, to "port": 8080,:

pi@raspberrypi ~/Adafruit-WebIDE $ vim config/config.js
pi@raspberrypi ~/Adafruit-WebIDE $ head -4 config/config.js
//NOTE: Changes in this file will not persist between updates at this point.
//Change port number in /config.
exports.editor = {
  "port": 8080,
pi@raspberrypi ~/Adafruit-WebIDE $

Now it should be possible to run the Adafruit WebIDE:

pi@raspberrypi:~/Adafruit-WebIDE$ node server.js
git push queue init
REPOSITORY_PATH /home/pi/Adafruit-WebIDE/repositories
info: Logger initialized!
  info  - started
webdav filesystem mounted

Find out the IP of your Pi, open a browser and point it to

pi@raspberrypi ~/Adafruit-WebIDE $ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr b5:33:ff:33:ee:aq
          inet addr:  Bcast:  Mask:
          RX packets:21867 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8684 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:27338495 (26.0 MiB)  TX bytes:1268356 (1.2 MiB)

pi@raspberrypi ~/Adafruit-WebIDE $
Screenshot Adafruit WebIDE setup

Screenshot Adafruit WebIDE setup

One of the many useful features of the WebIDE is that all of your code will be stored in the cloud over at So, before we can go any further, you will want to create your free Bitbucket account. If you already have one, you can use your existing account, or create one specifically for the Raspberry Pi WebIDE.

I don’t know if I should love or hate this feature but since I have already a free Bitbucket account I will do it.

Raspberry Pi WebIDE is requesting read and write access to your public and private repositories.

Raspberry Pi WebIDE is requesting read and write access to your public and private repositories.

The good thing is, that it will create a private Git repository (my-pi-projects), so my code is by default not visible to everybody and I have always a backup.

Test it

First test if the hardware is working correctly, I’ve connected a single LED to GPIO.17 and V3.3, lets switch it on and off from the terminal:

pi@raspberrypi ~ $ sudo sh -c "echo 17 > /sys/class/gpio/export"
pi@raspberrypi ~ $ sudo sh -c "echo out > /sys/class/gpio/gpio17/direction"
pi@raspberrypi ~ $ sudo sh -c "echo 1 > /sys/class/gpio/gpio17/value"
pi@raspberrypi ~ $ sudo sh -c "echo 0 > /sys/class/gpio/gpio17/value"
pi@raspberrypi ~ $
Raspberry Pi with red LED

Raspberry Pi with red LED

The Adafruit WebIDE has also a built-in terminal, so we can do it there too.

Adafruit WebIDE built-in terminal

Adafruit WebIDE built-in terminal

Now we will write a small python script to toggle the LED:

Adafruit WebIDE python script

Adafruit WebIDE python script

The WebIDE feels really good even Crtl+C is working if you want to stop a program.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from time import sleep
from leds import *

print("Hello World")

setpindirection(17, "out")

counter = 0
    writepins(17, 1)
    ledon() # switch on the green OK led
    writepins(17, 0)
    ledoff() # switch off the green OK led
    print("counter: %i" % counter)

#!/usr/bin/env python
# coding=utf8

def ledon():
    value = open("/sys/class/leds/led0/brightness","w")

def ledoff():
    value = open("/sys/class/leds/led0/brightness","w")

def ledheartbeat():
    value = open("/sys/class/leds/led0/trigger","w")

def export_pins(pins):
        f = open("/sys/class/gpio/export","w")
    except IOError:
        print "GPIO %s already Exists, so skipping export gpio" % (str(pins), )

def unexport_pins(pins):
        f = open("/sys/class/gpio/unexport","w")
    except IOError:
        print "GPIO %s is not found, so skipping unexport gpio" % (str(pins), )

def setpindirection(pin_no, pin_direction):
    gpiopin = "gpio%s" % (str(pin_no), )
    pin = open("/sys/class/gpio/"+gpiopin+"/direction","w")

def writepins(pin_no, pin_value):
    gpiopin = "gpio%s" % (str(pin_no), )
    pin = open("/sys/class/gpio/"+gpiopin+"/value","w")
    if pin_value == 1:

def readpins(pin_no):
    gpiopin = "gpio%s" % (str(pin_no), )
    pin = open("/sys/class/gpio/"+gpiopin+"/value","r")
    value =
    print "The value on the PIN %s is : %s" % (str(pin_no), str(value))
    return int(value)