Basic UART-SQLite query demo
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.
1. aMG USB Converter N board (Or other USB-serial device which 3.3V interface).
2. aMG SQLite Data Server Board.
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
The use putty.exe for communication software, download from: http://www.putty.org/
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.
1. Download sqlite3.exe, from http://www.sqlite.org/download.html 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.