hi. i wanna read the value of 4-20 ma sensor using arduino uno analog input. i did the circuit and the code in the attached pictures. but always when i turn on the arduino uno it is destroyed. kindly what is the error i did and how can i solve this pb?
Circuit is correct. Get out your multimeter and measure the actual voltage across the resistor, it should be no more than 5V. If it is, the sensor produces >20 mA and is probably broken (or your resistor value is >250Ω).
Sounds like you may have a faulty connection to the resistor, before blasting another Arduino with 24V put a 24k or 27k resistor in series with the analog input pin, that will limit current through the ESD protection diodes to less than 1 mA.
As pointed out by others, you need 250R or 500R for 5 or 10-volts from 4-20mA - don't forget the 4-mA offset to get it scaled right. Normally, you would use a 0.1% precision resistor, but it doesn't matter here.
If you shoved in 0 - 10 volts, then that's curtains. Again, it doesn't matter here, but 4-20-mA devices have to have enough oomph (compliance) to run everything. It's quite normal for a 4-20 device to output to several measuring items (chart recorder, data-logger, telemetry system) all in series, but if the total voltage drop across all the resistors exceeds the compliance voltage, it won't work.
Yes, get the DMM out before connecting to the Arduino or anything else or you won't get a career in instrumentation.
Out of interest, what is your 4-20 device?