In this tutorial we will learn how to use MCP4725 12Bit Digital to Analog Converter with Arduino and Visuino to generate Square, Sine and Triangle waves.
Watch the Video!
Step 1: What You Will Need
- Arduino Uno or any other Arduino board
- AD9850 (DDS Synthesizer) More Info
- OLED Display
- Jumper wires
- Breadboard
- Visuino software: Download here
- Oscilloscope (Optional)
Step 2: Brought by PCBWay
Thank you PCBWay for supporting this tutorial and helping users learn more about electronics.
NEW! Now you can get Aluminum PCB & FLEX PCB in their Special Offer!
What I like about the PCBWay is that you can get 10 boards for approximately $5 which is really cost effective for professional made boards, not to mention how much time you save!
Go check them out here. They also offer a lot of other stuff in case you might need it like assembly, 3D printing, CNC machining and a lot more.
- Connect Arduino pin [5V] to breadboard positive pin [Red line]
- Connect Arduino pin [GND] to breadboard negative pin [Black line]
- Connect MCP4725 pin [Out] to 1K ohm Resistor on the breadboard
- Connect other side of the Resistor to the LED pin [positive +]
- Connect LED pin [negative – ] to the breadboard negative pin [Black line]
- Connect MCP4725pin [SCL] to Arduino pin [SCL]
- Connect MCP4725 pin [SDA] to Arduino pin [SDA]
- Connect MCP4725pin [VCC] to breadboard positive pin [Red line]
- Connect MCP4725pin [GND] to breadboard positive pin [Black line]
- Connect Oscilloscope Signal probe to MCP4725 pin [Out]
- Connect Oscilloscope Ground probe to breadboard positive pin [Black line]
Step 4: Start Visuino, and Select the Arduino UNO Board Type
The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.
Start Visuino as shown in the first picture Click on the “Tools” button on the Arduino component (Picture 1) in Visuino When the dialog appears, select “Arduino UNO” as shown on Picture 2
- Add “Microchip I2C Digital To Analog Converter (DAC) – MCP4725” component
- Add “Square Analog Generator” component
- Connect “SquareAnalogGenerator1” pin [Out] to “DAC1” pin [In]
- Connect “DAC1” pin I2C [Out] to the Arduino Board pin I2C [In]
- Upload the Project to the Board, see the “Generate, Compile, and Upload the Arduino Code” Step on how to upload the project
- Add “Microchip I2C Digital To Analog Converter (DAC) – MCP4725” component
- Add “Sine Analog Generator” component
- Set the “Frequency” in the Properties window to 0.2
- Connect “SineAnalogGenerator1” pin [Out] to “DAC1” pin [In]
- Connect “DAC1” pin I2C [Out] to the Arduino Board pin I2C [In]
- Upload the Project to the Board, see the “Generate, Compile, and Upload the Arduino Code” Step on how to upload the project
- Add “Microchip I2C Digital To Analog Converter (DAC) – MCP4725” component
- Add “Triangle Analog Generator” component
- [Optional] Set the “Frequency” in the Properties window
- Connect “TriangleAnalogGenerator1” pin [Out] to “DAC1” pin [In]
- Connect “DAC1” pin I2C [Out] to the Arduino Board pin I2C [In]
- Upload the Project to the Board, see the “Generate, Compile, and Upload the Arduino Code” Step on how to upload the project
Step 8: Generate Digital Pulses – in Visuino Add & Set Components
- In this Example we are going to convert digital pulses from “Pulse Generator” component to Analog Signal using a “Digital To Analog” component
- Add “Microchip I2C Digital To Analog Converter (DAC) – MCP4725” component
- Add “Pulse Generator” component
- [Optional] Set the “Frequency” in the Properties window
- Add “Digital To Analog” component
- [Optional] Set the “True” or “False” values in the Properties window
- Connect “PulseGenerator1” pin [Out] to “DigitalToAnalog1” pin [In]
- Connect “DigitalToAnalog1” pin [Out] to “DAC1” pin [In]
- Connect “DAC1” pin I2C [Out] to the Arduino Board pin I2C [In]
- Upload the Project to the Board, see the “Generate, Compile, and Upload the Arduino Code” Step on how to upload the project
Step 9: Generate, Compile, and Upload the Arduino Code
In Visuino, at the bottom click on the “Build” Tab, make sure the correct port is selected, then click on the “Compile/Build and Upload” button.
Step 10: Play
If you power the Board LED will Blink and if you are using an oscilloscope you should see the signal from the MCP4725 module. There are many ways to use this module this was just a quick simple introduction to get started.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it here and open it in Visuino
Download MCP4725.zip