Putty settings to emulate the arduino serial monitor

Hi,

Does anyone know the settings on putty that replicate the arduino serial monitor (ASM)?

Even after setting the com port, data, stop and parity bits there are many settings that need to be configured to get the terminal to behave the same way as the ASM. There's no local echo, and they way it handles formatting seems to be different - not getting a new line on putty where a new line start is shown on the ASM when data is sent back from the arduino. Putty seems to send keyboard input as you type it whereas the ASM waits for the return key. With 'NewLine' selected in the drop down on the ASM I would assume it's sending a newline character when you hit the return key but omitting a CR - can't find the option in putty for this.

Lots of posts reporting putty and be used with arduino but no config is discussed.

Thanks.

In the left window of PuTTY highlight 'Terminal' and check the 'Implicit CR in every LF' box. That's all I remember doing to make it work.

Don

1 Like

There's no local echo

Configurable...

not getting a new line on putty where a new line start is shown on the ASM

The Arduino Serial Monitor is a windows app. Putty is a Unix-based app. Windows ASSumes that a carriage return means carriage return and line feed. Putty knows better. If you aren't sending carriage return and line feed, start doing so.

Putty seems to send keyboard input as you type it whereas the ASM waits for the return key.

Both have their advantages. And disadvantages.

From what I'm hearing, you should just be using the Arduino Serial Monitor application.

floresta:
In the left window of PuTTY highlight 'Terminal' and check the 'Implicit CR in every LF' box. That's all I remember doing to make it work.

Don

Thanks.

PaulS:
From what I'm hearing, you should just be using the Arduino Serial Monitor application.

There are reasons one might not want to do that. For example I use a tiling window manager on Debian and I just run a single command to bring up a PuTTY terminal already configured to connect to an Arduino-like board (using an alias in .bashrc), and the terminal comes up in just the part of the screen that I want it.*

floresta:
In the left window of PuTTY highlight 'Terminal' and check the 'Implicit CR in every LF' box. That's all I remember doing to make it work.

I suspect this is correct for Windows. If you're on Linux these settings work:

-The default serial speed (9600), data bits (8), stop bits (1), parity (NONE) and flow control (XON/XOFF) are good, so no need to go to the settings under Connection > Serial.

-Naturally we’ll connect to device /dev/ttyUSB0 (or whatever) instead of ttyS0.

-Under the “Terminal” settings, we can optionally set “Local echo” to “Force on” to see the characters we send.

-Also under “Terminal” settings, keeping “Local line editing” set to “Auto” should be OK, but if in doubt we can set to “Force off”. Having this on screws up this way of doing it.

-Under “Terminal” > “Keyboard” settings, set “The function keys and keypad” to either “Linux” or “Xterm R6”.

To send a string, type what you want to send, then instead of pressing the Enter key, press Ctrl+J. Ctrl+J is PuTTY’s shortcut for Line Feed, which in combination with the other settings above has the effect of replacing the Enter key for sending strings. I have not found that having PuTTY automatically add the LF works. If someone has figured out how to make this work with the normal Enter key instead of Ctrl+J I would like to know.

So that all works. But...

To make life easier, enter all those settings and then under "Session" highlight "Default Settings" under "Load, save, or delete a stored session" and then click Save. Or save it as a new name.

To make life easier still, now bypass the PuTTY Configuration GUI altogether by running $putty -serial /dev/ttyUSB0 -sercfg 9600 to start the serial terminal directly.

To make life EVEN easier, add something like alias puttyarduino='putty -serial /dev/ttyUSB0 -sercfg 9600' to your .bashrc file, logout and login, and forever and always bring up the PuTTY terminal with $ puttyarduino.

~Justine

*Most importantly I don't have to have the Arduino IDE break the connection first because I use an in-system programmer (the ~$25 AVR-ISP-MK2). I feel most Arduino people don't use an ISP because they just don't know about it. It makes life easier in a couple ways. Plug it into the heretofore unused ICSP port on your board and flash the program from the Arduino IDE using Ctrl+Shirt+U without first having to pick the USB port (or dev assignment) and without having to break your debugging serial connection.

3 Likes

PaulS:
Configurable

...

From what I'm hearing, you should just be using the Arduino Serial Monitor application.

Paul,

I've seen hundreds of your answers. But I've seen 10 at most helping someone. Lot of insulting ones, trying to ridicule the poster.

Why don't you learn from 'jhaupt', a newbie who really helped with the problem?

1 Like

corcovado:
Paul,

I've seen hundreds of your answers. But I've seen 10 at most helping someone. Lot of insulting ones, trying to ridicule the poster.

Why don't you learn from 'jhaupt', a newbie who really helped with the problem?

So you dont post for over 2 years, and then comment on a message that is a year old ?

Weird.

"... -Also under "Terminal" settings, keeping "Local line editing" set to "Auto" should be OK, but if in doubt we can set to "Force off". Having this on screws up this way of doing it. ..."

The above does not work, and "screws up this way of doing it..."

Use "FORCE OFF" for "Local line editing"

I tested solutions above, my code is:
(I still couldn't find where is the code flag)

// 串口LED RGB调光

int i = 0; //保存PWM需要输出的值
String inString = ""; //存储输入的数码字符串 - 用于转化成亮度值
char LED = ' '; //用于判断指定LED颜色对应的引脚
boolean stringComplete = false; //用于判断数据是否读取完成

void setup() {
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);

analogWrite(9, 255);
analogWrite(10, 255);
analogWrite(11, 255);

//初始化串口
Serial.begin(9600);
}

void loop() {
if (stringComplete) {
if (LED == 'R') {
analogWrite(10, 255);
analogWrite(11, 255);
analogWrite(9, ~i);
}
if (LED == 'G'){
analogWrite(9, 255);
analogWrite(11, 255);
analogWrite(10, ~i);
}
if (LED == 'B'){
analogWrite(9, 255);
analogWrite(10, 255);
analogWrite(11, ~i);
}
// 清空数据,为下一次读取做准备
stringComplete = false;
inString = "";
LED = ' ';
}
}

// 使用串口事件
// 读取并分离字母和数字
void serialEvent(){
while (Serial.available()){
// 读取新的字符
char inChar = Serial.read();
// 对输入的数据进行分类:
// 如果是数字,存储到变量inString中
// 如果是英文字符,存储到变量LED中
// 如果是结束符“\n”,则读取结束,并将inString转换为int类型数据
if (isDigit(inChar)){
inString += inChar;
}
else if (inChar == '\n'){
stringComplete = true;
i = inString.toInt();
}
else if(isAlpha(inChar)){
LED = inChar;
}

Serial.println("inChar = ");
Serial.println(inChar);
// Serial.println("LED = ");
// Serial.println(LED);
// Serial.println("inString = ");
// Serial.println(inString);
// Serial.println("i = ");
// Serial.println(i);
// Serial.println("~i = ");
// Serial.println(~i);
// delay(1000);
}
}

I set putty this way:

  1. Implicit LF in every CR (unchecked)
  2. Local echo: Force on
  3. Local line editing: Force on

then, my input was:
R200^j + "enter"
that works. "^j" is ctrl + j

my question is, since my code would judge isalpha or not, it works, why the compose "ctrl+j" hasn't been verified as character ?