Go Down

Topic: 12v to 5v serial circuit (Read 470 times) previous topic - next topic

wtaulu

Project summary is to connect the board pins 8 and 9 using the SoftwareSerial to communicate to a 12V serial device. 
Looking for a circuit to to up-convert the 5v to 12v on the TX and down-convert the 12v to 5v on the RX.
Looking for something better then a simple resister bridge.  If anyone has done this, would love to see the circuit diagram and the components used.

DrAzzy

#1
Sep 22, 2016, 12:25 am Last Edit: Sep 22, 2016, 12:32 am by DrAzzy
By 12v serial, do you mean RS232 voltage levels (+ and - 10~15v) or 0v/12v (which is weird)?

In that case, use something like a MAX232 - just drop it in with the capacitors as spec'ed on the datasheet, and it will shift one line in each direction for you. Doesn't even need the +/- 10v - it generates it from the 5v by cap switching (also, it's a very cheap way to get +/-10v at low current, if you need that for something. The HC-SR04 ultrasonic sensors that everyone and their mom has use a MAX232 to get the voltage to drive the transducer)

If it's actually 0v / 12v (very unlikely), serial is active low, so just use a standard bidirectional level shifter for it - you can get pre-assembled boards on ebay for dirt cheap, though they don't actually provide the specs with most of them, so you'll want to verify that they actually work with 12v on the high side side, or just make one yourself with fets you know will take the 12v. (google level shifter mosfet, go to image search and look for schematics, and click the pages for more info - there are many pages about the mosfet level shifter design, with plenty of info. It's worth looking up, and studying until you understand why it works, even if you don't plan to use it - it's a clever trick that I've used a bunch of times after finding it)
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

wtaulu

I should have added more details.  The 12V is a NRZ Inverted TTL 0 to +12V, not RS232.   
I have looked at shift levels but they is not much I can find out on a 5v to 12v and a 12v to 5v as I need to go both ways on the RX and TX. 

jremington

#3
Sep 23, 2016, 02:53 am Last Edit: Sep 23, 2016, 02:56 am by jremington
Quote
The 12V is a NRZ Inverted TTL 0 to +12V, not RS232. 
Are you certain? NRZ means "Non Return to Zero".

This type of bi-directional level shifter should work at 12V and 5V if the 12V signal is truly positive only.

wtaulu


Grumpy_Mike

That link will do what you want, the code type is irrelevant.

wtaulu

I thanks looks like what I need.

Go Up