Clodiuno - Clojure API for Arduino

Clodiuno is a library that allows you to control Arduino using Clojure allowing Clojure developers to interface with real world using Arduino hardware.

Currently Clodiuno supports two interfaces, you can either use the USB connection via Firmata or you can connect to your Arduino using WiFi via WiShield.

Dependencies (Firmata)

Firmata is a serial binary protocol, to get Java communicate via Serial Port there are two options, JavaComm API and rxtx API. Clodiuno uses rxtx, because thats what Arduino IDE uses, you already have the Jars required installed with your Arduino installation.

From your Arduino installation copy,

  • RXTXcomm.jar
  • librxtxSerial.jnilib (OS X Users)
  • librxtxSerial.dll (Windows Users)
  • librxtxSerial.so (Linux Users)

into your Java extensions folder, if you choose to place the Jars somewhere else make sure to set your Java library path to point to that folder too.

For Mac OS X users they are located inside the application bundle,

open /Applications/Arduino.app/Contents/Resources/Java/

Also if you are on Mac OS X, make sure you use 32 bit Java, otherwise RXTX won't work.

Dependencies (WiShield)

None.

Installation

Clodiuno is also available via Clojars, for now only Mac OS X native dependencies are available on clojars.

(defproject arduino-project "1.0.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.2.0"]
                 [org.clojure/clojure-contrib "1.2.0"]
                 [clodiuno "0.0.3-SNAPSHOT"]]
  :native-dependencies [[org.clojars.nakkaya/rxtx-macosx-native-deps "2.1.7"]]
  :dev-dependencies [[native-deps "1.0.5"]]
  :jvm-opts ["-Djava.library.path=./native/macosx/x86/"
             "-d32"
             "-server"])

For Firmata Interface

You need to upload Firmata sketch to your Arduino,

File -> Examples -> Firmata -> StandartFirmata

For WiShield Interface

Make sure WiShield library is configured to compile and run SocketApp sketch, once configured you can upload the wishield sketch located in the resources folder.

Usage

resources/examples/ folder contains examples to give a feel for the API, I also have the following hacks using Clodiuno,

Source

Project is hosted at github, grab it here.

License

Beerware Revision 42