Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Switching a PIC circuit from 5 to 12 volts

  1. Apr 15, 2010 #1
    Hi all,
    I have almost completed a project that I power on the breadboard from USB and it works with TTL levels.

    But the situation is that I must make it powered by 12V and working with CMOS logical levels (because of the external input to the device).

    All my chips are CMOS already (HC to be more exact), but at the moment working with TTL logical levels. So, I guess, there will be no problem with them, and for powering the PIC probably I could use a stabilizer. But I don't know what to do about making compatible the CMOS logical levels that are going to be sent by the ICs with the PIC.

    And another question, can you give me some good advices about putting protection on the device input from high voltages and big currents so that the chips won't burn out.

    Thank you
  2. jcsd
  3. Apr 15, 2010 #2


    User Avatar
    Science Advisor

    You're asking two separate questions here:

    1) Will the PIC be compatible with CMOS logic levels?

    Yes, since the PIC is a CMOS device, and the range of values for acceptable inputs (low under the electrical specifications in the datasheet for your particular device) are fairly broad. The digital outputs (which are nearly GND, and Vcc) should also be capable of triggering any CMOS logic you may have.

    2) How do I power my PIC off of 12V?

    You didn't make it clear in your post, but presumably, you would also need to power your other logic with 5V, and not 12V, and thus, your logic levels should still be 5V and 0V (I don't recall any of the families being able to deal with really high Vcc voltages, beyond maybe 6 or 7 V). In that case, you just need a voltage regulator, say, something like an LM7805 (they're cheap--make sure to use 10 or 100 uF electrolytic capacitors on input and output to ensure output stability: you don't have anything too high speed, so you shouldn't need to worry too much about slowed responses as a result of these higher capacitances)

    An example of an LM7805 (it's a genericized, or so heavily cross-licensed that it might as well be, part that dozens of companies produce and should be able to get to you for under a $1 per, in lower volumes):

    EDIT: I should mention that the 7805 takes in 12V, and outputs 5V to power your PIC, logic, etc.
  4. Apr 15, 2010 #3
    Thank you for answering. I am sorry I didn't explain well enough in my original post.

    So as far as I understood, I keep everything the way it was when I was powering the circuit from USB, just add this voltage regulator to the power supply line to make it 5V. And the capacitors I should put between the device input (the connector) and the PIC's pins (where there used to be nothing). Is that correct?

    And would you mind to explain briefly why exactly electrolytic capacitors?
    Last edited: Apr 15, 2010
  5. Apr 15, 2010 #4


    User Avatar
    Science Advisor

    Yes, keep your circuit the way it used to be, but see Figure 7 of the datasheet linked in the link I gave earlier for how to connect the capacitors. You would not connect across the unused I/O pins of the PIC, though it is good practice to put CERAMIC bypass capacitors (usually something like 0.1 uF or thereabouts) between the power and ground pins of your ICs right next to the ICs themselves (the ones you're powering, not the voltage regulator ones):

    The reason you use electrolytics for the regulator filter capacitors is that they're cheap, and do a reasonable job of removing voltage ripple on the input (and output). You also don't care if they're off by 50 or 80%, or that they 'leak' a fair bit, since you use such a large value anyway. Ceramics are smaller, and generally more expensive (for any given value, within a tolerance class). But their small size, low power dissipation (that leakage current gets turned to heat) and general non-polarization (unless you're dealing with tantalums) also make them ideal for bypass capacitors.

    These broad generalizations are just what I've heard (and taken to heart), so someone else may weigh in differently. I should also point out that if you disassemble PC power supplies (or many other wall-supplied supplies that need very steady output) you'll find banks of high-value capacitors: these are mostly used to smooth out the ripples and eliminate the noise that they get from the input. NOTE: Do not disassemble power supplies without knowing what you're doing! These 'great big capacitors' sometimes retain charge for months and can give you a rather unpleasant (or even fatal) surprise!
  6. Apr 16, 2010 #5
    Thank you, MATLABdude. You've been very helpful.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook