Small project showing how to read temperature from Papouch TQS3 thermometer and display temperature on
a 4 digits 7 segment display from Mikroelectronica (MIKROE-201: Serial 7-seg Display Board MAX7219).
Above operations are controlled by a STM32F103 microcontroller, on a OLIMEXINO STM32 board.
All things are connected together using a prototyping board - Base board in System diagram.
- UART 1 is connected to RS485 transceiver, communication bus for temperature sensors.
- SPI 2 use to send data to display (MAX7219). 4 digits, 7 segment - display temperature sensor number and temperature value (Celsius degrees)
- Relay output: is used to control an relay (Omron G5RL-1A-E-HR 16A/250VAC)
- Buzzer output (PC8) is used for turning buzzer on/off. Alarm when temperature is out of range
- LED output (PB7), flash when temperature limits monitoring is disabled
- Switch input (PA0) disable temperature limits monitoring
Open image in new tab to enlarge Diagram was drawn using Draw.io online diagram software. File is saved in diagrams folder (system_diagram.xml file).
STM32CubeMX application was used to generate C initialization code (see olimexino_stm32.ioc file). Link to this tool is at the end of the ST page - GET SOFTWARE section.
Project structure and folders
Project root folder contains below folders. Most of them are explained below.
Code and Visual Studio project is in project directory. Below is the structure of this folder:
Folders Inc and Src contains C files generated using CubeMX. CubeMX project was saved in olimexino_stm32.ioc file. Below is a screen shoot of CubeMX project. What is green is used in this project.
Initialization code need to be regenerated only when pins and/or microcontroller peripherals has changed.
Visual Studio project should look as below. To successfully open the project VisualGDB should be installed, GCC toolchain should be present and Embedded BSP for STM32 should be downloaded.
VisualGDB will ask to download the toolchain and necessary Embedded BSP if you try to open the project (temperature_monitor.sln) and above are missing.
Visual GDB use systems Users folder for shared files (Embedded BSP). This location will be different from what is now in project. To update for new location use Regenerate MCU files button from VisualGDB Project Properties - see below picture.
When everything is set correctly, in Visual Studio, Solution Explorer view should looks like below:
Programming and debug
For programming and debug J-Link Edu probe was used with additional header from Olimex - see below picture
Schematic for the base board (this board is used to route signals from/to other boards and adds I/Os) is in "hardware" directory. A screen-shoot is below.
A short video on YouTube Youtube Video
The software is licensed under MIT License (this license apply to modules contained in "sources" directory. Generated files has a license similar with this license - see generated files license section).
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Who do I talk to?