You are here

    • You are here:
    • Home > How can I send binary data using the GSatMicro and what...

Knowledgebase 

Knowledgebase Index
View Knowledgebase Index

Knowledgebase: KB000885


Inquiry:

How can I send binary data using the GSatMicro and what is the length limit?

Solution:

In the realm of binary messaging, here's an all-encompassing solution that shows how to pack and transmit binary.

The first thing we are going to run is a quick "in memory" function that makes converting from something easy to enter on the console (ASCII) hex characters to binary. One binary byte (8 bits) is represented by 2 hex bytes (also 8 bits). This in-memory function will make it easy to enter pairs of hex characters to convert to binary.

In your application, you can take a binary string and parse it out to the appropriate hex characters.

Each command must be less than 100 characters, so let's create some strings that are about 70 characters. Then we will take 48 hex bytes and convert them to 24 binary bytes, and append them to a "tx" variable.

Remember the maximum binary MO payload for the satellite modem is 340 bytes.

Last step is actually transmitting this "tx" variable with a simple "iridium.transmit(tx)"

Code Example:

function hex2bin(str) a='' for c in str:gmatch".." do a=a..string.char(tonumber(c,16)) end return a end
tx=hex2bin("1b4c75615100010404040401000000000000000000000000"))
tx=tx..hex2bin("00000202e005000005000000414000001c40000105000000"))
tx=tx..hex2bin("00000202e005000005000000414000001c40000105000000"))
...
iridium.transmit(tx)


Questions?

Have any questions?

We understand there are problems that can not be solved by a product-in-a-box. If you have special requirements for your project, please contact us and we will provide you with a custom solution tailor-fit to your needs.