NUERA has one Serial (RS232 – Rx, Tx) communication port using which , we can send and receive serial data between NUERA and PC. This can be done by taking out Rx, Tx, GND from Power-IO cable to RS232 port of PC using 3 wire custom cable. If PC do not have an RS232 port, a USB to RS232 adapter can be used.
Step 1: Create an instance of SerialCommunication class
Navigate to file src >> application >> application.cpp. In the section of the code where global variables are initialized and class objects are instantiated, create an instance of class SerialCommunication named serial_comm. Here, we also define the Baud rate for the UART serial communication. #include<string> must also be included in order to perform operations on serial data. This is shown below:
Step 2: Edit the application() in application.cpp to write data to serial port
Expand the application() in application.cpp . Here, add the code for serial communication from NUERA. For example, let us write the threshold value of the binary threshold function (which can be changed by user from WebGUI) seen in the previous section. The code is shown below:
Step 3: Install a Serial Port Terminal Software and open Port corresponding to NUERA.
Various serial port terminals are available.
For Windows PC:
We recommend Hercules SETUP utility on Windows platform for this facility. It’s freeware, and hence it can be used and shared for free. You can download the software here . After installing the Serial Port Terminal, connect the RS232 to USB cable from I/O module to the PC. Open Device Manager, and find out which COM Port is connected to the I/O module. Now, in the software, open the Serial tab, select the connected COM port, input the required Baud rate and data size and parity if required. Then select Open option.
Fig 1. Serial Terminal
On Ubuntu PC:
Minicom is the most commonly used Serial Port Monitor. The steps to install and use Minicom are mentioned below:
- Open Terminal
- Install the program with: sudo apt-get install minicom
- Connect the RS232 to USB cable from I/O module to the PC
- In order to find the name of your port(s) enter this command in terminal: dmesg | grep tty
- For a USB-to-Serial adapter, one may see: [ 0.000000] console [tty0] enabled, [ 5.065029] usb 4-3: pl2303 converter now attached to ttyUSB0. What we are interested in is the name of the serial port. In this case, it is ttyUSB0. We will need this in order to use Minicom.
- Next, in the terminal, enter: sudo minicom -s
- Choose “Serial port setup’. Then, adjust the Serial Device to that as seen in the previous step: A – Serial Device : /dev/ttyUSB0. In the same menu, input the Baud rate, data size and parity bits are specified.
- Once configured, select “Save setup as dfl”, which will save these as the default configurations for future connections (/etc/minicom/minirc.dfl). Once saved, choose Exit, and you will see minicom prompt.
Step 4: Update NUERA and observe output
Once you save the code file as mentioned in Step 2 and build the project, the build will complete successfully. Then you can Upload this project to NUERA. In the Serial Port terminals (in Ubuntu / windows, whichever the camera is connected to through the RS232 port), you can see the threshold value being printed continuously. If you update the value of threshold(through GUI), the same will be reflected in the serial port terminal screen. The serial output on Hercules is shown below:
Open terminal on ubuntu and type minicom to open the application. The output on Minicom is shown below:
For any further assistance, please contact our application engineer at email@example.com