Powered by Invision Power Board


Forum Rules Forum Rules (Please read before posting)
Pages:12 ( Go to first unread post ) Reply to this topicStart new topicStart Poll

> Convert 12v Ttl To 5v Ttl For Arduino, from car ecu serial output
rayder
Posted: November 25, 2011 10:13 am
Reply to this postQuote Post


Sr. Member
*****

Group: Trusted Members
Posts: 261
Member No.: 5,009
Joined: May 01, 2006




ok so i was doing a little reading through the plms schematic trying to work out how everything is working and tried to do a little more research on op-amps/comparators.

if i give it 6v and ground for the supplies, but i use 12v for the non inverting input and 5v for the inverting input. when the non inverting input reaches 5-12v will it output the 5v (at a guess due to the voltage drop) supply? or does the supply need to be higher than the inputs? hope that didn't confuse anybody lol
PMEmail PosterUsers Website
Top
Gorgon
Posted: November 25, 2011 02:11 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Trusted Members
Posts: 3,003
Member No.: 3,861
Joined: December 18, 2005




QUOTE (rayder @ November 25, 2011 11:13 am)
ok so i was doing a little reading through the plms schematic trying to work out how everything is working and tried to do a little more research on op-amps/comparators.

if i give it 6v and ground for the supplies, but i use 12v for the non inverting input and 5v for the inverting input. when the non inverting input reaches 5-12v will it output the 5v (at a guess due to the voltage drop) supply? or does the supply need to be higher than the inputs? hope that didn't confuse anybody lol

Comparator type?

TOK wink.gif


--------------------
Light travels faster than sound. That's why some people appear bright until they speak!
PMEmail Poster
Top
Sch3mat1c
Posted: November 25, 2011 05:23 pm
Reply to this postQuote Post


Forum Addict ++
Group Icon

Group: Moderators
Posts: 19,201
Member No.: 73
Joined: July 24, 2002




There are few op-amps which will allow you to apply >5V to any input when the supply is 5V. The circuitry doesn't have any way to "look at" voltages beyond the supply rail. To address this, choose a specialty comparator, or use resistor dividers to reduce the voltage back to the safe range (to drop 12V to maybe 4V, you need a divider with say 20k on top and 10k on bottom).

There are some comparators which allow this. Fairchild I believe makes an "Over-The-Top" something or other trademarked series which allows inputs up to 60V with any supply voltage. Likely there are equivalent chips from other manufacturers.

Most op-amps are ridiculously slow, so you do not want to use them as comparators. Their output voltage range is also generally inferior; an output-high condition might only yield 3-4V on a 5V supply, and output-low maybe 1-2V. This isn't much margin for a logic circuit and the 2-3V minimum that you'd get from an LM741 wouldn't even pass the minimum threshold voltages of a microcontroller.

