All About Circuits Forum  

Go Back   All About Circuits Forum > Software, Microcomputing, and Communications Forums > Embedded Systems and Microcontrollers

Embedded Systems and Microcontrollers Discussion forum for projects and working with embedded systems and microcontrollers (FPGAs, PICs, AVRs). Get help with hardware issues and embedded programming.

Reply   Post New Thread
 
Thread Tools Display Modes
  #1  
Old 11-06-2009, 12:48 AM
peskywinnets peskywinnets is offline
Junior Member
 
Join Date: Jan 2009
Posts: 13
Default What are my options for switching 2.5V DC using a PIC pin?

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.


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!
Reply With Quote
  #2  
Old 11-06-2009, 10:33 AM
MikeML's Avatar
MikeML MikeML is offline
Senior Member
 
Join Date: Oct 2009
Location: 841xx
Posts: 183
Default

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.
Attached Images
File Type: gif Chopper.gif (96.1 KB, 16 views)
Reply With Quote
  #3  
Old 11-06-2009, 12:10 PM
Markd77 Markd77 is offline
Junior Member
 
Join Date: Sep 2009
Location: Birmingham
Posts: 48
Default

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 by Markd77; 11-06-2009 at 12:12 PM. Reason: correction.
Reply With Quote
  #4  
Old 11-06-2009, 02:49 PM
MikeML's Avatar
MikeML MikeML is offline
Senior Member
 
Join Date: Oct 2009
Location: 841xx
Posts: 183
Default

Quote:
Originally Posted by Markd77 View Post
... 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...
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 by MikeML; 11-06-2009 at 05:01 PM.
Reply With Quote
  #5  
Old 11-07-2009, 12:41 AM
peskywinnets peskywinnets is offline
Junior Member
 
Join Date: Jan 2009
Posts: 13
Default

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/show...63&postcount=2

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

Many thanks,
Pesky
Reply With Quote
  #6  
Old 11-07-2009, 04:05 AM
thatoneguy's Avatar
thatoneguy thatoneguy is offline
Senior Member
 
Join Date: Feb 2009
Location: Midwest USA
Posts: 1,072
Blog Entries: 1
Default

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 by thatoneguy; 11-07-2009 at 04:11 AM.
Reply With Quote
  #7  
Old 11-07-2009, 10:21 AM
peskywinnets peskywinnets is offline
Junior Member
 
Join Date: Jan 2009
Posts: 13
Default

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 :-(
Reply With Quote
  #8  
Old 11-07-2009, 10:35 AM
thatoneguy's Avatar
thatoneguy thatoneguy is offline
Senior Member
 
Join Date: Feb 2009
Location: Midwest USA
Posts: 1,072
Blog Entries: 1
Default

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.
Reply With Quote
Reply   Post New Thread

Bookmarks

Tags
, , , ,

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with HV power supply will1234 General Electronics Chat 0 11-04-2009 11:37 PM
Help with 2 x fried Intel Little Falls 2 mobos! davcom1 General Electronics Chat 79 06-02-2009 08:11 AM
Timer Circuit Problem kauffjd3 The Projects Forum 27 05-05-2009 06:29 AM
Potentiometer A2D and PIC 16F877A for DC motor control with PWM zackattach Embedded Systems and Microcontrollers 0 04-23-2009 06:04 PM
Can a PIC drive an Enable pin? jpanhalt Embedded Systems and Microcontrollers 8 11-20-2008 12:58 AM


All times are GMT. The time now is 07:44 AM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Copyright © 2009, All About Circuits. All Rights Reserved.