arduino serial monitor not opening - arduino

I have been working with my arduino Uno on Ubuntu Linux (It won't work on Windows with my laptop). For a few days it worked fine, but recently I have been working with the Serial Port. It was all good, until the Serial Monitor stopped opening. It would have a process open, and using alt+tab it would show the window for it, but I couldn't get it to show normally or be interacted with in any way. I have opened it going tools>Serial Monitor, ctrl+shift+m, and the button for it. I can upload fine. I can't find the dynamic IP address for the arduino, or for just fun remotely interacting with it.

open the terminal and tap the following commands:
sudo usermod -a -G dialout xxxxx
sudo chmod a+rw /dev/ttyACM0
NOTE: xxxxx is your username

Related

Arduino IDE Ubuntu ports greyed out (no serial port installed)

I want to run Arduino IDE on a Ubuntu machine that has no serial ports. I'm only going to be using it for OTA but the IDE port option is greyed out. I've tried installing tty0tty but that didn't help. I can set up two minicom serial sessions and chat between them on the tnt0 and tnt1.
Are you running Arduino IDE as root? See this SuperUser query for more details about the potential permissions issue.
Also, verify that your user is in the dialout group. This is a requirement for the ports to be accessible in Arduino.
From the Arduino IDE docs:
On Linux, the Uno and Mega 2560 show up as devices of the form /dev/ttyACM0. These are not supported by the standard version of the RXTX library that the Arduino software uses for serial communication. The Arduino software download for Linux includes a version of the RXTX library patched to also search for these /dev/ttyACM* devices. There's also an Ubuntu package (for 11.04) which includes support for these devices. If, however, you're using the RXTX package from your distribution, you may need to symlink from /dev/ttyACM0 to /dev/ttyUSB0 (for example) so that the serial port appears in the Arduino software.
Run:
sudo usermod -a -G tty yourUserName
sudo usermod -a -G dialout yourUserName

Android Things: Connect to Serial Debug Console

I've been trying to connect to the serial console of a Raspberry Pi 3 with Android Things using USB to TTL cable from my Linux (Ubuntu) machine. Despite I connected the cable as per the documentation, all I get when executing the minicom command is the following
with no chance to type in any character. So I neither can see any kernel messages nor shell into the device.
What am I missing?
Linux (Ubuntu)
What's in?
GNU Screen
Minicom
minicom one-line-command (short answer)
minicom UI (long answer, detailed)
GNU Screen
Run in terminal
sudo screen port_name 115200
See below (step 2) to find out port_name, e.g /dev/ttyUSB0. Hit Ctrl-A, then K, then Y to exit screen. Execute sudo apt-get install screen if not installed.
Minicom
Short answer
Run in terminal
sudo minicom -b 115200 -o -D port_name
See below (step 2) to find out port_name, e.g /dev/ttyUSB0. Hit Ctrl-A, then X to exit minicom.
Long answer (UI)
minicom should be properly configured in order to open the connection. The general steps are as follows:
Install minicom with
sudo apt-get install minicom
Connect Rpi3 with your host machine using USB-to-TTL cable and open the terminal. Find the tty connections with
dmesg | grep -e tty
In my case I get
where ttyUSB0 is the board.
Run minicom and select the serial port setup with
sudo minicom -s
You should see
Check (or set) the settings for the tty connection. Make sure that /dev/ttyX corresponds to your connection, the one you get in the step 2 instead of X, and Bps/Par/Bits set as per the documentation.
Similar to
Now hit Exit and, if everything had been properly set up, the connection should be running. If you type the ls command you should see Android Thing's root directory
For exiting minicom hit Ctrl-A, then hit Q, then Yes:
Windows (with PuTTY)
Install PuTTY
Connect the board to machine with USB-to-TTL cable and find out the COM port using Windows Device Manager. You should look for the the one called USB Serial Port (in my case it was COM3).
Run PuTTY and set it up. Use the speed as per the documentation (115200):
Hit Open and type a command in a terminal window popped up.
I'm going to suggest some troubleshooting advice based in my own experience:
Make sure you have the Tx and Rx cables connected correctly because all the other settings won't give you any warning, minicom would connect beautifully to the USB adapter but no info on your screen from your Pi.
I didn't use a USB to TTL like the one you are using, mine has the labels for Tx and Rx inverted on the board. Took me some time and the help of an oscilloscope to figure out what was going on.

printing gatttool notification data in file

I am running sensortag 2650 to read notification from sensor to my computer.I am using gatttool (bluez) to do this.My output gets displayed on the console, while the sensor is on the run. BTW I am using ubuntu 14.0.4.
Now the issue is I am not able to make the output data get written in a file instead of displaying on the console. I tried the normal re-direct >>/> operator but that doesnt work.
I am using the following link, just that I am using Linux on my system instead of Raspberry Pi.
https://github.com/codeplanner/TI-CC2650-1
Any clue would be highly appreciated.
Thanks,
Shankhadeep
Do the following:
sudo gatttool -b XX:XX:XX:XX:XX:XX >> output.txt
Then the terminal won´t show anything. BUT! type connect and press enter.
Now the bluetoothmodule is paired with your device!
Normaly, everytime when you get a notification, this will be write in the output.txt.
I tested it with my bluetooth module HM-10 and a Raspberry Pi and it works!
I know its 6 years too late but:
what worked for me was sudo gatttool -b XX:XX:XX:XX:XX:XX -I >> output.txt
putty_capture
This is not ideal for me because im only interested in the received raw data not the ascii console dump, but it is what OP asked for...
Another option would be to use hcidump with some filters

Arduino Tools > Serial Port greyed out

I am running Debian 7 (Linux Crunchbang) and wanted to use The Arduino IDE to program my Arduino UNO. To do that I installed the package arduino. When I started the Arduino I was asked to add my user to the dialout group. So I did with sudo usermod -a -G dialout <my-username>.
However when I start the Arduino IDE using arduino in the commandline the IDE opens but I am not able to load my program to the Arduino. The error message is "Serial port COM1 not found. Did you select the right one from the Tools > Serial Port menu?" And when I went to select the Serial Port, the option "Tools > Serial Port" is greyed out.
I thought it is because I did not grant read and write permissions on my usb port (ttyACM0). So I did sudo chmod a+rw /dev/ttyACM0 but the option is still greyed out.
chdmod works for my under debian (proxmox):
# chmod a+rw /dev/ttyACM0
For installing arduino IDE:
# apt-get install arduino arduino-core arduino-mk
Add the user to dialout group:
# gpasswd -a user dialout
Restart Linux.
Try with the File > Examples > 01.Basic > Blink, change the 2 delays to delay(60) and click the upload button for testing on arduino, led must blink faster. ;)
sudo arduino is the only way I get the Arduino IDE working (serial port and upload) on ubuntu 12.04 (64)
Indeed the serial port to use is /dev/ttyACM0 in my case too.
The other two (ttyS4 and ttyS0) gave an error when trying to upload to Uno.
Have fun
Try Disconnecting the usb and plugging it back in. Its only grayed out because the ide cannot find any com ports that the uno has been plugged into.
another solution is to try all the com ports and see which one works.
finally if all fails try restarting your computer.
Close all instances of the arduino IDE
open ~/.arduino/preferences.txt and look for the line:
serial.port=<not your port>
and change it to your port:
serial.port=/dev/ttyACM0
you may have to log out for it to take effect
open $arduinoHome/arduino in text editor and modify last string:
java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base "$#"
to
java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dgnu.io.rxtx.SerialPorts="/dev/ttyACMN" processing.app.Base "$#"
(set property gnu.io.rxtx.SerialPorts to /dev/ttyACMN,where ttyACMN is name of serial port which you use)
it may temporary fix bug in rxtx library. helped me to upload sketch with arduino1.0.5 IDE.
Maybe would helpful for someone.
In my case this turned out to be a bad USB hub.
The 'lsusb' command can be used to display all recognized devices. If the unit is not plugged in the option to set the speed will be disabled.
The lsusb command should output something like the string 'Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)' if your device is recognized. Mine was an RFDuino
In my case I solved this issue by uninstalling the version of Arduino that I installed via apt-get and instead installed via the official website.
With the latest version of Arduino I didn't have the problem described on Ubuntu 18.04.
So I did with sudo usermod -a -G dialout <my-username>.
You need to log out after you add yourself to a group so those changes are applied. Just log out and log in again and the menu should be available.
install rx-tx lib for java run this command in terminal
sudo apt-get install librxtx-java -y
output port
sudo usermod -aG dialout $USER
sudo apt-get install gnome-system-tools
help regconize usb device
I solved following serial port related problems in ubuntu 18.04 as follows:
Problem 1 : Cannot open /dev/ttyACM0: Permission denied
Solution : Grant permissions to read/write to the serial port with this terminal command ---> sudo chmod a+rw /dev/ttyACM0
Here replace tty port with your respective ubuntu port.
Problem 2 : Failed to open /dev/ttyACM0 (port busy)
Solution : This problem appears when serial port is busy or already occupied. So kill the busy serial port with command ---> fuser -k /dev/ttyACM0. Here replace tty port with your respective ubuntu port.
Problem 3 : Board at /dev/ttyACM0 is not available
Solution : In this case your serial port in tools menu will be greyed out. I googled a lot for this, but I none of solution worked for me. Atlast I tried different arduino board and usb connector and it was working for me. So, if you are having old arduino board (can be solved using required drivers) or defected arduino board then only this problem arises.
If it is helpful to anyone, I had this problem using Ubuntu 22.04. The issue stemmed from:
apparmor (apparmor denied error, logging with dmesg)
brltty (ch34x converter now disconnected from ttyUSB0)
Solved it by removing both:
https://www.simplified.guide/ubuntu/remove-apparmor
sudo apt remove brltty
You can disable apparmor and it should work, however this made applications like firefox useless. My recomendation would be to totally remove it
Same comment as Philip Kirkbride.
It wasn't a permission issue, but using the Arduino IDE downloaded from their website solved my problem.
Thanks!
Michael
The following steps install the IDE and remove the error java.lang.NullPointerException thrown while loading gnu.io.RXTXCommDriver which usually comes with arduino installed with apt-get command in Ubuntu.
Install the IDE
sudo apt-get install arduino
for removing java error in IDE
sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-set-default
This also shows the Serial Port which was grayed out due to the error.
I had the same problem, with which I struggled for few days, reading all the blog posts, watching videos and finally after i changed my uno board, it worked perfectly well. But before I did that, there were a few things I tried, which I think also had an effect.
Extracted the files to opt folder, change the preference --> behavior --> executable text files --> ask what to do. After that, double clicked arduino on the folder, selected run by terminal
added user dialout like described in other answers.
Hope this answer helps you.
For a Windows solution I've found that disabling and re-enabling the Arduino in Device Manager, then restarting the Arduino IDE does the trick without fail (no unplugging necessary). Why this error occurs in the first place is beyond me. Perhaps the corresponding method for Linux will fix your problem.
Slightly related (not really), I had an issue with an AVR board a while back which was fixed by setting the device to a new COM port in the driver settings. Again, however you linux bunnies do it, I'm sure it'll be cookies and cream.
Cheers brother,
I encountered the same issue. My solution was to install and use java7:
sudo apt-get install openjdk-7-jre
sudo update-alternatives --config java
Select the number referring to the java-7 path.
You probably don't have the correct permissions. Try adding yourself to these groups.
sudo adduser username ttyl
sudo adduser username serial
sudo adduser username uucp
Then restart your system and check if you got added to the groups.
groups username
Good Luck!
Try to run as an administrator...
Run terminal, type sudo arduino, type your root password, and... :)

