Saturday, August 4, 2012

qSerialTerm: Serial port servomotor control

qSerialTerm, a Qt based serial port terminal emulator, now supports a "frame" feature, intended for servomotor control applications.

This "frame" feature allows the user to send multiple data points (uint8, int8, etc) grouped in a frame. The user can send this frame by click a button or choose to periodically send these frames via a checkbox.

The value of these data points can be varied via a slider or, alternatively, via a spin box. The frame can be sent in two formats: Raw binary or hexadecimal string, where each byte is represented by two characters. e.g. 31 (one raw binary byte) or "1F" (hexadecimal string = 2 bytes).

The minimum and maximum values for the data points and the endianness of data points can also be specified by the user.

Additionally, the user can append one byte and/or prepend one byte to the frame.

A image is worth a thousand of words, the above description will be clearer with the following image.

qSerialTerm frame feature

In the following sections, I'll show you some usage of this frame feature.

Raw binary format


Raw binary format

For this example, the frame was composed of these bytes: 48, 49, 50, 51; and sent in raw binary format. These bytes are equivalent to the '0', '1', '2' and '3' characters shown in the terminal.

Hexadecimal string format and endianness


Hexadecimal string format

In this example, these 4 words (uint16): 15, 255, 4095 and 65535 were sent in hexadecimal string format.

Notice that these 4 words should take 8 bytes, however the hexadecimal string format takes 16 characters (bytes).

Also the frame is in little endian format, this means that the least significant byte occupies the the lowest memory address. e.g. the word 15 is represented as 0x000F in big endian format, and represented as 0x0F00 in little endian format.

Finally, in little endian format 15 -> 0x0F00, 255 -> 0xFF00, 4095 ->0xFF0F and 65535 -> 0xFFFF. All this results in the following string: "0F00FF00FF0FFFFF", which is shown in the terminal.

Servomotor control demo


I owe you this one for now. I've used this software to send signal controls to a robot. I'll post a video later.

Repository


qSerialTerm source code is available in this repository.

More information


qSerialTerm as a serial port emulator
qSerialTerm for data logging
qSerialTerm for data acquisition
qSerialTerm for image visualization  

1 comment:

  1. How about if you have a pet robo???
    Meet the multi-talented Humanoid Robot- AIHRO...!!!
    Do Watch and Share

    http://sudowiki.com/aihro-an-artificial-intelligent-humanoid.html

    ReplyDelete