arduino measuring 4-20ma what kinda precision - Page 1
Forum section: electronics / beginners

author: simondid
author_rank: Contributor
timestamp: January 06, 2016, 04:13:50 pm
content: HeySo I’m working on interfacing a bürkert level transmitter 8177https://www.burkert.com/en/type/8177with a Arduino and raspberry I found that people are using a asc712 5a version Hal effect sensor to do this job.Question 1 : How much precision will I get out of this (assuming the sensor was is 100% accurate ) running it a 24 volt??Question 2: using this boardhttp://www.ebay.com/itm/381374424345?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AITcan i really just connect the 2 wires coming from the sensor DirectQuestion 3: will I be better off trying to implement the HART Protocol considering time and precision gain?thanks

author: max_torque
author_rank: Super Contributor
timestamp: January 06, 2016, 06:15:40 pm
content: 4 to 20mA into a 5A sensor?? The RESOLUTION will be terrible, irrespective of how much precision you manage to achieve!!You can calculate the resolution easily with basic maths (hint, work out the V/amp of the sensor, and then the V/count of your adc) and of course, the max precision of the system can only ever be half your resolution.

author: simondid
author_rank: Contributor
timestamp: January 06, 2016, 07:06:46 pm
content: Is there any way to get a good resolution?

author: bxh
author_rank: Contributor
timestamp: January 06, 2016, 07:17:48 pm
content: Never heard of the sensor, but quick Google brings up Sparkfun's listing which describes an opamp gain stage.

author: Alexei.Polkhanov
author_rank: Frequent Contributor
timestamp: January 06, 2016, 07:27:46 pm
content: This sensor is designed for standard 4-20 ma current loop so you can/should use some of available receivers like TI RCV420 (part name speaks for itself)link:http://www.ti.com/product/rcv420- it will translate your 4-20 current signal into 0-5V voltage.Check out other ICs in this list as well:http://www.ti.com/lsds/ti/amplifiers-linear/4-20mA-conditioning-products.page. 4-20 is something like 100y old de-facto standard for industrial automation so there are literally tonns of info and components available.

author: garre
author_rank: Contributor
timestamp: January 06, 2016, 09:10:20 pm
content: It seems to me that you are going at this the hard way. All you need to do is place a precision 250 ohm resistor in the output of the 4-20 ma transmitter. Then use a voltage sense to get a sensor range of 1 to 5 volts. Or if you need a lower output voltage range use a smaller resistor. Simple ohms law. Check the transmitter circuit to be sure that you can ground the negative side of the sensors transmitter 4-20 ma signal. This is usually OK to do. If not you will need a differential amplifier as an input or isolated power supplies with different grounds.I have worked in the instrumentation world for many years and this is a standard solution to the problem.

author: Alexei.Polkhanov
author_rank: Frequent Contributor
timestamp: January 06, 2016, 09:31:09 pm
content: Quote from: garre on January 06, 2016, 09:10:20 pmI think you forgetting a voltage reference?BTW single 4-20 receivers like RCV420 already have precision resistor, diff amp and voltage reference inside with 0.1% resulting accuracy - all for $8.4 on DigiKey in one-off quantities. I am not sure if can you bit that with "roll your own" kind of solution. Just saying.

author: simondid
author_rank: Contributor
timestamp: January 07, 2016, 02:34:42 pm
content: "Alexei.Polkhanov"tanks for the greate answere ;Dany chance youre aware off any cheapere chips sinse im living in denmark orders from digikey is a 30$ shipping cost and ebay for some wired reason is also kinda expensive...any chance you cut provide a schematic for using this chip with a arduino ore adc ? im kinda new to all this circuit building"garre"i have consideret that soloution and found that getting a precission resistor and referance voltage was kinda hard ... and the ic solution sound greate

author: Seekonk
author_rank: Super Contributor
timestamp: January 07, 2016, 02:59:20 pm
content: I should remind you that Arduino has a nice debug screen in TOOLS that data can be sent to. There is an issue though if you use that for calibration. Plugging your laptop USB in will likely change your calibration while connected because the A/D of the chip will use whatever 5V is higher for the reference. I use a USB cable with the 5V line cut and back to back diodes installed so the micro always runs off it's own regulator. I've not had an issue with the clones I've purchased and I prefer to use the stripped down mini for $3. The ones with gold are worth the small extra price.

