Comfort  Automation/ Security System Forums Home
Home Search search Menu menu Not logged in - Login | Register

Rs232 connection
 Moderated by: admin
 New Topic   Reply   Printer Friendly 
 Rate Topic 
AuthorPost
 Posted: Tuesday Jun 18th, 2024 02:52 pm
   PM  Quote  Reply 
1st Post
emabonacchi
Member
 

Joined: Friday Jul 31st, 2009
Location:  
Posts: 93
Status: 
Offline

  back to top

Hello and first of all scuse me for my bad English.I am using Cytech Comfort since about 15 years and it is connected to a Pc via serial port because on the Pc is running "Homeseer" software and Cytech is perfectly integrated.Now, i would like do send and receive rs232 data on "Arduino" board rather then "Pc".
I am trying but this seems a little difficult.I have mounted on the Arduino a TTL (with max232 chip) and Db9 Female plug and a "gender changer connector".
If i connect the cable from Cytech to "Pc", i can receive every data, but no data seems to be read from Arduino.Maybe somethink wrong on connection? Or maybe i need to do something i don't know?
Thank you very much.
Ema from Italy



 Posted: Tuesday Jun 18th, 2024 03:57 pm
   PM  Quote  Reply 
2nd Post
emabonacchi
Member
 

Joined: Friday Jul 31st, 2009
Location:  
Posts: 93
Status: 
Offline

  back to top

Are the only pins i need to connect "tx" "rx" and "gnd" or maybe some other (handshake hardware)? Maybe i need to invert "rx" and "tx" pins on db9?



 Posted: Wednesday Jun 19th, 2024 02:56 am
   PM  Quote  Reply 
3rd Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5615
Status: 
Offline

  back to top

Yes you need to exchange tx and rx pnm the DB9 so that TX is connected to RX and vice versa



 Posted: Wednesday Jun 19th, 2024 06:08 pm
   PM  Quote  Reply 
4th Post
emabonacchi
Member
 

Joined: Friday Jul 31st, 2009
Location:  
Posts: 93
Status: 
Offline

  back to top

Ok, i will give a try tomorrow.Can you please give me a schematic reporting the pins on Db9 female on Ucm i need to connect and what kind of connection i need to send to thise pins (es. gnd on pin 1, rx on pin 3 etc...)?
I think for example if i open or close a window, some data will pass throught serial port even withouth any ask, is it true? So if i connect cottectly an rs232 cable, i do receive some kind of message opening and closing a window. Right?.......

slychiu wrote: Yes you need to exchange tx and rx pnm the DB9 so that TX is connected to RX and vice versa



 Posted: Thursday Jun 20th, 2024 02:02 am
   PM  Quote  Reply 
5th Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5615
Status: 
Offline

  back to top

Pin 2 to pin 3, pin 3 to pin 2, pin 5 to pin 5 as in the picture


    
refer to the Comfort Protocol here http://www.cytech.biz/serial_interface_protocol.html

Last edited on Thursday Jun 20th, 2024 02:04 am by slychiu



 Posted: Thursday Jun 20th, 2024 06:16 pm
   PM  Quote  Reply 
6th Post
emabonacchi
Member
 

Joined: Friday Jul 31st, 2009
Location:  
Posts: 93
Status: 
Offline

  back to top

....no success.... I think i am confused in "front" and "rear" view, male or female....
I am trying every changes, but i don't hear signal on my rs232 input..... i know it is my error because on Pc port everything is fine..... i will try and try again.....




 Posted: Thursday Jun 20th, 2024 09:05 pm
   PM  Quote  Reply 
7th Post
strickers
Member
 

Joined: Sunday Jul 24th, 2011
Location:  
Posts: 91
Status: 
Offline

  back to top

"no success.... I think i am confused in "front" and "rear" view, male or female"

Its easy the fronts look a lot different :)

;)



 Posted: Friday Jun 21st, 2024 02:45 am
   PM  Quote  Reply 
8th Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5615
Status: 
Offline

  back to top

This may help




 Posted: Friday Jun 21st, 2024 07:14 pm
   PM  Quote  Reply 
9th Post
emabonacchi
Member
 

Joined: Friday Jul 31st, 2009
Location:  
Posts: 93
Status: 
Offline

  back to top

No luck.... i am wronging something.

Well, i have an UCM with female Db9 connector. It goes into a Db9 male connector on my Pc and when (for example) a close a windows, some data goes from Ucm into Pc.
I have an Arduino with this female module connected to gnd, tx and rx (and obviusly to vcc in arduino). I have soldered a "male" Db9 to the female pins as described in the schematic but no data traffic into serial monitor.... i am becoming a little crazy because i know it is a stupid problem i can not solve.

