beejayf
Published © GPL3+

SomfyDuino IO

USB to Somfy IO adapter - accepts serial commands and sends them to any Somfy roller shutter or windows blinds.

IntermediateFull instructions provided20,979
SomfyDuino IO

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Flat Cable
×1
Somfy IO Remote
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Wiring

Real life wiring1

Real life wiring2

Finished and packed

File missing, please reupload.

Code

Serial to Somfy

Arduino
// SomfyDuino
// by Bjoern Foldenauer
// 05/2017


int progPin = 8;
int upPin = 12;
int downPin = 10;
int myPin = 11;
int selectPin = 9;
int ledPin = 13;

boolean upPress = false;
boolean downPress = false;
boolean myPress = false;
boolean progPress = false;
boolean selectPress = false;
unsigned long holdTime = 0;
int repeatSend = 0;

char incomingChar;

void setup() {
  Serial.begin(9600);
  Serial.println("SomfyDuino 0.71");
  Serial.println("Bjoern Foldenauer");
  Serial.println("-----");
  Serial.println("receives single serial characters like:");
  Serial.println("u - prepare to press UP");
  Serial.println("d - prepare to press DOWN");
  Serial.println("m - prepare to press My");
  Serial.println("p - prepare to press PROG");
  Serial.println("s - prepare to press SELECT");
  Serial.println("r - increase send count by one");
  Serial.println("any digit X - increase hold time by X*100 ms");
  Serial.println("e - Execute! Runs a defined (multi button) press and hold");
  /erial.println("");
  Serial.println("Example: regular UP: u5e ");
  Serial.println("         3 second UP/DOWN: ud9993e ");
  Serial.println("         5 second PROG: p999995e ");
  Serial.println("");

  pinMode(progPin, OUTPUT);
  pinMode(upPin, OUTPUT);
  pinMode(downPin, OUTPUT);
  pinMode(myPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(selectPin, OUTPUT);
  digitalWrite(progPin, HIGH);
  digitalWrite(upPin, HIGH);
  digitalWrite(downPin, HIGH);
  digitalWrite(myPin, HIGH);
  digitalWrite(selectPin, HIGH);
  digitalWrite(ledPin, LOW);
}

void loop() {
  
  while (Serial.available() == 0) { delay(50); } // wait until serial command comes in
  if (Serial.available() > 0) {
    incomingChar = Serial.read();
    Serial.println(incomingChar);
    if (incomingChar == 'u') {upPress = true;}
    if (incomingChar == 'd') {downPress = true;}
    if (incomingChar == 'm') {myPress = true;}
    if (incomingChar == 'p') {progPress = true;}
    if (incomingChar == 's') {selectPress = true;}
    if (incomingChar == '1') {holdTime += 100;}
    if (incomingChar == '2') {holdTime += 200;}
    if (incomingChar == '3') {holdTime += 300;}
    if (incomingChar == '4') {holdTime += 400;}
    if (incomingChar == '5') {holdTime += 500;}
    if (incomingChar == '6') {holdTime += 600;}
    if (incomingChar == '7') {holdTime += 700;}
    if (incomingChar == '8') {holdTime += 800;}
    if (incomingChar == '9') {holdTime += 900;}
    if (incomingChar == 'r') {repeatSend++;}
    if (incomingChar == 'e') {somSend();}
  }
}

void somSend() {
  Serial.print("Pressing: ");
  
  for(int i=0; i <= repeatSend; i++) {
    if (upPress) {digitalWrite(upPin, LOW); Serial.print("up ");}
    if (downPress) {digitalWrite(downPin, LOW); Serial.print("down ");}
    if (myPress) {digitalWrite(myPin, LOW); Serial.print("my ");}
    if (progPress) {digitalWrite(progPin, LOW); Serial.print("prog ");}
    if (selectPress) {digitalWrite(selectPin, LOW); Serial.print("select ");}
    digitalWrite(ledPin, HIGH);

    Serial.print("for ");
    Serial.print(holdTime);
    Serial.println(" ms");

    delay(holdTime);

    digitalWrite(progPin, HIGH);
    digitalWrite(upPin, HIGH);
    digitalWrite(downPin, HIGH);
    digitalWrite(myPin, HIGH);
    digitalWrite(selectPin, HIGH);
    digitalWrite(ledPin, LOW);

    delay(holdTime);
  }
  
  upPress = false;
  downPress = false;
  myPress = false;
  progPress = false;
  selectPress = false;
  

  holdTime = 0;
  repeatSend = 0;

  Serial.println("done.");
}

Credits

beejayf

beejayf

1 project • 2 followers
Engineer - Love to understand things. My smart home runs without external services. 100% self written. All Pis and Nanos!

Comments