CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to scale down voltage to 5V? Will it effect external ckt
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
leesing2k3



Joined: 08 Nov 2005
Posts: 28

View user's profile Send private message

How to scale down voltage to 5V? Will it effect external ckt
PostPosted: Mon Feb 27, 2006 7:51 pm     Reply with quote

Code:

           |-----------|Voltmeter|-----------|
           |                                 |
           |               LED               |
-----------+---------------|>|---------------+---------- (20mA, clamp at 10V)

This is the existing circuit, it's a tester to test the diode with 20mA current and clamped at 10V. Now I am going to add a 16F877A to measure the voltage of the diode. If the diode is defective, the voltage will go up to 10V. So, I must scale down the voltage.
Code:

              |-----------|Voltmeter|----------|
              |                                |
              |             LED                |
--------------+------------|>|-----------------+---------- (20mA, clamp at 10V)
              |                                |
              |                                |
              |---\/\/\/-------+------\/\/\/---+
                    2K         |        2K     |
                               |               |
                               |               |
                           to 16F877A          |
                              Gnd--------------|

Will this effect the measurement of the existing system?


Last edited by leesing2k3 on Mon Feb 27, 2006 11:31 pm; edited 3 times in total
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Mon Feb 27, 2006 8:27 pm     Reply with quote

Your circuit should work as you drew it. However, you are not showing ground explicitly.

EDIT: PLEASE DISREGARD THIS POST FOR NOW


Last edited by kender on Mon Feb 27, 2006 10:38 pm; edited 1 time in total
leesing2k3



Joined: 08 Nov 2005
Posts: 28

View user's profile Send private message

PostPosted: Mon Feb 27, 2006 10:26 pm     Reply with quote

But will it effect what the voltmeter will measure? originally and after resistors are added into the circuit?
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Mon Feb 27, 2006 10:44 pm     Reply with quote

You have clarified you drawing, and I have to retract my previous post for now. Could you plese specify where you ground is? Also, what kind of diode are you testing (silicon, zener, schottky)?

Since you already have most of your test rig, here's a way for you to obtain the answers to your question experimentally. The A/D of a PIC has a high impedance (a couple iof megaohms). You can simply add the 2K resistors without the PIC and see if you're satisfied with voltmeter readings.
leesing2k3



Joined: 08 Nov 2005
Posts: 28

View user's profile Send private message

PostPosted: Mon Feb 27, 2006 11:31 pm     Reply with quote

Modified
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Feb 27, 2006 11:39 pm     Reply with quote

Your original schematic shows a voltmeter that is floating (not referenced to any system ground). The comment on the circuit "20mA clamped at 10V" is ambiguous. Does it refer to the voltage source applied to the anode of the diode under test or does it apply to some unknown circuitry connected between the cathode of the diode to some common ground?

If the cathode of the diode ALWAYS connects directly to ground then the circuit you have proposed will work however, to be safe, I would add a 4.7V Zener diode between the resistor junction and ground. This will protect the PIC in the event that the right hand resistor were to go open circuit. Another safeguard (some would use it as an alternative but it is complementary) would be to add a series resistor between the junction of the two resistors and the A/D input on the PIC.

There is a subtle difference in behaviour of the circuit wrt the original implementation and that is that in the original circuit current flow would be negligable until the forward diode volt drop appraoched 0.7v (silicon general purpose diode) or 0.2v (schottky diode) when noticable current will start to flow. With the voltage divider approach current will alway flow through the divider. This is really only an issue if you are trying to profile the tranfer characterisitics of the diode.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Mon Feb 27, 2006 11:46 pm     Reply with quote

Thanks! From the drawing alone it seems that you are driving 20mA directly into the ground. Did you actually mean this?
Code:

                       |-----------|Voltmeter|----------|
                       |                                |
                       |             LED                |
(20mA, clamp at +10V)--+------------|>|-----------------+
                       |                                |
                       |                                |
                       |---\/\/\/-------+------\/\/\/---+
                            R1 2K       |      R2 2K    |
                                        |               |
                                        |               |
                                    to 16F877A          |
                                        +---------------|
                                        |
                                       GND

If so, the resistors and the PIC should not affect the voltmeter readings.
Guest








PostPosted: Mon Feb 27, 2006 11:56 pm     Reply with quote

kender wrote:
Thanks! From the drawing alone it seems that you are driving 20mA directly into the ground. Did you actually mean this?
Code:

                       |-----------|Voltmeter|----------|
                       |                                |
                       |             LED                |
(20mA, clamp at +10V)--+------------|>|-----------------+
                       |                                |
                       |                                |
                       |---\/\/\/-------+------\/\/\/---+
                            R1 2K       |      R2 2K    |
                                        |               |
                                        |               |
                                    to 16F877A          |
                                        +---------------|
                                        |
                                       GND

If so, the resistors and the PIC should not affect the voltmeter readings.


Ya, I actually do mean that.
The resistor will effect the reading less if i use bigger resistors like this
Code:

                       |-----------|Voltmeter|----------|
                       |                                |
                       |             LED                |
