# How to connect an industrial lenght transducer with arduino

Please let us in the comment zone any suggestions that you think will improve the article!

If you like the article click the follow button  to stay in touch with us!

1. The sensor

Recently, i received from my workplace a lenght transducer, wich is mecanical broken (a screw is damaged). I don’t know the type and neighter the output form (standardized 0-10 volts or 4-20 mA), but we can discover.

A picture of the transducer is presented below:

It has a 3 pin connector also standardized 1-Vcc (brown wire), 3-GND (blue wire) and 4 -signal (black wire).Because i dont have an m8 connector, i used wires – but not with the colors presented above. Also, those types of sensors are using around 24V on industrial machinery but also they have a range of voltage input; i use mine on 18 V.

The lenght of measurable distance is from 0 to 55 mm.

2.The output signal

Because i don’t know the type of my sensor i have to find the type, so after i connect the sensor with pin 1 of the connector at 18 V, pin 3 at GND, between the pin 4 and GND i measure the voltage. When i push the metal bar of the sensor the voltage remain constant so, it is not on the 0-10 volt output.

After i found that the output signal is 4-20mA, the question is how to measure this value with arduino? Between pin 4 and GND, i connected an 100ohms resistor, knowing that at 4mA we have a 0.4V voltage drop on resistor and at 20mA we have 2 volts, values that an arduino can read with analog read function.

Below is a simple schematic on how i connected the sensor:

3. Conversion of the signal

We know that the leng is from 0 to 55 mm and the output signal is from 4 to 20 mA, so at 0 mm is 4 mA signal and at 55mm-20mA. To convert this current in lenght i used the next method:

The lenght interval beteween 4 to 20mA is equal to 16 mA(20-4).The lenght inteval betwen 0mm and 55 mm is equal to 55 mm(55-0), so on 16mA we have 55 mm.

Example (also in the picture below):

At 10.6mA we have an interval equal with 10.6-4=6.6mA, this values represent a percentage from the entire interval of 16mA, so 6.6/16mA=0.4125 from the entire interval.

Because we know that for 16mA we have 55 mm, 0.4125 from above is the corresponding distance which is 0.4125×55=22.68mm.

So, basically discover how much represents the tested value from the entire interval.

A video with simple check on the transducer: