RS232 interface protocol - serial-port

I'm developing a new board that should connect to other devices like PLC or industrial PC trough rs232.
The remote devices will connect to read and set some parameters (most of them one byte value).
I'm asking if is there any standard protocol to do that or if I can implement something proprietary that customers must follow .
I tought to use AT commands but my device has nothing to do with modems.

Related

Simulate com port on pc to be recognised by other pc

Currently I have a server, that communicates with a projector through a RS232. The server opens a com port when the projector is connected. The same happens to any PC when a certain type of device is connected through the USB (lets say an Arduino for example). What I want to do it basically replace the projector with a PC/Arduino/Raspberry without the server noticing anything. That would mean the server will recognise the connected PC and open a COM port for it. What do I need to do on the PC so that it automatically opens a com port on the server? I guess there is something very basic that any printer, Arduino, projector etc does, that computers recognise it as a "com port device".
P.S. Doesn't matter the OS on the PC, I just need to make it work and then implement w/e I need to do with the established communication over the port.
P.S.2 I've searched a lot about it, but probabl I am doing it wrong, because I didn't find my type of question anywhere.
COM ports are basically hardware that is detected by the system. Let's say, if an Arduino is connected to a PC, it has its onboard USB to TTL converter which can be found in the device manager(if using windows). Similar USB to TTL converters are there in the market like CP2102, PL2303 which acts like a COM port even if no device is connected further to it. it may be possible that the program you are using(as you referred server) may be sending some data over the serial port and verifying the hardware.
What you need to do to replace it is, first of all, find the baud rate at which the communication is going on, then, listen over the serial lines which machine is sending which message in the sequence(there must be a handshake as I mentioned earlier), if a complicated algorithm is not used by the device, you can simply mimic the device by sending same messages over serial.

Is running HM10 on a soft-serial enable the Low Energy charecteristics ? If so, how can the UUIDs and GATT profiles be tweaked in this case ?

I've been tinkering with the HM-10 board for a few weeks now, trying to push data from phone to module and vice-versa. The ultimate goal was to enable the BLE mode and tweak with the characteristics and GATT profiles. I'm pretty new to this domain so can anyone help me out ?
And is there any way we can interface the HM-10 with the hardware rx-tx channel instead of soft-serial ?
Your question is still not very clear, but i think you mean sending AT-commands over BLE-radio.
To make this possible you have to change the MODE using serial connection.
In standard mode the device can only be configured over the serial connection (pins RXD and TXD) using AT commands.
AT+MODE0: It only accepts AT-commands over the serial connection (RXD/TXD)
until a central device connects to the module.
AT+MODE1: Same as MODE0, once a connection is established,
AT-commands can be sent over BLE and manipulate some PIO pins on
the device.
AT+MODE2: Same as MODE0, once a connection is established,
AT-commands can be sent over BLE.
To test it just send a string to hm-10 as "AT\r\n" and it will respond with OK.
Update:
You cannot change the services and characteristics with AT-commands.
There are a lot of other things you can change,like advertising, setup a beacon and change a lot of settings.
For a full list of AT commands and more see the official data sheet:
http://www.jnhuamao.cn/bluetooth41_en.zip

computer AND esp8266 WITH arduino

how the bellow connection can be done , what the protocol that must be used to send bytes from computer through it's serial WiFi and receive the bytes in Arduino using ESP8266-01 WiFi Serial Transceiver Module.
computer AND esp8266 WITH arduino
It depends on what you want to accomplish, and what roles you want the computer and the arduino/esp combi to play. You can put the ESP in station or access point mode (or mixed), and have it talk to the arduino via the serial interface. The communication with the PC will indeed go via wifi/tcp protocol, but depending on your specific requirements you will have to decide one the roles. Then you can make the ESP a web client or a web server, mainly depending on the direction of the flow of information.
I assume you want to query the Arduino from the PC, in which you can send a HTTP/GET request from the PC to a simple web server on the ESP.
There are various examples in the Arduino examples that do just that to give you a start, available when you install the ESP library in the Arduino IDE, see: https://github.com/esp8266/Arduino
HTH

Fetch data from url using SIM900 ATC modam

