Arduino Voltmeter

Hi guys!

I’m working on a small project to test some sensors. These sensors consist of an IR-led and two phototransistors.

Basically what you do is, plug the sensor and measure the phototransistors outputs across a 1k resistor. The voltage across the IR-led, which turns the phototransistors on, is also measured.

I made a schematic of what I want (attached).

Looking at it now, I notice that it could be done differently by using a LCD display module of some kind.

What I would like is a screen that would display those three voltages (Vout1,Vout2,Vrled) instead of placing 3 voltmeters modules on the final design.

Could this be achieved with a single arduino and display?

The voltages to be measured range from 0 to 5 volts.

Thanks!

Could this be achieved with a single arduino and display?

Given that the voltages to be measured range from 0 to 5 volts then yes.

However that schematic is odd. Their are no labels on the voltage adjust circuit and the output does not go anywhere apart from a meter. You show the ground on the voltage adjust connected to the LED+ input and the LED- input as the ONLY connection to some other sort of ground. In other words your schematic makes little sense.

Right, the schematic makes little sense :-(

I guess that you want to connect analog inputs to Vout1 and Vout2.

I also guess that you want to connect the LED resistor from LED- to Gnd, so that you can measure the LED current (resistor voltage) relative to Gnd.

Hi, Can you post a schematic with the IR LED and the photo-transistors included please. Thanks.. Tom... :)

Thanks for the replies!

Sorry for the schematic, I tried to keep it simple but it made things a little more confusing :confused:

Attached the complete schematic and a photo of a sensor so you can see.

What I’m trying to make?
A ‘‘box’’ where you attach the sensor and do the measurements.
At work we assemble these sensors, after the assembly is done we test them to see if they are within the specified specs.
We already have a ‘‘box’’ that does that, but it’s pretty old (for example you have to connect multimeters to able to read the measurements) and i think i can make a new one that does the same, looks a bit better and you dont have to connect any multimeters to it.

How did I come up with the schematic?
I opened the ‘‘box’’ and made a schematic of the wiring. When I had that, i was able to find out what the test ‘‘box’’ actually does.

What does the test ‘‘box’’ do?
It’s actually pretty simple. It simply measures the output of each phototransistor across a 1k resistor, at a specified voltage.

What is this ‘‘specified’’ voltage?
According to the instructions to test the sensor, you have to measure 4.5v across the 80ohm resistor which is connected to the IR-led. You get the 4,5v by adjusting the resistance of the potmeter.

When you have that settled, you measure the outputs of the phototransistor and see if they are within the given specs. When they are ok, you can proceed to the last step, which is; lowering the voltage again, with the help of the potmeter, until you read 70mV coming out of one of the phototransistors. Then you read the voltage across the 80ohm resistor. This voltage should be between 0.15-0.45v, and it’s written on a sticker and placed on the sensor.

What do i got now?
After making the schematic I attached, i build it on a breadboard to see if it did the same as the old box. To my surprise it worked in one shot! :slight_smile:
so what’s left is the building part. My first idea was to place voltmeter modules where you see the multimters on the schematic. After doing some more research i came across LCD display modules, now I think that a LCD display that displays 3 voltages (Vout1,Vout2, Vrled) would be a smarter/better solution for what i want.

My question?
Is this possible with a single arduino? If yes, how doable is it? i have messed around with arduinos before, so I do have some ecxperience, but it’s been a while since that. Or would it be more reasonable to put the 3 voltmeter modules?

Thanks! :slight_smile:

P.S the resistors across which we measure(1K,1K,80ohm), are part of the test ‘‘box’’. They dont form part of the sensor itself.

IMG_0361.JPG

Well the schematic is still not making complete sense. 1) Why is there an 80R resistor in parallel with a 11K resistor? 2) Why is there a 1K resistor in series with the two voltmeters at the top of the page? They can serve no purpose whatsoever.

now I think that a LCD display that displays 3 voltages (Vout1,Vout2, Vrled) would be a smarter/better solution for what i want.

My question? Is this possible with a single arduino?

Yes.

If yes, how doable is it?

Easy peasy lemon squezy doable.

P.S the resistors across which we measure(1K,1K,80ohm),

As drawn you are not measuring across any 1K resistors, the resistor in in series or in line with the measurement. As voltmeters are high impedance these resistors look at best superfluous and at worst will affect the accuracy of the reading.

Thanks for the reply!

Sorry for the schematic again, i posted the wrong one :confused:

This one looks more like it (attached).

Grumpy_Mike:
Easy peasy lemon squezy doable.