author: cs.dk
author_rank: Unknown
timestamp: January 07, 2016, 03:19:39 pm
content: Quotehttp://dk.rs-online.com/web/p/transimpedansforstaerkere/6606626/http://www.tme.eu/en/details/rcv420jp/ui-uf-uu-converters/texas-instruments/#Shipping from TME is not that high, and they ship pretty fast. You usual have your stuff the next day.

author: simondid
author_rank: Contributor
timestamp: January 07, 2016, 03:44:34 pm
content: any one able to draw a schematic using the RCV 420 chip with arduino i not confident enu in this..."Seekonk" i was not aware off this ill check it out"cs.dk" thanks alot mate didnt know rs-online sold ic and that stuff

author: tszaboo
author_rank: Super Contributor
timestamp: January 07, 2016, 03:52:16 pm
content: Quote from: simondid on January 07, 2016, 03:44:34 pmRead the friendly datasheet. Figure 1, 15...

author: Kleinstein
author_rank: Super Contributor
timestamp: January 07, 2016, 04:03:57 pm
content: Given that the ultrasonic sensor is internaly likely measuring times and not voltage, I would consider looking at the HARD protocol. Chances are the output is better than the analog one, and no additional errors from transmission.The µC shlould be fast enough - it just needs quite some software.As the resolution of the AVR internal ADC is only 10 bit, there is no real need for a really high qualitiy reciever chip. I would consider a precission resistor and an extra ADC like MCP3421 - should be cheaper, smaller and higher resolution.

author: simondid
author_rank: Contributor
timestamp: January 07, 2016, 07:01:24 pm
content: "NANDBlog"just to confirm this is the figur youre talking about rightimages upload"Kleinstein"you're properly right but i been looking around the web and found near zero free information on the hart protocol and found that acces to dukomentation is price at 900 dollarshttps://www.eevblog.com/forum/projects/industrial-sensor-interfaces-(like-hart)/msg701202/#msg701202witch kinda rules it out

author: XFDDesign
author_rank: Frequent Contributor
timestamp: January 07, 2016, 07:08:28 pm
content: Simondid,Without mentioning any parts, can you provide a simple summary statement of the problem which you're trying to solve?Too often, people approach a problem, not really knowing what it is they're trying to do, and come up with very convoluted ways to solve something. If you can take a step back and state the problem you're trying to solve, you may find the solution to be much more simple than your current approach.For example, can you define your inputs, your outputs, and your system constraints?

author: tszaboo
author_rank: Super Contributor
timestamp: January 08, 2016, 12:13:32 pm
content: No, I dont think that is the way to connect it.QuoteYou typically only connect to the "little circles" something external.

author: simondid
author_rank: Contributor
timestamp: January 08, 2016, 02:53:37 pm
content: "NANDBlog"upload a pictureso if the input polarity is posetiv it goes to in+ and the othere to Ct ?"XFDDesign"im traying to interface an raspberry ore arduino with a 4-20ma sensor outputim looking for a decent precission sinse i goth othere sensors with the same output i wan't to usethe solution also have to be with in a decent price range...

author: LukeW
author_rank: Frequent Contributor
timestamp: January 08, 2016, 04:37:36 pm
content: Let's just assume that you are converting a 4-20mA loop current into 0-Vref in a sensible way and feed that voltage into the AVR's internal ADC.To answer your question about what resolution you can get, assuming you're not using a separate external ADC connected to the microcontroller, it's a 10-bit ADC, so the resolution that you can achieve will be 16mA/1024 or 15.63 uA.If you have a simple approach like a resistor where 0-20mA corresponds to 0-Vref then the resolution will be slightly worse at 19.53 uA.

author: AlxDroidDev
author_rank: Frequent Contributor
timestamp: January 08, 2016, 05:24:30 pm
content: I am surprised nobody has suggested the INA219 so far.theTexas' INA219is an I2C device and does the measurement using an user-defined shunt resistor, based on the current being measured.I've tried both ACS712-5 and INA219. For small currents, the ACS712-5 is completely useless. It's very noisy. It's noise is higher than the output voltage for very small currents, so it is very hard to tell, for such small measurements, what is noise and what is measurement. I even wrote about it on theArduino forums.The INA219, OTOH, is a very stable and precise device. I've had it measuring currents from 1-100mA, using a 0R5 resistor, and after adjusting its calibration it gave consistent results that were always identical to the one on my fluke 17B+. Interfacing it with the Arduino is quite easy and AdaFruit has a library for it.