Most comparators have open collector outputs, so a pull-up resistor is required if you want a full 5V output. The reason they leave this as an option is because comparators are more useful when connected to different things; a driven output (like an op-amp's) would require more interface between circuitry. This isn't always important, and high-speed comparators are designed with appropriate logic level outputs (the fastest are LVDS and ECL, boasting tens of gigabits bandwidth; they are not ordinary silicon, but ICs fabricated from RF transistor materials -- pricey!).

Tim


--------------------
Answering questions is a tricky subject to practice. Not due to the difficulty of formulating or locating answers, but due to the human inability of asking the right questions; a skill that, were one to possess, would put them in the "answering" category.
PMEmail PosterUsers Website
Top
GPG
Posted: November 25, 2011 11:27 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Spamminator Taskforce
Posts: 6,201
Member No.: 792
Joined: April 25, 2004




QUOTE
will it output the 5v
The comparator will output whatever the pull up on it's output allows.
PMEmail Poster
Top
rayder
Posted: December 05, 2011 01:45 pm
Reply to this postQuote Post


Sr. Member
*****

Group: Trusted Members
Posts: 261
Member No.: 5,009
Joined: May 01, 2006




is there any way to use a max232 ic to do the conversion for me or is there no way to change the outputs from -12v ~ +12v to 0v ~ +12v?
PMEmail PosterUsers Website
Top
rayder
Posted: December 09, 2011 08:15 am
Reply to this postQuote Post


Sr. Member
*****

Group: Trusted Members
Posts: 261
Member No.: 5,009
Joined: May 01, 2006




ok so after a little more research and screwing around i've come up with this:

user posted image

can anyone see any problems with it?
PMEmail PosterUsers Website
Top
Gorgon
Posted: December 09, 2011 09:51 am
Reply to this postQuote Post


Forum Addict ++
*******

Group: Trusted Members
Posts: 3,003
Member No.: 3,861
Joined: December 18, 2005




Yes, I can see several problems here.
You should do some more research on the subject of 'open collector and pullup resistors' and the basic subject of 'the NPN transistor and it's polarity'.

Beside the faults, I suppose you know you will be running this with 4800bd?
The 7812 is of no use here, due to the low headroom.

I also refer to my previous posts, regarding the design.

TOK wink.gif


--------------------
Light travels faster than sound. That's why some people appear bright until they speak!
PMEmail Poster
Top
millwood
Posted: December 09, 2011 12:51 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Trusted Members
Posts: 1,823
Member No.: 25,377
Joined: July 26, 2009




QUOTE
i've come up with this:


since you are doing serial communications, an open collector solution (which sometimes degenerates into a resistor + a diode) would seem to be the way to go.

PMEmail Poster
Top
rayder
Posted: December 10, 2011 01:36 pm
Reply to this postQuote Post


Sr. Member
*****

Group: Trusted Members
Posts: 261
Member No.: 5,009
Joined: May 01, 2006




QUOTE (Gorgon @ December 09, 2011 06:51 pm)
Yes, I can see several problems here.
You should do some more research on the subject of 'open collector and pullup resistors' and the basic subject of 'the NPN transistor and it's polarity'.

Beside the faults, I suppose you know you will be running this with 4800bd?
The 7812 is of no use here, due to the low headroom.

I also refer to my previous posts, regarding the design.

TOK wink.gif

ok so what about this one?

user posted image

according to my simulator, it "should" work lol.

oh and btw baud rate is 9600 not 4800.
PMEmail PosterUsers Website
Top
Gorgon
Posted: December 10, 2011 07:51 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Trusted Members
Posts: 3,003
Member No.: 3,861
Joined: December 18, 2005




QUOTE (rayder @ December 10, 2011 02:36 pm)

ok so what about this one?

user posted image

according to my simulator, it "should" work lol.

oh and btw baud rate is 9600 not 4800.

I hope you didn't pay too much for that simulator.

Baudrate first:

2457600Hz / 32(Q5) / 16 = 4800. Use Q4 if you want 9600bd. (The xtal in the example design was twice your frequency.)

Clock output: Should be buffered by a transistor relative to the 12V from the car. With a pullup 1k-2k2. 10k from the 4060 to the base.

Tx(arduino):

The arduino is supplied by 5V. I suppose the Tx output is a normal logic output, and not an open collector. The Tx output will then be kept to 5V by the protection circuits inside the Arduino. The PNP transistor will then be hard on all the time regardless of the output status. This keeps the signal =12V to the car.

Solution: add an emitter base resistor to remove the offset when the output is 5V. A simple resistor ladder may do. When the output is 2V5 the base(PNP) should be at 11V5. To make this simpler, add zener diode(ex 4v7) in series with the resistor, to increase the voltage swing at the base. You'll still need 2 resistors.

Rx(Arduino)
If you don't want to use a buffer, use a pullup to 5V and a serial resistor of about 10k on the Arduino side of the pullup. This for protection of the Arduino.

Since the output from the car is an open collector according to the documentation, you need the pullup to get a signal swing. (example value 4k7)

TOK wink.gif


--------------------
Light travels faster than sound. That's why some people appear bright until they speak!
PMEmail Poster
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic OptionsPages:12 Reply to this topicStart new topicStart Poll

 


:: support us ::




ElectronicsSkin by DutchDork & The-Force