||2 years ago|
|lib||2 years ago|
|libopencm3@cb0661f81d||3 years ago|
|.gitignore||5 years ago|
|.gitmodules||7 years ago|
|Doxyfile||3 years ago|
|LICENSE.txt||5 years ago|
|README.md||2 years ago|
|Rakefile||3 years ago|
|application.c||2 years ago|
|application.ld||3 years ago|
|bootloader.c||3 years ago|
|bootloader.ld||3 years ago|
|global.c||3 years ago|
|global.h||3 years ago|
This is the firmware for the sound lever meter. It will read the measurements from a GM1351 sound level meter and send them over Bluetooth.
The GM1351 is a digital hand held sound level meter. It is available under multiple brands. There is no connector/interface to read the measurements. Instead I am using test point on the back of the PCB. This allows me to monitoring the interface to the LCD and read back the data displayed into measurements.
The measurements are send transmitted over Bluetooth using a SPP module.
The firmware runs on a black pill development board. It is based on a STM32F103C8T6 micro-controller. This will do all the processing and control the peripherals.
The Bluetooth module is a HC-05. It should be configured to be a slave and offer a SPP profile. The measurement will be forwarded by the micro-controller over the UART part configured at 115200 bps 8N1. It will transmit the measurement in the format "123.4 dBa\n".
This does not use a Bluetooth Low Energy (BLE) module because it does not fit the needs. There is no need to save energy since the device needs permanent power just for the display. There is a constant stream of data (not fitting BLE principles). The is a specified Classic Bluetooth profile for serial data: Serial Port Profile (SPP). BLE module use non-standard GATT characteristics for serial data transfer.
Connect the peripherals as described below.
MT3608 voltage regulator module:
- IN-: ground
- IN+: 5V
- OUT-: ground
- OUT+: IDC 2x3 pin 5
Set the MT3608 voltage output to 9V. This is meant to replace the GM1351 PP3 9V battery. It kind of also works with 5V, but the LCD is very dim. Since I don't know if the measurements remain accurate at 5V, I prefer to provide the voltage it was designed for.
HC-05 Bluetooth SPP module:
- STATE: no connect
- RX: USART3_TX/PB10
- TX: no connect
- GND: ground
- VCC: 5V
- EN: no connect
n-channel MOSFET 2N7000:
- 1 source: ground
- 2 gate: PB0, add pull down resistor
- 3 drain: IDC 2x3 pin 2
IDC 2x3 2.54 mm, micro-controller side:
- 1: ground
- 2: PB13, SPI2_SCK
- 3: 2N7000 pin 3
- 4: PB15, SPI2_MOSI
- 5: MT3608 OUT+
- 6: PA8
IDC 2x3 2.54 mm, GM1351 side (solder wires on the PCB):
- 1: B-
- 2: LCD_WR
- 3: D7/D8, on the text side, to control the ON/OFF button
- 4: LCD_DATA
- 5: B+
- 6: LCD_CS
All pins are configured using
defines in the corresponding source code.
The source code uses the libopencm3 library.
The projects is already a git submodules.
It will be initialized when compiling the firmware.
Alternatively you can run once:
git submodule init and
git submodule update.
To compile the firmware run
To generate doxygen documentation run
There are two firmware images:
bootloader image allows to flash the
application over USB using the DFU protocol.
bootloader is started first and immediately jumps to the
application if it is valid and the DFU mode is not forced (i.e. by pressing the user button on the board or requesting a DFU detach in the
application image is the main application and is implemented in
It is up to the application to advertise USB DFU support (i.e. as does the provided USB CDC ACM example).
bootlaoder image will be flashed using SWD (Serial Wire Debug).
For that you need an SWD adapter.
Makefile uses a ST-Link V2 along OpenOCD software.
To flash the
booltoader using SWD run
bootloader is flashed it is possible to flash the
application over USB using the DFU protocol by running
To force the bootloader to start the DFU mode press the user button or short a pin, depending on the board.
It is also possible to flash the
application image using SWD by running
SWD also allows to debug the code running on the micro-controller using GDB.
To start the debugging session run
The firmware offers serial communication over USART1 and USB (using the CDC ACM device class).