Hahah that’s nice to know, I will do some research on how to get started. I’ll be back when i have questions :slight_smile:

The pot drawing still looks wrong to me. The pot should stand upright, with the wiper connected to the transistor base.

DrDiettrich:
The pot drawing still looks wrong to me. The pot should stand upright, with the wiper connected to the transistor base.

Do you mean it should be something like the one i attached now?

While making the schematic I double checked I drew everything right the way it was wired, before I soldered everything back in place. So I was pretty sure that’s how it was supposed to be, before you mentioned it. Although I did get the correct readings on the breadboard, next time on the breadboard I will try to replace the whole transistor voltage regulator thing, with a variable dc power supply. That way i can see if the results are the same or not.

Yes, now it's what I had in mind.

Eventually something went wrong while soldering the original circuit. IMO the 11k resistor should sit on top of the pot, and the 1k at the emitter. Or the 11k was a mistake at all, should have been 1k or 10k as well? But if you replace that part with a programmable voltage or current source, such details won't matter at all.

It seems you just want a 0-100mA current through the IR LED.

Why not make a control voltage with an Arduino PWM pin. And power the LED from 5volt.

Try to draw this: 1k resistor from Arduino PWM pin to the + of a 100uF capacitor. -cap to ground. +cap also to the base of an NPN transistor. Collector to +5volt. Emitter to the anode of the IR LED. Cathode of the IR LED via an 18-22ohm resistor to ground.

Voltage (LED current) can be measured, if needed, across that current limiting resistor. Leo..

I think that a PWM signal must be very well filtered, because LEDs are very susceptible to minor changes of their forward voltage.

I also would add feedback from the photo transistors, so that the current source can adjust itself to the 70mV output threshold. Then you simply read the related current, instead of modifying the current and watching the transistor outputs. The Arduino then only switches the current source between initial (fixed) current and threshold current mode.

I calculated a max LED ripple current of ~3% with those parts values. Just saw that it's for measuring an existing device, so my post is irrelevant. Leo..

Thanks for the replies! Today I did some more testing on the breadoard, I want to figure the reason of the transistor-voltage-regulator part out before I continue. It bothers me that haven’t figured that out yet.

So I replaced the transistor part with a voltage divider. I thought I would get the same values but that was not the case.

First I tried what you see in image 1. That’s the way it’s also wired on the old test box. If I measure around 7v coming out of the emitter, then the voltage drop across the 80ohm resistor is about 4.5v. If I continue with the measurements the results I get are the same as the ones I get from the old box. So this way it works…

Then I replaced the transistor part with a voltage divider, image 2. If I measure around 7v at point A, then the voltage drop across the 80ohm resistor is around 1v. That left me a bit confused. Now I can say that the transistor-voltage-regulator part is necesseray but why I don’t know yet, maybe it’s the ouput impedance of the emitter that makes a difference :confused:

I’ll leave that as it is for now, but it would be nice to know why the design is like that.

Regarding the arduino voltmeter, i found some information on how to do it. However measuring the voltage across a resistor is still unclear. As you can see on the blockdiagram on image 3, I could use A0 and A1 for Vout1 & Vout2 (i would have to modify the code they give a little bit, but that wouldn’t be a problem).

So displaying Vout1 & Vout2 seem easy because you measure with respect to ground.
But if i want to measure the voltage between to points, like when measuring the voltage drop across a resistor, how could i do that?

Looking at the example code I got from this site:http://projectsdunia.blogspot.nl/2016/02/make-digital-voltmeter-using-arduino.html

I dont see how the arduino knows he has to measure with respect to ground, or does he assume that unless you tell him to?

Thanks!!

3.PNG

then the voltage drop across the 80ohm resistor is about 4.5v.

Not with that circuit you posted it doesn't. You only get a voltage drop across a resistor when the other end of the resistor goes someplace else. This is something you keep failing to understand despite having it pointed out to you.

Then I replaced the transistor part with a voltage divider, image 2. If I measure around 7v at point A, then the voltage drop across the 80ohm resistor is around 1v. That left me a bit confused.

Why. The potential divider divide the voltage but the impedance is high so if you draw any significant current from the junction of the two resistors the voltage will drop. As a rule of thumb you should have a current going down the potential divider at least 10 times the current you want to draw out of it.

But if i want to measure the voltage between to points, like when measuring the voltage drop across a resistor, how could i do that?

Use a differential amplifier ahead to the A/D, there is one built into the Arduino. BUT it will not measure floating differential inputs.

As you can see on the blockdiagram on image 3, I could use A0 and A1 for Vout1 & Vout2

