non-inverting summer using a opamp

Thread Starter

Brogath

Joined Apr 24, 2014
5
Hello everyone,

For a project I am multiplexing several pin outputs of a microcontroller (Chipkit max32) to a different controller (with not enough inputs to wire each separately)

I recall using this method before for some older project but I cannot recall how I solved the problem I have now.

The schematic I included does work for individual outputs but when using multiple signals the values do not add up as they should.

The 5V for the schematic is supplied by a LM7805C.
The opamp is a LM324.
The optocouplers are all four gates from a TIL193.

now the Vout is not stable when opening multiple optocouplers, can I solve this using different resistors/optocouplers? a change in schematic perhaps?

The output must be able to see which button is pressed based on the Vout. this is read via a ADC from the second controller (but initial tests use the chipkit's microprocessor and ADC)
 

Attachments

ericgibbs

Joined Jan 29, 2010
18,865
Hi,
The opto outputs wired as emitter followers into a common 1K will cause a few problems.

Any reason for using opto couplers?

E
 

Thread Starter

Brogath

Joined Apr 24, 2014
5
the second controller is a high-power motor controller. while that one is rather sturdy, the PIC controller on the development kit is not. I wanted a good protection from the sensitive controller to the other.

So, a optocoupler is not required, but I would like to refrain from using mechanical part (relays) and still protect the main controller from anything the motor controller might do/cause.

Would increasing the resistance values by 10 (or more) improve the performance if 1K resistors are problematic?
 

ericgibbs

Joined Jan 29, 2010
18,865
Usually a non inverting 'summer' expects the outer ends of the summer resistors to be terminated by the same resistance, else the 'summing' becomes inaccurate, which is what you have described.
 

Thread Starter

Brogath

Joined Apr 24, 2014
5
Im not sure if i am following you to be honest.
would a R/2R netwerk be better? I attached another schematic. if this is better, what value would you give R?

Besides this non-inverting opamp, would a inverting one (like this one) be better for my purpose? I could add a negative 5V if required.

or perhaps a whole different approach? The method itself is free to be changed at this point so it does not matter if this idea gets replaced by another.

it was just that this method was the first to come to mind. :p
 

Attachments

Last edited:

ericgibbs

Joined Jan 29, 2010
18,865
hi,
If you get the summer working, will only one button be pressed at a time, also what would your 'ideal' output be from the summer.??

ie: what are you expecting?
E
 

Thread Starter

Brogath

Joined Apr 24, 2014
5
a full weighted summer would be the ideal end result:
Rich (BB code):
b1 | b2 | b3 | b4 | Vout
 0 |  0 |  0 |  0 | 0V
 1 |  0 |  0 |  0 | 0.3125V
 0 |  1 |  0 |  0 | 0.625V
 1 |  1 |  0 |  0 | 0.9375V
 0 |  0 |  1 |  0 | 1.25V
 1 |  0 |  1 |  0 | 1.5625V
 0 |  1 |  1 |  0 | 1.875V
 1 |  1 |  1 |  0 | 2.1875V
 0 |  0 |  0 |  1 | 2.5V
 1 |  0 |  0 |  1 | 2.8125V
 0 |  1 |  0 |  1 | 3.125V
 1 |  1 |  0 |  1 | 3.4375V
 0 |  0 |  1 |  1 | 3.75V
 1 |  0 |  1 |  1 | 4.0625V
 0 |  1 |  1 |  1 | 4.375V
 1 |  1 |  1 |  1 | 4.6785V
to see which button is pressed I subtract the largest value (2.5) from the measured value and see if this is higher than 0-1/2Lsb (so result>-0.15625)
if yes, subtract the largest value from the measured value and repeat for a value lower. (b4 is pressed)
if not, b4 is not pressed and the value can be used on the next step.

subtract 1.25 form the (remaining) measured value and test is again to see if it is higher than -1/2Lsb.
etc.

this way I should be able to measure which button is pressed and which one is not.

The ADC convertor is 10 bits, so i think it should be able to measure the small difference.
The resistors get a trimmer to get their value as close to the desired value(s) as possible. A minor inaccuracy could throw the measurement off balance.

Edit: The use of multiple buttons could be useful for certain conditions but is not absolutely required. it would require additional programming to catch any situation where multiple buttons are pressed. if it is possible to do this with analog electronics, i save myself the need for this additional code.

for additional information. The project is for a AGV (Automated Ground Vehicle). the PIC is the AGV master and listens to user input (if any) as well as monitoring the general status of the AGV. the master will light any alarms/signals should the be danger or problems to the device.
The second controller is a sturdy motor controller with limited I/O. this controller measures the path it must take (it follows a magnetic track) and steers the AGV to remain on track. it has no control over the rest of the device.

When on the magnetic tracks, there is no need for multiple buttons at the same time. However, off the track there could be two buttons pressed in order to steer right/left while moving forward. for this purpose multiple buttons are desired, but not absolutely required (it would make manual control less practical).
 
Last edited:

ericgibbs

Joined Jan 29, 2010
18,865
Its similar to a 4 by 4 matrix keypad for analog inputs to a PIC.

A PIC 10bit ADC can easily discriminate between those voltage steps.

I will try to come up with ideas using opto's in that application.
 

ericgibbs

Joined Jan 29, 2010
18,865
hi,
This option should work, the voltage steps would be inverted, but will give 16 discrete voltage steps for the OPA buffer.

Ignore the 393 counter IC, its only for the sim.
 

Attachments

Thread Starter

Brogath

Joined Apr 24, 2014
5
Not quite sure why but the values keep differentiating from the simulated values.

Ill try the same using a general purpose DAC.

Thanks for your replies and have a nice day.
 
Top