Continue to Site

# Help Building a Water Meter Gauge using LM3914 and PreAmp

Status
Not open for further replies.

#### Needlerp

##### New Member
Hello everyone!

Please bear with me as I'm a complete newbie, and haven't done any electronics since I was at School!!

I'm wanting to build an LED meter for a rainwater tank, using a MaxSonar ultrasonic distance meter and a LM3914. The MaxSonar gives an analog reading of approx. 9.8mV/inch, so when my tank is emty the distance will be approx. 70 inches, so 0.68v.

1. When the tank is full, the distance from the sensor will be small, so the voltage will be at its lowest. I therefore need to reverse the signal as in the Gas gauge project at this thread.
2. As the actual voltage range will depend on the final installation, I need to be able to adjust both the zero and range by say +/- 10 inches (98mV)
3. The sensors will be in the tank and the display in the house, so the cable to the sensors will probably be 15m long. Will a 5v supply pass down this OK, and in turn will the length of cable have any effect on the return voltage?

I've had a good look at the gas gauge thread, and the tech specs for the LM3914, but am really struggling to get my head around circuit diagram and the sizing of resistors.

Is anybody out there able to help me specify the Preamp and resistors, and work out a wiring diagram?

Hello everyone!

1. When the tank is full, the distance from the sensor will be small, so the voltage will be at its lowest. I therefore need to reverse the signal .
You know, old age and senility gives me a unique perspective:

Consider this: if you buy an analog (needle) meter, you can make a face for the meter that says anyhting you want and glue it on. I do that a lot. So, instead of a lot of fancy circuitry to reverse things, just make the scale so all the way to the right is empty and all the way to the left is full. Sort of like that writing that goes right to left.......

Find an analog meter that gives full deflection with .68V OR LESS (they are around, I have some), and you don't need any circuitry at all: just a resistor in series with the meter to set full scale. Your entire project is then making a meter face to match the readings you want, and sticking it on with double sided tape.

Making meter faces is easy on the computer if you have a good graphics program like canvas 11 or similar. Probably lot's of others too.

BTW: a nice analog meter will give better accuracy and resolution in cases like this. LEDs are an "ON/OFF" indicator, meters are analog.

Last edited:
I did think about that, but why do something so simple when I can complicate things and learn lots along the way!!

I've managed to work out the part of the circuit which deals with the LM 3914, taking an input voltage of 0-3.5v.

The bit I'm struggling with is how to take my input of 0v-0.68v, multiply it by a gain of 5 (10k and 2k resistors?), but also invert the signal so that I still get 0-3.4v as a positive voltage input to the LM3914. I think I've got the gain bit and the inverse bit, but that would give me -3.4 to 0v, which presumably wouldn't work with the LM3914?

Many thanks

I did think about that, but why do something so simple when I can complicate things and learn lots along the way!!

I've managed to work out the part of the circuit which deals with the LM 3914, taking an input voltage of 0-3.5v.

The bit I'm struggling with is how to take my input of 0v-0.68v, multiply it by a gain of 5 (10k and 2k resistors?), but also invert the signal so that I still get 0-3.4v as a positive voltage input to the LM3914. I think I've got the gain bit and the inverse bit, but that would give me -3.4 to 0v, which presumably wouldn't work with the LM3914?

Many thanks

hi,
This is a simple way to do the gain/inversion.

Ideally the Voff should be a Vref source, adjustable 0.4V thru about 0.8V

EDIT: changed to +5V
Note: with only a 5v supply the CA3140 will be very close to its upper output limit when outputting 3.8V.

#### Attachments

• AAesp01.gif
24.1 KB · Views: 665
Last edited:
Many thanks, I'll try and get my head round that!

OK, I think I'm getting my head round this.

I want to use 5v as my Vref as I'll be driving this, the MaxSensor and LM3914 from a 5v supply. I've had a look a the TI website and think the revised resistor values should be:

R2 - 7k5 (still use a 10k pot)
R3 - 1k5
R4 - 10k
R5 - 1k3 (still use 2k pot)

but the TI website doesn't show your R1 across Vout. Please can you confirm whether my calcs above are correct, and also let me know how I calculate an appropriate R1?

Edited the earlier image to 5V.

Many thanks. Can I still use a LM358 rather than the CA3140?

Many thanks. Can I still use a LM358 rather than the CA3140?

