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 https://drive.google.com
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:
MAX7219_SendAddrDat(0x08,LEDcode[(a/10000000)]+0x80);
0x08 is the digit number, 0x80 is the command to turn on the decimal point.

Get the code here https://drive.google.com




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 https://drive.google.com.
Please send me your comment to silvester.dao(a)gmail.com .

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 https://drive.google.com.


Aug 2, 2016

4-Digit Seven Segment Display TM1637 (STM32F103C8T6)

TM1367 is a LED drive and keyboard scan controller but in this application it is uses for driving 4 digits seven segment display. There are 4 wires connecting the display and the microcontroller:

Display : MCU 
GND     - GND
VCC     - 5V
DIO     - Port A1
CLK     - Port A0


It communicates using I2C protocol, that's why the code has below procedures:
- TM1637Start(void);
- TM1637Stop(void);
- TM1637ReadAck(void);

The example code init the mcu, init the TM1367 and then display integer counting from 0-9999 repeatedly. Get the code here https://drive.google.com.

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 a...