Latest Updates: arduino RSS

  • Raspberry Pi with Node.js and Alamode

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

    alamode

    For this tutorial I use the latest Raspbian version from http://www.raspberrypi.org/downloads.

    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://github.com/wyolum/alamode.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:

    arduino

    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
    then
    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()
    {
      Serial.begin(9600);
      pinMode(13, OUTPUT);
    }

    void loop()
    {
      char inSerial[5];  
      int i=0;
      delay(1000);
     
      if (Serial.available() > 0)
      {            
           while (Serial.available() > 0) {
             inSerial[i]=Serial.read(); //read data  
             i++;      
           }
           inSerial[i]=\0;
           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:

    Serial.write("alamode_data");

    Install node.js

    wget http://nodejs.org/dist/v0.10.12/node-v0.10.12-linux-arm-pi.tar.gz
    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: https://github.com/voodootikigod/node-serialport
    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]

    serialPort.open(function () {
          console.log(‘open’);
    });

    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);
          }
          console.log(results);
          });
    });

    To receive serial data from the Alamode, listen for data with this code:

    serialPort.open(function () {
          console.log(‘open’);
          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:

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

    Processing
    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("127.0.0.1",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");
    oscMess.add(flexiforceSensor);

    oscP5.send(oscMess, myRemoteLocation);

    The entire Processing sketch can be seen here.

    Unity
    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 = "127.0.0.1";
    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.init(udp);
    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 | 13 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.

    amplus_led_message_display_sundh

    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
          messageBoard.configure(displayTime,SCROLLLEFT,VERTICALCLOSE);
    }

    void loop {
          String euroChars = "Testing with European characters <U45><U44><U76><U65><U64><U61>";
          messageBoard.displayMessage(PAGE_A,euroChars);
    }

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

    <ID00><L1><PA><FE><MA><WC><FD>MESSAGE CHECKSUM<E>

    <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:
    ethernet_led_bb

  • Make WiShield work in latest Arduino IDE

    Ellen 17:22 on February 17, 2012 | 28 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:

    clock-arch.c
    Replace #include “wiring.h” with #include “Arduino.h”

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

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

    WiServer.h
    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

    ethernet

    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

    Untitled-1

  • 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,

    badge

    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 :-/

  • Turn on lamp with iPhone 0.3

    Ellen 21:58 on May 24, 2011 | 3 Permalink | Reply
    Tags: arduino, corona sdk, , ,

    My first test of controlling the Arduino outputs from an iPhone app. I use the firmware for Arduino and a Processing script checking if the light is on or off and sending the info to the Arduino board and the lamp. Code will soon see the light here.

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
esc
cancel