Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Driver for the MCP41100 digital potentiometer

mcp41100 DAC digital potentiometer voltage divider

  • Please log in to reply
2 replies to this topic

#1 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 09 June 2013 - 01:20 PM

Hi all!

 

The MCP41100 is a programmable digital potentiometer with SPI interface and comes in a breadboard friendly DIP-8 package. You can set it to any value between 0 (zero) and 100 kOhm in 256 steps. You can of course tweak it into doing other ranges by wiring in series or in parallel with other (fixed) resistors.

 

For another project, I needed to produce a variable voltage between 0 (zero) and 5V so I made a simple driver class for it and thought I'll share it with you. Attached you'll find the driver and demo app. It is written for my beloved mini but works with others too requiring only small modifications.

Attached File  miniMCP41100.zip   4.51KB   7 downloads

 

You simply use it like this:

var r = new MCP41100(new SPI.Configuration(Pins.GPIO_PIN_17, false, 0, 0, false, true, 10000, SPI.SPI_module.SPI1));// set half resistance (i.e. ~50k)r.Level = 128;// set zero resistancer.Level = 0;// ...or you can use the Resistance property to set ~50k like sor.Resistance = 50000;// set ~100kr.Resistance = 100000;

The demo app assumes the IC has been wired as a voltage divider like in this schematic (Pw = output):

Attached File  mcp41100.PNG   20.48KB   25 downloads

When connected that way, you can use it as an a very slow "arbitrary signal generator" meaning you can pretty much draw any signal over time like I did in this post or a nice sine wave if you prefer that:

Attached File  MCP41100_sine.JPG   36.09KB   24 downloads

 

I guess you could think of the MCP41100 like a "poor man's DAC" :) but since the mini does not have a DAC, it can actually very useful at times as it's also much simpler than to use PWM.

 

Enjoy!

 

EDIT: Note that the MCP41100 is not suited for signal generation in general.



#2 cutlass

cutlass

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationNew England. :)

Posted 09 June 2013 - 03:26 PM

Neat, Thanks!

 

For FPGAs, and dedicated hardware (like a PWM output), a simple/cheap analog output can be made with an RC (resistor , capacitor - or other low-pass filter) and doing a simple PWM (vary the pulse width).  Depending on many factors, it's possible to get ~7-8 bits of resolution (~128-256 values) from that single line. :)

Note, there is ripple on the signal, and many other "non good things" with this type of simple output!

 

For debugging, that simple type of signal can be good. You just hook up a voltmeter, or a lead to a multi-channel voltage data-logger, and you can get valuable information. :)  It's also much easier than a serial output.  And, a handheld voltmeter is small and easy to use, and to look at signals/test-points.

 

Some more info:

http://www.ti.com/li...497/slaa497.pdf



#3 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 09 June 2013 - 07:19 PM

Yes, I even mentioned PWM in the end of my post. Naturally, the MCP41100 is not at all intended for signal generation (for many reasons), it just seemed like a "fun thing" as opposed to being something of practical value. 



For debugging, that simple type of signal can be good. You just hook up a voltmeter, or a lead to a multi-channel voltage data-logger, and you can get valuable information.  :)  It's also much easier than a serial output.  And, a handheld voltmeter is small and easy to use, and to look at signals/test-points.

That's a good tip!

 

Speaking of PWM, below is a sine(-ish) wave form that I generated using a UART and an LP-filter. It was done using a regular USB to TTL UART converter cable with code running on the PC in an attempt to produce audio - see how beautifully smooth it is?  :lol: 

Attached File  UART_sine.JPG   117.81KB   8 downloads

 

Also, I was actually thinking of doing PWM audio on an MSP430 but someone beat me to it:

 







Also tagged with one or more of these keywords: mcp41100, DAC, digital potentiometer, voltage divider

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.