author: XFDDesign
author_rank: Frequent Contributor
timestamp: January 08, 2016, 05:34:01 pm
content: Quote from: simondid on January 08, 2016, 02:53:37 pmMaybe this is something which comes from the hours put into engineering school.Let me elaborate."I'm trying to interface a raspPi or an arduino to a 4-20mA sensor output."So take the sensor output and plug it into any pin on the rPi or Arduino.That won't work? It's a very literal 'interface.' It's describing the actions you're trying to do, but it isn't stating theidea or purposeof what you're intending on doing.You mention 'decent precision,' but this is not a qualified statement. For example, in my industry many of our "precision" products have target specs of less than 1uV for things like input offset voltage.Instead of working backwards (micro to sensor), consider working forwards:You have some 4-20mA device. What kind of resolution canitprovide? What kind of power supply requirements doesithave? Suppose you used a 150 ohm sense resistor between +12v and your sensor. At 20mA, the sensor sees 9V. Will it still operate in this range?Now suppose it does. You get all kinds of answers in this thread. You get solutions which resolve down to 1uA, for a dynamic range of 86dB. Then it turns out your sensor is only capable of an 8-bit conversion internally and discreetly steps 62.5uV for a dynamic range of 48dB. Yoursolutionis grossly over-engineered, because you didn't design your front-end around your sensor.Now, suppose the sensor was a purely continuous time, continuously variable output, and that the device operates from 12 to 24V. In this case, you could simply power an LM741 on the +24V supply, use a sense resistor and a following transistor an some negative feedback, and resolve current to voltage by way of regulating the output voltage. The current consumption develops an error voltage across the sense resistor, and then you simply feed that error across another LM741 setup as a difference amplifier. This would be a very cheap, functional solution (<$1), but would have all sorts of DC errors that you would have to calibrate out, and would not have high precision (diff amp resistors not highly matched, poor CMRR, gain errors, etc). Is this sufficient performance? We don't know, because we don't have the details of the sensor. If that is not precise enough, a different approach still, would be required.I was unable to find a datasheet on the 8177, so there isn't much I can do without it. But without knowing what the sensor can do, and what its constraints are the design won't be a good one.The mastery of engineering, comes down to the ability to describe the problem and understand the solution required.

author: simondid
author_rank: Contributor
timestamp: January 08, 2016, 07:34:25 pm
content: "AlxDroidDev"hey tanke for the sugestion just a few quick questionsso according tohttps://www.adafruit.com/products/904adafruit websiteQuoteso i can get a 0.1ma resoluction with this setup ?if thats the case i will get a resolution at 16ma/0.1ma = 160760 / 160 = 4.76cm pr data pointis this right?what you mean when you say “ using a 0R5 resistor” where inn the circuit?"XFDDesign"So I’m think you want me to put some numbers on what I’m looking for ?so in terms off precision assuming the sensor was 100% accurate something like 1data point / pr 1 cm in other word 8meter - 0.4m(sensor dead zone) = 7.6 m = 760 data pointsSince i'm no engineer just pure hobby the circuit design and calculation need to be simple and straight forwardIn terms of price less than 20$ from ebayQuoteI can't give you any more information then what’s on this linkhttps://www.burkert.com/en/type/8177and these images since it the only stuff i have access to atmcapture screenimages uploadalso in general i'm confused if i need more then 2 wires to use this sensor for power and signalupload image online

author: theatrus
author_rank: Frequent Contributor
timestamp: January 08, 2016, 08:08:36 pm
content: Since this is not a loop powered sensors from the looks of it, you can use a very simple sense resistor (100-250ohm) and op-amp to feed an AVR A/D channel (not strictly required if you use an external voltage reference). For me, this would be a "decent" accuracy level, but what qualifies as decent would of course be up to you. Back when I was doing hardware design professionally, this arrangement with a small capacitor across the input was shipped in a lot of products - usually it exceeded the resolution and accuracy of the sensor in use.

