In fact, any new program written for MCU is only copy-paste from older projects. Not real copy paste, but using the same libraries and subroutines. For some upcoming bigger project, I decided to use STM32 microcontroller, this means, I need to port several AVR libraries from older projects to the new ARM MCU. Due to historical reasons, older libraries were a bit chaotic. New versions are a bit improved, unified and much easier to use.
Porting somehow was very fast. Most of the problems were with the I2C bus- breadboard I used had some issues and I added additional termination resistors to keep everything stable. Maybe bigger capacitance of the breadboard or bad connections inside.
All sensors and screens are from China, only FM75 is from an old plasma TV set and MAX44007 donated by a friend. I had no idea what to create next and also I was a bit bored. And one day, I received a letter from them, with an offer to create some any project I wish and they will give some of the needed components. After this, I made a small poll about projects people need for now. I add some engineering touch to poll results and in a few posts I will start step by step articles about one smart thing.
Sensors and screens used in this test are:
- LM75 temperature sensor, I2C (FM75 is advanced version, compatible with LM75)
- MAX44007, I2C, digital calibrated light sensor.
- PCF8574, I2C, 8bit I/O extender.
- Old school txt LCD ekraniukas on PCF8574 extender. Free 5V – 3V level shifter.
- SSD1306 OLED screen on I2C bus.
- Analog input- not external module, but part of STM MCU chip.
- RTC (real time clock)- also not external, but build in STM MCU.
- BMP180 Atmospheric pressure sensor with temperature detection option.
Somehow I forgot to add DHT11 sensor code in this post. Sorry. I think in some future post it will be.
The OLED screen is using Commodore 64 font and there is error in font data. Will fix in future.
All libraries are compatible with GNU gcc and STM32CubeMX programs. All files compile without single warning.
Some data from sensors are shown on OLED and LCD screens and all data is sent using the USB virtual COM port for debug purposes.
Continued on Part 2.