In this article I will explain how to solve a common error in Arduino:
avrdude: ser_open (): can't open device "/ dev / ttyACM0": Permission denied
After a long time without using Arduino I have taken my two inserts (the original and the elegoo) to do some activities with my daughter. I connect them, I am going to insert the blink to see that everything is fine and when I go to send it to the board it returns the well-known error.
Arduino: 1.8.5 (Linux), Card: "Arduino / Genuino Uno" avrdude: ser_open (): can't open device "/ dev / ttyACM0": Permission denied Problem uploading to the board. Visit http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
Both on my PC and my laptop I have Ubuntu 18.04 installed.
I start by following the link that they suggest. And I follow the steps
En tools / plate Arduino / Genuino Uno is selected
En tools / serial port / dev / ttyACM0
and as the documentation suggests, in case there are problems with the Drivers and permissions, I open the terminal and execute:
sudo usermod -a -G tty yourUserName sudo usermod -a -G dialout yourUserName
where yourUserName is your username
Now I log out and log in again. And just in case I restart the PC / laptop.
It still doesn't work for me and the Arduino documentation doesn't help anymore. So I've kept looking, in forums and blogs. If at this point it does not work for you and you are like me. Follow the next steps
ls / dev / ttyACM0 returns / dev / ttyACM0
ls -l / dev / ttyACM0 returns crw-rw—- 1 root dialout 166, 0 Nov 26 16:41 / dev / ttyACM
With this we confirm that the port exists
We are going to give permissions and check if our user has the necessary permissions.
sudo chmod a+rw /dev/ttyACM0 id devuelve 20(dialout)
And I see that the user is within the group dial out so this part we got it right.
What has worked for me has been to reinstall Arduino.
If you check
And it does not return anything reinstalling Arduino should be fixed.
sudo apt install --reinstall arduino
And if you have not been able to solve the problem, leave me a comment and I will try to help you.
AVRDUDE Troubleshooting Tool
There is a script they have prepared to fix this problem. You can try to see if it helps you. I have not used it but I leave it because I think it can be a useful resource.
I leave a bit of information to better understand what AVRDUDE is. The name comes from AVRDUDE - AVR Downloader / UploaDEr
AVRDUDE is a utility to download / load / manipulate the ROM and EEPROM contents of AVR microcontrollers using the in-system programming (ISP) technique.https://www.nongnu.org/avrdude/
AVRDUDE was started by Brian S. Dean as a private project as a programmer for the Atmel AVR series of microcontrollers.
You can find the software and much more information in the project website.