Image 3 shows no such thing. It has a 100K and 10K voltage divider so it will present 0.45V at the input.

I dont see how the arduino knows he has to measure with respect to ground

It is the way all electronics are designed. Any differential inputs in a system like this are all relative to ground before being passed through a differential amplifier.

Simply move the resistor down the line, until it connects to ground. This means that it ends up between LED- and ground, as already suggested in reply #2.

If you want to replace the transistor, you don't need a voltage divider. Instead you need a variable resistor (2 pins of a pot) to control the current flowing through the LED.

Grumpy_Mike:
Not with that circuit you posted it doesn’t. You only get a voltage drop across a resistor when the other end of the resistor goes someplace else. This is something you keep failing to understand despite having it pointed out to you.

Yes that is clear to me, but I didn’t draw it because I had posted a picture of the complete schematic before and got a little lazy to draw it again. The 80ohm resistor goes to the IR-led, it doesn’t just hang there.

Grumpy_Mike:
Why. The potential divider divide the voltage but the impedance is high so if you draw any significant current from the junction of the two resistors the voltage will drop. As a rule of thumb you should have a current going down the potential divider at least 10 times the current you want to draw out of it.

Why it confuses me, see the image I attached now. I have the same voltage coming out of junctions A and B so my question was, why is the voltage drop across the resistor not the same? What I didn’t take into consideration first was the current coming out of each junction, I assume they are not equal so that’s why the difference in voltage drop across the resistor.

Grumpy_Mike:
Use a differential amplifier ahead to the A/D, there is one built into the Arduino. BUT it will not measure floating differential inputs.

Ok I will look that up. But couldn’t I also measure the voltage at each leg of the resistor and then in the program I tell it to subtract those voltages? the outcome would be the voltage drop.

Thanks!!

I have the same voltage coming out of junctions A and B so my question was, why is the voltage drop across the resistor not the same?

Because exactly as I said the impedance of the potential divider. You put no resistor values on those diagrams. Suppose on the first one the resistors are both 1M, then all the current you take out has to pass through the top resistor. There is sod all current you can take before your load becomes a significant part of the effective lower resistor.

The effective lower resistor is the load in parallel with the lower resistor. So once you connect a load you alter the ratio of the potential divider. When you have a transistor between the lower resistor and the load you are isolating the load from the lower resistor and buffer it. The current from the load comes direct from the power supply not through ugh the top resistor.

Grumpy_Mike: Because exactly as I said the impedance of the potential divider. You put no resistor values on those diagrams. Suppose on the first one the resistors are both 1M, then all the current you take out has to pass through the top resistor. There is sod all current you can take before your load becomes a significant part of the effective lower resistor.

The effective lower resistor is the load in parallel with the lower resistor. So once you connect a load you alter the ratio of the potential divider. When you have a transistor between the lower resistor and the load you are isolating the load from the lower resistor and buffer it. The current from the load comes direct from the power supply not through ugh the top resistor.

Thanks!! It's clear now :)

Hey guys!

I haven’t posted in a while, so I don’t know if I should start a new thread or not (feel free to tell me if I should). But here goes:

Like I mentioned in the beginning, I want to make a volt meter for a test box for some sensors, using an arduino.

The sensor consists of two phototransistors and a infrared led.

I’m measuring three voltages coming out of the sensor (voltage coming out of the phototransistors and the voltage across the ir-led) I was able to display these three voltages on a 16x4 LCD.

Now I want to add another tweak on the new test box I want to make.

A step in the process of testing the sensors is making sure (by adjusting the backplate of the sensor) the voltage coming out of one of the phototransistor is between 0.01-0.05v higher than the other.

I got an 8x8 LED matrix, which I would like to display let’s say a smiley face when the difference is between the limits, a neutral face when the difference is a bit higher than the limits, and a sad/angry face when it’s way above.

Getting the led matrix to display different patterns is no problem. The problem comes when I connect the LCD and the led matrix at the same time on the arduino.

If I connect it while the LCD is running, the displayed voltages go up. Image 2.

Image 1 is before I connect the led matrix to the 5v coming out of the arduino. If I connect the led matrix to an external 5v then I can avoid that.

But when I upload the code I made for the LCD and led matrix, I get a blank screen on the LCD and all the lights of the led matrix turn on.

What could be the cause of this problem?

My guess is that I have a serial LCD and the led matrix also has a serial interface, so “too much” serial for the arduino. I’m using the arduino uno, should I try with a different one?

I will post some better pictures and the code next time.