Get the source code
The code for this demo is located in the following Github repository:
This repo only contains Spresense demo applications and the corresponding configuration files. To build it you must first download and setup the SDK according to the one of the Spresense SDK Getting started guides in the documentation.
Once you have the SDK in place, download the Spresense tutorials source code repo by running:
git clone https://github.com/sonydevworld/spresense-tutorials.git
From this downloaded repo, copy the whole directory of the example application (“pdm_demo”) into the “examples” directory of your Spresense SDK.
Also copy the folder containing the corresponding configuration (in this case ”configurations/pdm_demo”) into the “sdk/configs/examples” directory of your SDK.
When all the source code is in place, change working directory to the “sdk” folder of your SDK repo and proceed with building it.
Build and flash the software
Building the software is done as with any other Spresense SDK application. When you have downloaded the code, enter the “sdk” subfolder and run:
The build process will result in two separate binary files. The main software is flashed as usual:
./tools/flash.sh -c nuttx.spk
The DSP signal processing binary should be placed on the SD card so that the main software can find and load it at startup:
- Create a new directory called “BIN” in the root of your SD card.
- Copy the file “examples/pdm_demo/sigproc/dsp/DSPFFT” into the BIN folder on the SD card.
Configure the software
The software is configured by providing a configuration file that must be placed on the . The reason for this setup is to enable reconfiguration without having to rebuild the software and flash the board. It also avoids having to keep login credentials and other sensitive data in the source code.
A template file is available at “examples/pdm_demo/config/pdm.config”. The configuration is specified using the format “: ”, and lines starting with a hash (“#”) are comments and will be ignored.
The settings include Wi-Fi and web API login credentials, sensor and bearing specifications, and motor speed. Fill in the missing values to match your setup and copy the file to the root of the SD card.