Find Arduino's serial port in Linux

Submitted by gvso on Fri, 10/20/2017 - 21:36

I got an Arduino-based playground circuit for a class. I was eager to try it out, but after plugging it, compiling and uploading the code, nothing happened.

The issue was that I didn't select the serial port to which the compiled object would be uploaded. So, to fix this issue I did the folowing:

  1. Unplug the cable from the computer and plug it again
  2. Run the folowing command to display the last messages from the kernel ring buffer:
    dmesg | tail
    [343030.622424] usb 1-2: Product: Circuit Playground
    [343030.622426] usb 1-2: Manufacturer: XXXXXXX
    [343030.623405] cdc_acm 1-2:1.0: ttyACM0: USB ACM device
    
    By now we know that the last port with a connection was the one where the circuit was plugged, so the serial port in this case is ttyACM0
  3. Go to the Arduino IDE >> Ports and select the port you got above
  4. Run the following command to give permissions to write on the serial port:
    sudo chmod 666 /dev/ttyACM0   // change ttyACM0 by the correct port in your case

That's it. You should now be able to run and upload your code into your Arduino.