In school we always did our arithmetic using kOhms, mA, and volts. So 20 v / 20 mA = 1 kOhm. As long as you express the values in these units you can simply do the arithmetic 20/20=1
If you send the values from the arduino to the pc you can open the serial plotter(tools->serial plotter) in the arduino IDE and show a graph of the values comming in
I really like your videos! I'm studying electrical engineering - It's just so cool to take a look inside stuff I wouldn't want to break and seeing how much we've actually learned. Thank you!
Wired a water treatment room for an aerospace manufacturer about 7 years ago. It was a beautiful decent sized industrial job. There was one 460 Volts PLC controlling everything. To someone who doesn't know much about it, it would look complicated but it's really not. There is inputs and outputs, and the 4-20ma sensors talk to the PLC which through programming and miscellaneous switches controls the vfd's for the pumps according to what the client needs. Of course the wiring diagram was engineered nicely, we just run the wiring and build the system. Still to this day it was my favorite job.
AvE, Based on your comments near the end of the video, or in case you were not aware... Plotting the data coming from the serial port is super easy. Just remove all the extraneous Serial.print commands, and instead just print the value (for instance, your calculated PSI) to the serial port via a single "Serial.println(outputValue);". Once you've made those changes, then instead of choosing the "Tools"..."Serial Monitor" to open up the serial window, simply choose "Tools"..."Serial Plotter" and you'll get a pretty self-sizing graph next time you run your program. Hope this helps...Mike
This is well timed. I'm going to build one to log the temperature of my in-laws heating system. Just so much cheaper than to rent a data logger. Simply put: this is the best channel on TH-cam period.
You have hit my specialty area! We use 225 ohm resistors (0.9 to 4.5 VDC). You can detect some failures where the current goes above 20 mA or below 4 mA. The current loop allows you to have multiple devices in the loop (panel meters, current switches etc.) without affected the output. Since the loop doesn't care about resistance (within limits) it is unaffected by resistance in the wiring. Just be careful about the configuration so that you don't have a power supply with a grounded negative, then ground the loop somewhere else.
Michael Steeves you need to make sure the power supply can drop the voltage for each device but otherwise yes. Just use 220R for an Arduino, it's an E12 value
This video explains something i never thought to question. Having worked with PLC's which you can usually select which type of device you connected ( 4-20ma or 0-5v ), and usually having the option to choose which I bought for the job there was never a need to think about it. It is very logical and this will stick with me. Thanks
Ave! Just a suggestion, since you're so good at explaining things.... You should make a video about how use an arduino or some other controller in conjunction with sensors and a control element. All together to make a simple PID control loop! I know it would really help me in my schooling.
Depending on how the sensor is rated I would suggest that the lower value (100) isn't actually 0 psi, it's likely closer to 14.7 psi depending somewhat on your elevation (14.7 psi would be sea level, 13 psi would be 1042m/3420ft, etc).
For better, more functional code that properly handles below 4ma errors: short read420(analogPin){ sensorValue = (short)(analogRead(analogPin)-204); //is an approximation of the 4ma value if (sensorValue < 200){ //is under the 4ma value by some quantity to account for component aging and noise sensorValue = -1; } return sensorValue; } //Note that -1 is an error code and anything positive is a good value
The reading that is measured by the arduino depends on the precision of the 250 ohm resistor. At my steel mill we always purchased expensive high precision 250 ohm resistors.
I'm in the habit of constraining values in addition to mapping them when reading from analogue devices. This eliminates generating errors from erroneous input in later code if you're working with returned values such as when the circuit wasn't powered and returned negative values.
I've seen the map function used in some other programs before but never really understood what it did, even after I looked it up. Just you giving a brief explanation did more than countless articles online. Thanks Uncle Bumblefuck.
in your diagram the +/- on sensor are wrong way round. Also with your wiring, if the 24v gnd and auduino gnd connect the auduino will let the smoke and/or schmoo out. if you connect the 24v to sensor and put 250R between sensor and gnd, then sensor and auduino using same gnd reference and the circuit will be much safer.
If you want to correct for non-linieraty you should make a function (or maybe look it up in the data sheet for the sensor) and use that instead of the linear map() function
For what it's worth, if you're using a 6" bourdon tube gauge as your calibration standard, they're typically +/- 1% of full scale. Heise (mirror backed) gauges are generally 0.1% or better.
You godda, you just have to graph it! Please do follow up video, take this thing to the limit, and past. I have liked your videos, but this video brings you up a big notch, this is the cool and fun stuff that we can participate in with for most part, almost no monetary investment.
Pro tip: Plan on measuring up to 24mA so you can see if the sensor is going overrange (sensor fault). Of course, the question remains as to what yer gonna do if you do measure that, but I degrease.
Bastard got me. I'm running it over and over in my head how the F does one get 250 ohms from 3-10ohm resistors. It didn't occur to me until I finally got that marble loose in the old can of brake clean I have had on my shelf for years! You had me really questioning myself. Never doubt AVE!
Instead of using a linear function to transform the data I would've colleceted a bunch of points (raw value and the pressure) and plugged it into a application or a fancy calculator and have it compute a regression formula. The data wasn't even close to linear, you would have a lot more accurate PSI readings with a better fitting equation.
Swapped out a controller once, old devices were setup for either sink or source 4-20mA, can't remember which but our new controller was setup for the opposite. Ended up dead shorting a 96VA 120/24VAC transformer. She hummed like a bastard but there was enough cable length there that it didn't immediately trip the overload. Scared the bejesus out of me.
it's interesting, I got a lot of sensors in working condition from scraping industrial machines, I never got the time to hook them up to an arduino (because, first, I rarely work directly on electronics so my experience is limited, I mostly work on automatic systems that have all the electronic components built-in the I/O devices and second, I'm lazy as frakk). so thanks for this video, it may probably kick me out of my laziness and try!
Many people here are saying that he did the math wrong an should be using a 1K resistor because 20V / 20ma = 1kohm. No. 250 ohm is correct. He's simply using a resistor to convert current output to voltage. The sensor lets through current and the resulting voltage developed is based on the resistance (up to a limit... cannot be higher than the supply). V@4ma = 250Ω * .004A = 1V V@20ma = 250Ω * .020A = 5V
Yeah that's the right answer, but he wrote down the wrong math! He wrote and said "20V/20mA=250 ohm", which is plain wrong. He should have written 5V/20mA=250 ohm.
The 20mA should be represented in amps before the division. 24v/0.02amps = 1.2kohms. Ohms law is Voltage divided by amps x resistance in ohms. Not Voltage divided by milliamps x ohms
Don't know if they all ready have something like that on a car but it would be cool to apply this to the air pressure system on a car with a little turner comfuser or a little electric gauge, so if you have air lockers or air compressors in your truck and don't have an easy way to see pressures and stuff while on a trail.
Your pixie wrangling explanation is a bit off. For any part of the circuit, V = I * R. If you therefore measure the voltage and know the resistance, you know the current via that formula. If you know the max voltage (5V) and the max current (20mA), you can calculate R = V / I = 5V / 0.02A = 250 ohms. If your measuring device works with 3.3V, you need a resistance of R = 3.3V / 0.02A = 167 ohms. You will notice: lower resistance means lower voltage - which might sound counter-intuitive, but it's because the current is regulated. Therefore, if you can't find or fabercobble the desired resistor, in this case you should find the closest one below the desired resistance (so 220 ohms or 150 ohms in the standard series) to be on the safe side. As others pointed out: uncle Bumblefuck here probably remembered the value, but forgot the actual way of getting there.
Good video, very valid approach to convert current into a voltage, however a more Skookum way would be to use a Transimpedance amplifier, just google it on the confuser.
Being part of the VIP club, we don't get the videos early so you don't have to feel like you are missing out. videos are available to everyone at the same time, as they should be. We do get some goodies and sometimes a video on one of the extra projects. On an unrelated note, Ave, how about those projects? It's been a few months...
Thinking of the "blue smoke" video you released the other day, we need someone who can do BOLTR reviews of electronicals. Pop the cap off, put it under an electron microscope, talk about how the bits wrangle pixies and see how skookum it is.
I at one time calibrated these for a living. To source a pressure point. You actually use your one fluke there and source 4-20 mA and see if it’s reading correctly.
thanks , I do learn something even when you are making a funny video! I've always dreaded messing with electrical things , now I am not so skiddish of it!
Great video, I get to work with 4-20 equipment so it's great to learn more about these great industrial devices. But that paper napkin maths. Answer seemed a little funny.
Dependant on ADC then a couple of 100R in parallel would be better as at 20mA you get less voltage drop (1V) so there is less of an issue from errors when the battery runs low. EG if the circuit in the transducer needs say 4V and you use a 200R resistor (E96 value) then you have a 4V drop at full scale. That means if you are powering it from a 9V battery you will be seeing drift well before the battery is low (7.2V). Noise really is nothing like as much of an issue with a differential twisted pair as it would be with say a single ended shielded co-ax so you don't really need to worry about reducing from 5V to 1V FSD.
@AvE Your first circuit diagram is correct with respect to the arduino and ground, but your second one has the arduino ground on the wrong side of the resistor. Can't see how you actually hooked it up, so we can't be sure if it contributed to your strange results. Teardown Dan pointed out a math error in the resistor calculation that will also alter your results. EDIT: I can see you are powering the arduino with USB, so that's not an issue as it also gets it's ground there with nothing in between.
AVE - Great videos dude, you crack me up! I'll add this comment what for trying to help... I believe the reason your values were not matching up is due to the scaling you used in the program. A 4-20mA over a 250 ohm resistor produces a 1-5 volt signal. I also believe the arduino input is a 0-5 volt input, so when the transmitter is at 4mA or 0% of signal, the input is seeing 1 volt, or 20% of the arduino signal range. To account for this difference, you must offset the scaled range down by 25% of the transmitter range. 367 * .25 = 91.75, so if you scale your output from -92 to 367, 1v will produce 0 psi. This table might help people visualize the scaling. mA Volts Display 0 0 -92 4 1 0 8 2 92 12 3 184 16 4 276 20 5 368 The formula we use in the Plc world is this. Scaled value = (((raw value - raw offset) X (eng span)) / raw span) + Eng Offset Offset = distance from 0, can be positive or negative. Span = Max value - min value.
Current sensing shunt. For thoes who don't understand he is sensing detecting the voltage drop over a resistor. And with ohms law he is deducing the current going throw the resistor. Which is the same amount of current going through the circuit. There are other ways of decting current too
If say you wanted to use this method to read 2 different pressure sensors both with the same 4-20mA output signal would you simply connect the +ve side of the second sensors limiting resistor to a different analogue input in the arduino and connect the - side of the second sensors limiting resistor to the same arduino ground?
AvE, you could do a pretty cool video with feedback control loops using this setup, just need to get your hands on a control valve or something similar.
eh, nevermind. Just looked at my Freescale 9s12 and Vmax-adc = Vcc. When using a precision voltage source (recommended best practice) to feed the Vref-adc pins Vref-adc should be Vcc - some small voltage. Is the Arduino hard fabbed to tie Vref-adc to Vcc? I've only used Freescale stuff, and nearly all of em have the pins broken out.
Hey , Ave why not get a few data points, and make discrete linear equations for each line segment. Then all it takes is a quick multi-if statement based on the voltage range to land at the "right" multiplier for that range. Might get you to +95% accuracy pretty quick. Anyways, great video, pleasure as always
3:46 -- I think you mean 5V divided by 20mA as that's what would give you 250 ohm.
I love that you lead with the TL;DR, then go into the intro and explain what's going on for those of use who decide we care about that topic. Cheers!
In school we always did our arithmetic using kOhms, mA, and volts. So 20 v / 20 mA = 1 kOhm. As long as you express the values in these units you can simply do the arithmetic 20/20=1
But he’s got 250 ohms. 😮
If you send the values from the arduino to the pc you can open the serial plotter(tools->serial plotter) in the arduino IDE and show a graph of the values comming in
Or just use a Pi with an ADC hooked up.
Gordon Lawrence "just" .. I would say the arduino solution is way easier to get it running
I really like your videos! I'm studying electrical engineering - It's just so cool to take a look inside stuff I wouldn't want to break and seeing how much we've actually learned. Thank you!
Wired a water treatment room for an aerospace manufacturer about 7 years ago. It was a beautiful decent sized industrial job. There was one 460 Volts PLC controlling everything. To someone who doesn't know much about it, it would look complicated but it's really not. There is inputs and outputs, and the 4-20ma sensors talk to the PLC which through programming and miscellaneous switches controls the vfd's for the pumps according to what the client needs. Of course the wiring diagram was engineered nicely, we just run the wiring and build the system. Still to this day it was my favorite job.
AvE, Based on your comments near the end of the video, or in case you were not aware...
Plotting the data coming from the serial port is super easy. Just remove all the extraneous Serial.print commands, and instead just print the value (for instance, your calculated PSI) to the serial port via a single "Serial.println(outputValue);". Once you've made those changes, then instead of choosing the "Tools"..."Serial Monitor" to open up the serial window, simply choose "Tools"..."Serial Plotter" and you'll get a pretty self-sizing graph next time you run your program.
Hope this helps...Mike
AVE Has super powers ! watch him turn 3 10ohm resistors into a 250ohm resistor @ 4:30 :D
Yes, i realized what he did was 220 ohm + 3*10 ohm
Totally missed the 220, and I rewatched it to figure out how you get 250 from 3x10
lol same here!
I knew Someone would answer this question so I didn't have to rewind haha.
same
This is well timed. I'm going to build one to log the temperature of my in-laws heating system. Just so much cheaper than to rent a data logger. Simply put: this is the best channel on TH-cam period.
You have hit my specialty area! We use 225 ohm resistors (0.9 to 4.5 VDC). You can detect some failures where the current goes above 20 mA or below 4 mA. The current loop allows you to have multiple devices in the loop (panel meters, current switches etc.) without affected the output. Since the loop doesn't care about resistance (within limits) it is unaffected by resistance in the wiring.
Just be careful about the configuration so that you don't have a power supply with a grounded negative, then ground the loop somewhere else.
Michael Steeves you need to make sure the power supply can drop the voltage for each device but otherwise yes. Just use 220R for an Arduino, it's an E12 value
This video explains something i never thought to question. Having worked with PLC's which you can usually select which type of device you connected ( 4-20ma or 0-5v ), and usually having the option to choose which I bought for the job there was never a need to think about it.
It is very logical and this will stick with me.
Thanks
Dont sweat the petty, pet the sweaty!
Now THAT is some good advice...if you'll excuse me, I have some petting to do...
finally the Arduino sensor vid!
Everything I needed to know within 50 seconds, good ol' boy!
the videos of you releasing the shmoo are better for us gear heads and were getting less of our shmoo fix here lately and i still need some freebies
Holy shit. I literally ran into this problem at work today and was braining about how to fix it. You rock!
One of these days, one of these tricks, is literally going to save lives.
Ave! Just a suggestion, since you're so good at explaining things.... You should make a video about how use an arduino or some other controller in conjunction with sensors and a control element. All together to make a simple PID control loop! I know it would really help me in my schooling.
Do i have to watch this right now at work or will this video be removed again!?!?
Instrumentation and data acquisition is an art form. This is brush clearing.
i really like these kinds of videos of ave. i like when he nerds out and i learn to love something.
Depending on how the sensor is rated I would suggest that the lower value (100) isn't actually 0 psi, it's likely closer to 14.7 psi depending somewhat on your elevation (14.7 psi would be sea level, 13 psi would be 1042m/3420ft, etc).
You would only do that if you're trying to measure absolute. He's reading PSIG.
That hug I got from the van was quite warm and sticky 6/10
I have no idea what, where, how, I would ever use this but I enjoyed it.
For better, more functional code that properly handles below 4ma errors:
short read420(analogPin){
sensorValue = (short)(analogRead(analogPin)-204); //is an approximation of the 4ma value
if (sensorValue < 200){ //is under the 4ma value by some quantity to account for component aging and noise
sensorValue = -1;
}
return sensorValue;
}
//Note that -1 is an error code and anything positive is a good value
Just got my tap chart t-shirt in the mail, and had to explain to the the wife why it was upside down. Thanks for the videos.
Perhaps some of the errors in the readings are from poor tolerance resistors?
UA Level 1 instrumentation tech here. Enjoyed the vidjeo.
The arduino IDE has a serial graphing in it that you may find useful - Serial Plotter ( Ctrl+Shift+L )
Nice video. I'm watching forma Perú and it help a lot. Best wishes for your channel.
Did it work sir
The reading that is measured by the arduino depends on the precision of the 250 ohm resistor. At my steel mill we always purchased expensive high precision 250 ohm resistors.
I have no idea what you're talking about... But, I find it incredibly interesting...
relearning my electronics classes, all over again.
I'm in the habit of constraining values in addition to mapping them when reading from analogue devices. This eliminates generating errors from erroneous input in later code if you're working with returned values such as when the circuit wasn't powered and returned negative values.
I've seen the map function used in some other programs before but never really understood what it did, even after I looked it up. Just you giving a brief explanation did more than countless articles online. Thanks Uncle Bumblefuck.
in your diagram the +/- on sensor are wrong way round. Also with your wiring, if the 24v gnd and auduino gnd connect the auduino will let the smoke and/or schmoo out. if you connect the 24v to sensor and put 250R between sensor and gnd, then sensor and auduino using same gnd reference and the circuit will be much safer.
I was just trying to figure this out. perfect timing.
Interesting, especially learning why you use 4-20mA sensors vs analog voltage sensors
3:45 no you mean 5v/20mA=250ohms. 5v is the voltage you want it to correspond to the max reading from the sensor i.e. 20mA
To take advantage of the full resolution of the AVR microcontroller's ADC, you can add gain and offset adjustment with a 741 opamp.
If you want to correct for non-linieraty you should make a function (or maybe look it up in the data sheet for the sensor) and use that instead of the linear map() function
Arduino videos on the AvE channel?? what is this?? 2012?
That's the joke. This is how the channel started, glad to see more arduino vids.
ThatsTheJoke.jpg
true :)
No it's Uncle Bumblefuck's republic of Kanukistan.
maybe he thought we were missing the software cringe moments. ave is a pleaser.
For what it's worth, if you're using a 6" bourdon tube gauge as your calibration standard, they're typically +/- 1% of full scale. Heise (mirror backed) gauges are generally 0.1% or better.
thanks for your vids dude keep em coming
You godda, you just have to graph it! Please do follow up video, take this thing to the limit, and past.
I have liked your videos, but this video brings you up a big notch, this is the cool and fun stuff that we can participate in with for most part, almost no monetary investment.
This is great, I going right now to Graingers to buy a dozen of these things. Thanks
Pro tip: Plan on measuring up to 24mA so you can see if the sensor is going overrange (sensor fault). Of course, the question remains as to what yer gonna do if you do measure that, but I degrease.
If it goes higher won't it damage the arduino since it will output higher unexpected voltages?
Bastard got me. I'm running it over and over in my head how the F does one get 250 ohms from 3-10ohm resistors. It didn't occur to me until I finally got that marble loose in the old can of brake clean I have had on my shelf for years!
You had me really questioning myself.
Never doubt AVE!
Instead of using a linear function to transform the data I would've colleceted a bunch of points (raw value and the pressure) and plugged it into a application or a fancy calculator and have it compute a regression formula. The data wasn't even close to linear, you would have a lot more accurate PSI readings with a better fitting equation.
no need for anything fancy, the sensor is linear and all the info is there.
zero pressure is 4mA*250R = 1V, max pressure is 20mA*250R=5V
It's a linear sensor though that's the point
Swapped out a controller once, old devices were setup for either sink or source 4-20mA, can't remember which but our new controller was setup for the opposite. Ended up dead shorting a 96VA 120/24VAC transformer. She hummed like a bastard but there was enough cable length there that it didn't immediately trip the overload. Scared the bejesus out of me.
it's interesting, I got a lot of sensors in working condition from scraping industrial machines, I never got the time to hook them up to an arduino (because, first, I rarely work directly on electronics so my experience is limited, I mostly work on automatic systems that have all the electronic components built-in the I/O devices and second, I'm lazy as frakk). so thanks for this video, it may probably kick me out of my laziness and try!
How does the maths work at 4:32?
10 X 3 = 250?
Totally missed the 220, and I rewatched it to figure out how you get 250 from 3x10
Was about ask the same thing...totally missed the 220
Ditto. I think it might have been accidentally edited out or something.
so whats going on here then?
Many people here are saying that he did the math wrong an should be using a 1K resistor because 20V / 20ma = 1kohm.
No. 250 ohm is correct. He's simply using a resistor to convert current output to voltage. The sensor lets through current and the resulting voltage developed is based on the resistance (up to a limit... cannot be higher than the supply).
V@4ma = 250Ω * .004A = 1V
V@20ma = 250Ω * .020A = 5V
Yeah that's the right answer, but he wrote down the wrong math! He wrote and said "20V/20mA=250 ohm", which is plain wrong. He should have written 5V/20mA=250 ohm.
I agree with Alex Gray: AvE shouldn't actively try to mess up with our heads.
Math. Not even once.
The 20mA should be represented in amps before the division. 24v/0.02amps = 1.2kohms. Ohms law is Voltage divided by amps x resistance in ohms. Not Voltage divided by milliamps x ohms
Yay, Uncle Bumblefook is back!
Fraid you lost me on this one. Thanks for the Video though! I'll check out the next one.
we applied the cortical electrodes but were unable to get a neural response from either patient... great vijeo AvE!
Don't know if they all ready have something like that on a car but it would be cool to apply this to the air pressure system on a car with a little turner comfuser or a little electric gauge, so if you have air lockers or air compressors in your truck and don't have an easy way to see pressures and stuff while on a trail.
Messiest desk, cleanest explanation. Thanks!
Your pixie wrangling explanation is a bit off. For any part of the circuit, V = I * R. If you therefore measure the voltage and know the resistance, you know the current via that formula.
If you know the max voltage (5V) and the max current (20mA), you can calculate R = V / I = 5V / 0.02A = 250 ohms. If your measuring device works with 3.3V, you need a resistance of R = 3.3V / 0.02A = 167 ohms.
You will notice: lower resistance means lower voltage - which might sound counter-intuitive, but it's because the current is regulated. Therefore, if you can't find or fabercobble the desired resistor, in this case you should find the closest one below the desired resistance (so 220 ohms or 150 ohms in the standard series) to be on the safe side.
As others pointed out: uncle Bumblefuck here probably remembered the value, but forgot the actual way of getting there.
Then the 24Volt supply is irrelevant? Can I use 9volts with the same 250Ohm resistor to output the same signal, then?
Thanks for explaining this, i didn't understand how he divided 20 by 20 and got 250.
Good video, very valid approach to convert current into a voltage, however a more Skookum way would be to use a Transimpedance amplifier, just google it on the confuser.
more of this kinda witchcraft pls... Great vid.
Have you enjoyed the outdoor seating at The Boathouse in White Rock? One of my favorites.
You have no idea how helpful this was for me, thank you so much!
Glad it helped!
you can graph it directly in the most recent versions of the Arduino IDE.
did you briefly upload this video then remove it a week or so ago?
AMACturbo69 yeah
He uploaded it, but UNLISTED it. The VIP club gets them a week earlier. Look at the date. It says Published, not uploaded.
Being part of the VIP club, we don't get the videos early so you don't have to feel like you are missing out. videos are available to everyone at the same time, as they should be. We do get some goodies and sometimes a video on one of the extra projects. On an unrelated note, Ave, how about those projects? It's been a few months...
Steven Doesburg How do you join the VIP club?
You put some money in the jar on patreon: www.patreon.com/AvE
Will do a review on the micsig tablet mini scope
Thinking of the "blue smoke" video you released the other day, we need someone who can do BOLTR reviews of electronicals. Pop the cap off, put it under an electron microscope, talk about how the bits wrangle pixies and see how skookum it is.
Interesting 2 chanel power suply you made. Looks like to be a 19" standard to fit in a server cabinet.
hey AvE, a better implementation would be a trans-impedance amplifier. Would give you a much better result.
I at one time calibrated these for a living. To source a pressure point. You actually use your one fluke there and source 4-20 mA and see if it’s reading correctly.
"Only 2 pins... can't be that complicated to hook up"... infamous words uttered by very man moments before hoopajooping it.
Make sure you use a high accuracy resistor too or it will add to your measurement error (possibly significantly)
thanks , I do learn something even when you are making a funny video! I've always dreaded messing with electrical things , now I am not so skiddish of it!
Great video, I get to work with 4-20 equipment so it's great to learn more about these great industrial devices.
But that paper napkin maths. Answer seemed a little funny.
Dependant on ADC then a couple of 100R in parallel would be better as at 20mA you get less voltage drop (1V) so there is less of an issue from errors when the battery runs low. EG if the circuit in the transducer needs say 4V and you use a 200R resistor (E96 value) then you have a 4V drop at full scale. That means if you are powering it from a 9V battery you will be seeing drift well before the battery is low (7.2V). Noise really is nothing like as much of an issue with a differential twisted pair as it would be with say a single ended shielded co-ax so you don't really need to worry about reducing from 5V to 1V FSD.
2:30 isn't the power source symbol flipped horizontally?
Arduino ide can actually make graph from serial.
@AvE Your first circuit diagram is correct with respect to the arduino and ground, but your second one has the arduino ground on the wrong side of the resistor. Can't see how you actually hooked it up, so we can't be sure if it contributed to your strange results. Teardown Dan pointed out a math error in the resistor calculation that will also alter your results. EDIT: I can see you are powering the arduino with USB, so that's not an issue as it also gets it's ground there with nothing in between.
To have 5V voltage drop (max that we can read) on 20mA current resistor should be 5V / 0.02A = 250Ohm
Could do a basic curve fit in excel to calibrate the sensor. I'd bet a simple 2-3 term fit would get you plenty of accuracy.
AVE - Great videos dude, you crack me up! I'll add this comment what for trying to help...
I believe the reason your values were not matching up is due to the scaling you used in the program. A 4-20mA over a 250 ohm resistor produces a 1-5 volt signal. I also believe the arduino input is a 0-5 volt input, so when the transmitter is at 4mA or 0% of signal, the input is seeing 1 volt, or 20% of the arduino signal range. To account for this difference, you must offset the scaled range down by 25% of the transmitter range. 367 * .25 = 91.75, so if you scale your output from -92 to 367, 1v will produce 0 psi. This table might help people visualize the scaling.
mA Volts Display
0 0 -92
4 1 0
8 2 92
12 3 184
16 4 276
20 5 368
The formula we use in the Plc world is this. Scaled value = (((raw value - raw offset) X (eng span)) / raw span) + Eng Offset
Offset = distance from 0, can be positive or negative.
Span = Max value - min value.
gonna take a screenshot of this formula thank you kind stranger.
Awesome! Thanks for posting this! I'm assuming you can do the same thing with a 0-5V output sensor?
I'm pretty sure the Arduino IDE has a built in serial plotter now so you don't have to use processing.
Current sensing shunt. For thoes who don't understand he is sensing detecting the voltage drop over a resistor. And with ohms law he is deducing the current going throw the resistor. Which is the same amount of current going through the circuit. There are other ways of decting current too
If say you wanted to use this method to read 2 different pressure sensors both with the same 4-20mA output signal would you simply connect the +ve side of the second sensors limiting resistor to a different analogue input in the arduino and connect the - side of the second sensors limiting resistor to the same arduino ground?
Is that really how simple it is? Nice. If I die... you are gonna have to support my wife! ;)
AvE, you could do a pretty cool video with feedback control loops using this setup, just need to get your hands on a control valve or something similar.
BTW ,, AvE the scaling is 1v to 5v not 0 to 5. With a 250 ohm resistor
AvE, you should check out William Osman's new video- exploding resisters- quite enjoyable.
Way above my head, but darn entertaining.
The resistor should be sized to have 5 volts across it at 20ma. 250 ohms it is. His 30 ohm resistor is causing the low readings.
You didnt talk about the best feature of 4-20, you know if wire break or failed sensor if current goes below 4ma.
Maybe a lookup table with some measured points to fix the nonlinearity problem
One warning: Some Arduinos run on 3.3v and if you have one of those, you need to resize the resistor for a 3.3v maximum voltage into the Arduino.
John Ridley Arduino doesn't have Vref inputs for the ADC bank?
eh, nevermind. Just looked at my Freescale 9s12 and Vmax-adc = Vcc. When using a precision voltage source (recommended best practice) to feed the Vref-adc pins Vref-adc should be Vcc - some small voltage.
Is the Arduino hard fabbed to tie Vref-adc to Vcc? I've only used Freescale stuff, and nearly all of em have the pins broken out.
Not hard fabbed. Though you need to declare in code that you are using external Vref. It defaults to Vcc w/out this
Cool. Great that they brought the pins out. I had one MCU with ~50 pins, but it was in a 24 pin DIP, so a good about of function was lost.
Alternatively just use a couple of 100R in parallel and use some maths to re-scale.
Very useful information.
Hey , Ave why not get a few data points, and make discrete linear equations for each line segment. Then all it takes is a quick multi-if statement based on the voltage range to land at the "right" multiplier for that range. Might get you to +95% accuracy pretty quick. Anyways, great video, pleasure as always
When AvE reads code I find it very tricky to power through and finish the stroke. Barely finished this time. I guess it's endurance training.
The circuit's battery terminals are different at 20th sec and 3 min16th sec?
AvE you should do a vijeyo on DIY air bearings!
do you have any example on 3 wire? i got confuse about the wiring..