For correct operation over the required output swing a MCP6291 rail to rail opa is required.
The LM358 will clip the 3.8V output swing when a +5V supply is used.

You could use a LM358 with a higher supply voltage .

OK.

My proposed power supply is variable voltage, so I think I'll power the Opamp at say 9v as per your original schedule, then use a 5k trimpot to reduce the voltage across the other components.

Still learning!!

The bit I'm struggling with is how to take my input of 0v-0.68v, multiply it by a gain of 5 (10k and 2k resistors?), but also invert the signal so that I still get 0-3.4v as a positive voltage input to the LM3914. I think I've got the gain bit and the inverse bit, but that would give me -3.4 to 0v, which presumably wouldn't work with the LM3914?

Many thanks
You need to create a virtual ground reference voltage equal to the full scale (empty) voltage whatever that is. use a LM336-1.2V reference and a resistive divider.

Take an op-amp, set up an inverting amplifier and reference it to the virtual ground. The signal out from that amp will be zero when the signal in is equal to the full scale (empty) voltage. You will get a positive signal as the input voltage goes down. Resistors will scale it to whatever you want, but the meter return will have to referenced to the virtual ground. Eric Gibbs circuit is basically what I would use.

Last edited:
For correct operation over the required output swing a MCP6291 rail to rail opa is required.
The LM358 will clip the 3.8V output swing when a +5V supply is used.

You could use a LM358 with a higher supply voltage .
Or an analog meter since they typically will give full scale deflection with a drive of under a volt.

But can't you just use a resistive divider on the 3914 and scale it down to match a smaller input signal range by reducing the reference voltage that corresponds to max input?

Last edited:
OK.

My proposed power supply is variable voltage, so I think I'll power the Opamp at say 9v as per your original schedule, then use a 5k trimpot to reduce the voltage across the other components.

Still learning!!
I still think it would be easier just to scale the signal range down at the 3914 to make it match the dynamic range the op amp can deliver. Just leave the inverting stage at unity gain which gives you a signal range of 0.68 to 1.36 at the op amps output with respect to ground. Take the bottom return for the resistive divider on the 3914 and tie it to the 0.68V virtual ground point. Set the top of the divider to 1.36 by dividing down the reference voltage on the 3914. You got it made.

Last edited:
OK, I seem to have the system working with the exception of the op-amp, which I can get to work in non-inverting mode OK, with the correct gain etc using R2=20k, R3=10k pot set at about 5k. However I've completely failed to get it to work in inverting mode.

It's running at 9v single supply. Eric or bountyhunter, please can you help me with the resistor values again? I want the same response as I get from the non-inverted just upside down!

Thanks

If you are using it inverting, did you create a bias voltage for "middle ground" to bias the input resistors to? With a single voltage, you can't have an inverting amp unless you raise the bias point up above ground because most op amps don't allow the input voltage to go all the way down (a few do).

Post your schematic and we can trouble shoot it.

I haven't read the thread carefully. Has anyone suggested turning (or wiring) the LED bar display upside down?

Last edited:
I haven't read the thread carefully. Has anyone suggested turning (or wiring) the LED bar display upside down?

I suggested just using an analog meter and changing the scale for full scale being equal to NO water, no deflection equals FULL. That's the easiest way. Reverse wiring the LED string is a good idea too.

Last edited:
I suggested just using an analog meter and changing the scale for full scale being equal to NO water, no deflection equals FULL.
I know. The difference is, if you reverse the LED bar, the top of the bar will indicate FULL, which is the "normal" way of viewing things.

Enclosed the schematic I think I'm working to, based on information provided by Eric. Does the 2 resistors between + and gnd effectively provide the virtual ground you are referring to?

I did think about reversing the LEDs, but have already started going down this path and have challenged myself to work my way through it!!

Thanks

#### Attachments

• OpAmp Schematic.jpg
13.3 KB · Views: 226
I know. The difference is, if you reverse the LED bar, the top of the bar will indicate FULL, which is the "normal" way of viewing things.
That's true, it would correspond to depth of water. It's a good idea, my only object to LEDs is they give away accuracy. Ten LEDs means your meter has 10% accuracy best case. It's OK, I just like analog meters because you can see more precision.

Status
Not open for further replies.

Replies
52
Views
6K
Replies
16
Views
2K
Replies
73
Views
9K
Replies
16
Views
3K
Replies
45
Views
5K