Convert 5v serial data to 12v

Discussion in 'The Projects Forum' started by chrisall, Jun 13, 2008.

  1. chrisall

    Thread Starter New Member

    Apr 15, 2008
    3
    0
    I have a device that sends a string of serial data at 300baud to an ECU. This output is standard async 8N1, inverted so that a 1 is 0v and a 0 is +12v. I wish to emulate this device with a PIC, but this outputs TTL voltages. How can I convert the 5v to 12v?

    Note that I'm not trying to convert TTL to RS232 levels, ie MAX232 is not suitable.

    Cheers,
    Chrisall.
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,152
    1,794
    A single transistor can be used as an inverting level shifter.
     
  3. m.majid

    Active Member

    May 28, 2008
    39
    0
    Hi
    I recommend the following circuit.
    It works up to 9600 bps,
    An advantage of this circuit is isolating +12 from +5
    It should work, but I didn't test this circuit practically.
    Try it, if not work then tell me to test it practically.
     
    • 1.GIF
      1.GIF
      File size:
      5.5 KB
      Views:
      256
    Last edited: Jun 14, 2008
  4. lightingman

    Senior Member

    Apr 19, 2007
    374
    22
    Hi,

    Just use a MAX232.

    Daniel.
     
  5. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    I would be interested in learning the reason why you have ruled out the MAX232 right off the bat.

    hgmjr
     
  6. m.majid

    Active Member

    May 28, 2008
    39
    0
    MAX232 converts 0, +5v to +12v, -12v
     
  7. chrisall

    Thread Starter New Member

    Apr 15, 2008
    3
    0
    Because MAX232 converts TTL into RS232 ie, 0v / 5v into -12v / +12v. The ECU im working with doesn't use RS232 comms, it requires inverted 8N1 async where a logic '0' is represented by 12v and a '1' by 0v.

    Cheers,
    Chrisall.
     
    Last edited: Jun 16, 2008
  8. chrisall

    Thread Starter New Member

    Apr 15, 2008
    3
    0
    Hi, that's pretty much the same as what I've tried already, except I used a 4N25 opto-isolator. I did use a lower value pull-up res and ommited the cap though, so that may be causing problems.

    I only need the Tx side btw, all the ECU does externally once it's received the correct code is turn on a lamp!

    Cheers,
    Chrisall.
     
Loading...