Dec 11, 2019

Wifi Display (ESP8266 STM32F103C8T6 P4.75)

This Display will receive text from PC or phone through wifi. It can work as access point or station. Access point means you can connect to the display directly without wifi router, while station requires wifi router between PC/phone and the display. The display has 4 lines, you can write on every line or clear all the display depending on the first byte you send before the text. If you send 0x01 (byte), it will clear 1st line and then you can send the text, maximum 10 characters per line. The display will ignore the text you send if more than 10 characters per line. Send 0x02 (byte) for 2nd line, 0x03 (byte) for 3rd line, and 0x04 (byte) for 4th line. If you want to clear all the display, then send 0x00 (byte).

Connect to DaoLink AP, password mypassword2019 and send the data.
You can use Putty or Hercules for PC. TCP UDP Terminal apps for Android.
For custom function, you can build TCP client software using VB or other language. Android TCP client can be build using Android Studio.

TCP UDP Terminal application link:
Hercules software link:

The wiring of the modules as the following:
ESP8266 - STM32 Blue Pill
VCC     - 3.3V
GND     - GND
TX      - RX USART2 PA3
RX      - TX USART2 PA2
CH_PD   - 3.3V

STM32   - P4.75 Display
PA5     - CLK
PA7     - R1
PA0     - OE
PA1     - LAT
PA8     - A
PA9     - B
PA10    - C
PA11    - D

Don't forget to wire R1 at header JOUT to R2 at header JIN on LED display because it work as double 64x16 display to became single 64x32 display.

Get the hex code here: WifiTerminal.

Jan 27, 2019

Samsung Smart TV Remote Control Receiver STM32F103C8T6

When you output your Samsung Smart TV audio to optical SPDIF, the volume control will not work because it work in fixed volume. So I build an IR receiver to collect the data transmitted by the remote control to increase or decrease the audio volume when the related button is pressed.

Below the waveform of the signal received by the IR sensor.

I use a common IR receiver with 3 pins: VCC, Data, GND. A 47 ohms resistor needed between VCC pin to 5V power supply and a 1 uF capacitor from VCC pin to GND for RF decoupling. Data pin is connected to the PORTA0 of the STM32F103C8T6 microcontroller.

The code is here, at the moment the volume up and down are used to turn on and off the LED on PORTC13, you can connect it to 2 pieces (for stereo purpose) of X9C103 digital potentiometer in order to increase and decrease volume received at the output of SPDIF receiver.

Jan 24, 2018

Water Level Sensor of Washing Machine (STM32F103C8T6)

Typical work principle of water level sensor of a washing machine shown on the picture. Sensor is located above the water level and connected by an air tight tube to the bottom of the tub. When the water level increase, the pressure in tube increase as well due to gravitational force.

The sensor convert pressure to frequency by placing an ferrite bead on a diaphragm in an inductor. The variation of inductance then converted to frequency by a chip and some passive components.
The frequency has a quite linear correlation to water level. In the curve, 26 kHz generated when water level 0mm, and 23 kHz when water level 200mm. In practice, 400mm water level will generate 20kHz.

The sensor looks like the picture  at left side. There are three pins which are GND, OUT, VCC or sometimes VSS, OUT, VDD (5VDC). If you are not sure, you can check the forward voltage of the pins since there is a protection diode between VDD and VSS. When the forward is about 0.4-0.6V meaning the plus lead of multimeter is VSS and minus lead is VDD because the protection diode is installed in reverse polarity.

Two pin type sensor is not usable for this project because it contains only inductor without L to Fconverter. Two pin type is suitable for the system which converter located in the washing machine controller.

I made 10 sampling per second so the pulse count range is 2627 down to 2000. You can convert the range of reading to 0-100% or 0-400mm depending on your application. Connect a plastic tube to the sensor, blow the tube with your mouth to simulate the water level change.

You can get the code here
It was compiled using Coocox CoIDE and GNU Tools ARM Embedded however other compilers will do.

Nov 24, 2017

MAX7219 8-digits 7-segment (STM32F103C8T6)

I made MAX7219 for C51 but now I need it for STM32F103 too.
The wiring is simple:
MAX7219_CLK   hooked up to PORTA0,
MAX7219_DIN  to PORTA1,
MAX7219_CS    to PORTA2.

The software initiate the MCU clock, init GPIO, init MAX7219 and display is ready to use.
Just call _DisplayInt procedure and pass the value, it will display the integer on the seven segments.
If you need to turn-on the decimal point, just add 0x80 to the digit to display, example:
0x08 is the digit number, 0x80 is the command to turn on the decimal point.

Get the code here

Oct 15, 2017

MCP4725 I2C 12-bit DAC (STM32F103C8T6)

This breakout development board can be bought easily online. The interface is I2C.
For other microcontroller, it's easy to hook up because wire.h library can handle it. For STM32F103, the example codes doesn't work. It seems the I2C interface get some error. That's the reason why I don't use I2C interface but I emulate the GPIO instead.

The code will init the GPIO, then zero the DAC and send increment count from 0 to 4095. The maximum voltage output depends on the VCC, in my case is 3.3V. In many examples found on Google, the address is before left shifted ie. 0x62 or 0x61 but in my code the address is 0xC4 because directly implemented to I2C interface. This circuit will be useful for my 4-20mA project Rev3. Using STM32F103C8T6, 7-segment display, DAC, step up DC/DC and V/I converter, Rev3 will be much easier to build.

You can get the code here
Please send me your comment to silvester.dao(a) .

Jul 2, 2017

DHT-11 Humidity and Temperature Sensor (STM32F103C8T6)

This project is to get humidity and temperature readings from DHT-11 and show them on 4-digit seven segment display TM1637.

Microcontroller pin connections are:
PORTA Pin_0 for TM1637_CLK (Display)
PORTA Pin_1 for TM1637_DIO (Display)
PORTA Pin_2 for DHT11_1Wire (Sensor)
and of course VCC and GND to every module.

Get the code here

Wifi Display (ESP8266 STM32F103C8T6 P4.75)

This Display will receive text from PC or phone through wifi. It can work as access point or station. Access point means you can connect ...