Arduino DHSG Protocol

Hi want to use a Arduino to pick up a call on my Desktop Phone.
I know there a some hook up lifter which would be easy to control with Arduino.

But my phone also support DHSG Protocol. I found some information's about the Protocol.

The Problem is that the DHSG Protocol have a pause/break after every Byte (see Attachments) on the UART.

Is it possible to send such a command with a Arduino?

The DHSG specification could be found in German on following Website:

And some information in English here:
http://sebastianschaper.net/index.php/archives/151

Is it possible to send such a command with a Arduino?

Yes, but don't use the serial hardware, you have to bit-bang the protocol on a GPIO.

Hi I try first the read of the value but only get Bullshit :frowning:

To be honest i am new to arduino and have no real idea.

For receiving, I just look for a rising edge on the DHSG line, wait 0.3125ms and then read the PIN state every 0.625ms to include the zeroes , first i just want to write to serial for checking if working and later I want to write to a buffer and check whether the result matches a valid DHSG code.

After this i want to set up a timer for 1600 Hz and alternately transmit one data bit and a zero bit when the interrupt fires to send a DHSG message.

int buttonStateRising = 1;
int lastButtonStateRising = 1;
int i;



void setup() {
  Serial.begin(9600);
  pinMode(11, INPUT); 
}

void loop() {

 
  buttonStateRising = digitalRead(11);
  if ((buttonStateRising == HIGH) && (lastButtonStateRising == LOW)) {
      Serial.println("There was a rising edge on pin 11");
      delay(0.325);
      for (i=0; i<7 ; i++){
        if (digitalRead(11) == HIGH){
          Serial.println(1);
        } else {
          Serial.println(0);
        }
        delay(0.625);
      }
      
    
  }
  lastButtonStateRising = buttonStateRising;

}

umarr: without even understanding what you want to do, looking at your code, I believe you can not have a delay that is fractional. The delay expects a datatype of long integer, so no floating point value.

Amazingly, I tried placing a delay(0.625) in some code and the compiler doesn't complain, and I didn't look too closely why it wouldn't, or even what the result would be, except that it would probably equate to zero, so a delay of zero time, which will not be what you want, correct ?

Anyhow, if you want smaller delays than milliseconds then use this code:delayMicroseconds(625);


Paul - VK7KPA

@rockwallaby

Thank you for the tip, that was the Problem :slight_smile:

Now i am able to read values from the Phone and also to do something with the information...

void loop(){  
    
  readPhone();
  if (Code == "1101111"){
   Serial.println(BTModu.stdCALL());
   parseSerial();
  }
  else if (Code == "1111011"){
     Serial.println(BTModu.stdEND());
   parseSerial();      
  }
  Code = "";
}

void readPhone(){
  
  buttonStateRising = digitalRead(phonePin);
  if ((buttonStateRising == HIGH) && (lastButtonStateRising == LOW)) {
      Serial.println("There was a rising edge on pin 8");
      delayMicroseconds(625/2);
      for (i=0; i<7 ; i++){
        if (digitalRead(phonePin) == HIGH){
          //Serial.println(1);
          Code += 1;
        } else {
        //Serial.println(0);
          Code += 0; 
       }
       
      delayMicroseconds(625);  
     }
      delay(20);    
      Serial.println(Code);
  }
  lastButtonStateRising = buttonStateRising;

}

Now the next Part would be send Code to the Desk-Phone:

I cant get the "bit-bang" Part to work :frowning:

Most of the information i found was with a Clock Line but the DHSG connector has only BUS Send and BUS Receive.

I cant get the "bit-bang" Part to work :frowning:

Most of the information i found was with a Clock Line but the DHSG connector has only BUS Send and BUS Receive.

Bit-banging is more common on synchronous interfaces but there are several examples that do it asynchronously: SoftwareSerial (bad example), AltSoftSerial (much better example, but much more complex code) or the WS2812 driver.
If you do it like SoftwareSerial, you're blocked during sending (so also no reception possible during that time) and receiving. The other examples use hardware timers to do the job which doesn't let the processor wait for such long time frames but the programming needs more inside know-how and is very hardware dependent.