the challenge: FIRMATA over Ethernet Shield w MultiSerialMega and SPI

I decided to repost this as a new topic because I’ve found very little on using Firmata over Ethernet, so hopefully this will help someone -
… if not at least I will be able to find it. see the original topic here for reference,116816.msg1192129.html#msg1192129>

Basically what I want to do is control two boards - both running the Firmata Library - using one Ethernet shield.

My setup is>

|A|- ArduinoMega 2560 + Seeed Ethernet Shield (v1) + [sketch1]
pins[17,18][5v,grd] tied to
pins[1,0][vin,grnd] on
|B|ArduinoUno R3 + Arduino Motor Shield(external power supply) + [sketch2]

Im able to connect board A no problem but can’t seem to ping or connect to board B

My Sketches are based on the ‘StandardFirmataEthernet’ sketch which can be found here>

it requires you to overwrite the current Ethernet library - but it works great with just one device.

On the host side(PC) Im using the PyFirmata library for Python>

Im also using HW VSP3 - Virtual Serial Port to create my socket for PySerial, but Id like to get that written into my code >

first let me show you my code…

Here is my Python code for the client/controller, which is currently being run from a Windows PC

Keep in mind that the "COM#" - is a Virtual Serial Port mapped to the ip address of my Arduino.

Nothing real special here, just for testing a few pins. I have not written in my attempt to establish a second connection yet, but it should be no different than the first.

# -*- coding: utf-8 -*-
                #                .~- ~-.
                #                 Created on 1/7/13
                #                   @author: paul
                #                 ~ Monster Project ~

from pyfirmata import *

# try: board = Arduino('/dev/ttyACM1')
# except: board = Arduino('/dev/ttyACM0')
#     except:

    board = ArduinoMega('COM3')
    print '''
    lights are on but nobodys home
            CONN FAILED

motora = 11
motorb = 3
temp1 = 5
light = 13[motora]._set_mode(PWM)[motorb]._set_mode(PWM)[light]._set_mode(PWM)


it = util.Iterator(board)

def lspd(x):[motora].write(x)

def rspd(x):[motorb].write(x)

def readtemp():
    return board.analog[temp1].read()

def setlight(x):[light].write(x)

that together with > and one device should work just fine..

My thought is to sort of splice together StandardFirmataEthernet with MultiSerialMega.ino

  Mega multple serial test

 Receives from the main serial port, sends to the others. 
 Receives from serial port 1, sends to the main serial (Serial 0).

 This example works only on the Arduino Mega

 The circuit: 
 * Any serial device attached to Serial port 1
 * Serial monitor open on Serial port 0:

 created 30 Dec. 2008
 modified 20 May 2012
 by Tom Igoe & Jed Roach

 This example code is in the public domain.


void setup() {
  // initialize both serial ports:

void loop() {
  // read from port 1, send to port 0:
  if (Serial1.available()) {
    int inByte =;
  // read from port 0, send to port 1:
  if (Serial.available()) {
    int inByte =;

..which would be run on the ArduinoMega

then on the connected ArduinoUno I would be running an unmodified copy of the FirmataEthernet (with diff IP)

So the Mega would first act as sort of a 'dumb hub' passing along all ethernet data to Serial1 before looking at it itself.

I guess my first question is regarding the MultiSerial bit - I wonder should I change >

FirmataClass firmata(ethernet);

to> FirmataClass firmata(serial);

then move everything out of the main loop and just do something like>

void setup() {
  // initialize both serial ports:

void loop() {
  // read from port 1, send to port 0:

  ser = [Serial,Serial1]

  if (ethernet.available()) {
    int inByte =;
  if (ser.available()) {
    int inByte =;