non-inverting summer using a opamp

Discussion in 'Electronics Resources' started by Brogath, Apr 24, 2014.

  1. Brogath

    Thread Starter New Member

    Apr 24, 2014
    5
    0
    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)
     
  2. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    Hi,
    The opto outputs wired as emitter followers into a common 1K will cause a few problems.

    Any reason for using opto couplers?

    E
     
  3. Brogath

    Thread Starter New Member

    Apr 24, 2014
    5
    0
    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?
     
  4. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    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.
     
  5. Brogath

    Thread Starter New Member

    Apr 24, 2014
    5
    0
    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
     
    Last edited: Apr 24, 2014
  6. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    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
     
  7. Brogath

    Thread Starter New Member

    Apr 24, 2014
    5
    0
    a full weighted summer would be the ideal end result:
    Code ( (Unknown Language)):
    1. b1 | b2 | b3 | b4 | Vout
    2.  0 |  0 |  0 |  0 | 0V
    3.  1 |  0 |  0 |  0 | 0.3125V
    4.  0 |  1 |  0 |  0 | 0.625V
    5.  1 |  1 |  0 |  0 | 0.9375V
    6.  0 |  0 |  1 |  0 | 1.25V
    7.  1 |  0 |  1 |  0 | 1.5625V
    8.  0 |  1 |  1 |  0 | 1.875V
    9.  1 |  1 |  1 |  0 | 2.1875V
    10.  0 |  0 |  0 |  1 | 2.5V
    11.  1 |  0 |  0 |  1 | 2.8125V
    12.  0 |  1 |  0 |  1 | 3.125V
    13.  1 |  1 |  0 |  1 | 3.4375V
    14.  0 |  0 |  1 |  1 | 3.75V
    15.  1 |  0 |  1 |  1 | 4.0625V
    16.  0 |  1 |  1 |  1 | 4.375V
    17.  1 |  1 |  1 |  1 | 4.6785V
    18.  
    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: Apr 24, 2014
  8. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    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.
     
  9. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    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.
     
    Brogath likes this.
  10. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    Adding a capacitor on the Vs to make the waveform of output voltage more smoothly.
     
  11. Brogath

    Thread Starter New Member

    Apr 24, 2014
    5
    0
    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.
     
  12. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    Refer to R2R Ladder DAC, you just need to use P0~P3.
    [​IMG]

    The same circuit in another website.
    [​IMG]
     
Loading...