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

No comments:

Post a Comment

Water Level Sensor of Washing Machine (STM32F103C8T6)

Washing Machine Typical work principle of water level sensor of a washing machine shown on the picture. Sensor is located above the wa...