Friday, 5 December 2014

Programming and Interfacing the Serial/UART/RS-232 port of a Computer/PC in Windows and Linux Part-2

So here is the linux part of my tutorial on how to interface a serial port. Windows part is here.

To say the truth the programming a serial port is comparatively easier in linux then in windows.

In linux we can open the serial port directly using the terminal emulator. As the terminal emulator has nearly the same settings like a Serial Terminal.

Below is the code for a basic SerialConsole like program which sends any characters typed to the serial port and prints received text in the terminal emulator.

So first we have to override the terminal settings and then apply the settings for the serial port.

You can compile the program directly in linux and run it. Like i wrote above make sure you have proper rights to access the serial port, or better just run the program as root user.

So this is the end of my serial port tutorial.

If you have any questions or suggestions feel free to post a comment.
Unknown An Electronics and Tech Enthusiast

I am a Tech enthusiast who loves to build stuff like new gadgets and tinker around with electronic devices doing some DIY stuff, writing some code and in the process providing something back to the community.


  1. Dear sir,
    I followwed your post and let me tell you that works perfect on a console on my linux mint, I have changed only a line in order to make it work with an arduino uno.
    I am trying to make the same but with codeblocks and xwidgets in order to make a best looking program hmi.
    thank your for your kind information and to share with us.
    Fabio Arias

  2. A very excellent blog post. I am thankful for your blog post. I have found a lot of approaches after visiting your post.

    1. Great Article
      Cloud Computing Projects

      Networking Projects

      Final Year Projects for CSE

      JavaScript Training in Chennai

      JavaScript Training in Chennai

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

  3. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. hoverwatch review 2020

  4. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me. Laptop

  5. I am impressed by the information that you have on this blog. It shows how well you understand this subject. Cable Universe UK


  7. Google Glass is a computer that you wear like eyeglasses. Like a smartphone or tablet, it can connect you to just about anything and anyone. However, unlike iOS or Android technology, Google Glass offers hands-free, voice-activated interactivity. blog de empreendedorismo