Advice on Input circuitry for 0-10v or Pot


Closed Thread
Results 1 to 19 of 19
  1. #1
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    126

    Default Advice on Input circuitry for 0-10v or Pot

    SO I was in the pub with a friend the other night and he was telling me about the led dimmers he had seen at work that took a 0-10v signal OR a 10K pot to set the brightness.

    Thats dead easy I said - I could do that with an 8 pin pic with build in PWM and a MOSFET.

    So he says 'OK then. Build me one for the kitchen. $20 says you can't..'

    So I can get a voltage input to drive it no issue by feeding it through a non-inverting LM358 with a gain of x0.5 to get a 0-5v output into the AtoD on a 12F683.

    What I can't work out is how to get a 10K pot and a 0-10v input (obviously only one is used at a time) I was thinking a pot between Gnd and the input that could use a soft 'pull up' that forms the top end giving a variable voltage that could drive the op-amp.

    Analog is not really my thing - I am a definately digital guy and have tried googling under various things, but cannot find out how a front end like those functions. Might have to get one and try to reverse engineer the circuit.

    Anyone got any hints ? Attached is what I was thinking of.

    bill.
    Attached Images Attached Images  

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    This should get you started with the ADC part. No LM358 required.
    http://www.rentron.com/PIC12C67XAD.htm

    Then once you have the ADC reading the pot, take the number generated by the ADC and use that with the PWM output.

    If you are using 8 bit the ADC will go from 0 - 255. Use a multiple of that number as the pulse.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    126


    Did you find this post helpful? Yes | No

    Default

    That bits no issue for me. Its the front end analog bit I am haviing the issue with.
    Hoped some analog hero would pop in with the solution !
    bill

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Maybe I am misunderstanding.

    Analog front end.

    The pot is connected between the ground and 5+ with the wiper going to the ADC input.
    The PWM output goes to the mosfet gate.

    The pot is not connected to the 10 volt. Use the same power supply as the PIC. The 10 V will only connect to the drain or source of the mosfet. NPN or PNP, what ever you use.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    you can still use your opamp directly.. the problem here is that your gain will never be 0.5 but 1.5.

    This bring at least few solutions. Forget the opamp, and use a simple voltage divider with 2 resistors + small capacitor (let's say 0.1uF) to smooth the signal noise...

    OR a more fancy op-amp circuit + low pass filter. the whole thing must have a gain of 0.5.

    Advantage to use an opamp in between... at least a higher input impedance... so you don't alter the signal.

    Which voltage sources you have on hand? Is there any negative rails?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    I would follow mister-e's suggestion and use a divider (2 x 10k resistors) to halve the voltage to give you the 5 volts and then feed this into the PIC.

    You could use the POT command to give you a value which is then used as the delay for the pulse train on the output, something like (I've not tried this but it should give you the idea)

    Code:
    scale = 10
    Pot GPIO*,scale,D
    pwm GPIO.**,D,1

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Nah, sorry, not POT for me to measure an external voltage source. ADCIN (or home made ADC conversion routine) would be my suggestion.

    Maybe POT/RCTIME would be a last resort when your PIC don't have any spare ADCs and you need to measure a POT, maybe some LDRs... MAYBE.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    Join Date
    Feb 2003
    Location
    Sydney, Australia
    Posts
    126


    Did you find this post helpful? Yes | No

    Default

    0-10v with a resistive 2:1 dividor would work for the 0-10v input to the ADC input. How about the pot input?

    The commercial units use a 10K between the ground and the input terminal (which can be either 10K pot or 0-10v), but i cannot figure out how they do it.

    Could it be a current rather than a voltage thing ??

    See - this is why I like digital stuff -its on or off.

    bill.
    Attached Images Attached Images  
    Last edited by bcd; - 11th April 2008 at 03:05. Reason: Add picture

  9. #9
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Nah, sorry, not POT for me to measure an external voltage source. ADCIN (or home made ADC conversion routine) would be my suggestion.
    True, but I have very limited experience of ADCIN

    With regards to the voltage divider the attached image might work - maybe better with a 10K lin pot ?
    Attached Images Attached Images  

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Nope... range of 0-2.5 volts only... because this extra 10K in parallel with your POT.

    2x1% 10K in serie, your ADC in the middle... a 0.1uF cap and that's it.

    If the source handle this load, and is not that far of the PIC (i doubt because of this ol' 0-10v naming), this shouldn't cause any problem... as usual, software filtering/averaging are your friend.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  11. #11
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Looks Darrel had written something (LOL ) on that subject ... nooooooo ????

    http://www.pbpgroup.com/modules/wfse...p?articleid=25

    ....

    Boooooooooooooooooooooooooooo

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  12. #12
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Nope... range of 0-2.5 volts only... because this extra 10K in parallel with your POT.

    2x1% 10K in serie, your ADC in the middle... a 0.1uF cap and that's it.
    So how would he adjust the voltage, would placing the 10K pot across the 10v supply, and then placing the 2 x 10K resistors between the wiper and gnd, and then tapping off in the middle work. My thoughts would be that the tap in the middle of the resistors would therefore be half of what ever voltage is coming out of the wiper ?
    Attached Images Attached Images  

  13. #13
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Oh well, there's some voltage divider and ohm law that i'm not going to explain on a friday

    But to me, when at all possible, i try to avoid any kind of trim pot, software calibration is interesting... but there's alway extra work to be done... and the PIC Vdd, and voltage source have their own error margin as well. So i stick to the simple 2 resistor voltage divider

    If you really want to stick with a Trim Pot, i would suggest something like...
    <img SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2493&stc=1&d=120795014 3">
    Attached Images Attached Images  
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  14. #14
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post

    If you really want to stick with a Trim Pot, i would suggest something like...
    I thought that was what the original poster wanted...
    Quote Originally Posted by bcd View Post

    What I can't work out is how to get a 10K pot and a 0-10v input (obviously only one is used at a time) I was thinking a pot between Gnd and the input
    bill.
    Steve, I'm still confused over this, using your circuit effectivly gives 10K and 11.1K (2k + 9.1K) when the pot is at min (ie wiper diectly touching the 10K resistor) which would give 5.26 v, but at the opposite throw, it would be 12K and 9.1K which would give 4.31v to the PIC. I assume that you would therefore use the 0.95v difference as the range to measure for the ADC ?

  15. #15
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    The pot is there for calibration purpose only. inject 10V at the input, then adjust the pot to reach 5v... a bit useless in most case
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  16. #16
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    So in essance its a straight divider, 5V (+ or - 0.25 ish of a volt).

    So how would you then take the 5v output and use this to give a voltage range the ADC can use to intern generate the PWM to dim the LED. I assum that any pot between 5v and gnd will thus be in parallel with the 9.1K, hence your comments regardig Ohms Law

    EDIT:
    Or have I missed something, in that the 0-10v stated in the original post is already a varible voltage between zero and 10v, rather than a fixed 10v supply ? If so then I can see your logic
    Last edited by malc-c; - 12th April 2008 at 10:12. Reason: Afterthought :)

  17. #17
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    i'm not sue if i follow you malc ... not sure you follow us too no pun intended

    You take the output and plug it directly to the PIC... straight, not much. Sugarless, fat-free, not much, zip, zero,nada. Want to use it to dim a LED? easy...

    ADCIN 0, ByteVar
    HPWM 1,ByteVar,Freq

    If i haven't missed anything in the OP request, he have an external source which provide voltage between 0-10V... and want to monitor it (for xyz reason) with a PIC, hence why the voltage divider.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  18. #18
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post

    If i haven't missed anything in the OP request, he have an external source which provide voltage between 0-10V...
    That's the part I missed - I was assuming it was a fixed 10v supply

  19. #19
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I don't see why any PIC should be used here anyway
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. A/D, Pot, Input, A,B So lost now....
    By Helmutt in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th March 2008, 22:23
  2. 0 - 10V input on PIC 16F876
    By slayerizer in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 14th February 2008, 07:25
  3. Digital Pot Advice
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd October 2007, 20:38
  4. Timing input pulses and re-outputting them
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2007, 01:50
  5. Replies: 4
    Last Post: - 24th January 2007, 22:20

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts