What are my options for switching 2.5V DC using a PIC pin?

Discussion in 'Embedded Systems and Microcontrollers' started by peskywinnets, Nov 5, 2009.

  1. peskywinnets

    Thread Starter Active Member

    Jan 19, 2009
    47
    0
    I posted on the PICBasic forum, but then realised this is more of an electronics 'techie' type problem than a programmming one (I've got the actual programming bit sorted in my head)

    So I found this little circuit that works well for my needs - the circuit takes one small analogue signal into an opamp & when a SPST switch is flicked, the opamp output changes from non-inverting to inverting.
    [​IMG]

    I've changed the circuit to illustrate my needs - it normally switches a ground to the non inverting pin - that's fine if you're using dual rail/supply opamp circuits - but all my circuit is single rail & therefore my opamp pins input pins aren't biased at ground potential .....my circuit uses a single rail of 5V - therefore all my opamps are biased at VCC/2 .... 2.5V.

    So therefore rather than switch a ground to the non inverting pin as in the original circuit (which would have been easy to do with a PIC!) ...I'm faced with having to switch 2.5V - so I'm looking for a way to get the PIC to do this with the lowest component count possible! Also, I want to avoid relays as I just don't have the PCB real estate available.

    Suggestions welcome!
     
  2. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Doing some synchronous demodulation, are you?

    A place to start:

    You probably already have R4, R5, and U6. If you have two port pins, you can drive A and B with complementary signals and leave out U4 and U5. You can leave out U3, but the Out symmetry suffers a little. Don't use a high-speed opamp, or there will be some feed-through spikes in the output.
     
  3. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    If I understand right, you want to turn the 5V (ish) from the pic output pin to 2.5V. Depending on how accurate it needs to be, and how much the rest of the circuit affects it, a variable resistor of about 1k might do the trick. Just connect the centre connection to the pic pin, one of the other connections to ground and the remaining one to your op amp. Worth a try. Then just hook a voltmeter up and adjust to 2.5V.
     
    Last edited: Nov 6, 2009
  4. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    What the OP needs to do is to alternatively switch 2.5V(at low impedance) or an infinite impedance to the non-inverting input of his OpAmp. A passive resistor network will not do that. It will switch either 0V or 2.5V, but leave the resisistance in the circuit.
     
    Last edited: Nov 6, 2009
  5. peskywinnets

    Thread Starter Active Member

    Jan 19, 2009
    47
    0
    Hi Mike...yes that's what I'm trying to achieve (ie your #4 post) - no it's not a chopper (don't even know what that does!)....I just need a simple way on inverting a signal 180 degrees.

    Thanks for the circuit - not sure I fully understand it - but I can see how the CD4066 might be useful! I've also had one response on the picbasic forum that might be worth a go....

    http://www.picbasic.co.uk/forum/showpost.php?p=80463&postcount=2

    as that scenario wouldn't need extra ICs (I have a couple of spare outputs on my PIC)

    Many thanks,
    Pesky
     
  6. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Going to your: initial post linked above, This is for controlling the volume on a TDA8551 Amplifier

    From the datasheet:

    Volume control
    trep pulse repetition time 100 - - ns
    Vth(UP) UP/DOWN pin up threshold level 4.2 - VP V
    Vfloat(max) UP/DOWN pin floating high level - - 3.4 V
    Vfloat(min) UP/DOWN pin floating low level 1.0 - - V
    Vth(DOWN) UP/DOWN pin down threshold level 0 - 0.6 V
    IUP/DOWN input current UP/DOWN pin 0 < VUP/DOWN < VP - - 200 uA

    It appears this could be accomplished with a single output pin, and the high impedance state (reference - figure 4 in Datasheet)

    No Volume Change - Hi-Z
    Volume Up - Output High
    Volume Down - Output Low
     
    Last edited: Nov 6, 2009
  7. peskywinnets

    Thread Starter Active Member

    Jan 19, 2009
    47
    0
    Hi thatoneguy .... though similar - this request is not for controlling that TDA amplifier (sorry for the confusion)). As it goes, I was able to control the TDA amp well using a pulse up / down from a DC level of 2.5V ....but neing an audio amp it was log vaolume control - for my particular application, I need linear control....so the IC was binned.

    No, I simply now have a need to invert a signal going through an opamp....I tried last night to use to PIC pins (one switched high, & one switched to 0V) with two resistors between them - sure, the 2.5V appeared & the opamp duly inverted the signal - the problem was when I left the pins floating (ie not 2.5V) ...there was too much distortion on the non inverted signal :-(
     
  8. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    In that case, the 4066 bilateral switch may be the most robust solution to interface an audio circuit not designed for a uC to interface with a uC.
     
Loading...