# Need help in designing a simple device

Discussion in 'General Electronics Discussion' started by veee8, Apr 23, 2017.

1. ### veee8

10
0
Apr 23, 2017
Hey guys, looking for some help from the experts in designing a fairly simple device. I am a bit lost to the requirements and components needed to build the device I need. What I have will send the inputs, so I will need the device to "create" the outputs.
The device will be based on 5 volt DC inputs. Two separate inputs and outputs.
First input will be a linear sweep .88V to 1.08V that would need to output 4.75V to .35V linear sweep
Second input will be a linear sweep .39V to .59V that would need to output .35V to 4.75V linear sweep

The device would need to be fairly durable and reliable.

2. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,496
2,837
Jan 21, 2010
A simple solution will use a pair of rail to rail op-amps designed to operate from a single ended 5V supply, and voltage references/gain set to produce the output you require.

This document (from page 19 onwards) gives a pretty good explanation.

You will need to do the math to determine the gain and reference voltage required. The gain is simply the ratio of the output voltage range to the input voltage range.

in the first case the gain is (4.75 - 0.35) / (0.88 - 1.08) = -22

in the second case, the gain is (0.35 - 4.75) / (0.39 - 0.59) = 22

The reference voltage is the same as the input voltage which will produce a 0V output

in the first case, the reference voltage is 0.88 - (4.75 / -22) = 1.096V

In the second case, the reference voltage is 0.39 - (0.35 / 22) = 0.375V

The formulae give you ratios of resistor values. You should probably keep the minimum resistor value to be above 1k.

To generate the reference voltages you *might* be able to get away with a resistive divider, however you do need to note the effect of loading. A trimpot carefully adjusted to give the correct voltage when in-circuit may be sufficient if your power supply voltage is well regulated.

3. ### veee8

10
0
Apr 23, 2017
Steve, thank you so much for the response.
The voltage input to the device will be an output from an automotive ecu. It should be stable.
I found this which I can get quickly as I need to get something together to test this week.
https://www.amazon.com/dp/B01D8C4N9A/ref=cm_sw_r_cp_awdb_WAk.ybFJXQCY4
Would it be as simple as running my input into a circuit board, through a pot then out?
Any other components needed?
From what is included in that kit, what range pots would be needed?
Sorry for being such a newbie for all of this.

4. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,496
2,837
Jan 21, 2010
You don't need pots, you need op-amps and fixed value resistors.

You need gain, not just loss.

5. ### veee8

10
0
Apr 23, 2017
Man this is over my head at this point. I can build the circuits no problem if I had a parts list and an idea where to place the components.

6. ### veee8

10
0
Apr 23, 2017
As far as the supply voltage, I have the actual 5v reference coming from the ecu that can be used direct I think. Then combined with my varying input voltages, will net my carrying output voltages.
So then I need to figure out which op amps, resistors and a nice board to mount it all on, and I should be ok. Still trying to push my way through figuring this out.

7. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,496
2,837
Jan 21, 2010
I'll see if I can draw up the circuit for you with suitable value resistors.

I can't do it on my phone so it will have to wait a while

veee8 likes this.
8. ### veee8

10
0
Apr 23, 2017
Much appreciated!

9. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,496
2,837
Jan 21, 2010
This should do it.

I would use 1% resistors for R3, R4, R8, and R9. 21k is an unusual value. You can make it out of two 10k resistors and a 1k resistor.

R2 and R6 should be trimpots (i.e. screwdriver adjustable, not with a shaft for a knob).

U1 to U4 can probably be a quad op-amp. Note that the power supply connections to the op-amp are not shown. Inputs, outputs, and test point voltages are referenced to ground.

The op-amp needs to be able to operate from a 5V supply and have inputs and outputs which are rail to rail.

One op-amp you could use is the MCP6004. There's a bazillion you could use, but this one came at the top of the list (cheapest) from Digikey.

Oh, and be careful, U4 is drawn upside-down compared to the others. The chip has 4 op-amps. There is no reason why the ones labelled here as U1 to U4 have to map to any particular op-amp in the package. They're all the same.

veee8 and BobK like this.
10. ### veee8

10
0
Apr 23, 2017
Thank you so much! I got all the components ordered up. I'll report back after I get it built.

11. ### veee8

10
0
Apr 23, 2017
Steve,
To clarify, when you say the 5V power supply is not shown. Can I use the same 5V coming in to R1 and R5 for the op-amp power supply? Or should they all be separate 5V lines? Also, the legs off of R2 and R7 goes to ground?

12. ### veee8

10
0
Apr 23, 2017
Is it possible to help me designate from your drawing to which pins on the chip please?

File size:
87.4 KB
Views:
51
13. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,496
2,837
Jan 21, 2010
Yes

Yes. As does the ground pin of the op amp (not shown), and this ground is also the reference against which the output voltages are measured.

14. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,496
2,837
Jan 21, 2010
You should be looking at the far right set of pin numbers.

Pin 4 (Vdd) is the positive supply pin (+5V).

Pin 11 (Vss) is the ground pin

Each op amp had two inputs, the inverting input (labeled -) and the non-inverting input (labelled +). These are positioned on one side of the triangle symbol. They are designated Vin{x}- and Vin{x}+ respectively, where {x} is A, B, C, or D identifying which of the four op amps they relate to.

An op amp had a single output. This is drawn connected to the corner of the triangle opposite the side the inputs are connected to. They are designated Vout{x}, where {x} again identifies the op amp it relates to.

The table you posted also has a text description for each pin which should match this.

More importantly, the datasheet from which this came should also have a diagram showing a representation of the package from above. It will show the pin numbers and have the individual op amps drawn inside. I find this to be the most useful part of the datasheet when I am wiring things up.

As I have mentioned before, my designations U1, U2, U3, and U4 do not need to be matched to A, B, C, and D, but it may be simpler if you do. Alternatively, you can simply write pin numbers next to each of the op amp inputs and outputs on my diagram.

15. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,496
2,837
Jan 21, 2010
Here is the diagram I was referring to:

The datasheet is for single, dual, and quad op-amps. You need the quad. It is the lower right one.

The semicircle at the top of the diagram is often present on the chip itself. An alternative is a circular depression near pin 1. In some cases ((not for chips the size you have) there may be a chamfered edge identifying the side that pin 1 is on (on this case it would run along the side where pins 1 through 7 are.

16. ### veee8

10
0
Apr 23, 2017
Steve, with your much appreciated help, I was able to successfully build the device first try, and it does appear to work.
One issue I do have is that the inputs 1&2 get increased voltage back to the source control module when the other control module that the outputs 1&2 are connected to is switched on. Like it backfeeds about .5V back.
What would be the best approach of keeping that at bay?

File size:
341.9 KB
Views:
60
17. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,496
2,837
Jan 21, 2010
What is the source of your voltages? If they are very high impedance then I can understand input 1 affecting it's source, but not input 2.

The question relates to them actually being outputs. Are they?

And I have assumed they are relative to the ground voltage of the op amp.

I've assumed that you mean that you have measured the output voltage of the ECU and it changes when you add this circuit.

18. ### veee8

10
0
Apr 23, 2017
Yes I can datalog the master ecu, and the voltage on 1&2 changes when the slave ecu is switched on. They both jump up about a half a volt.
Input 1&2 is the output from the throttle pedal.
The master ecu sends reference ground and 5 volt to the pedal assembly, the variable ratio resistors built in send back the voltages.
So I am tapping into those voltages and they are being used for pedal input in the master, slave and for the device we built here.
Can we add something to suppress any additional resistance etc from skewing those pedal signal lines?

Last edited: May 1, 2017