Can supreme log data?


Hi Guys

I have no experience with wavecom or AT commands. I have to come up with a system below by 1 week. :mrgreen:

What do guys think of the below system? Need any tweaking? :blush:

  1. To perform the operation above, there is no need for me to attach an external microcontroller or datalogger, right?
  2. I had a look at the user manual of supreme 20, it seems that the data will be logged in the CPU, right? What is the maximum amount of data I can save in the CPU before sending it out? I need to log about 300 characters of ascii data before sending them out every 10 minutes.
    3.Can the fast track 10 at the sensor side send the data to email addresses instead of to another modem? (I have written software to read data in email and this save one modem cost for my customers).
  3. Is there any example AT command for apps similiar to mine above? :blush:

Thanks guys.


This system can be implemented using only one Fastrack 10 modem.

However there are not such AT commands for such application. You have to write OpenAt application.
This application should save every minute data from the sensor (using FCM and Timer).
For sending data to PC over GPRS, application in Fastrack should open TCP socket to PC and send the data to that socket. This can be done using WIP lib.
On PC side you have to write application that also opens TCP socket and listens data from Fastrack.

I hope that I have given you a general idea.


Many thanks, Kaldvee


FWIW, here’s how you’d do this in Open AT Lua. The main program, in Lua, would look like (untested code):

-- Configuration settings. These can be changed on-the-fly.

SERVER_IP          = '' -- Server where data is sent
SERVER_PORT        = 1234            -- Listening port on the server
DATA_MAX_NUMBER    = 10              -- Number of entries to read before sending
DATA_READ_INTERVAL = 6000            -- Time between two readings (1/10th seconds)
DATA_TABLE         = { }             -- Intermediate storage for data.

-- Initialize the data gathering request, wait for data to
-- actually arrive, return the result.
function read_data ()
   local _, event, data = wait('DATALOGGER', 'ARRIVED')
   return data

-- Send all the data gathered in DATA_TABLE to the server
-- through TCP/IP.
function send_all_data ()
   local socket = wip.tcp_client (SERVER_IP, SERVER_PORT)
   for i = 1, # DATA_TABLE do
      socket:write (DATA_TABLE [i])
      socket:write ("\n")

-- Every time it's called, read one data line and add it to
-- DATA_TABLE. If the table is full, flush it through the
-- TCP/IP network.
function add_data_to_table ()
   table.insert(DATA_TABLE, read_data())
      DATA_TABLE = { }

-- Call add_data_to_table() at regular intervals
function data_loop ()
   while true do

It relies on a couple of C functions, that will do your data acquisition. request_data_from_C() will start the data gathering process. When it’s finished, you signal that it’s completed by sending the signal ‘DATALOGGER’.‘ARRIVED’ to Lua (read_data() was waiting for this signal, thus simulating a blocking call from Lua’s PoV). The signal emission is done by the C function data_arrived() below.

/* Start the data collection */
static int request_data_from_C( lua_State *L) {
   /* Initialize the data gathering routine. */
   return 0; /* Return 0 results to Lua */

/* When data is ready, run this C callback */
static void data_arrived( char *data_line, int data_len) {
   /* push data as an extra arg to the Lua event */
   lua_pushlstring( L, data, data_len );
   /* Trigger th event */
   luaW_signal_str( L, "DATALOGGER", "ARRIVED", 1);

/* Register the 'request_data_from_C' function in Lua.
 * Add this entry in the config table of your application's main source file. */
luaopen_datalogger( lua_State *L) {
   lua_pushcfunction( L, request_data_from_C);
   lua_setglobal( L, "request_data_from_C");
   return 0;

The C code is always non-blocking, but it appears as blocking in Lua (read_data()), thus easing the application writing. Similarly, all TCP/IP code is blocking, no need to synchronize on WIP_CEV_XXX events nor to write a state automaton.

In the next version of WIP + Open AT Lua, there will be a full UART driving API from Lua, so chances are that you won’t need to write a single line of C for such an application.

This program will probably require some improvements before going to prod:

  • Data should be stored in a flash table, so that they won’t be lost in case of a reset (there’s a Lua API for this)
  • You should decide what to do when TCP/IP is unreachable (error handling is done with function try() and dedicated bearer / socket events)
  • Maybe you want to switch the GPRS off and on when appropriate (wip.bearer_client(‘GPRS’, gprs_config))
  • You might want to be able to setup some emergency recovery procedures, e.g. change the server address and GPRS settings from an SMS (there are ‘SMS’ events for that).


Use the ‘Img’ (short for “Image”) tag to display your image in the forum:

True - provided that the PC has an IP connection accessible from the GPRS network.

Most commonly, that would be via an Internet connection - in which case you’d have to ensure that your ISP allows it, and that all your firewalls, routers, etc are appropriately configured.

Some services give you (effectively) a direct connection into the GPRS network - the provider would give you details in this case.

Why does it have to be GPRS?

  • As you’re only sending 300 characters, that would easily fit into 2 SMS messages - maybe even just one, if you’re careful…
  • You could also use a dial-in data call - in which case any standard PSTN modem would do at the PC end.

The answer to which is “best” may lie as much in your available tariff options as in any technical merit…! :wink:


Many thanks, you dudes are the coolest.