Darrell L. - Viewing Profile: Likes - Netduino Forums
   
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.

Darrell L.

Member Since 24 Apr 2013
Offline Last Active Apr 18 2017 08:53 PM
-----

#61936 0-5V input, 0-20mA output via NDP2

Posted by Darrell L. on 24 March 2015 - 11:30 AM

Firstly, let me say that I’ve learned a TON of things about embedded development from this community and after lurking  :ph34r:  in and out of the forums for some time, it’s now my turn to share some of the knowledge that I’ve acquired as a result.

 

This is also my first every write-up of any kind... so kindly let me know how I did!!! 

 

Having a requirement for a 0-5V input to a 0-20mA output, I’ve arrived at the circuit contained within the attached .ZIP file (VtoI.png).  This is by no means my final circuit (as there is always room for improvement) but it is what I’m using at the moment and it fills the need.

 

This circuit is comprised of two parts:

  1. The actual V to I converter (XTR111)
  2. The 12bit DAC (controlled via the NDP2’s SPI bus)

 

Let’s look at the first part:

 

The XTR111’s circuit is setup according to the device’s application notes.  One minor change I’ve implemented is the ability to trim the output current so that at 0.000V input you’d get 0.000mA as well as being able to adjust the output to 20.000mA when the Vin pin has 5.000V applied it.

 

 

And the 2nd part:

 

The LTC1257 DAC is a 12bit device capable of outputting 0.000V to Vref volts (there is a limitation to this.  Please refer to the device’s datasheet for complete details).  The DAC itself requires a 12bit “WORD” in order to operate.  A 12bit “WORD” in this case is the lower 3 nibbles of 2 bytes.

 

To set the DAC’s output to the desired voltage level, you need only do the following:

  1. Apply 5.000V to Vref (the more accurate your Vref voltage, the more accurate your output voltage will be).

 

  1. Use the following formula to calculate the desired output level (refer to the source code example for greater detail)
    • 4095 * dacOutputVoltage / Vref

 

  1. Write the value to the device via the SPI bus.

 

In order to calibrate the 0-20mA output, you simply need to set the DAC’s output to 5.000V and adjust the trim pot to give you 20.000mA at the Iout output (use an ammeter connected directly between the Iout and Iout return terminals).

 

It’s a pretty simple setup.  Took me a couple of hours of “noodling” to get it right.

 

I’ve attached the source code, related datasheets and a simple schematic in order to complete this example.

 

Hope you enjoy reading this (and prototyping it?) as much as I had going through the excersise. :D

 

Attached Files




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.