Introduction: Somfy USB Remote Control

A colleague of mine has a roller shutter that can be controlled via a Somfy Remote Control. He wanted to control this roller shutter via USB so a new project was born.

When connected to the PC, this Somfy USB Remote Control acts a serial COM port which accepts the following remote control commands from the PC:

  • ‘S’ for roller shutter stop
  • ‘U’ for roller shutter up
  • ‘D’ for roller shutter down
  • ‘P’ for program. Programming is needed to pair the remote control with your roller shutter
  • ‘T’ for testing purposes. This is a toggle to switch a test mode on and off.

After a command is given the remote control will return the command that was entered, followed by ‘Done’ when the remote control message is completely transmitted. The latter depends on the number of repeats that is used for sending the remote control message. When a testing mode is activated the remote control will return more status information. It is possible to change the settings of the Somfy USB Remote Control, which is explained in the last part of this Instructable.

There is one important remark to make about the hardware. Somfy uses Amplitude Shift Keying (ASK) for the RF transmission but the frequency is not the standard that you buy from e.g. AliExpress. If you normally purchase an ASK RF transmitter, the frequency is at 433.92 MHz. The Somfy Remote Control, however, uses a frequency of 433.42 MHz. This may seem a small difference but when using the higher frequency it will drastically lower the range of the remote control. At 433.42 MHz the range can be 10 meters but at 433.92 MHz this is reduced to 1-2 meters.

Step 1: The Remote Control Protocol

The biggest unknown and so the biggest challenge of this project was to find out the protocol that a standard Somfy Remote Control is using. Luckily there was somebody that already reverse engineered this protocol. I got the information from PushStack.

I am not going to explain this protocol in detail but will provide some screenshots that show the protocol.

Screenshot 1 shows the first frame (and a part of a repeat frame at the right of the screen). It starts with a long pulse that acts as a wakeup signal. After a pause, the first frame is transmitted.

Screenshot 2 shows the wakeup pulse, the first frame, followed by 2 repetitions of the same command. As you can see the repeated frames are different than the first frame and longer. The repeat frames have no wakeup signal.

Screenshot 3 zooms in on the first frame. It has 2 synchronization pulses.

Screenshot 4 zooms in on a repeat frame. It has 7 synchronization pulses and because of that the repeat frame is longer than the first frame. The data, however, is the same.

Step 2: The Electronics

The electronics is quite simple, it consists of a PIC16F1455 Microcontroller which has on-board USB hardware and some LEDs to indicate a connection to the USB Host and to show when an RF message is transmitted.

The schematic diagram shows the design of this version. You need the following components for this project:

  • 1 PIC16F1455
  • A 433.42 MHz ASK RF transmitter
  • LEDs: 1 Amber, 1 Red, 1 Green (or any other color you like)
  • Resistors: 2 * 22 Ohm, 3 * 330 Ohm
  • 1 electrolytic capacitor of 10 uF/25V
  • Ceramic capacitors: 1 * 100 nF and 1 * 470 nF
  • 1 USB connector

The hardware was built on a breadboard as shown in the picture. The circuit is powered by the USB connection so no external power supply is required.

Step 3: The Software

Because I used the JAL USB library that can act as a serial port, the software was quite simple to create. In general terms the software does the following:

  • Handle the USB requests
  • Process the commands entered by the user
  • Prepare the frame to be transmitted
  • Store the new rolling counter in EEPROM (see the Somfy protocol description)
  • Transmit the data in the frame using Manchester encoding
  • Send a response to the user when the command is executed

The software is divided over a main program and a part that handles the preparation and transmission of the remote control frame. Both are in the attached as .txt but should be renamed to .jal when compiling with the JAL compiler. The Intel Hex file for programming the PIC is also attached.

Step 4: Changing the Settings

After having programmed the PIC with the software, some initial settings for the remote control are used. These settings can be reprogrammed.

The initial settings are:

  • The remote control address is 0x121300
  • The rolling counter starts with a value of 0x0065
  • The number of frame repeats is set to 0x02. This means that the first frame is repeated twice

The current setting can be requested by typing the command ‘?’

For changing the current settings, a special command needs to be given. The format of this command is: !AAAAAACCCCRR#

Where:

  • AAAAAA is the remote control address, 3 bytes
  • CCCC the rolling counter which is incremented after each new transmission, 2 bytes
  • RR the number of repeats, 1 byte

All values are in hexadecimal notation.

Example: Assume you want to change the settings as follows:

  •  Address to 0x531F71
  • Rolling Counter to 500 = 0x01F4 hexadecimal
  • Repeat to 13 = 0x0D hexadecimal

De programming string then becomes: !531F7101F40D#

When you reprogrammed the setting you can verify this by typing the command ‘?’ The following screenshot shows some of the responses when a command is given or when the settings are changed as mentioned earlier. I used the terminal emulation program Termite for sending the commands. The blue text is the command being given where the green text is the response of the Somfy USB Remote Control. As can be seen in this example, the settings can be requested and be re-programmed.

If you are interested in using the PIC microcontroller with JAL – a Pascal like programming language – visit the JAL website.

I hope you liked this Instructable and looking forward to your results and reactions.