Basic UART-SQLite query demo

<< Click to Display Table of Contents >>

Navigation:  STM32F4 Target > Demos > Hardware Modules Demos > aMG SQLite Data Server >

Basic UART-SQLite query demo

Previous pageReturn to chapter overviewNext page

The demo showing to communicate with aMG SQLite Data Server board via UART. It helpful for understanding the command/ protocol to start develop your own software to communicate with aMG SQLite Data Server board.

Hardware requirement:

1. aMG USB Converter N board (Or other USB-serial device which 3.3V interface).

2. aMG SQLite Data Server Board.

Hardware setup

Follow below hardware setup, connection between aMG USB Coverter N and aMG SQLite Data Server board.

 Tx pin of aMG USB Converter N ---> Rx pin of aMG SQLite Data Server

 Rx pin of aMG USB Converter N <--- Tx pin of aMG SQLite Data Server




Software setup

The use putty.exe for communication software, download from:

1. UART port configuration



2. Terminal configuration



1. press Enter, to display main prompt ">".

2. Ask for board firmware version, by keying "version" + press Enter key.


3. Enter SQLite3 prompt mode, by keying "sqlite dbname.db" + press Enter key.


Note: If database name not specified when switch to SQLite prompt, it will use the default "database.db".

4. Now try to create data table, to store temperature measure at room no.1, no.2 and no.3 for every minutes.


T1 - Temperature measure at room no.1

T2 -  Temperature measure at room no.2

T3 -  Temperature measure at room no.3


Note: aMG SQLite Data Server board did not implement command history, it not support Arrow key.

5. Display data in table name "temperature", by using "SELECT" statement.


6. Disconnect from SQLite prompt mode, exit to main prompt. By keying ".quit" + press Enter key.


Repeat step3 if you want to enter SQLite prompt again.

Checking SD card for generated database file


Open database file on Host PC (Process database)

1. Download sqlite3.exe, from at section "Precompiled Binaries for Windows".

2. Extract executable file to "C:\sqlite", also copy database file "dbname.db" from SD Card place into same directory.


3. Start windows command line prompt, cmd.exe


4. At windows command prompt, change current directory to "C:\sqlite". Type command "cd \" to change to root directory "C:\", then type "cd sqlite".

5. Run sqlite3.exe with specify database name "dbname.db"

6. Display data storing in database by "SELECT" statement.


Export data to CSV format