beire
Posts: 4
Joined: Thu Jan 14, 2016 8:16 pm

max232 serial interface

Thu Jan 14, 2016 8:46 pm

Hello,

I'm new here and my knowledge around electronics is quite limited so bear with me please ! :)

I also don't know if i should be asking this question on these forums, but i thought a lot of knowledgeable people are here so i took the shot.

What i want to do is interface a raspberry pi to a heat pump. ( the brand i do not want to detail at the moment )
I have an interface cable that works fine. I can use it with the manufacturer software in windows.

BUT. I actually want to know what it is. And if possible construct/supply them my own, because i think they are not that special. (probably not worth the price they are asking! )

I have uploaded 2 photos for you to see:
Http://users.telenet.be/bart.e/cable1.jpg
Http://users.telenet.be/bart.e/cable2.jpg

As you can see it uses a max232 chip. So i gues it's TTL to rs232?
It also uses a usb cable solely to supply it with power. Communication is done with the d9 connector.

Can anyone help me analyze this piece of equipment and tell me if i can build my own interface to the raspberry?

Thx!
Bart

klricks
Posts: 8192
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA

Re: max232 serial interface

Thu Jan 14, 2016 10:45 pm

For the RPi you need to use a MAX3232 (not MAX232) and the VCC of the MAX chip needs to go to 3V3 (not 5V).
There are dozens of modules available on ebay (China) etc.
Unless specified otherwise my response is based on the latest and fully updated RPi OS Bullseye w/ Desktop OS.

beire
Posts: 4
Joined: Thu Jan 14, 2016 8:16 pm

Re: max232 serial interface

Fri Jan 15, 2016 7:16 am

Thank you.

Am I correct in assuming I can interface directly to the gpio pins?
But then I would need something like this:
https://www.sparkfun.com/products/12009
or
https://www.adafruit.com/products/1875

Assuming the TTL side is 5v.

When I want to interface through rs232 I need this:
http://m.ebay.com/itm/111736171766
Or http://m.ebay.com/itm/221850004544

But do I also have to supply it with 5v then?

Please correct me when wrong !

User avatar
karrika
Posts: 1351
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: max232 serial interface

Fri Jan 15, 2016 9:28 am

You need to use the original cable as there is two photo couplers on board (the P112A chips) . You could make a separate RS-232 interface that replaces the Windows computer. But don't connect anything directly to the heat pump without proper isolation.

beire
Posts: 4
Joined: Thu Jan 14, 2016 8:16 pm

Re: max232 serial interface

Fri Jan 15, 2016 12:58 pm

Hmm. I already thought it wouldn't be that easy.
There's no easy wat to source any of these modules that include isolation?
Or an easy wat to add.

User avatar
karrika
Posts: 1351
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: max232 serial interface

Fri Jan 15, 2016 1:49 pm

It is cheaper to buy a second cable than creating your own board. The PCB and the chips set you back in the range of €30 - €50 depending of where you manage to buy the parts. Making electronics in single quantities is not cheap.

The easiest solution would be to buy an USB-RS232 adapter (usually the 9-pin connector is a male). You may also need a 9-pin null-modem adapter (usually these are female-female) and a male-male 9-pin gender changer. This should cost around €20.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12368
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: max232 serial interface

Fri Jan 15, 2016 1:58 pm

I'd be very cautious. I haven't fully traced that schematic, but it almost looks like it could be a current loop drive. You actually have no idea what the logic levels are on the heat pump side of the circuit (unless you measure them of course).

Trace the board schematic for at least the opto side to the heat pump and the links to the MAX232, then work out which bits of the MAX232 side you can convert to 3.3V easily. Check the spec of the optos as they may work OK down at 3.3V if you change a few resistors.

If you're doing this as a one-off for yourself, forget it. Get a USB RS232 adapter and use that. You'll save yourself a lot of grief.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

klricks
Posts: 8192
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA

Re: max232 serial interface

Fri Jan 15, 2016 2:02 pm

beire wrote:Thank you.

Am I correct in assuming I can interface directly to the gpio pins?
But then I would need something like this:
https://www.sparkfun.com/products/12009
or
https://www.adafruit.com/products/1875

Assuming the TTL side is 5v.

When I want to interface through rs232 I need this:
http://m.ebay.com/itm/111736171766
Or http://m.ebay.com/itm/221850004544

But do I also have to supply it with 5v then?

Please correct me when wrong !
The MAX3232 chip works at 3V3 if powered by 3V3 or 5V if powered by 5V. The MAX232 works at 5V only.
If using the MAX232 chip on the RPi then you would need to add the 5V to 3V3 level shifter on RX .... but using the MAX3232 at 3V3 would be quite a bit simpler.
Unless specified otherwise my response is based on the latest and fully updated RPi OS Bullseye w/ Desktop OS.

beire
Posts: 4
Joined: Thu Jan 14, 2016 8:16 pm

Re: max232 serial interface

Fri Jan 15, 2016 7:49 pm

karrika wrote:It is cheaper to buy a second cable than creating your own board. The PCB and the chips set you back in the range of €30 - €50 depending of where you manage to buy the parts. Making electronics in single quantities is not cheap.

The easiest solution would be to buy an USB-RS232 adapter (usually the 9-pin connector is a male). You may also need a 9-pin null-modem adapter (usually these are female-female) and a male-male 9-pin gender changer. This should cost around €20.
Yeah well, the original cable package comes at a price of 450€.
I find that a bit high ...

I want to interface a couple of our clients devices for energy metering. But the price of this original cable is way too high.

Anyway.
I have found a reference to a serialcomm TTL-232-5P in a manufacturer data book.

Serialcomm also have one with external power supply option:
http://www.serialcomm.com/datasheets/TTL-232-5IE.pdf

Am i wrong or is this resembling the unit i have got? Together with a rs232 to usb converter.

Thank you for your patience, as i said, my knowledge is very limited regarding this matter.

User avatar
karrika
Posts: 1351
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: max232 serial interface

Sat Jan 16, 2016 9:15 am

If you need to make a few of these I would use an isolated DC-DC power supply on board and re-create the original functionality. The easiest way would be to design a small HAT board with optic isolation and proper drivers. A little like my DiscoHAT http://discohat.com that does pretty much the same thing.

The price you mentioned 450€ is in no relation to the cost or complexity of the board. Designing a board like this takes about one day. Then you have to wait for 2 weeks for the protos. Soldering the series takes another day. Perhaps you can find some local hw guy to help you out.

User avatar
TonyD
Posts: 453
Joined: Thu Sep 08, 2011 10:58 am
Location: Newcastle, UK
Contact: Website

Re: max232 serial interface

Mon Jan 18, 2016 1:34 pm

There are a few RS232 boards designed to work with the Pi.

This is one I designed a while ago for the original Pi model B (& A) to a similar job as the OP. It also works with the current Pi's as well.

Image

You can buy from Tindie
Tony

Return to “Interfacing (DSI, CSI, I2C, etc.)”