The Godfather talking
You can run, but you can't hide.
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 13, 2024, 08:06:05 20:06


Login with username, password and session length


Pages: [1]
Print
Author Topic: Wireless RS232[ideas]  (Read 6845 times)
0 Members and 1 Guest are viewing this topic.
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« on: January 26, 2019, 12:07:42 00:07 »

I have a PCB that gives serial data and a program that runs on a laptop where I can view all the settings and alter the setting at the moment it use's the cable.

My Idea would it be possible to make this wireless either buying ready made units but which type  or even better still design and make my own if possible.

On searching I found some but then they start talking about Bluetooth or one way commination I need both ways as the software does an handshake.

Any suggestions links and ideas would be great
 
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
Old_but_Alive
Senior Member
****
Offline Offline

Posts: 331

Thank You
-Given: 738
-Receive: 120


« Reply #1 on: January 26, 2019, 07:46:26 07:46 »

my first thought was Buetooth HC-05 modules, very cheap, and easy to use.
However, no hardware  hanshaking ( DTR/CTS etc)

same with the newer DT-06 wifi to serial.

You dont say whether the handshaking is hardware or software (Xon/Xoff)

If its the latter both should work fine.

If its really hardware flow control, I fear you will have to do it alone.

That may be achievable using an ESP8266 module and bespoke software.
Logged

I fought Ohm's Law ...  and the law won
I only use Mosfets because I have a Bipolar mental disorder :-)
PICker
Active Member
***
Offline Offline

Posts: 162

Thank You
-Given: 207
-Receive: 109


« Reply #2 on: January 26, 2019, 12:39:16 12:39 »

There are some 433 MHz alternative RF modules like, for example, the ones at the following links:
https://www.tindie.com/products/lensentech/smart-rf-module-433mhz-data-transceiver-ttl/
https://www.tindie.com/products/lensentech/100mw-rf-module-433mhz-rs232-rs485-ttl-to-wireless/
Unfortunatly they dont have hardware handshaking.
A more complex (and expensive) module with CTS/RTS signals is this one:
http://www.farnell.com/datasheets/56734.pdf
« Last Edit: January 26, 2019, 12:47:35 12:47 by PICker » Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #3 on: January 26, 2019, 09:41:43 21:41 »

Sorry Guy's I should of mentioned, The Serial data comes from some software called webgpi by a company called Danfloss, I've not yet tried to look at the signals and only assume that it does handshake when the unit is not turned on it reports unit not responding. On the controller pcb there is a micro controller with a serial port which gives out the data where you can alter the setting and use it as a tool for fault finding. I cannot get any information on what data or how it sends it through the serial port.


I just thought rather than using a long serial cable see about making it wireless, I did think about trying the HC-05 modules as the baud rate is 11500, but at a guess I would have to use a logic converter as those modules work 0n 3.3V
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
especialista
Junior Member
**
Offline Offline

Posts: 50

Thank You
-Given: 83
-Receive: 161



WWW
« Reply #4 on: January 26, 2019, 10:04:09 22:04 »

I've made a data aquisition system in the past based on cheap ZigBee modules. It worths a look!
Logged
PICker
Active Member
***
Offline Offline

Posts: 162

Thank You
-Given: 207
-Receive: 109


« Reply #5 on: January 26, 2019, 10:44:54 22:44 »

Wizpic,
from WebGPI datasheet I've found on this site (hxxps://prom-electric.ru/media/WebGPI.pdf) seems that two serial cables are available (pag. 48):
1) Sauer-Danfoss Cable PN 1090740 (3 wires?) for the Sauer-Danfoss Microcontrollers MC200/MC400
2) Sauer-Danfoss Cable PN KW02027 or PN KW02012 (6 wires) for the Sauer-Danfoss Microcontrollers MC300/S2X

