Serial is not working!

Hi! I'm trying to communicate between a UNO and a Wild Thumper Controller ( based on ATMega168 AVR ). Both of them are able to communicate with my PC, and trough the serial monitor. However, when I unplug the USB and go for external power, the RX/TX LED's stop blinking, and they won't lit up even when I connect the RX/TX between the boards.

Everything is connected as it should be, with RX to TX and vice versa, and they're sharing GND. I know it have worked before, so I don't really know what the problem is right now.

All help is appreciated!

// Andreas

The RX and TX LEDs only indicate the comms via the USB, they’re not status indicators for activity on D0 and D1.

I may not have this right, but I think you’d have to modify the board to power the USB IC. As built, it only gets power from the USB cable. V_USB can power the board, but powering the board through Vin or the external barrel connector does not feed the V_USB.

[quote author=Runaway Pancake link=topic=179733.msg1332028#msg1332028 date=1374969620] The RX and TX LEDs only indicate the comms via the USB, they're not status indicators for activity on D0 and D1.

I may not have this right, but I think you'd have to modify the board to power the USB IC. As built, it only gets power from the USB cable. V_USB can power the board, but powering the board through Vin or the external barrel connector does not feed the V_USB. [/quote]

Hey! I was pretty sure that the LED indicators lit up when communicating with each other before, but maybe I remember wrong. When it comes to the power supply: which board are you referring to that wouldn't work with external power? Arduino have an built in DC plug for external power with a recommended input voltage of 7-12V, where I use a 9V battery. The same goes for the Wild Thumper Controller, which is pretty much made for external use on RC cars @ 7,2 V, where I use a 7,2 V RC battery. In fact, you cannot even run the Wild Thumper board with power from USB, since it's only 5V.

And as I mentioned: everything has been working fine earlier, so I don't know why it wouldn't work now..

// Andreas

If you look at one of the schematics ("the board" == Arduino whichever, Uno, Nano, etc) you'll see that those LEDs aren't connected to D0 / D1 at all. D0 & D1 are routed back to the USB interface IC, yes, but the LEDs are connected to two entirely different pins on the USB interface IC. They 'blinkle' only when the USB is connected, indicating USB comms activity.

Uploading a simple sketch --

void setup ()
{
  Serial.begin(9600);
}

void loop ()
{
  Serial.print("A");
  delay (1000);
}

demonstrates this much.

When connected to the USB, the on-board "TX" LED shows activity. But when disconnected from USB and powered through the barrel jack, there is no "TX" LED activity.

If you require a comms indicator, I could offer suggestions. If you just want to verify results of the test sketch above (seeing is believing), remember that the output (TX) from D1 is normally high - place an LED with its anode to +5 and its cathode going to D. A resistor isn't needed because D1 and D0 have on-board resistors (600?) between the output header and the ATmega328 pins.

[quote author=Runaway Pancake link=topic=179733.msg1332625#msg1332625 date=1375024957] If you look at one of the schematics ("the board" == Arduino whichever, Uno, Nano, etc) you'll see that those LEDs aren't connected to D0 / D1 at all. D0 & D1 are routed back to the USB interface IC, yes, but the LEDs are connected to two entirely different pins on the USB interface IC. They 'blinkle' only when the USB is connected, indicating USB comms activity.

Uploading a simple sketch --

void setup ()
{
  Serial.begin(9600);
}

void loop ()
{
  Serial.print("A");
  delay (1000);
}

demonstrates this much.

When connected to the USB, the on-board "TX" LED shows activity. But when disconnected from USB and powered through the barrel jack, there is no "TX" LED activity. [/quote]

Alright, but even though the LED's aren't supposed to blink, I can still not get the serial communication itself to work. I've done some sketches for testing purposes, trying to power a LED trough serial, but without success.

// Code for Wild Thumper Controller

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.println('1');
  delay(100);
}
// Code for Arduino Uno

void setup() 
{
  Serial.begin(9600);     
  pinMode(4, OUTPUT);
}

void loop() 
{
  int reader = Serial.read();   
  
  if(reader == '1')
  {
    digitalWrite(4, HIGH);
  }
  
  delay(100);
}

Do you have any suggestions?

// Andreas

I was modifying my previous Reply, but while you were composing yours

Following, I'll restate what I'd added: If you just want to verify results of the test sketch above (seeing is believing), remember that the output (TX) from D1 is normally high - place an LED with its anode to +5 and its cathode going to D. A resistor isn't needed because D1 and D0 have on-board resistors (600?) between the output header and the ATmega328 pins.

Humm, yeah it actually blinks! But then why isn’t the Uno reacting at all?..

Jellycow: But then why isn't the Uno reacting at all?..

Maybe it's your sketch?

if(Serial.available() > 0)
{
    reader = Serial.read();
    if(reader == 0x31)   // hex code for numeral 1
    {
       digitalWrite(4, HIGH);
    }
}

Once it gets a '1' then D4 will go on, so I assume you can send it a '2' or other characters or modify it to toggle or turn off otherwise.

[quote author=Runaway Pancake link=topic=179733.msg1332980#msg1332980 date=1375044044]

Jellycow: But then why isn't the Uno reacting at all?..

Maybe it's your sketch?

if(Serial.available() > 0)
{
    reader = Serial.read();
    if(reader == 0x31)   // hex code for numeral 1
    {
       digitalWrite(4, HIGH);
    }
}

Once it gets a '1' then D4 will go on, so I assume you can send it a '2' or other characters or modify it to toggle or turn off otherwise. [/quote]

Haha, I found out the problem! All the time I've thought that D1 was RX and vice versa instead of D1 being TX. The reason for this is because in the manual for the Wild Thumper Controller, it says D1 - RX and D0 - TX, which is obviously wrong. http://letsmakerobots.com/files/Wild_Thumper_Controller_Instructions.pdf

Thanks a lot for your help!

// Andreas