Latest Updates: arduino RSS

  • Configure Yun and install Node

    Ellen 17:21 on November 4, 2014 | 0 Permalink | Reply
    Tags: arduino, , , yun

    Turn your Arduino on by connecting the micro-usb cable. It will get it’s own access point that you connect to. When connected type in http://arduino.local into your browser and you will get into the page of the Arduino Yun. Password comes preconfiguired as “arduino”.

    If http://arduino.local doesn’t work. Check the IP adress of your network ie and type it in but replace the last digit with 1 so it becomes

    Type in the details of your wifi network so that the Arduino can connect to internet. Configure and restart. No connect to your wifi network that has internet connection.

    Now open the Terminal and type:

    ssh root@arduino.local

    You will be required to type in the password you set earlier.

    Upgrade OpenWrt
    Download the upgrade for OpenWrt to the SD card via the Terminal.

    cd /mnt/sda1/

    Install unzip and unzip the package

    opkg update
    opkg install unzip

    Install upgrade

    run-sysupgrade /mnt/sda1/openwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade.bin

    The output will look like this:

    run-sysupgrade /mnt/sda1/openwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade.bin
    Sending TERM to remaining processes … uhttpd dbus-daemon dnsmasq avahi-daemon thd ntpd uSDaemon sleep syslogd klogd hotplug2 procd ubusd netifd
    Sending KILL to remaining processes …
    Switching to ramdisk…
    Performing system upgrade…
    Unlocking firmware …
    Writing from  to firmware …
    Upgrade completed
    Rebooting system…

    When the process is done you see “Rebooting system…”.

    The Arduino Yun has now gone back to its original settnings. Connect to it with its access point and hook it up to your wifi again. Make it a habit to change name and password for future security.

    Format SD card
    To format the SD card and assign more disk space to OpenWrt follow these steps. All is copied from

    Upload YunDiskSpaceExpander sketch to your Arduino Yun via USB (not over wifi). Make sure that your Arduino Yun is connected to the wifi for this procedure though.

    If you experienced problems uploading the sketch make sure that the Arduino Yun is listed as a known host on your computer with

    Click on the Serial Monitor-button to get started. Write yes to proceed. Make sure that you have “Newline” selected.

    When bridge started write yes to proceed:

    Proceed to partitioning micro SD card and write yes. Then enter the number of MB for data partition.

    The instructions invites you to press the Yun RST button when it is done. The Yun RST button reboots the Arduino Yun and is placed close to the LEDs.

    When the Arduino Yun restarts you can ssh into it and confirm the partition with:

    df -h / /mnt/sda1

    It should look something like:

    Install node
    To install node on your Arduino Yun, enter:

    opkg update
    opkg install node

    To talk to the Arduino part from OpenWrt install the node package serial-port.

    opkg update
    opkg install node-serialport

    Open the serial port for Node so communication between Arduino and OpenWrt can be done:

    vi /etc/inittab

    Add # in front of the last line to comment it out. In the vi editor press i to insert text.

    #ttyATH0::askfirst:/bin/ash –login

    Press Esc and write “:w!” to save and “:q!” to quit editor.

    Now reboot your Arduino Yun and we will get some code going!

    Example code of calling an Arduino sketch from node:

    var SerialPort = require("serialport").SerialPort
    var serialPort = new SerialPort("/dev/ttyATH0", {
        baudrate: 9600,
        dataBits: 8,
        parity: ‘none’,
        stopBits: 1,
        flowControl: false
    }, false);

    serialPort.on("open", function () {
    var data_with_newline = "mydata/n";
         serialPort.write(data_with_newline, function(err, results) {      
          log("send data");
          if(err != undefined) {            
            log(‘err ‘ + err);      

        serialPort.on(‘data’, function(data) {
            log(‘data received: ‘ + data);

      serialPort.on(‘error’, function(err) {
          log(‘error: ‘+err);

    The Arduino sketch receving the data:

    char incomingChar;
    bool incomingCodeReceived = true;

    void setup() {
     while (Serial1.available() > 0 && !incomingCodeReceived) {
       incomingChar =;
       if (incomingChar == \n) {
          incomingCodeReceived = true;
        } else {
        if ((incomingStrLength + 1) < INCOMING_STR_SIZE) {
            incomingStr[incomingStrLength] = incomingChar;
            incomingStrLength += 1;
          } else {
            incomingStrLength = 0;

    void loop() {

    Install forever on Yun

    The Yun doesn’t have enough memory to install this module on its own so the version I use can be downloaded here:

    Make sure your forever module is executable:

    chmod u+x /root/node_modules/forever/bin/forever

    Try it out by typing:


    Crontab on the Yun
    You might want to run a Cron job on your Yun. This can be done by typing:

    /etc/init.d/cron start
    /etc/init.d/cron enable

    Edit your Crontab as you normally do with:

    crontab -e

    Setting static IP of an Arduino Yun
    Soon to be published

  • Raspberry Pi with Node.js and Alamode

    Ellen 15:52 on July 1, 2014 | 0 Permalink | Reply
    Tags: alamode, arduino, , , serial port


    For this tutorial I use the latest Raspbian version from

    Setup Alamode
    Install the arduino IDE on the Raspberry

    sudo apt-get update
    sudo apt-get install arduino

    Get the Alamode setup files and install them by following these steps:

    git clone git://
    cd /alamode/alamode-setup
    sudo ./setup

    In order for these setting to take effect, please reboot your Raspberry PI:

    sudo reboot

    Load an Alamode sketch
    If you don’t have your Raspberry Pi connected to screen, keyboard and mouse you can access the GUI from your computer. I have a Mac and use XQuartz.

    As you start XQuartx open the Terminal in this application with Command + N and log into your Raspberry Pi like this:

    ssh -X user@ipaddress

    When you are logged in, just type:


    and the Arduino IDE will start up on your computer.

    The Alamode setup added the Alamode board to your Arduino IDE. Select it by
    Tools > Board > Alamode
    Tools > Serial Port > /dev/ttyAMA0

    Copy the following code and paste it (Ctrl+V) into a new sketch. Put an LED into ground and pin 13 on your Alamode.

    void setup()
      pinMode(13, OUTPUT);

    void loop()
      char inSerial[5];  
      int i=0;
      if (Serial.available() > 0)
           while (Serial.available() > 0) {
             inSerial[i]; //read data  
           if(!strcmp(inSerial,"high")) {
            digitalWrite(13, HIGH);
          if(!strcmp(inSerial,"low")) {
            digitalWrite(13, LOW);

    To send data from Alamode to Arduino, just write to the serial port with:


    Install node.js

    tar xvfz node-v0.10.12-linux-arm-pi.tar.gz
    sudo mv node-v0.10.12-linux-arm-pi /opt/node/

    Set the path to node.js:

    echo‘export PATH="$PATH:/opt/node/bin"’ >> ~/.bashrc
    source ~/.bashrc

    Install serialport
    To communicate between the Alamode and node.js we need the serialport package for node.js:

    npm install serialport

    More information on:
    Node.js coding

    var SerialPort = require("serialport").SerialPort
    var serialPort = new SerialPort("/dev/ttyAMA0", {
    baudrate: 9600
    }, false); // this is the openImmediately flag [default is true] () {

    Trigger this command and “high” will be sent to the Alamode

    // Sends "high" to the Alamode
    serialPort.write("high", function(err, results) {
          if(err != undefined) {
                console.log(‘err ‘ + err);

    To receive serial data from the Alamode, listen for data with this code: () {
          serialPort.on(‘data’, function(data) {
                console.log(‘data received: ‘ + data);
                if(data == "alamode_data") {
                     // Do something

    External power
    If you are dealing with many power consuming sensors on your Alamode, it’s a good idea to power your Alamode externally with its own 5V power adapter.

  • Heavy duty pull sensors

    Ellen 18:21 on June 25, 2012 | 0 Permalink | Reply
    Tags: arduino, , ,

    Interacting with installations with a long life time we turn to heavy duty sensors that can handle a lot of cycles. The string and pull sensors below can handle more than a million cycles and are built for industrial use. They can also be connected to circuit board like Arduino.

    Check out all the pull sensors and string pots from Celesco. Novotechnik also offers a wide range of pull sensors.

    Check out this Processing and Arduino project by nhw3030 with Celesco string sensors.

  • Unity + Processing + Arduino

    Ellen 10:32 on May 31, 2012 | 18 Permalink | Reply
    Tags: arduino, , , ,

    I did a test connecting Arduino and Unity with the help of Processing and a Open Sound Control library. When I am pushing the Flexi Force sensor the values affect a cube within Unity. To get this setup do the following:

    Load the Standard Firmdata on to your Arduino. Check out a full Arduino + Processing tutorial to get the setup.

    Download the oscP5 processing library and put it in your Processing sketch folder in the folder libraries.

    Initialize oscP5 library and broadcast data to port 12000. The port Unity will listen to.
    Add the remote location to listen to on port 3200. If Unity would broadcast event in this example, the broadcast port would be set to 3200. Initialise Arduino to be used later on.

    oscP5 = new OscP5(this,12000);
      myRemoteLocation = new NetAddress("",3200);
      arduino = new Arduino(this, Arduino.list()[0], 57600);

    In the draw function we read the analoge pin 0 to get sensor values from the Flexi Force sensor. Set the OSC message to flexiforce. Unity will listen to this label. Add the message of the sensor value into the osc message with add method. This method can take numbers, strings and byte data.

    float flexiforceSensor = arduino.analogRead(0);
    OscMessage oscMess = new OscMessage("/flexiforce");

    oscP5.send(oscMess, myRemoteLocation);

    The entire Processing sketch can be seen here.

    In Unity you can import the Osc.cs and UDPPacketIO.cs to broadcast and listen to UDP data.

    Set up the corresponding host and ports in your Unity script.

    public var OSCHost : String = "";
    public var SendToPort : int = 3200;
    public var ListenerPort : int = 12000;

    Import the UDPPacketIO and Osc components and feed in the host and ports. Add your specific label of your osc message and what method to call when receiving this event from Processing.

    var udp : UDPPacketIO = GetComponent("UDPPacketIO");
    udp.init(OSCHost, SendToPort, ListenerPort);
    handler = GetComponent("Osc");
    handler.SetAddressHandler("/flexiforce", AffectObject);

    In the receiving method you can print out the label and message values. In this case the sensor value from the Flexi Force. The cube will change width when getting a new value from Processing.

    public function AffectObject(oscMessage : OscMessage) : void
            Debug.Log("Event name: " + Osc.OscMessageToString(oscMessage));
            Debug.Log("Event data: " + oscMessage.Values[0]);
            var myCube = GameObject.Find("Cube");
            var boxWidth:int = 8 - ( oscMessage.Values[0]);
            myCube.transform.localScale = Vector3(boxWidth,5,5);

  • Arduino library for LED Message Display

    Ellen 18:53 on April 15, 2012 | 17 Permalink | Reply
    Tags: arduino, Arduino library, , LED

    Making life a lot easier I wrote an Arduino library that takes care of converting strings and calculating the checksum of all commands sent to the LED Message Display. Compared to the first example of sending text to the display the library can send commands of how long the text should display, how to be animated in and out and display European characters. All included in the BockiMessageBoard library on Github.


    The code below shows how to initiate and send messages:

    #include <BockiMessageBoard.h>

    BockiMessageBoard messageBoard = BockiMessageBoard(0); // 0 is the Id of your message board

    void setup {
          // Configure the display before sending the text.
          int displayTime = 0.5; // Input 0.5 sec or 1 to 25 seconds

    void loop {
          String euroChars = "Testing with European characters <U45><U44><U76><U65><U64><U61>";

    The library generate serial data to the LED Message Display with this setup:


    <ID00> - The id of the message board.
    <L1> - Line number
    <PA> - Page id
    <FE> - How the text will appear. Scrolling, twinkeling, snowing…
    <MA> -
    <WC> - Waiting time. How long to display text.
    <FD> - How the text will disappear. Scrolling, twinkeling, snowing…
    MESSAGE - The message text to be displayed
    CHECKSUM - Hex value calculated on all tag sabove.
    <E> - End of data.

    The circuit uses a RJ14 cable to transfer the serial data to the display board:

  • Make WiShield work in latest Arduino IDE

    Ellen 17:22 on February 17, 2012 | 33 Permalink | Reply
    Tags: arduino, , wishield

    1. Download the WiShield library that has been optimized and fixed by users:

    2. Rename the folder to WiShield and put it into Arduino_sketch_folder/libraries
    You might notice that just running a sketch with the WiShield library will generate errors like:

    return type specified for ‘virtual void Server::write(uint8_t)’
    clock-arch.c:44:20: error: wiring.h: No such file or directory

    3. In order to get rid of these error you need to change the corresponding names in the following files:

    Replace #include “wiring.h” with #include “Arduino.h”

    Replace #include “WProgram.h” to #include “Arduino.h”

    Replace #include “WProgram.h” to #include “Arduino.h”
    Replace void Server::write(uint8_t.. to be size_t Server::write(uint8_t..

    Replace virtual void write(uint8_t); to virtual size_t write(uint8_t);

  • Small Ehternet access just got smaller

    Ellen 22:08 on January 12, 2012 | 0 Permalink | Reply
    Tags: arduino, arduino shield, , ethernet, freetronics


    The Arduino Ethernet shield has been around for some time now. It’s a great solution for cutting out the middle man of the computer when check things online from the Arduino. In order to build smaller cases I stumbled upon EtherTen from Freetronics. It’s a fully Arduino-compatible board that runs Arduino code AND connects to internet with Ethernet.

    Lets make a list of the pros:
    - Smaller than Arduino board with Ethernet shield on top
    - Runs Arduino Ethernet library
    - Power of Ethernet, no power supply needed (!!!!)
    - Micro SD card holder
    - And sexy round corners (rounder than the Ethernet Shield)
    - Neat mini USB socket

    When it arrived I simply ran the TwitterClient file by Tom Igoe in Ethernet examples of the Arduino IDE and it was up and running. To call my custom php file was a bit harder though. Example code to be posted on my Arduino Circuit Blog shortly.

  • My Arduino circuit blog

    Ellen 11:45 on October 31, 2011 | 4 Permalink | Reply
    Tags: arduino, curcuits,

    Whenever I make a circuit I try to document it and take photos. With the Fritzing software it gets even better. To share code and circuits I gathered my Arduino circuits on this new blog: Ellen Sundh’s Arduino Circuit Blog


  • Geek Girl Arduino Workshop

    Ellen 11:15 on October 12, 2011 | 0 Permalink | Reply
    Tags: arduino, ,

    During the Arduino Workshop with Geek Girls Meetup we went through a number of sensors. A full list will be posted here soon. Here are some images from the workshop:
    @ellensundh visarVisning av motståndsappen

  • Geek Girl Meetup 2011

    Ellen 07:10 on May 30, 2011 | 1 Permalink | Reply
    Tags: arduino, , ggm11,


    Inspiring times at this year’s Geek Girl Meetup in Stockholm. See my session on Input / Output – Creative technology with electronics where I demo some of my projects. Only in Swedish :-/

compose new post
next post/next comment
previous post/previous comment
show/hide comments
go to top