If the cable uses only 3 wires (TX-RX-GND) it is possible that there is a proprietary connection protocol between Sauer-Danfoss software and the microcontroller; in this case it will be no so difficult to implement a wireless connection by a small circuit with two rs232 level translators (ie max232 )and two wireless tranceiver modules (FULL DUPLEX?).
Please check how many cables are used in serial transmission, for example by building a custom serial cable (with only 3 wires) for the connection between PC and the microcontroller unit.

If the used serial signals are more than TX-RX-(GND), the implementation of the wireless transmission will be more tricky.
 

Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #6 on: January 28, 2019, 12:11:20 12:11 »

I will look into that and check it out when I get the board home so that I can start playing. At the moment it just uses a standard 9 wire serial cable, Hope fully it just uses 3 wires like another tester we use for a different machines/manufacture  so I know that  one could be done using 3 wires

Posted on: January 26, 2019, 06:52:03 18:52 - Automerged

I’m in luck, I’ve tested the controller and it just used 3 wire connection, so I guess that I can use the HC-05 Bluetooth modules with a logic converter has the system runs 5v supply

Or are there better devices ?
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
PICker
Active Member
***
Offline Offline

Posts: 162

Thank You
-Given: 207
-Receive: 109


« Reply #7 on: January 28, 2019, 08:42:33 20:42 »

Wizpic,
it is possible to make the HC-05-Module compatible with 5V signals with some hardware mods and a lot of patience:
https://www.instructables.com/id/Make-Bluetooth-HC-05-Module-5v-Compatable/
There are other solutions like:
https://www.openimpulse.com/blog/products-page/product-category/4-0-bluetooth-module-3-3v-5v-comptabile/
https://tenacious33.wordpress.com/2012/07/21/5v-tolerant-bluetooth-module/
https://it.aliexpress.com/item/Wireless-Bluetooth-Module-Serial-Transceiver-Compatible-with-3-3V-5V-for-Arduino-RPi-AVR/32350474249.html
(I do not know if the core remains the cheap HC-05-Module with some workaround circuit)
Logged
sadman
Hero Member
*****
Offline Offline

Posts: 705

Thank You
-Given: 1812
-Receive: 2830


Sow The Seeds of Love


« Reply #8 on: January 30, 2019, 05:16:03 05:16 »

why doing tedious modification to the HC Bluetooth module simple solution is to use level converter Bi directional from SparkFun  which do the job better i used it with WiFi module for same task.



https://www.sparkfun.com/products/12009
Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #9 on: March 06, 2019, 08:04:28 20:04 »

I've got some HC-05 in, Got them paired and set up,All ok

The trouble I'm facing it does not work as expected, Just for testing I've just used and Arduino mega to read pot value and send out the data on the serial one port at 38400 baud on the master also sending the data out on the normal serial port, This looks ok.

On the salve side I've tired 2 ways first was connecting my RS232 usb to serial port converter and connected the input's to it and started an serial monitor but getting rubbish through like this
Code:
€ø€ø€ø€€ø€øøøøøøøøø€€ø€€€øø€øøøø
Second method I just used an old RS232 chip connected to the USB to RS232 converter as computer does not have serail port. and basicly get the smae result.
Code:
€ø€ø€ø€€ø€øøøøøøøøø€€ø€€€øø€øøøø
I was kind of expecting this as what I see on the serial monitor
Code:
76
87
68
92
59
97
53
101
48
104
46
104
46

May be I'm looking at this wrong, I can't really use another Arduino on the RX side as this will not communicate with the software that runs on the laptop,
I've checked all the settings and baud rates they all match any ideas or is this what you get without using a second Arduino.

The set up I'm looking for is no Arduino's (only used to check it) Is the HC-05 one as master  connected to board that give the RS232 on the machine then this signal gets transmit and the other HC-05 set as slave to the software on laptop