(20mA, clamp at +10V)--+------------|>|-----------------+
                       |                                |
                       |                                |
                       |---\/\/\/-------+------\/\/\/---+
                            R1 10K      |      R2 10K   |
                                        |               |
                                        |               |
                                    to 16F877A          |
                                        +---------------|
                                        |
                                       GND

Is there any problem with this? Or is there another way?
leesing2k3



Joined: 08 Nov 2005
Posts: 28

View user's profile Send private message

PostPosted: Tue Feb 28, 2006 12:00 am     Reply with quote

Ya, I actually do mean that. If I use smaller resistor like only 2k, this will effect the reading of the meter.
The resistor will effect the reading less if i use bigger resistors like this
Code:

                       |-----------|Voltmeter|----------|
                       |                                |
                       |             LED                |
(20mA, clamp at +10V)--+------------|>|-----------------+
                       |                                |
                       |                                |
                       |---\/\/\/-------+------\/\/\/---+
                            R1 10K      |      R2 10K   |
                                        |               |
                                        |               |
                                    to 16F877A          |
                                        +---------------|
                                        |
                                       GND

Is there any problem with this? Or is there another way?
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Tue Feb 28, 2006 12:06 am     Reply with quote

Anonymous wrote:
The resistor will effect the reading less if i use bigger resistors like 10k. Is there any problem with this? Or is there another way?


There is a problem with resistors bigger then 2.5k. The input impedance of the A/D on a PIC is not infinite, and the datasheet calls for the output impedance of whateve is connecte to the PIC to be under 2.5k. So, in your schematic R2 should be under 2.5k, or the A/D readings will be skewed. Alternatively, you can use R2>2.5k if you buffer the A/D input with an OpAmp with high input impedance (like 10M or more). The question is - what's you desired accuracy of the A/D measurement and voltmeter measurement?
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Tue Feb 28, 2006 12:16 am     Reply with quote

Anonymous wrote:
Or is there another way?

You can also do what asmallri had suggested - add a 4.7V zener diode clamp to the A/D and remove the resistors altogether.

Code:

                       |-----------|Voltmeter|----------|
                       |                                |
                       |             LED                |
(20mA, clamp at +10V)--+------------|>|-----------------+
                       |                                |
                       |                       Zener    |
                       |                       4.7V     |
                       |----------------+------|<|------+
                                        |      R2 2K    |
                                        |               |
                                        |               |
                                    to 16F877A          |
                                        +---------------|
                                        |
                                       GND
leesing2k3



Joined: 08 Nov 2005
Posts: 28

View user's profile Send private message

PostPosted: Tue Feb 28, 2006 12:24 am     Reply with quote

You mean just use a Zener diode without any resistor?
leesing2k3



Joined: 08 Nov 2005
Posts: 28

View user's profile Send private message

PostPosted: Tue Feb 28, 2006 12:33 am     Reply with quote

kender wrote:
Anonymous wrote:
The resistor will effect the reading less if i use bigger resistors like 10k. Is there any problem with this? Or is there another way?


There is a problem with resistors bigger then 2.5k. The input impedance of the A/D on a PIC is not infinite, and the datasheet calls for the output impedance of whateve is connecte to the PIC to be under 2.5k. So, in your schematic R2 should be under 2.5k, or the A/D readings will be skewed. Alternatively, you can use R2>2.5k if you buffer the A/D input with an OpAmp with high input impedance (like 10M or more). The question is - what's you desired accuracy of the A/D measurement and voltmeter measurement?


The voltmeter should have the same reading or very close to the original circuit. The A/D measurement can be quite flexible.
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Tue Feb 28, 2006 12:57 am     Reply with quote

leesing2k3 wrote:
You mean just use a Zener diode without any resistor?


Yes. Zener will protect the A/D input. Choose a Zener, which is rated for more then 20mA. Also keep in mind the following failure mode:
- Your current source fails to limit the current to 20mA and in addition the LED is faulty (or isn’t plugged in at all).
- The current through the Zener becomes higher then the rating.
- The Zener toasts and the A/D input of the PIC is no longer protected.
- The PIC toats.
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Tue Feb 28, 2006 9:42 am     Reply with quote

I believe the zener idea will work. Since the LED requires a current limiting resistor, that same resistor will limit the current through the zener in case the LED opens up. The zener will not conduct any current, in normal operation, since the voltage drop across an LED is, tipically, 1.2V. This circuit could detect if the LED opens up or even shorts out. If you want to add a little redundancy you could add two zeners, say a 3.3V and a 4.7V, into your circuit. The 3.3V zener would take the initial load in case of the LED failing. Then if the 3.3V zener were to open up the 4.7V zener would be able to protect the input and your program could watch for the different voltages and act accordingly.

One problem, though, if any of the components were to become shorted you would not be able to tell which one it was since any one of them would pull the input low and the LED would not light up. This is not very likely though but possible.

Ronald
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group