Serial communication between an instrument, a micro controller and a PC

Hello everyone,

I am fairly new in this world but I need to establish communication between an optical particle counter and a PC through a micro controller. I am actually using a teensy 3.6 micro controller but I also have an Arduino Mega at home if it's easier to start with.

My instruments sends its measurement once per second at a 9600 baud rate via an rs232 UART port. I have made all the connections to my micro controller's serial port number 2. I use a max3232 transceiver breakout to convert rs232 to TTL (3.3V).

The micro controller is then connected to my PC with the USB cable.

Basically, what I would like is to see on my serial monitor is what the instrument is spitting out.

I have looked at different discussions and example codes but I am a bit lost at the moment. Could anyone help me get started with that?

Thank you very much!
Roman

romanpohorsky:
Basically, what I would like is to see on my serial monitor is what the instrument is spitting out.

Why?

What I'm wondering is whether you want to do this for a short period for debugging purposes or whether you want it to be a permanent feature.

What role is the "Arduino" playing? Will it be using the data from the particle counter or do you just want to use the "Arduino" to convert between the RS232 of the counter and the USB of your PC?

I'm not familiar with Teensies. With a Mega I would probably connect the Max232 to Serial1 and read the data using one of the examples in Serial Input Basics - probably the second one. When a message has been received from the particle counter it could then be passed on to the PC

...R

Thank you for your answer.

To answer your question, this is not a permanent setup. In the future, the particle counter will be hanged under a tethered balloon and will record its data on the micro controller and the micro controller will send data to a ground station through an Xbee module.

The current setup is a first step towards that goal in order to get acquainted with the code to read serial data.

I will have a look at what you suggested, thank you.

The sample program should do what you want (read from Serial1, write to Serial and vice versa). This assumes the particle counter is connected to Serial1.