Pages: [1]   Go Down
Author Topic: Monitoring RX Pin  (Read 595 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am attempting to interface an Arduino Uno with a bluetooth module. The two communicate with one another via TTL level signals using the RX/TX pins. In order to setup the bluetooth module on power up, I must wait for a prompt and send some text commands via serial.

The problem lies in the fact that I can't see anything I'm receiving on the RX pin of the Arduino. The only way I can see it is if I have the serial monitor open and call

Code:
Serial.println((char)Serial.read());

to echo whatever data I receive to the screen. This obviously causes problems since using that method actually writes the received data back to the bluetooth module.

Is there a way I can echo the RX data without having to actually write it back to the serial port?

Edit: I just realized the serial monitor only captures what is sent over the usb connection, not what is sent/received over the RX/TX pins. I suppose the only way to monitor these pins is to use another serial cable?
« Last Edit: August 04, 2011, 07:04:52 pm by isometrik » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16518
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I suppose the only way to monitor these pins is to use another serial cable?

That a good reason to get one of these nice inexpensive usb serial converter modules:

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=190544446821&ssPageName=STRK:MEWNX:IT


Lefty
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46090
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could connect the bluetooth device to some other pins, and use NewSoftSerial to talk to it, leaving pins 0 and 1 free for debugging.
Logged

Sussex UK / CT USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1028
Forums forever
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For details of connecting Arduinos to serial devices, such as the one you are working with, or even just a "big" PC....

http://sheepdogguides.com/arduino/art4SeIntro.htm
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Edit: I just realized the serial monitor only captures what is sent over the usb connection, not what is sent/received over the RX/TX pins. I suppose the only way to monitor these pins is to use another serial cable?

What is the difference? What is sent over the USB connection is what is on the Rx/Tx pins. As an example, in this project here:

http://www.gammon.com.au/forum/?id=11283

I have connected a RFID card-reader to pin D0 (the Rx pin). I receive the data in the sketch, and echo it on D1 (the Tx pin). That shows up in the serial monitor, as I expect it to.

Quote
Is there a way I can echo the RX data without having to actually write it back to the serial port?

Well the serial monitor never echoes the Rx data, so that is the real problem.

For debugging you could disconnect the Tx pin from your bluetooth module (so the data from your sketch is not echoed back to it) and then add the line you had which copies the Rx data to the Tx pin.

Alternatively use the NewSoftSerial library and connect the bluetooth module to other pins (which is exactly what PaulS said). Or, for debugging echo via (say) I2C to a second Arduino and monitor what is happening with that. Or, get a logic analyzer.
Logged

Pages: [1]   Go Up
Jump to: