Calibrating a current to voltage converter

A decade ago ScruffR participated in a discussion here on the forum about measuring water pressure with Photon. I want to do the same thing but will convert the pressure reading to water volume in gallons. At this early stage, I only need help with testing and calibrating a current to voltage converter sitting between a pressure transducer anf a Photon..

I have purchased all the hardware I think I need:

For testing purposes only, a signal generator:

At this point, what I need help with calibrating the current to voltage converter.

I have been trying to understand the information found at HW-685 4-20mA Current Sensing | Turais Tech Docs but it is confusing. I have used a multimeter to measure voltage across each possible pair of output terminals on the converter, i.e. VCC & VOUT, VCC & GND, VOUT & GND. No amount of adjusting the potentiometers on the converter results in any changes in the voltage readings regardless of the chosen current setting on the signal generator (note that I have removed both jumpers on the converter to assure that its maximum output is 3.3 volts).

Another connection diagram (Arduino but Photon should be the same except the voltage should be 3.3, right?).

My test setup (12 volt DC input). Note that the converter is not plugged into the breadboard; it is glued to it with silicone. No connection to the Photon yet but if viewers think there is no possibility of there being more than 3.3 volts on the analog line, I can hook it up to see what happens..

Does anyone have any thoughts that can assist me?

‘Morning Brian!

Do you have more info on the generator? Does it generate 4-20mA?

Thanks

Yes sir. It is specifically designed for 4 to 20 mA and won't go beyond those values.

Here are the details on the converter:

Hey, thanks for the link.

Your converter needs to be connected to VCC to work (5-12V) AND GND but I do not see it connected in your pic.

Like this:

Your pic:

I haven't connected anything to the Photon yet Gus 'cause 1) I wanted to be sure that I wasn't going to put more than 3.3 volts into the Photon and 2) for code purposes, I still need to caibrate the converter using its potentiometers. I just don't know where I should connect my multimeter to measure the voltage.

Hey, I do not mean to connect it to the Photon, but it needs power to work. So you need to connect it to GND/VCC from your power source if it’s 5-12V.

It has three pins on that side:

VCC: 5-12V of your power source

VOUT: leave it unconnected for the time being

GND: connect to GND of your power source

Ah HA! Let me try that. Stay tuned.

OK, did that. Let me read peekay123's comment next.

Hey @blshaw45. First I assume you know you cannot power the Photo2 with 12v so in your setup, it will be powered via the USB. From the HW-685 wiki, I see it can be powered from 12v, as well as, the 4-20mA signal generator so they all need to share a common ground with the 12V supply. The Photon2 GND will also need to be connected to this common ground.

Next, make sure to set the jumpers on the HW-685 to output a 0-3.3v voltage. If you have a multimeter, you can calibrate the HW-685 output as per the Wiki. In theory, the HW-685 will present near-zero voltage with a 4mA input and near 3.3v with a 20mA input.

If you don’t have a multimeter, this is where you will need to use the Photon2 to measure the voltage output of the HW-685 to adjust its pots. You can use the first bit of code in the HW-685 wiki remembering that the Photon2 has a 12-bit ADC so the range is 4095 count , not 1023 count.

Once calibrated, you will need to “calculate” the pressure based on the pressure sensor datasheet.

1 Like

Yes, I am aware of the 12-volts prohibition.

I have set the jumpers to 3.3 volts.

I do have a multimeter. Once all the connections are in place, where/how would I connect the multimeter's probes to measure the voltage? My major in college during my first year was electrical engineering but switched the next year. I should have stuck with EE because now I know nothing about the electrical aspects of this system.

You can connect your multimeter to the output of the converter: VOUT and GND respectively.

1 Like

And what did you switch to?

Business Administration. I had no idea what kind of industry I might want to work in but I knew that every business needs managers. It worked out OK. Made good money and now, retired, no mortgage, no car loan, living in paradise (Latitude Margaritaville). Only way I'm leaving here is in a body bag (probably soon).

2 Likes

OK Peekay123, at 4 mA, my meter shows that I cannot get the voltage below about 2 no matter how I adjust the 'zero' potentiometer. At 20 mA I cannot get the voltage below 4.4. Maybe my meter is defective (it's very old). Luckily I have a second one (if I can find it. Stay tuned.

Well, you can check your meter by measuring the 3v3 pin voltage on the P2 with USB plugged in. Allso if you connect both leads on the multimeter to ground, it should read near zero. Try that first.

While you were typing, I found my second meter. I have been successful in getting the voltage from a 4 mA input down to .01; close enough methinks. That 'zero' potentiometer surely requires a gazillon turns to effect noticeable changes!

Going to work with the 20 mA input next. Update to follow.

SUCCESS!!! 3.3 volts on the nose!

Now I'm going to hook everything to the Photon. Almost there!

The next thing, of course, is to test the code but I think (hope) that'll be a no brainer (famous last words).

Thanks to you and Gus - as always - for sharing your knowledge and advice. Couldn't do it wthout you.

2 Likes

@blshaw45 yay! I typically use a map() function to convert the voltage range to the pressure range.

Other famous quote that I (do not) love:

it should be easy!

ha :clown_face:

1 Like

Yup, that's in the code I stole off Github.

1 Like

One more wiring question Gus. The diagram shows VCC in parallel with the voltage input on the Photon and the positive feed from the power supply. But that's 12 volts. Would I be correct that now that I am done testing I can remove the connection to the power supply and go from VCC only to the 3.3 volt input to the photon?

@blshaw45 the Arduino can power input can handle up to 12v. Based on the HW-685 Wiky, it needs 5v-12v supply so you will not be able to power it from the Photon2’s 3V3 line. Also, the 3V3 pin on the Photon2 is an OUTPUT only. If you are powering using USB, you can use the Vusb pin on the Photon2 as per the docs:

VUSB Pin

The pin is internally connected to the VBUS of the USB port. The nominal output should be around 4.5 to 5 VDC when the device is plugged into the USB port and 0 when not connected to a USB source. You can use this pin to power peripherals that operate at such voltages. Do not exceed the current rating of the USB port, which is nominally rated to 500mA. This pin is also protected with an internal fuse rated at 1000mA.

If you are powering with an external 5V supply (do not exceed this!), you can do so via the Vbus pin and also power the HW-685.

In my 4-20mA designs, I use a 5v supply to power the Photon2 and use a small 5-12v (or 24v) boost regulator to power the 4-20mA sensor. Another approach is to keep your 12v supply and use a buck regulator (ideally not an LDO due to heat) to provide 5v to the Photon2.