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.
neutronstriker 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. 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

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


  5. 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

  6. Thank you so much for your hard work and discussing for this very informative topic.

    If you are thinking of initiating any Online platform then you can think of launching an On Demand Medical Test App in the market for gaining more revenue. he App Ideas is leading web and Mobile App development. We provide the best IT Services at best rates. Contact us now!