Necessary Hardware
- Microcontroller/development board of your choice
- With necessary programmer
- SmartMesh IP Mote (DC9003A-B)
- With 6 female-female jumper cables
- SmartMesh IP Manager (DC2274A-A)
- SmartMesh Interface Board (DC9006A)
- With USB-A to USB-micro cable
- Computer (should support Python and Java)
Necessary Software
- FTDI Serial Drivers
- IDE/programmer/debugger of your choice
- SmartMesh C Library
- SmartMesh QuickStart Library
- Git client (optional)
Downloading Libraries
There are two ways to download the QuickStart Library:
Clone The Source Code
- Clone the repository: TODO: Add link when public repo created
- Checkout the latest release: TODO: Refer to latest release
Initialize and update the neccessary C Library submodule:
(...)
/QuickStart_Library
$ git submodule init
(...)
/QuickStart_Library
$ git submodule update
Download Zip/Tar
- Go to the QSL release page and download the latest zip/tar: TODO: Add link when public repo created
- Go to the C Library release page and download the latest zip/tar: TODO: Can possibly be added as attachment to QSL release. If not: Make a note about why it needs to be downloaded separately
- Unzip the files using your favourite compression tool.
Directory Structure
The QSL repository contains the following directories:
- sm_qsl/ contains the QuickStart Library as a collection of headers (.h) and source code files (.c).
- sm_clib/ is a submodule that contains the underlying C Library, with sample applications for its direct use.
- sm_clib/ is the C Library itself as a collection of headers (.h) and source code files (.c).
- ports/ contains an example of the necessary C Library ports.
- examples/ contains sample applications which use the C Library directly.
- sm_clib/ is the C Library itself as a collection of headers (.h) and source code files (.c).
- examples/ contains sample applications utilizing the QSL
- rpi/SimplePublish/ contains an example that connects and starts publishing random data, where the necessary porting functions have been implemented for the Raspberry Pi.
- rpi/SimplePublish/ contains an example that connects and starts publishing random data, where the necessary porting functions have been implemented for the Raspberry Pi.
The SmartMesh C Library will be in the sm_clib/ directory from the separate unzipped folder if you chose the zip download.
The SmartMesh QuickStart Library, and C Library it depends on, are both designed so you can drop their directories into your application without modification, i.e. these two folders from the structure above:
- sm_qsl/
- sm_clib/sm_clib/
You are free to modify them to suit your needs; however, we recommend you avoid changing the contents of these two directories, as this will allow you to easily replace them with future revisions.
In addition to the files in these folders, you need to implement a handful of functions, as discussed in the next section.
3 Install FTDI Serial Drivers
To be able to connect to and configure the mote and manager, your computer will need the necessary FTDI Serial Drivers. Most modern OSes come with FTDI drivers pre-installed (e.g. Linux), but you may have to install them manually if they do not configure automatically when you plug in the interface board or manager. Follow the installation guide corresponding to your OS if you have any trouble.
If installed correctly, the interface board or manager should appear as a group of 4 serial ports when connected via USB:
- Windows: 4 COM ports can be viewed using the Device Manager (Control Panel -> System -> Hardware -> Device Manager -> Ports)
- Linux: $ dmesg | grep FTDI should detect FTDI converters attached to /dev/ttyUSBn to /dev/ttyUSBn+3
The ports of interest are the third and fourth, which map to the CLI and API, respectively, as defined by Table 1.
Device | Serial Port Number | Usage | Baudrate | Data Bits | Parity | Stop Bits |
---|---|---|---|---|---|---|
SmartMesh IP Manager | third* | CLI | 9600 | 8 | No | 1 |
fourth* | API | 115200** | 8** | No** | 1** | |
SmartMesh IP Mote | third* | CLI | 9600 | 8 | No | 1 |
fourth* | API | 115200** | 8** | No** | 1** |
*: Refers to the serial ports created by the FTDI drivers.
**: Default values (can be changed).
Note that for Windows, the COM port assignment will change whenever you connect the interface board (or manager) to a different USB port.
4 Prepare Mote
4.1 Select Slave Mode
By default, the motes in starter kits are configured for master mode; a demo mode where the API is disabled and an application is run that generates sample data and controls joining. To use the mote alongside an external MCU, the mote has to be configured for slave mode; the API is enabled and the mote expects a serially attached application to control it.
- Start by connecting the mote to your computer via the interface board, as shown in Figure 1.
- Identify the port name that maps to the CLI. For example, if you are in Windows and see the four COM ports pictured below, the CLI will be accessible through COM14.
- Connect to the mote CLI with a third-party serial terminal of your choice (e.g. putty). See Table 1 for configuration details.
Use the get mode command to see the current mode:
> get mode
master
Use the set mode command to switch to slave mode, followed by reset for the change to take effect. After rebooting, a new get mode should confirm the persistent mode change.
> set mode slave
> reset
> SmartMesh IP mote, ver 1.3.3.1 (0x100)
> get mode
slave
- Disconnect the mote from the interface board and make sure to remove its battery (if any), as we will power the mote from the MCU.
4.2 Connect to Your Microcontroller
You will need to connect 4 wires between your MCU and the mote for power and serial communication, as shown in Table 2. In addition you need to ground the mote RX Request to Send (RTS) and TX Clear to Send (CTS); unless your MCU cannot wake on data and has to use these accordingly (the mote does not need incoming flow control).
Table 3 lists the names (equal to those found on the silkscreen) of the P1 pin header on the DC9003A mote board visible in Figure 2.
MCU | Mote |
---|---|
3.3 V | VBAT |
Ground | GND |
UART TX | RX |
UART RX | TX |
Name | Pin # | Name | |
---|---|---|---|
TX CTSn | 1 | 2 | TX RTSn |
TX | 3 | 4 | GND |
RX | 5 | 6 | RX RTSn |
RX CTSn | 7 | 8 | CO TX |
CO RX | 9 | 10 | GND |
RESETn | 11 | 12 | F P ENn |
I MISO | 13 | 14 | I MOSI |
I SSn | 15 | 16 | I SCK |
GND | 17 | 18 | TCK |
TMS | 19 | 20 | TDO |
TDI | 21 | 22 | VUSB_3V6 |
PGOOD | 23 | 24 | GND |
VBAT | 25 | 26 | KEY |
EHORBAT | 27 | 28 | RSVD |
I/O 1 | 29 | 30 | I/O 2 |
V+ | 31 | 32 | +5V |