Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

output voltage of PIC micro-controller

Status
Not open for further replies.

Marwa Majed

Newbie level 5
Joined
Oct 17, 2014
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
67
Hello everyone ,
I just thinking to get dynamic output voltage let say ( 0.5V ,1V ,2 V,3 V) from PIC micro-controller based on its input current values for example if the input current 100 mw the output i want to get 3 V and so on, so can i do this or not is it visible method or not?
Many thanks
Categories Uncategorized
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,145
Helped
4,938
Reputation
9,897
Reaction score
4,750
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
128,625
It isn't clear what you are trying to achieve. The PIC inputs are voltage driven but you are looking for a 'current' of 100mW which is a power specification not current.

I'm guessing what you want to do is produce a voltage proportional to the current flowing through a resistor. You can do this with analog circuits but if you want to do it digitally, the method is:

1. pass the current through a resistor so it drops a voltage.
2. measure that voltage with the PICs ADC module
3. calculate or look-up the voltage to be produced
4. produce a PWM output signal with average of the voltage you want out
5. filter the PWM to recover that average.

Brian.
 

Marwa Majed

Newbie level 5
Joined
Oct 17, 2014
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
67
It isn't clear what you are trying to achieve. The PIC inputs are voltage driven but you are looking for a 'current' of 100mW which is a power specification not current.

I'm guessing what you want to do is produce a voltage proportional to the current flowing through a resistor. You can do this with analog circuits but if you want to do it digitally, the method is:

1. pass the current through a resistor so it drops a voltage.
2. measure that voltage with the PICs ADC module
3. calculate or look-up the voltage to be produced
4. produce a PWM output signal with average of the voltage you want out
5. filter the PWM to recover that average.

Brian.

thanks a lot for your helping i really appreciate it. I have another question can i take PWM signal average voltage via wire and connected to diode?
Regard
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,145
Helped
4,938
Reputation
9,897
Reaction score
4,750
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
128,625
You can connect it to anything, including a diode, as long as you respect the maximum current you can draw is very small.
The PWM averaged voltage from a PIC will always be positive polarity so if you are thinking of using a diode to rectify it, there is no need to.

Brian.
 

Marwa Majed

Newbie level 5
Joined
Oct 17, 2014
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
67
You can connect it to anything, including a diode, as long as you respect the maximum current you can draw is very small.
The PWM averaged voltage from a PIC will always be positive polarity so if you are thinking of using a diode to rectify it, there is no need to.

Brian.

actually i try to configure capacitance of varactor diode by output voltages of PIC microcontroller so can i do this?
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,145
Helped
4,938
Reputation
9,897
Reaction score
4,750
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
128,625
Yes you can. A Varactor is used in reverse bias mode so it needs almost no current to feed it. Be careful though, the voltage derived from PWM will have to be well filtered, any residual PWM signal will cause modulation of the capacitance. If the Varactor is used for tuning you would see FM at the PWM frequency.

Brian.
 

Marwa Majed

Newbie level 5
Joined
Oct 17, 2014
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
67
Yes you can. A Varactor is used in reverse bias mode so it needs almost no current to feed it. Be careful though, the voltage derived from PWM will have to be well filtered, any residual PWM signal will cause modulation of the capacitance. If the Varactor is used for tuning you would see FM at the PWM frequency.

Brian.

Thanks a lot for your great helping
I just want to be sure that i understand right what you have written so Please check my following paragraph and tell me please if is it right or wrong but first i want explainig briefly what my project is my project detect LED light by using photo-detector then read this signal by microcontroller for getting my goal voltages what i understood from your replies:
"that i took input to PIC from photodetctor via resistor then filter output for getting my goal voltages"
Is it right what i mention?
Regard :-D
Marwa
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,145
Helped
4,938
Reputation
9,897
Reaction score
4,750
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
128,625
Not correct I'm afraid!
Your original post said you wanted to convert current to voltage but normally, a photo-detector circuit has an voltage output not a current output. Your design may be different but most would take the output from a photo-detector, amplify it from the few mV it produces up to say 5V maximum then use the ADC to measure it.

If you take the output from a photo-detector diode or transistor directly it will be too small to measure accurately. For example a PIC ADC, assuming you use internal reference and all 10 bits resolution can only measure voltage in steps of about 4.8mV. There are 1023 steps up to maximum but if the detector only produced say 10mV your ADC would only return values of 0, 1 or 2. You would need the amplifier to scale the photo detector output up to a value nearer 5V in full brightness.

Where does the Varactor fit into this?

Brian.
 

Marwa Majed

Newbie level 5
Joined
Oct 17, 2014
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
67
Not correct I'm afraid!
Your original post said you wanted to convert current to voltage but normally, a photo-detector circuit has an voltage output not a current output. Your design may be different but most would take the output from a photo-detector, amplify it from the few mV it produces up to say 5V maximum then use the ADC to measure it.

If you take the output from a photo-detector diode or transistor directly it will be too small to measure accurately. For example a PIC ADC, assuming you use internal reference and all 10 bits resolution can only measure voltage in steps of about 4.8mV. There are 1023 steps up to maximum but if the detector only produced say 10mV your ADC would only return values of 0, 1 or 2. You would need the amplifier to scale the photo detector output up to a value nearer 5V in full brightness.

Where does the Varactor fit into this?

Brian.


Dear Brain
Last question can programmed my PIC so each input voltage give me what i need output voltage for example if my input 1 V the ouput will be 0.5 v is it possible may be my question silly but i haven't any knowldge about electronic device
Many thanks
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,145
Helped
4,938
Reputation
9,897
Reaction score
4,750
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
128,625
That is easy. almost all PICs have ADC modules and PWM modules.

ADC = Analog to Digital Converter. It measures a voltage on a pin and converts it to a number, usually in the range 0 to 1023.
PWM = Pulse Width Modulation. It has several uses but in your case it would be used to convert a number into the width of pulses in a continuous pulse stream. After averaging, the result is a voltage in the range 0V to PIC supply voltage.

When you have the number from the ADC you can do anything you like with it then use the result to control the PWM output and from there produce a voltage again. You can do math on the number or you can use it to find an entry in a look-up table to decide what voltage the PWM should produce.


Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top