Can´t upload code to Arduino Uno using stino and Ubuntu 12.04 (Precise Pangolin)

I have installed stino on Sublime Text 2 succesfully, but when I try to upload my code to Arduino Uno, the output is the following:
Uploading /home/lucas/Arduino_Build/programa_teste/programa_teste.hex to Arduino Uno...
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
ioctl("TIOCMGET"): Inappropriate ioctl for device
[Stino - Error while uploading.]
I have the Arduino IDE installed, and it is working fine, only Sublime Text can´t upload the code.
well, as #Bibhas says, your problem is that /dev/ttyACM0 is having the wrong permissions, and that has nothing to do with Arduino or sublime text. It's the linux kernel who creates character devices per default with no user permissions.
But good thing is that it can be changed!
The fast and easy solution is to add your current user to the dialout group:
sudo adduser YOU dialout
where YOU is your username and then log out and log back in to have those new permissions propagated into your shells.
Hint:
There's a solution that is a bit more complicated, is to create a udev rule such as:
/etc/udev/rules.d/48-arduino.rules
SUBSYSTEM!="usb_device", ACTION!="add", GOTO="arduino_end"
SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", MODE="660", GROUP="arduino", SYMLINK+="arduino.leonardo"
LABEL="arduino_end"
which creates a /dev/arduino device readable and writable by the arduino group, that you need to create (or you can use the default dialout group which is perfectly fine):
addgroup arduino
adduser YOU arduino
and then reload your rules:
sudo udevadm control --reload-rules
The nice thing about that second hint is that when you unplug replug your arduino, you won't have it change device number oddly, it will be kept to the name. If you're not using an arduino leonardo, you can check your device idvendor/idproduct using lsusb:
% lsusb
… ↓↓↓↓ ↓↓↓↓
Bus 006 Device 105: ID 2341:0036 Arduino SA
…
HTH
Accoding the Troubleshooting doc, I use
sudo usermod -a -G tty yourUserName
sudo usermod -a -G dialout yourUserName
fix my problem.
I have the same problem today, and the incredible happend. The USB cable gave power to the Arduino, but doesn't allow the communication. The solution for us was to change the USB cable, and after that everything worked

Resources