Mega and Bluetooth EZ Link Shield RX and TX Communication [Solved]

Hello everyone.

The Question: How do I get the following set-up to send serialized data to an Android device?

I have an Arduino Mega with a Bluefruit EZ Link Programmer shield on top. No additional wiring is attached.

My ultimate goal is relatively simple, to transmit data from pins A0-A3 over Bluetooth to an Android device. I have accomplished transmission over the WiFi board as seen in the second picture. I only am only including this information for context of the project.

Using just the following code sample I thought I should be getting periodic readouts on my Android, which successfully connects to the board. Instead I get no data transmission, nor does the TX light blink to indicate attempted transmission.

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

void loop() { // run over and over
  Serial.write(45);
  delay(500);
}

Additional info:

The Bluetooth board RX light does flash when I transmit a message to it from my Android.

What does work is wiring TX and RX together on the Bluetooth shield. That allows me to send serialized strings from my Android device and get them mirrored back at me. I believe at this point the signal wouldn't even need to be interacting with the Arduino.

It is being powered off a USB from a PC. I attempted to plug it in, still with the USB, to the wall directly with a power brick but the effects were the same. The serial monitor has been kept closed to ensure no interactions are blocking RX and TX.

Any and all help is appreciated. Thank you.

How do I get the following set-up to send serialized data to an Android device?

First thing you do is explain what "serialized data" is, and how that differs from any other kind of data.

I have an Arduino Mega with a Bluefruit EZ Link Programmer shield on top.

A link would be so much more useful.

Using just the following code sample I thought I should be getting periodic readouts on my Android, which successfully connects to the board. Instead I get no data transmission, nor does the TX light blink to indicate attempted transmission.

Is 9600 the correct baud rate?

Get the bluetooth device off the first hardware serial port, so you can debug your program.

First thing you do is explain what "serialized data" is, and how that differs from any other kind of data.

By serialized data I just mean transmitting the data as bytes. If Arduino abstracts this and lets me transmit strings or doubles that is fine too. Pretty much all data can be broken down to this level. On the receiving side I can either receive full constructed objects sent as packets, or just bytes of data. Either way they will get read into a buffer ultimately for processing.

A link would be so much more useful.

This is the shield I am using. https://www.adafruit.com/products/1628

The board is the mega 2560, I should have specified. https://www.arduino.cc/en/Main/ArduinoBoardMega2560

Here is an image of my setup.

http://imgur.com/3z7JhOm

Is 9600 the correct baud rate?

Get the Bluetooth device off the first hardware serial port, so you can debug your program.

From page 21 of this booklet about the EZ Programmer, and various other forums, I found the following. EZ Link Booklet

"Hey! It's not working with my Android device! Limit your Arduino sketch Serial communication speed to 9600 baud. This step is very important, if you try other baud rates the Android device will not be able to communicate with the Bluefruit EZ-link."

I have changed the baud rate to Serial.begin(115200); just to check, and there is still no effect.

I removed the Bluetooth device from the hardware serial port and used the Serial monitor to check the posted program.

The Serial.write on the integer 45 just printed dashes. This new code does not fix or change the Bluetooth issue.

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

void loop() { 
  Serial.write("45");
  Serial.println(45);
  delay(500);
}

I am watching the outprint on the Serial Monitor printing 4545 4545 4545 4545 4545 4545 4545 forever as expected.

Plugging back in the bluetooth stops me from being able to monitor on the serial monitor, but still shows no signs of sending the data. (No flashing TX light and no response on the Android phone).

It took a logic analyzer to help me work this one out. For anyone else experiencing similar issues, here is how I solved it.

I still do not know why the board was not managing transfers from RX0 to TX0, but by changing the Serial out prints to Serial1 and wiring TX1 into TX0 and transmission is now functional.