Hi all,
I've been trying to use the MCP4921 DAC chip to literally just try to read an analog voltage using an oscilloscope, but the noise looks weirdly digital. I THINK I have it wired correctly, but the noise I'm seeing from my oscilloscope looks strangely (and worryingly) digital. The library I'm trying to use is linked here: GitHub - RobTillaart/MCP_DAC: Arduino library for MCP_DAC MCP48xx and MCP49xx series SPI-DAC
I have to zoom way in to see this change, but it still looks like its in digital steps (pic attempted to be uploaded below)
If you want us to check, show a schematic of your circuit as well as a good photograph of the actual setup.
Noise problems can be related to actual wiring; even if the schematic is technically correct, you may run into trouble due to noise pickup in long wires, on breadboard strips etc.
I think that the steps that you are seeing is an artefact of the oscilloscope, and the setting of the Y amplifier gain control.
You appear to be measuring a voltage of around 4V, and using the 5V/division range. This is not the most appropriate setting for the voltage you are looking at.
The oscilloscope has an 8 bit ADC, that means that it can only display 256 different levels. Those 256 levels have to cover the whole of the screen i.e. 8 divisions x 5V = 40V. So each division can only show 32 different levels maximum.
I think that if you were to change to 1V/division or even 500mV/division (if it doesn't go offscreen) then those steps would not be visible.
Wiring also doesn't exactly match the schematic with the additional component (resistor? inductor?) in series with the output. The MCP is effectively running into a load of near-infinite impedance with only the scope probe loading it. I'd start loading it with 22k or so.
You can filter the output depending on the required speed (esp. slew rate) of your application. If you don't need very fast transients, you can filter the output with a small cap to filter out some AC noise.
Note how the datasheet lists performance with a 5k load and 100pF across this load. See sections 1.0 and 2.0 of the datasheet. You're running it with IDK maybe 10MOhm (wild guess; see specs of your scope) or more and maybe 10-15pF in parasitic capacity (again, see scope specs + consider parasitic capacity of the breadboard + wiring).
There is no power supply decoupling on the MCP. Add 100nF or so between Vcc and GND directly at the Vcc pin of the DAC. See section 3.1 of the datasheet.
There are plenty of long wires and potentially sketchy connections between each part of the system that invite noise or all kinds. Wire everything closer together and preferably evaluate performance in either a more compactly-soldered strip/vero board setup or (better yet) a PCB. See section 6.3 of the datasheet that explicitly mentions breadboards as poor choices to evaluate noise on.
When implementing devices like these, make sure to give the datasheet a very, very thorough read - or better yet, several reads.
What you've done so far is demonstrate to yourself that the chip works, in principle. I'd now focus on the actual application and draft the requirements for that, and then determine a schematic that will implement these requirements. Review that closely and then build a test setup, and evaluate this with measurements. As long as the test setup involves a breadboard and DuPont wires, take any noise measurements with a Swiss alp's worth of salt; you're likely looking at totally extraneous stuff like receiving your local FM station and picking up noise from the neighbor's dishwasher rather than the inherent noise of your system. For actual noise evaluation, move to a setup with soldered connections and a compact build, with attention to prevention of ground loops, proper shielding etc.
Thank you for the advice! Although this didn't clear up my noise problem, it is a great tip that is very helpful especially because I only started using oscilloscopes this week. I think the noise is being caused by what rsmls mentioned in their response, I'm looking further into it now.
Thank you sincerely for your in-depth and clearly thought-out reply! I'm still new to looking at data sheets and whatnot, so thank you for being patient and pointing out some things I had missed. I do have a question or two though - specifically about the second half of your first paragraph (' I'd start loading it with 22k or so.') and third paragraph. If you could just explain what you mean a bit more in-depth, that would really be helpful because I'm such a beginner. Otherwise, I'm starting work on a more compact, soldered, and otherwise stable build with your recommendations!
Thank you for helping me, you rule!
C2 is optional.
For the tests in the datasheet they apparently used 5k for R10.
Much appreciated; hope it helps! I'd just proceed with the project and then solve whatever problems you may run into on the fly, and not worry about the noise thing too much for the moment.