I'm trying to communicate with a device over a serial port, and pipe its output to a file. I've managed to use the screen program to communicate with the device, but I'm not sure how to pipe the data I receive to a file.
For example, right now can start the screen program with: sudo screen /dev/ttyACM0. Then I can send the command DATA to the device, and the data I want gets printed to my console. Now I want to send that data to a file.
stty doesn't seem to be working for me due to some permission error. Using sudo didn't help.
Does anyone have ideas on how I can accomplish this?
Related
I need to write commands to a USB serial port to configure multiple devices, the commands are always the same so I type the same list of commands over and over again which is inefficient. I do this using PuTTY.
Is there a program similar to PuTTY which allows you to read commands from a text file or another method which I can send the same series of commands quickly?
PuTTY comes with console tool called Plink that's (contrary to PuTTY) intended for automation.
See this question for details how to use Plink to execute commands over serial connection:
Execute a command on device over serial connection with Plink
I am trying to make a windows executable talk with a Quectel module through serial.
The tool always fails at the first step which is to read the module's firmware version with an AT command (AT+CGMR\r).
I tested to send the same command to the module, using Putty and typing out the command, and it worked like a charm.
However, when I type the command in a notepad (including the carriage return at the end), then copy the text and paste it into putty (my idea was to get closer to the behavior of the .exe by sending the command faster), 2 weird things happen:
1 - I don't get a response from the module until I send a second carriage return by pressing Ctrl-M in putty. I am certain that the character is copied into the clipboard from the notepad though...
2 - The module does not receive "AT+CGMR" but "AT+CGMM" (which is also a valid command). I tested other variations and concluded that the last text character is always replaced by the second to last text character. So AT+CDFR gives AT+CDFF. AT+PILJ gives AT+PILL etc...
I am certain that is what the module receives because echo mode is on so the module prints out the command it received before the answer to said command.
To summarize:
By typing on the keyboard directly into putty I get:
AT+CGMR
SSB,V150R100C10B200SP1
SECURITY_A,V150R100C20B300SP5
PROTOCOL_A,V150R100C20B300SP5
APPLICATION_A,V150R100C20B300SP5
SECURITY_B,V150R100C20B300SP5
RADIO,Hi2115_RF0
OK
Which is the expected output.
But by copying and pasting the exact same text from notepad I get:
AT+CGMM
BC95GJB-02-STD
OK
and that, only after I press Ctrl-M. Before that there is no answer at all so it is as if the module never received the carriage return.
I can't figure out what is going on here... Any help appreciated.
I worked a lot with Quectel 4G modules. Maybe make a simple data tracer.
Download dumb terminal Termite so you can see single hex characters including non printable. Connect termite to to read a stock USB to serial adaptor. Make sure the adaptor is set to 3.3V not 5V. The Quectels are 1.8V domain but can scrape in and drive 3.3V logic. I assume you are driving your Quectel with 1.8V.
Hardware wise attach the Rx pin of the Quectel module to the USB module Rx pin then you can see exactly the characters going into the Quectel from Notepad and Putty. (Sometimes you may need a 1K in series with the USB Rx pin to reduce loading). Bingo, you can see exactly the characters the Quectel is getting. I found many bugs doing this.
I'm trying to use an Arduino nano with a humidity sensor and using the serial monitor to collect the data on my computer. When I'm done with my test, I want it to stop printing data to the serial monitor so I can copy and paste the data to a spreadsheet. I think there's a way to do this by pressing space bar and I can have it stop printing, but i'm not sure how. Thanks in advance
I can get the data to print, but I do not know how to tell it to stop.
Simplest solution: Disconnect either by unplugging or by using another terminal software like Hterm, which allows to close the serial connection or even directly write to files.
Usually you'll have a start/stop command that you send to your device from the PC or you process a hardware button to achieve the same.
Arduinos Serial Monitor is very simple and very limited in functionality.
I am currently attempting to use a computer and RS232 connection to control a HP 34401A Multimeter. I am able to use commands such as "SYSTem:REMote" or "*TST" however when I attempt to use a command that sends back information nothing is returned to the computer. If I use another return command directly after I get a -410 error signifying that the output buffer is full. Are there any commands I need to use to tell it to send the information to the computer? I have been looking through the manual for one but cannot find it.
Extra Info:
RS232 Connection Setup: Baudrate=9600, Data bits=8, Stop bits=2, Parity=None
Since the connection is DTE to DTE I am using a null modem cable
I am using Termite to send commands to the multimeter
Thank you for any help!
I am successfully using GNU Screen as serial terminal to "talk" to my Altair 8800 clone (http://altairclone.com/) using serial line. The command I use is 'screen -istrip /dev/ttyUSB0'. Screen does the VT100 emulation, strips off MSB from output etc. - works perfect.
Now, I am also working on an emulator of Altair 8800 in Java and would like to use some terminal emulator to connect and talk to it, just like it was a real machine behind serial device. What is the best way to solve in in the Linux world? Is there a way to use Screen for that? Something tells me the solution is trivial, but I just don't know it yet ;) Thanks for any suggestions.
You emulator has to create a something called a "pseudoterminal". This is a pair of devices - the master side is used by the terminal emulator, writing bytes that are to be sent to the program on the computer and reading bytes that the computer sends. The slave side is on the other end: it is the device that the program being controlled by the pseudoterminal opens to get input and send output to. The slave device will appear in the filesystem with a name like "/dev/pts/9". See http://www.gnu.org/software/libc/manual/html_node/Pseudo_002dTerminals.html.
Also, to get the vt100 emulation in Linux make sure the terminfo package is installed and set TERM=vt100; export $TERM after opening your terminal window