versenowbot
  • Home

Arduino Delphi Serial Communication Rs232

15.08.2019by admin
  1. Arduino Rs232 Serial Communication Example
  2. Arduino To Arduino Serial Communication
  3. Arduino Rs232 Communication

My project goal is to read the serial signal which is supplied by the P1 port of a Smart Meter (ISKRA type MT382-D2A52-M2K0agnZ) with an Arduino MEGA 2560 @ 9600 Baud rate. Many before me have succeeded, however I don't seem to manage. Before the Arduino can 'read' the signal from the P1 port, the signal requires to be inverted.

Arduino Rs232 Serial Communication Example

Active2 months ago

The Question and Setup

I'm trying to have my Arduino Pro Mini (w/ ATmega328) communicate with a serial device via RS232. Specifically, I want the arduino to eventually communicate with a BKPrecision 1785B power supply and control its voltage, current, etc.

One caveat. I'm using my computer (via the only RS232 hookup on the arduino) to program and debug the code, and my arduino only has one serial port. Therefore, I decided to use the SoftwareSerial library to setup an additional software RS232 port (on digital pins) for communicating with the power supply.

Arduino To Arduino Serial Communication

What I've done to date

Arduino Rs232 Communication

I tried implementing the above, but the BK1785 didn't show any sign of receiving or understanding the commands. I then plugged in a second computer into the SoftwareSerial port (instead of the power supply) to monitor communication and make sure that the commands were properly sent. The second computer (using Docklight as a serial monitor) noticed that information was being received, but it didn't match what was sent (see below). I can only assume that the I haven't set up the adruino to communicate correctly. It seems most likely that it must be either 1) the Software serial setup or 2) me incorrectly broadcasting the data.

Additional info

The power supply requires a packet of 26 bytes.
Docklight is setup as 9600, 8N1 (edit#1)

Arduino Code

This is the simplified code that I'm running on the Arduino.

Output and Input

I'm broadcasting the following 26 bytes (shown below in dec. format) from the arduino (see code above) through the SoftwareSerial port:170, 0, 32, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 203

My second computer (connected to the SoftwareSerial port of the arduino) is receiving the following 25 (not 26) bytes (also shown in dec. format):149 191 253 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 105

Final thoughts

I've tried using both the write and print commands in the arduino, but neither appear to work. Honestly, I have no idea if using the for loop to send the 26 bytes is the correct way to send information like that. Is there a better method for sending a packet of bytes? I poked around on the internet, but I couldn't mind a similar example.I would appreciate any feedback for the community. Thanks!

Edit#2

I replaced the for loop in my code with the following line:

and received a the identical set of 25 bytes:149 191 253 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 105

Edit#3

I'm trying to post images of my oscilloscope traces, but I don't have 10 reputation points yet.
Is the serial communication receive line supposed to be high when there is no data sent?

dsolimano
7,61733 gold badges4141 silver badges5757 bronze badges
johnjohn

1 Answer

Given that you are getting mostly 1's where you want 0's, maybe you've got the high-low levels wrong. If the hardware connections look right, try the undocumented 'inverse_logic' flag in the SoftwareSerial() constructor.

See https://github.com/arduino/Arduino/blob/master/libraries/SoftwareSerial/SoftwareSerial.cpp, line 335

AShellyAShelly
27.1k1111 gold badges7575 silver badges130130 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Not the answer you're looking for? Browse other questions tagged serial-portarduino or ask your own question.

Description

Used for communication between the Arduino board and a computer or other devices. All Arduino boards have at least one serial port (also known as a UART or USART), and some have several.

BoardUSB CDC nameSerial pinsSerial1 pinsSerial2 pinsSerial3 pins

Uno, Nano, Mini

0(RX), 1(TX)

Mega

0(RX), 1(TX)

19(RX), 18(TX)

17(RX), 16(TX)

15(RX), 14(TX)

Leonardo, Micro, Yún

Serial

0(RX), 1(TX)

Uno WiFi Rev.2

Connected to USB

0(RX), 1(TX)

Connected to NINA

MKR boards

Serial

13(RX), 14(TX)

Zero

SerialUSB (Native USB Port only)

Connected to Programming Port

0(RX), 1(TX)

Due Brocade silkworm 300 firmware download for windows.

SerialUSB (Native USB Port only)

0(RX), 1(TX)

19(RX), 18(TX)

17(RX), 16(TX)

15(RX), 14(TX)

101

Serial

0(RX), 1(TX)

Serial

On Uno, Nano, Mini, and Mega, pins 0 and 1 are used for communication with the computer. Connecting anything to these pins can interfere with that communication, including causing failed uploads to the board.

You can use the Arduino environment’s built-in serial monitor to communicate with an Arduino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to begin().

Serial communication on pins TX/RX uses TTL logic levels (5V or 3.3V depending on the board). Don’t connect these pins directly to an RS232 serial port; they operate at +/- 12V and can damage your Arduino board.

To use these extra serial ports to communicate with your personal computer, you will need an additional USB-to-serial adaptor, as they are not connected to the Mega’s USB-to-serial adaptor. To use them to communicate with an external TTL serial device, connect the TX pin to your device’s RX pin, the RX to your device’s TX pin, and the ground of your Mega to your device’s ground.


Un Venerdi Nero Suvat
Dragon Magazine 390 Pdf To Jpg

  • Latest News

    • Un Venerdi Nero Suvat
    • Mawarsoft Q Player 3 Crack
    • Studiologic Cmk 149 Manual High School
    • Cisco Aspire Crack Token
    • Sail Simulator 5 Crack Download Torrent
    • Cisco Linksys E3000 Setup Software
    • Bombardier Manuals Online
    • Darksiders 2 Артбук Скачать
    • Richard Dokey Sanchez Pdf Writer
    • Download Elyana Kalis
    • Finale 2004 Torrent Download
    • Consuming Grief Beth Conklin Pdf Writer
    • Digital Living 7 Picture Frame Manual
    • Fluid Power Handbook Free
    • Traktor Pro 2 Layout Download Free
    • Zentrix Download Deutsch
    • Caddie Software Crack
    • Lirc Serial Receiver Howtopriest
    • Whitecap Platinum Download Mac
    • Stan Walters The Truth About Lying Pdf Download
Copyright © 2019 versenowbot.
  • Up