Go Down

Topic: Redirecting serial port to PC via RedFly WiFi shield (Read 1 time) previous topic - next topic


Hey guys,

I have a couple of Arduinos in different projects and I would like to be able to update them without unplugging them from their locations and bring them to my PC to upload new sketches.
For that reason, I want to be able to use one of my Arduino Unos with a RedFly WiFi shield from Watterott to proxy the data for me: the "master" Uno with the WiFi shield is connected to the "slaves" Arduinos FTDI (or ISP) header.

Now I would like to just click on upload in the Arduino IDE and have the data be sent to the master via WiFi which will send the data straight to the slave and program it via FTDI.

For that I want to use "socat" (I'm using linux) to create a fake serial port that sends everything to the ip & port of my master, but I can't seem to get that to work at all. I would be happy for now if I could even get avrdude to talk to my master using -Pnet:, but it only tells me that it times out after it connected.

I'm struggling to understand how the sketch on the master would have to look like. So far I used a simple sketch: read WiFi -> send on Serial (RX/TX connected to FTDI), read on Serial -> write on WiFi. But that apparently isn't enough. I also tried running the BitLash telnet example but had no success as well (I rewrote it to work(?) with the RedFly lib, which is very similar to the Ethernet lib).

So does anyone have tips for me how I could get this running? I already tried googling all over the place for 3 days now, but wasn't able to find something that worked.



Sep 10, 2011, 01:48 am Last Edit: Sep 10, 2011, 01:52 am by Emmeran Reason: 1
Ok, I think I've gotten closer to it. Maybe somebody can tell me, why the Arduino that I'm trying to program doesn't reply at all.

I connected TX/RX on the "master" to RX/TX on the "slave", ground +5V obvious, CTS to ground and DTR to digital pin 4.

Here's my code:
Code: [Select]

#include <RedFly.h>
uint8_t serversock, sock;

void setup()
  // virtual reset pin
  pinMode(4, OUTPUT); // reset pin for arduino / DTR on FTDI header
  digitalWrite(4, HIGH);

  //init the WiFi module on the shield
  /* wlan init is irrelevant => removed */

uint8_t buf[200];
int bp = 0;
bool resetDone = false;

void loop()
  /* read data from WiFi to buf - removed for easier read */
  RedFly.disable(); // disable WiFi card
  Serial.begin(115200); // change baudrate to Arduino bootloader baudrate

  // buffer pos != 0 -> data received   
  if (bp != 0)
    if (!resetDone)
      // reset slave before sending first data
      digitalWrite(4, LOW);
      digitalWrite(4, HIGH);
      resetDone = true;
    // print received buffer to boatloader
    for (int i = 0; i < bp; i++)
      Serial.print(buf[i], BYTE);
    bp = 0;
    // wait a bit for a reply

    // read reply from bootloader
    while (Serial.available())
      buf[bp++] = Serial.read();

  // change serial back to WiFi cards speed 

  // enable wifi card

  // we received data from bootloader -> send it via WiFi
  if (bp != 0)
    RedFly.socketSend(sock, buf, bp);
  // wait a bit for a reply

The data from WiFi (the first bytes from avrdude, namely 30 20) gets received and redirected at the right baudrate, I checked that. But the bootloader does not respond.

What am I doing wrong?

Thx for any help!

Code: [Select]

~ $ avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -q -q -patmega328p -carduino -Pnet: -b115200 -D -Uflash:w:wlanprog.cpp.hex:i -vvvv

avrdude: Version 5.10, compiled on Jun 29 2010 at 21:09:48
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
         User configuration file is "/home/emmo/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : net:
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
ioctl("TIOCMGET"): Invalid argument
ioctl("TIOCMGET"): Invalid argument
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
ioctl("TIOCMGET"): Invalid argument

Master = Arduino Uno w/ RedFly shield
Slave = Arduino Ethernet

Andreas Watterott


I think a problem is the different serial format (RedFly 8N2, bootloader 8N1).
The best would be to use a software serial port for the RedFly communication or an Arduino Mega with more hardware serial ports.


Go Up