Serial Port programming Tutorial using Java SE for Embedded Developers

RSDevX
2 min readFeb 24, 2022

A short tutorial on how to communicate with an Arduino or ATmega328P microcontroller from your Windows or Linux PC using JavaSE.

Cross platform Java serial port communication with Arduino

Here we will learn about programming the serial port using a commonly used cross platform library called jSerialComm.

If you are tring to communicate with other microcontrollers like MSP430 ,Please use a USB to Serial Converter like the one shown below.

Please note that MSP430 is 3.3v volt tolerant.

You can find the link to the library and source codes below.

The Tutorial teaches you to

Once you have downloaded the jSerialComm JAR file in a directory of choosing, you can compile the source code as shown below.

javac -cp .;jSerialComm-2.9.0.jar YourSerialSourceCode.java

resulting class file can be run as

java -cp .;jSerialComm-2.9.0.jar YourSerialSourceCode

Here are a couple of images of java serial port in action on a Windows10

Java serial port programming displaying available serial ports on a Windows 10 PC
Java Serial port program receiving data from Arduino.

--

--