What is the simplest way to turn a uC 3.3v square wave into a 12v square wave signal?

Discussion in 'The Projects Forum' started by gte, Aug 7, 2012.

  1. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    I need to generate a 0-12v signal from the 0-3.3v dc square wave signal that my uC produces. I'd like the signals to be identical sans the peak voltage increase. Should I use a jfet and an emitter resistor and have the signal out between the emitter and emitter resistor?
     
  2. #12

    Expert

    Nov 30, 2010
    16,337
    6,821
    No. A jfet in that configuration is an emitter follower. You're going to have to use gain and inversion. Do 2 stages of common emitter amplifier.
     
    gte likes this.
  3. wayneh

    Expert

    Sep 9, 2010
    12,150
    3,058
    Couldn't you just use a logic-level MOSFET with a 12v supply?
     
  4. #12

    Expert

    Nov 30, 2010
    16,337
    6,821
    That would cause an "invert" as in, not "identical sans the peak voltage increase".
     
  5. wayneh

    Expert

    Sep 9, 2010
    12,150
    3,058
    Ah, got ya'. I suppose you could use a p-channel though. Or define your output as Vcc - drain.
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You'd also have to use an N-channel or BJT on the output of the uC, or the uC would never be able to turn it off.
    Huh?
     
  7. wayneh

    Expert

    Sep 9, 2010
    12,150
    3,058
    I just mean that, from the point of view of a load, the voltage it sees across itself is Vcc minus the drain voltage. On a 12V supply and using an N-channel logic MOSFET, this will range from 0V to 12V in synch with the gate voltage. Output (drain V) versus logic ground (source) will be inverted.
     
  8. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Thanks everyone for the replies.

    Is this sufficient as a 2 stage common emmiter amp?

    Should Rc1 and Rc2 have the same values, or should I skew the values or insert an Rb2?


    [​IMG]
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Why not start with what your output load will be?
    You've told us that your uC's input is 0v-3.3v, and you need 0v-12v out ... but you have not said what you need to drive with the 0v-12v signal. The current requirement of the load may determine what the value of Rc2 is; we really don't know yet.

    Then Rc1 = Rc2*10, and the 1000 Ohm resistor should allow 1/10th the base current as flows through Rc1 when the transistor is fully turned on. Otherwise, you'll be wasting power in the resistors.
     
    gte likes this.
  10. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Hi Sgt,

    I don't know the requirement of what I'm driving. It is an existing piece of hardware that I have no information on. My belief is that it is almost no load at all and it just monitors the signal I am sending it, in other words it is driving measurement circuitry with very little load.

    Maybe I can figure out the loan of the device by measuring the amperage of the signal on my meter? I'm not sure how this will effect the signal, but I can think of a way anything could be damaged this way?
     
  11. jwilk13

    Member

    Jun 15, 2011
    228
    12
    Check these out. Have a look at Figure 1. I've used these in +12V applications with an N-Channel FET and a 3.3V microcontroller with no problems.
     
  12. jwilk13

    Member

    Jun 15, 2011
    228
    12
    Or maybe try something like the attached figure. Ignore those FET part numbers...you can size them for whatever your requirement is (actually, the BSH103 will probably still work). This figure assumes the load is grounded. The only problem I ran into with this configuration was that when my load current was significant, the particular P-FET I used had a high Rds(on), meaning more power dissipated and my voltage at the load was lower than 12V.

    I may be off on this one, but SgtWookie may be able to correct me :)
     
    gte likes this.
  13. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Hi,

    I actually first tried a jfet (TIP120) that I've used with this uC before with success, but as a switch controlling the sinking side, and when I connected it I got a perfectly matching 3.3v square wave signal, to match the 3.3v square wave signal I was (already generating) sending to the base. So with my tail in between my legs, I then made this post hoping to learn or figure out what I've forgotten/done wrong.

    It looks as though in your second post, the circuit has two fets. If I could dissect it, and you can correct me when wrong, R1 limits Q1 (which is probably an n fet) CE current and limits Q2 (which is probably a p fet) BE current. R2 is a pull down resistor for interference of which I have in my noisy 12v environment, and I always use a resistor in between the transistor and the uC so that I don't overdraw the uC, so my R3 would have to be in between 3.3v and Q1, at maybe 220Ω, which is what I used in my previous projects with this uC and transistor, but then I was only using it as a switch to control Christmas lighting.

    How is my analysis?
     
  14. jwilk13

    Member

    Jun 15, 2011
    228
    12
    The BSH103 is N-Channel, the IRFR9110 is a P-Channel.

    It's there to make sure the BSH103 turns off. The gate has some capacitance, and it will hold a charge. If the voltage is not discharged, the FET may continue to conduct.

    Someone may correct me on this, but I don't think the resistor is necessary. The transistors you have been using are current-controlled devices, whereas the FETs shown in my diagram are voltage controlled. Supply the correct voltage, and you should be good to go. EDIT: I wouldn't use the IRFR9110, personally. It has a high Rds(on), and could limit you if you plan on the load drawing any significant amount of current.

    Hope this helps :)
     
  15. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Sgt,

    Do you see any problem with measuring the amperage of the signal but putting my meter in between the signal and the hardware? I cannot theoretically think of any way my hardware or sensor could get damaged, but I would like a second opinion.

    Here is a scope of the signal if that helps

    http://img62.imageshack.us/img62/6884/3625000rpmscopeat1ms.jpg


     
  16. bountyhunter

    Well-Known Member

    Sep 7, 2009
    2,498
    507
    Here's a circuit I designed to create a 25V square wave, you could change the supply voltage to 12V. The logic level drive comes in at the left into the inverter (top of R9).
     
    gte likes this.
  17. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Thanks bountyhunter

    In case this thread comes up in a search, I was able to put the meter in between the sensor and the hardware to measure th AC signal. I used the AC mA setting on my dmm because it did not register on the 10A setting.

    The output is variable but it goes from .1 mA to 1mA. I saw the mA reading jump around and spike every once in a while, maybe because I'm in a noisy environment? I'm wondering if that is normal? 98% of the time it consistently read from .1 to 1 mA . What do you all think?
     
  18. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Ok, I built this circuit tonight and the scope output it gives is below. The resistor values were just for testing and are not final yet, I will have to go over that and verify those values suit this project best.

    What does everyone think?


    [​IMG]


    [​IMG]
     
  19. wayneh

    Expert

    Sep 9, 2010
    12,150
    3,058
    Your drawing in post #8 shows no connection of µC ground to your circuit ground, or from your step-up circuit to the downstream device. Is it assumed?

    I still contend that the simplest way (as in the title of your thread!) is a single logic-level N-channel MOSFET. Put a current-limiting 470Ω resistor from +12 to the drain pin, which is your output. When it's turned on, the drain will be pulled very close to the source (ground). When it's off, the pull-up will take the output up near 12v.

    Gaaa!! I didn't see the post above when I started writing. And nuts, I keep forgetting about inverting.
     
    Last edited: Aug 9, 2012
  20. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Hi Wayne,

    I just left the uC and the rest of the hardware sharing a common ground as assumed, I probably should have connected it though, so yes it was assumed.

    I tried the single fet (TIP 120) and it would only pass the amount of voltage through the fet, that I fed to the gate, it was very strange. I'm still not sure why that happens that way, but that's why posted here ... because that threw me for a loop.

    I had to throw the bjt in between the uC and fet and feed it 12v and then re-invert the newly inverted signal with the fet, so I could get the identical signal on the scope, just with a higher amplitude. I'm pretty happy with it, unless there is a design flaw. The nice thing about the TIP120 fet is that it will pass 5 amps.



     
Loading...