0

I have a strange problem. I am running Ubuntu and NodeMCU si plugged into USB. I have very simple sketch running on it, when it reads letter "R" on serial, it turns ON relay.

When I open Serial Monitor in Arduino IDE and I type letter "R" and send it, it works perfectly. However when I run commands below, it does nothing:

stty -F /dev/ttyUSB0 115200
echo "R" > /dev/ttyUSB0

I tried running the same commands on different PC with Ubuntu and these system commands work just fine.

I also tried copying exact same configuration from stty -a -F /dev/ttyUSB from PC where it works to PC where it doesn't, but it didn't help either.

I don't think it's driver issue, because if it would, then I suppose it wouldn't work with Serial Monitor also.

Thank you for any help or hints in advance.

asked Apr 4, 2021 at 8:25
4
  • Do you have something else plugged through USB in the PC where it does not work? Maybe the NodeMCU is ttyUSB1? Commented Apr 4, 2021 at 8:47
  • 1
    Does this answer your question? How to connect Arduino device to Linux? Commented Apr 4, 2021 at 8:51
  • 1
    Are you waiting a bit between opening the port and sending the data? The Arduino might not yet be ready to receive data directly after opening the port (since it resets) Commented Apr 4, 2021 at 8:55
  • Try executing: stty -F /dev/ttyUSB0 -hupcl Commented Apr 4, 2021 at 11:16

2 Answers 2

2

I had the same issue. After entering command that Majenko suggested:

stty -F /dev/ttyUSB0 -hupcl

I still wasn't able to send commands to Arduino nano. Strangely, when I open Arduino IDE Serial Monitor and send command it works. When I close it, I can send commands in terminal to Arduino for some time. Then it stops working again :/

answered Apr 22, 2021 at 14:06
0

OK, so I resolved this problem, but only half-way. I was using NodeMCU with CH340 ... and this controller worked only in Serial Monitor, not in command shell on one computer (it worked fine on other computer).

So I tried using different NodeMCU with CP2102 and it worked just fine. So I assume there must be some kind of issue with ch341 driver in my linux, I don't know.

answered Apr 4, 2021 at 9:58

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.