UPDATE:I double checked the baud rates and the defaults should of been 38400 on the HC-05's but when checked they where set to 9600, sSo I've changed them but still not getting the numbers I was expecting. This is what I get now
Code:
OQR;TTT;Q=O@LEJIJLC@>Q;TT8TR=IILE>QTTROFI
« Last Edit: March 06, 2019, 08:26:36 20:26 by Wizpic » Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
kreutz
Active Member
***
Offline Offline

Posts: 183

Thank You
-Given: 993
-Receive: 125


« Reply #10 on: March 06, 2019, 08:38:17 20:38 »

You are probably receiving data and treating it as ASCII characters, you need to convert the (binary) data received into hex or bcd as needed
Logged
Parmin
Hero Member
*****
Offline Offline

Posts: 582

Thank You
-Given: 496
-Receive: 133


Very Wise (and grouchy) Old Man


« Reply #11 on: March 06, 2019, 10:26:59 22:26 »

+1 to what Kreutz say.
The data conversion is not sync properly.

Another thing to do is to reduce the baud rate until you have a good transmission.
Logged

If I have said something that offends you, please let me know, so I can say it again later.
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #12 on: March 07, 2019, 06:39:04 06:39 »

I've tried connecting these modules direct to the PCB and laptop where I want them to work and they did not work, So guess it's back to the drawing board and re-think.

Parmin, kreutz I know what you mean but I really can't use any micro I just wanted to make an RS232 @ 115200 baud to a wireless bridge between the two units. Think I will just have to bite the bullet and buy one
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
kreutz
Active Member
***
Offline Offline

Posts: 183

Thank You
-Given: 993
-Receive: 125


« Reply #13 on: March 07, 2019, 02:09:39 14:09 »

You don't need to change the micro. Review your serial receiving code and change it to convert the received data bytes to BCD and then convert BCD to string, check exactly what you are transmitting using a terminal program on a PC. I will look around for an example, but it will take me some time...

See:   http://www.fiz-ix.com/2012/11/arduino-serial-communication-bytes-bases-and-ascii-characters/
« Last Edit: March 07, 2019, 02:32:36 14:32 by kreutz » Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #14 on: March 07, 2019, 04:23:40 16:23 »

I have done a bit more searching and I'm think  the HC-05 works on TTL signals so I need an Max232 on both side which I've ordered some of E-bay, I seen a on a link which I will put on here later when I get home
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
kreutz
Active Member
***
Offline Offline

Posts: 183

Thank You
-Given: 993
-Receive: 125


« Reply #15 on: March 07, 2019, 06:32:07 18:32 »

Arduino inputs/outputs are ttl signals..
Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #16 on: March 07, 2019, 09:07:18 21:07 »

I don't really want to use any micro controller at all I just want a straight wireless RS232 bridge between the PCB below and laptop which runs the software, I'm not sure if this PCB gives TTL signals as it just uses 3 wire serial cable. I was only trying the Arduino way jsut to make sure that the modules where working in sending data beofre I connected/tried on the real set-up, But I have tried it and it does not connect the PCB, This is why I thoguht I'd try MAX232 in-between the HC-05

Here is the link for that web page where they make the wireless RS232 unit

https://eksfiles.net/a-build-it-yourself-bluetooth-serial-interface/

This is why I thought of the Max232 chips. I've attached some pics of the PCB and software to show you what I'm trying to make.
The PCB.


My trail setup was one arduino connected to the master jsut reading a Pot and sending that value to the HC-05 for TX and the RX I just used an FTL232 converter and connected to the slave HO-05, But I only get rubish as I posted above, I will try it with 2 arduinos for TX&RX which I know will work or I can get it to as it should, This is not as easy has I thought but hey I love a chalange.

« Last Edit: March 07, 2019, 09:12:24 21:12 by Wizpic » Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
kreutz
Active Member
***
Offline Offline

Posts: 183

Thank You
-Given: 993
-Receive: 125


« Reply #17 on: March 07, 2019, 09:26:58 21:26 »