I have Sim900 modem which have TCP/IP stack. I have developed website which return data in json. like if you hit my url;
http://mywebsite.com/?id=8&certkey=Hljhph895D5
then it will return value like
{'name':'Ali', 'Age':23}
I would like to know how to fetch data using Sim900 modem. any help would be appreciated.
The GSM (GPRS, UMTS etc) connection is lower level than the IP connection. So you need to make a GPRS or UMTS data connection from your modem to the operator's network, and an IP connection on top of that (usually both connections are done with one single connect command to the modem).
Then you can use this IP connection like any normal internet connection, and retrieve your json data.
How you make the GPRS/UMTS and IP connections, depends upon your platform.
As you are using C#, I guess it's Windows.
If the modem supports newer Windows interfaces, you can use Windows Mobile Broadband API on Win 7 or 8(desktop).
If the modem doesn't support Mobile Broadband API, then you can use AT commands. There is lots of help on the internet for that.

What kind of port is the USB port?

I am developing a serial port communication java-J2ME-J2SE application. There is a mobile phone and a computer ( running Windows XP ). These two machines are communicating through the phone mobile's cable. And the phone mobile's cable is a USB cable. So what is the type of the port : is it COM1 or something else ?
I looked the device manager and I found that the mobile phone ( Alcatel OT-806D ) is in port COM4. Here is a captured image of the device manager:
An USB port is a kind of serial port that computers and devices can use to communicate. It defines the connectors and cables, as well as the physical and link layer protocols that devices must use to communicate over USB. In this sense, it's similar to Ethernet, Firewire or other communication protocols.
At a physical level, USB is a serial protocol, meaning that bits are sent in a serial fashion. Old serial RS-232 ports (traditionally named COMx under Windows) are not related to modern USB architecture. Old serial ports used a simpler and slower communication protocol (RS-232) that was usually handled by a family of chips called UARTs, whereas USB communication requires more complex hardware.
So, the physical and link-layer characteristics of these two protocols are very different. While both are serial protocols, USB allows for several devices to share the same bus (traditional serial ports don't) and communication speed is much higher in USB. Error detection and correction, flow control and other data transfer concerns are better handled in USB.
COM ports are a Windows abstraction to represent any communication port. In other operating systems other names are used. In Linux, the COM1 port is represented by the device /dev/ttyS0.
Note that this is no more than an abstraction. It is possible (and often done) to use serial ports that are not using the traditional, physical, serial port. In fact, you can create operating system drivers that provide serial ports that are in fact communicating over Ethernet, USB, IP or any other communication layer. The COM port at operating system level is no more than an abstraction to represent a communications port.
Mobile phones offer a variety of services through their USB port. This often includes raw serial communication (which you can use in your application), but in many other cases the USB port provides other "profiles" (usb mass storage, headphones, or whatever). All those profiles are standarized so you can plug your phone to a computer and establish a "serial communication" channel, among other things, without having to code communication drivers for the computer or the phone.
So, to answer your question, no, an USB port is not a COM port. It is an USB port. You can use it for serial communications, but you can also use it for other things.
USB means Universal Serial Bus. Generally all os the USB connections on PC will be linked on the same bus. All devices connected to the bus are assigned virtual port numbers. These port numbers will change depending on what is connected to the bus.
However, you won't be communicating with the phone directly but with any driver that is installed for it, unless you're writing the driver itself.
Some phones are not controllable in any way, others may appear as a modem, because that is the functionality that their manufacturer has assigned them through the drive.
My current phone installs as a device in itself (for use with a manufacturers piece of software), a modem and a storage device.
Have a look here for some more information.
um, depends what you mean by "type of port". I think you want to know the name of the port, but what you really need to know is what protocol your phone will understand.
You need to know what protocol (if any) the phone can communicate with over USB. Just because you can connect the phone to a USB cable doesn't mean that you can control the phone. This depends on the phone. Not all phones are built to understand the same protocols.
Also, USB is a serial bus because it transmits data serially on a single line (as opposed to transmitting in parallel over multiple lines), but it doesn't (necessarily) use the same RS-232 protocol as a computer's serial port. If you had a RS-232 device connected to a USB port, then you would connect to it using COM1 (or COM2 or COM3, your operating system assigns this port name).

Resources