author: Alexei.Polkhanov
author_rank: Frequent Contributor
timestamp: January 08, 2016, 08:45:17 pm
content: Quote from: simondid on January 08, 2016, 02:53:37 pmConnections look right to me.I never used Arduino or Atmel MCUs. I lokked at datasheet and it appears that it has 12 bit (10 bit normal) ADC. What I don't see is ANALOG reference input for ADC like ADUc845/ADUc848 MCUs from Analog Devices have for example. ADUc845 require 2.5V external reference. What you have to make sure is that you make use of entire dynamic range of your ADC without clipping. So for example in case of ADUC845, some models have 24bit ADC with external reference set to 2.5V - meaning that you would expect input 0V to be represented as 0x000 and 2.5V to be 0xFFF - in that case 0-5V will be twice the range of ADC so it has to be halved through resistive divider for example. Now if you have ADC that takes reference input then ideally you would want to use reference output from your receiver as external reference for ADC. Now it terms of Arduino I am not sure if its abnalog input that spans 0-5V?So if you take 0-5V output (from whatever receiver circuit you choose) then you scale it to match the ADC input range and leave some room for component errors. Accuracy of scaling resistors in this case is not important as long as you use same voltage reference. When you done you calibrate WHOLE system. If your voltage reference, resistor devider's resistors tempco and other component's drift with temperature/humidity/power supply voltage are low your calibration will remain accurate for years.BTW on your photos - you have I2C interface on your sensor - is it for calibration only? You can probably hook up sensor to your Arduino using I2C and it should work up to 100m.if not use I2C extender IC - I would add a beefiest one I can find anyway. So you probably don't need to use 4-20 loop at all for this specific sensor.

author: Yansi
author_rank: Super Contributor
timestamp: January 08, 2016, 09:22:52 pm
content: Quote from: AlxDroidDev on January 08, 2016, 05:24:30 pmI am more surprised nobody has suggesting learning basics first, as the OP seems not to have much clue about what he is doing (as 99.9% of arduino users).But back to the topic of interfacing the arduino to the current loop: Arduino is not worthy of any INA or RCV for this application.I'd suggest using a simple shunt and an noninverting amplifier with OPamp (preferably a R2R type one, to be able to cover the full 5V range of the ADC using the same 5V supply for it). This will be tough task for the OP itself I guess, so let's not get it complicated.Of course, one can build more sophisticated circuit with opamp, which would even solve the 4mA/20% shift, using the whole range of the ADC, but let the OP start with something, he can probably make work. Somehow.

author: simondid
author_rank: Contributor
timestamp: January 09, 2016, 10:46:14 am
content: bay the way i allready ordered a 16 bit adchttp://www.ebay.com/itm/400985244934?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AITsinse this also seems to be a bottel neckalso i found an item on ebay with says it can do the job what are youre thoughtshttp://www.ebay.com/itm/Current-to-Voltage-Transmitter-Signal-Module-4MA-20MA-to-0-5V-Linear-Conversion-/252214939748?hash=item3ab92e9064:g:ua0AAOSwBLlVAUVk"Alexei.Polkhanov"Quotei think the i2c is for the display with can be added to this sensor... in case the data from the sensor was on the i2c pins i have 0 acces to any information on it's communication protole and how they communicate"Yansi"Quotetrue i'm more off a programmer then a electronics engineer and have near 0 experiance in designing electrical circuits there for im look for a complete circuit drawing ore a an ic that can due the job like the rcv420 ore the Texas' INA219 witch both seems to be able to do the job but rcv is kind of expensive and the ina219 is lacking a bit off precision

author: XFDDesign
author_rank: Frequent Contributor
timestamp: January 09, 2016, 01:27:15 pm
content: Quote from: simondid on January 08, 2016, 07:34:25 pmIf you want about 760 data points, then you're looking at a 10 bit converter (1024 counts).So here is a simple question, have you hooked up a DMM in Ammeter mode to the supply line of this thing, and directly powered it from a DC supply? Can you confirm basic operation of the device by adjusting height and verifying a reading change on your DMM?

author: simondid
author_rank: Contributor
timestamp: January 09, 2016, 01:34:16 pm
content: Quoteno i havent i don't have acces to a 14v+ power supply atm i goth one in order on ebay but you know like 30+ delivery

author: XFDDesign
author_rank: Frequent Contributor
timestamp: January 11, 2016, 03:22:09 pm
content: Quote from: simondid on January 09, 2016, 01:34:16 pmStack two 9V batteries in series?

author: Seekonk
author_rank: Super Contributor
timestamp: January 11, 2016, 03:47:10 pm
content: Just going to more bits may not increase the accuracy. Every instrument will have some drift and noise associated with it. If this does measure distance as said in the prior post, I doubt that it is that accurate or repeatable. Distance measured with an analog signal is seldom accurate. 1000 data points should be about the limit for this kind of device. The number of data points needed for the entire length should have been the first thing figured out.