Your linked article is about connecting the HC-05 to a PC using RS232 or two PCs using two HC-05 modules, in case of two Arduinos (instead of PCs) you should be connecting each Arduino's TTL output and input (TX and Rx Respectively) to the HC-05's RX and Tx pins respectively (level translation in between is also necessary), so there is no need to the Max232 chips in between.

If you are receiving data (even if not the one you expected) means that there is communication between them (HC-05s). If the serial configuration for both, Arduinos and HC-05, is the same (baudrate, #of bits, parity, Stop bits), they your data being displayed in ASCII mode is due either to your Received byte processing or your Transmitted byte processing code, or both of them. Posting your code would help us to help you find the cause.

In case of your pcb and laptop you will need the RS232 chip between the PCb (or Laptop) and the HC-05 (as well as the level translation between the max232 and the HC-05 because the MAX232 needs 5Vdc Vcc and HC-05 i/o levels are 3.3. volts maximum)

 
« Last Edit: March 07, 2019, 09:40:45 21:40 by kreutz » Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #18 on: March 07, 2019, 09:37:35 21:37 »

I see this is where I got the confusion from.
This is the TX side(crude but only for a simple test)  on a Arduino Mega
Code:
int potValue = 0;

void setup() {
  Serial.begin(115200); // Default communication rate of the Bluetooth module
  Serial1.begin(115200); // Default communication rate of the Bluetooth module
}

void loop() {

  // Reading the potentiometer
  potValue = analogRead(A0);
  int potValueMapped = map(potValue, 0, 1023, 0, 255);
  Serial1.write(potValueMapped); // Sends potValue
  Serial1.write(0x48);   // H
  Serial.println(potValueMapped); // Sends potValue
  delay(50);
}

This is the RX side(again crude but quick test), Bearing in mind I've not tired this version yet, As I  thought that I could just use the FTL232 converter to read the data from the HC-05 then display it on PC.

Code:
#define led 9

int data=0;
void setup() {
 
  pinMode(led,OUTPUT);
  Serial.begin(115200); // Default communication rate of the Bluetooth module
}

void loop() {
 if(Serial.available() > 0){ // Checks data is  from the serial port
 data = Serial.read(); // Reads the data from the serial port
 analogWrite(led,data);
 delay(10);
 
 }
}
Basicly I just want to replace the cable in-between the PCB and computer with someting wireless, Just make it easier when I have to get someone to operate the machince without having a long cable dangling which gets caught sometimes.
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
kreutz
Active Member
***
Offline Offline

Posts: 183

Thank You
-Given: 993
-Receive: 125


« Reply #19 on: March 07, 2019, 10:04:41 22:04 »

I guess you didn't read carefully the link I posted above:

"
To give you an example, if you were to send the letter A to an Arduino via serial and saved the incoming byte as myByte using code like that given above, the numerical decimal value of myByte would be 65. Try the following code and enter A in the serial terminal and you will notice that the number 65 is returned to the terminal and output to the screen because the Serial.print() function by default prints the decimal value of the byte.

byte myByte;
void setup(void){
   Serial.begin(9600); // begin serial communication
}

void loop(void) {
   if (Serial.available()>0) { // there are bytes in the serial buffer to read
      while(Serial.available()>0) { // every time a byte is read it is expunged
      // from the serial buffer so keep reading the buffer until all the bytes
      // have been read.
         myByte = Serial.read(); // read in the next byte
      }
      Serial.println(myByte); // print byte to screen
      delay(100); // a short delay
   }
  
}
If you want to instead print the ASCII character corresponding to myByte, use the Serial.write() function instead. You can also use an additional argument to tell the Serial.print() function to display the byte using the decimal, hexadecimal, octadecimal, or binary base numeral systems. The following code will take a byte read in from the serial terminal and print it to the terminal using these various bases.

byte myByte;
void setup(void){
   Serial.begin(9600); // begin serial communication
}

void loop(void) {
   if (Serial.available()>0) { // there are bytes in the serial buffer to read
      while(Serial.available()>0) { // every time a byte is read it is expunged
      // from the serial buffer so keep reading the buffer until all the bytes
      // have been read.
         myByte = Serial.read(); // read in the next byte
      }
      Serial.println(myByte, DEC); // base 10, this is the default
      Serial.println(myByte, HEX); // base 16
      Serial.println(myByte, OCT); // base 8
      Serial.println(myByte, BIN); // base 2
      Serial.write(myByte); // ASCII character
      Serial.println(); // carriage return
      delay(100); // a short delay
   }
  
}

(all of the above was copied and pasted here from my linked article)
"

Posted on: March 07, 2019, 03:49:17 15:49 - Automerged

Basically: Using Serial.println() you can specify what format data is being sent. Using Serial.write() you always send ASCII.


Posted on: March 07, 2019, 03:53:43 15:53 - Automerged

How your terminal software, in your laptop, displays the data is also important.


Posted on: March 07, 2019, 03:55:13 15:55 - Automerged

Read also how to configure the serial interface here:
 
https://www.arduino.cc/reference/en/language/functions/communication/serial/begin/
« Last Edit: March 08, 2019, 04:01:41 04:01 by kreutz » Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1200

Thank You
-Given: 550
-Receive: 409



« Reply #20 on: March 07, 2019, 11:02:50 23:02 »

Sorry I had a quick skim through it, But will read it in depth, As I said before the Arduino is only for testing the linkage between the 2 HC-05 modules. I did change the serial.write to Serial.print and got more or less same rubbish in the serial terminal software. once I read through the link you mentioned I will test the software and see about getting it working that way just for fun but by connecting the  HC-05 to PCB and laptop I thought this should work as is as all the coding is done for that already.

I just thought becasue the PCB and laptop commitcate trough the serial port via a cable(which is already been pre set by the supplier)  that these HC-05 modules would just repalce the cable and send the same data via bluetooth, But the slight down fall is the range but should be ok as I'm nenver more than 5/10 feet away from the machine. I know that if you try and make your own serial commications you have to think about missing bits or ending the transmission and all about timing but that has already been taken care of by the supplier.


May be I've been looking at this all the wrong way
« Last Edit: March 07, 2019, 11:12:17 23:12 by Wizpic » Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
wacks
Newbie
*
Offline Offline

Posts: 8

Thank You
-Given: 7
-Receive: 11


« Reply #21 on: March 08, 2019, 03:10:00 03:10 »

From my understanding you also need to set the correct baud rate to use on those HC-05 modules.

[Arduino 1/Serial Device 1]  <==> [HC-05] ~~~~~ [HC-05] <==> [Arduino 2/Serial Device 2]

If you change the baud rate of Serial Device 1 and Serial Device 2 it will no longer match the baud rate of those HC-05 modules, hence you will see garbage data.

From the illustration below the data is already corrupted when the data has entered the first HC-05 module.
[Arduino 1/ Serial Device 1 @34800] <==> [HC-05 @ 9600] ~~~~~ [HC-05 @ 9600] <==> [Arduino 2/Serial Device 2 @ 34800]

The correct one is to use the same baud rate for all devices:
[Arduino 1/ Serial Device 1 @34800] <==> [HC-05 @ 34800] ~~~~~ [HC-05 @ 34800] <==> [Arduino 2/Serial Device 2 @ 34800]

To change the baud rate of HC-05 modules:

Connect the module's KEY pin (pin 34) to 3.3V

Use a terminal (adjust the baud rate to match the default 9600 of the module unless the module's baud rate has been changed before)

AT+UART? tell you the default baud rate. If you receive no response then the baud rate did not match the module

AT+UART=9600 set the baud rate to 9600.

AT+RESET reset and save changes.

Also note that some HC-05 modules (with breakout board) are rated 5V since the 3.3V voltage regulator and level translator are already incorporated on the breakout board.

Just my 2cents.
« Last Edit: March 08, 2019, 03:14:00 03:14 by wacks » Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC