the first creature to discover water was likely not a fish

Posts Tagged ‘code

wiiHack – Montreal

leave a comment »

First notes from the wiimote weekend at Hexagram (Montreal).

Spent yesterday compiling a list of tactics for accessing data. Will post full results as today unfolds….

Connecting a chuck to an Arduino

Just give me the code!

The solution I am working on is based upon code and examples from:


TodBot — code example and developer of the physical adaptor I am using.  This is a great  resource — so you may want to start there if you are stuck


Windmeadow Labs

the adapter I am using can be found at sparkfun

High Level Map
Chuck speak I2C — a form of serial communication. You need 2 libraries to make this code work. The first is wire.h — which ships with Arduino. The second is some form of the wiiChuck libraries that others are developing. I have pulled two pieces of code from the above sites to create my solution.

There is nothing particularly novel about this stage — I just moved the power code block from Todbot over to the library from growdown. The samples I found seemed to have this missing.

I am cleaning code but this bundle is working for me. Set your serial monitor to 19200 to see the data in the Arduino environment.

Written by hex705

October 18, 2009 at 11:05 am

Posted in wii

Tagged with , ,

Communicating with Xbees

with one comment

This is a quick post — will clarify ASAP.

This post will cover a set up for communicating between two Arduinos with Xbee radios.  it is not the only solution but it is a start.  I will also describe how to organize a piece that enables a remote Arduino to communicates with processing via xBees.

I am assuming that you have configured your radios to talk to each other.

Connections for Serial Communication

When communicating between Arduinos with Xbees we need a different circuit than we used to configure the radio.  If you removed your Arduino chip to configure the radios you will need to replace it for the following to work.  Make sure you put the chip in the right way — notched end goes towards the edge of the board (I think that makes sense looking at the board, let me know).

The circuit is simple.  Power the xBee with 3.3V from the Arduino.  Next, for serial communication you need to connect two wires.  Connect Arduino RX (PIN 0) to xBee TX (labeled Dout on the xBee breakout board).  Connect Arduino Tx (PIN 1) to xBee Rx (labeled Din on the xBee breakout board).  If you have your xBee and Arduino facing the same ways as I do, your communication wires will cross over each other.  That is what you want.  (NOTE: this is different that the wiring used to configure the XBees).

Arduino talking to Xbee

Arduino talking to Xbee

Radio Connections Close-up!

Radio Connections Close-up!


Important: You will need to disconnect one end of the serial communication wires you just connected EACH time you change the code in your Arduino.  Once the code uploads you can RECONNECT the serial communication wires.

The Whole System

Here is an example that uses xBee radios as a communication bridge between two Arduinos.  You will need:

  • 2 xBee radios
  • 2 Arduinos
  • 2 LEDs
  • 1 button (switch)
  • wires, and some 1k and 10k resistors.
  • sample CODE.

The system requires the sending radio to have the serial communication connections above as well as a digital switch (button) connected to PIN 2 and an LED connected to PIN 3. The receiving side has an xBee connected as above and an LED connected to the receiving Arduino on PIN 2.


Send Circuits

Recieve Circuits

Recieve Circuits

When working this system will sense button presses, turn on the local LED and send a message via xBees to the remote Arduino. The remote Arduino receives the message and reflects the button state with its LED.

This is a one way system. I will post a two-way system later today.

Ya, But I want to Talk to Processing

If you want to talk to processing from a remote arduino then you have two choices.  Once use the system above — and receive serial from an arduino connected to the computer.


Set up a slightly different system.  I think this is an easier solution — but you may disagree.  Use xBees to replace the cable you are using for communication. (NOTE: you will still need the cable to program your arduino — this is for once you have code in place.  Using radios to code is another story).

The system should be developed and debugged with the programming cable first with radios introduced at the end.  So I will assume you have some code that allows your arduino to talk to processing already — maybe a sensor reading or similar.

Once that is working, remove the programming cable and connect an xBee to your Arduino as above in THIS post.  At the computer side where processing is running connect an xBee as if you were about to configure it (ie with a FTDI breakout or a dechipped Arduino).

If you tell processing to look at the port where you just connected an xBee you should be receiving data — just as you were with the cable.

If I need more HELP?!

As always this is coved in Tom Igoe’s Making Things Talk.

Written by hex705

November 30, 2008 at 10:34 am