Attachment: arduino232.jpeg (Downloaded 25 times)



 Posted: Saturday Jun 22nd, 2024 02:00 am
   PM  Quote  Reply 
10th Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5615
Status: 
Offline

  back to top

You must set the baud rate to 9600 baud, 8 bits 1 stop bit on arduino



 Posted: Saturday Jun 22nd, 2024 09:59 am
   PM  Quote  Reply 
11th Post
emabonacchi
Member
 

Joined: Friday Jul 31st, 2009
Location:  
Posts: 93
Status: 
Offline

  back to top

This is the default setting for arduino.... speed 9600, data 8bits, NO parity bits, stop bits 1.

Last edited on Saturday Jun 22nd, 2024 10:00 am by emabonacchi



 Posted: Saturday Jun 22nd, 2024 04:14 pm
   PM  Quote  Reply 
12th Post
emabonacchi
Member
 

Joined: Friday Jul 31st, 2009
Location:  
Posts: 93
Status: 
Offline

  back to top

Now i have a little suspect. I try to explain (it's difficult because my bad english):
When Ucm is connected via rs232 to my pc running Homeseer, i can open or close a window and pc "hear" data via rs232.So, i disconnect Pc and connect Arduino. Opening and closing the window, no data receive.
If i reconnect Pc, data ok.
I have read on "comfort protocol":
Before the UCM can accept and commands or send status, it needs a valid login. This is done using
the LI login command LIxxxxxx where xxxxxx is a 4 to 6 digit numerical code. If the code is valid,
UCM reports LUnn where nn is a user number 1 to 16 or 254 for Engineer. If invalid LU00 is seen.
E.g. LU09 means Login by User 9.
Once the UCM is logged in commands are accepted and events are reported by the UCM
Well, maybe this can be the problem?

I think no, because when i reconnect Pc, ucm continues to send data correctly even without doing a new login. So, i think it means data continue to way along the rs232.
Am i in wrong?







 Posted: Sunday Jun 23rd, 2024 02:22 am
   PM  Quote  Reply 
13th Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5615
Status: 
Offline

  back to top

Some data like alarms can go from UCM to PC without a log in. But you need to log inm before the PC can send commands to UCM



 Posted: Monday Jun 24th, 2024 05:11 pm
   PM  Quote  Reply 
14th Post
emabonacchi
Member
 

Joined: Friday Jul 31st, 2009
Location:  
Posts: 93
Status: 
Offline

  back to top

Finally i have had a working result!!
The problem, was only me.... I was in confusion with rear and front, male or female, tx and rx connections.Now, i can easily receive for example "IP0200" when i close a window and "IP0201" when i open the same window as a set of charachters.
Next step, is to send to Ucm some messages.I am not sure about the format i have to send this.I have understood i need to send a STX, a message and a CR.
Maybe i need to send 3 different strings? Or a single string? Or a charachter at time?

In the example <STX>O!1501<CR>, do i need to go in this way?:
  Serial1.write("03");  
  Serial1.write("O!1501");
  Serial1.write("0D"); 




Last edited on Monday Jun 24th, 2024 05:12 pm by emabonacchi



 Posted: Tuesday Jun 25th, 2024 02:00 am
   PM  Quote  Reply 
15th Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5615
Status: 
Offline

  back to top

that is corrrect



 Posted: Thursday Jun 27th, 2024 09:56 am
   PM  Quote  Reply 
16th Post
emabonacchi
Member
 

Joined: Friday Jul 31st, 2009
Location:  
Posts: 93
Status: 
Offline

  back to top

All ok in receiving data from Ucm, but unfortunaterly no success in sending.
I am doing something wrong, but i don't understand what. I think something about string i send.
Maybe something like "0x03" is what i need?

Last edited on Thursday Jun 27th, 2024 10:00 am by emabonacchi



 Posted: Friday Jun 28th, 2024 05:47 am
   PM  Quote  Reply 
17th Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5615
Status: 
Offline

  back to top

yes you need to add 0x03 to the start of each command as stated in Comfort Protocol



 Posted: Friday Jun 28th, 2024 03:42 pm
   PM  Quote  Reply 
18th Post
emabonacchi
Member
 

Joined: Friday Jul 31st, 2009
Location:  
Posts: 93
Status: 
Offline

  back to top

Ok, finally everything seems to works fine!
I want to thank you very very very much. Your help was great!
For who wants to use Arduino, the way to send something via serial port is this:
  Serial1.write({0x03});
  Serial1.write("M?");
  Serial1.write({0x0D});



 Current time is 02:19 pm
Top




UltraBB 1.172 Copyright © 2007-2014 Data 1 Systems