Problems with Custom Protocol over Half Duplex Asynchronous


I'm facing some issues regarding Writing and Receiving data from another device. Unfortunately there is not a lot of documentation available about the device I'm trying to communicate with. All the documentation I received is the following:

- Ground
- Single wire async communication

Byte Format
- Asynchronous 
- Half duplex
- 38.4kbps +/- 1.75%
- 1 start bit
- 8 data bits
- lsb first
- 1 parity bit (even)
- 2 stops bits

- The last byte of the packet contains the packet checksum, which is calculates by summing the previous bytes of the packet and then 1's complementing the answer.

Startup Packet
- 1 Byte for Header (HEX 53, ASCII S)
- 1 Byte for Checksum
- Total 2 Bytes send @38.4kbps (0.624ms)

- The Startup response should me executed every 10ms until there is a valid response

Startup Response
- 1 Byte for Header (HEX 73, ASCII s)
- 1 Byte for settings (0-7 bits)
- 1 Byte for settings (0-7 bits)
- 1 Byte for Checksum
- Total 4 Bytes send @38.4kbps (1.248ms)

Based on the information above, I've setup my Arduino MEGA 2560 with the schematic and code below. Every 10ms I send the Startup Package, but I don't receive a single response. I also tried multiple Checksum Calculations but none of them are working. I expect the is probably an issue with Checksum, Baudrate or Wiring. But not sure where too look anymore.

My current Test Code:

int incomingBytes[2];
int index = 0;
//byte dataArraySendStartup[] = {0x53, 0x53};
unsigned long newmicros, oldmicros;
const long DELAY = 9996;   // 10 ms;

void setup() {
  Serial3.begin(38400, SERIAL_8E2);
  oldmicros = micros();

void loop() {

  //Send serial Bytes in code block below
  newmicros = micros();
  if (newmicros - oldmicros >= DELAY) {
    if (newmicros - oldmicros != DELAY){
        oldmicrosByte = micros();
        newmicrosByte = micros();
        Serial.println(newmicros - oldmicros);

        oldmicros = newmicros;

  //Write serial Bytes to Serial Monitor
    incomingBytes[index] =;    
    Serial.println(incomingBytes[index], HEX);

  //Reset the incoming bytes
  if(index == 2) {
    index = 0;  // reset index so we don't overwrite next time

My current Schematic:

Your OLD machine is likely using RS-232 for it's serial communication. Are you using an adapter to convert RS-232 to the TTL level logic used by your Arduino?

Thanks @Paul_KD7HB for your response!

I only have a Mini-Fit Jr - 2x2 Connector, I added wires to them and connected the other side to my breadboard. But now you mention it, there is also an adapter that goes to RS-232 if you want it connect to a computer.

Are there some 'public' or 'well known' schematics available for wiring my Arduino to RS-232?

I will also do some extra research tonight specific about RS-232, didn't now that was different :relaxed:.

Should the placement of the 1K resistor be like this?


So, I was looking around for some schematics for converting the RS-232 to TTL for the Arduino, and saw two Schematics, The first one; One-Wire RS-232 Half Duplex (EE Tip #135) - Circuit Cellar and then Image number 3, I created that schematic but no succes on that either.

Here on the Arduino Forum I came across, this Topic that referred to Alternatives of MAX232 in low budget projects - Do It Easy With ScienceProg where there is a 'One of such solution is Transistor based interface:' But that is full-duplex, does anyone know how I can convert that schematic to Half Duplex? Or should I Create another Topic for this specific Question?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.