Close
0%
0%

Fresh air automation by RF usb dongle

Wireless USB dongle (868MHz) for home automation to improve the indoor air quality (IAQ)

Public Chat
Similar projects worth following
Recently I started using "Home Assistant" for automation, I was looking for a solution to wirelessly connect my house ventilation to HA, it turned out, that most ventilation manufacturers, do not provide any kind of solution to control their units on a "smart" way. In the summertime on hot days it would be interesting to run the ventilation on higher speeds when everybody is away from home in the morning, to refresh the indoor air. Ventilation systems in residential buildings are mandatory in Europe, probably most people never change their ventilation settings if it doesn't do it automatically, that might be because of ease, they are not aware, or they don't like the ventilator audible noise.

If we are able to cool down the house during summertime slightly, in an automated and convenient way, this might also dampen the urge for air conditioners.

"Global energy demand from air conditioners is expected to triple by 2050"
www.iea.org

Reverse engineering

Before starting hardware and software design, the communication protocol needed to be reverse-engineered. Therefore I opened up my Orcon wireless RF15 remote control, I noticed that there is a Atmel mcu together with CC1101 wireless chip. The CC1101 uses a SPI interface for communication. To get more info about the communication, I attached very thin "patch wires" to lines between the CC1101 and host mcu. I connected them to my Saleae logic analyzer to see what's happening.

Via the SPI interface the CC1101 registers are configured, also via the SPI interface the radio is put into RX or TX mode, furthermore it turned out that the GDO0 pin of the CC1101 is used to transmit and receive 38k4 serial data as payload. Via the Logic analyzer, it was possible to record the configuration of the CC1101. Also see the Excel file in the attachements.

Next steps...

When I got familiar with the configuration and serial messages, I tried to control my Orcon unit by an Arduino connected to a CC1101 radio module:

It was more repeating the messages I recorded earlier, but anyway, it worked perfectly fine! The next days with the help of some blogs on the internet I was able to understand the serial data in more detail: Tweakers.net It seems the serial data is manchester encoded.

In general when sending a message via the CC1101 radio, the order is as follows:

1. Reset CC1101
2. CC1101 configured
3. Put CC1101 into TX mode and serial messages sent by GDO0
4. Put CC1101 into RX mode and waiting for valid messages on GDO0
5. Put CC1101 into sleep mode again

For detailed info about the registers, check the attached Excel file!

Hardware design

From here I started with the hardware design since I knew that it worked with the seperate modules. The idea is to use a Atmega32u4 as host mcu, since it has built-in USB and 2 UART's. Also it can work on +3V3 supply voltage, the same as the CC1101 radio chip. The end result of the hardware design:

The pcb outline is designed in a way that it fits within a standard hammond 1551USB2 USB enclosure. Within the enclosure, the dongle looks like this:

Software design

The idea is to simply upload the Arduino micro bootloader via the ISP header, from this point the software application can be flashed via the USB port by using the Arduino IDE. From here I started writing the software, the software is based on Arduino StandardFirmata

After powering the USB dongle, it will stay in "clone mode" for 2,5sec, when you press a random button on the default Orcon RF15 remote control, the addresses will be copied. After this, the USB dongle will simply use the same addresses as the RF15 and Orcon ventilation unit, that means the Orcon unit cannot see difference between messages coming from the RF15 or USB dongle. If no button pressed within 2,5sec, it will use previous stored address in eeprom. The addresses will be stored in eeprom so that it is not forgotten during power off.

The dongle will request the last Orcon fan speed state each 5 sec, if the fan speed is changed by the RF15 standard remote control, it will be known within around 5 sec. The orange led on the Orcon unit will blink around each 5sec, this represents successful radio communication.

For all the details and source code, check the GIT in the "links" section!

Getting things to work in Home Assistant

To be able to control and read the FAN speed from Home Assistant using Firmata, a "sensor" and "light" entity is used. At the moment this is the only method to communicate an analog value between Home Assistant and the Arduino board. Normally the entity: "lights" in Home Assistant is being controlled by sending percentage based on a range from 0 till 255, therefore setting the min/max range to 0-99, will result in percentage equals decimal number, what is more convenient in automations, it prevents you have to calc the right percentage yourself.

... Read more »

RF_usb_dongle_868.sch

Autodesk Eagle schematic

sch - 612.09 kB - 05/28/2022 at 08:06

Download

RF_usb_dongle_868.brd

Autodesk Eagle board

brd - 164.44 kB - 05/28/2022 at 08:06

Download

12 - 27.34 kB - 04/30/2022 at 12:37

Download

Adobe Portable Document Format - 53.83 kB - 04/30/2022 at 12:37

Preview
Download

  • 1 × ATMEGA32U4-MU Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers
  • 1 × Hammond 1551USB2
  • 1 × CC1101RGPR RF, IF, RFID, ZigBee Semiconductors and ICs / Wireless Infrastructure
  • 1 × 0868AT43A0020E Antenna 868mhz
  • 1 × 0896BM15A0001 Passive Filters / RF Band Pass, RF Low Pass Filters

View all 6 components

  • Roadmap session

    Marcel07/07/2022 at 18:02 0 comments

    Thinking ahead, what would be cool neat features to support and work on in the future:

    For this moment, I started working on a dedicated Home Assistant integration to replace Firmata. Furthermore I hope the developers who received a dongle will also push for new features and bugfixes if any.

  • First batch completed :)

    Marcel07/01/2022 at 22:14 0 comments

  • Received the first batch of produced pcbs!

    Marcel07/01/2022 at 13:52 0 comments

    Picture:

    Today I received the first batch of pcb's to share with other developers. I tested one of the boards, it seems to work well, so that is good news :) 

    Now putting things toghether, mounting the pcb in the housing.

  • Label update!

    Marcel06/16/2022 at 20:36 0 comments

    I thought it would be cool to add a label:

    Soon, I will receive a small batch of RF USB Dongles to share with other developers to push things forward, therefore some extra labels:

  • Update on Home Assitant script

    Marcel06/08/2022 at 17:15 0 comments

    Today I noticed the FAN speed was switched back to 1 when it already was at 1. Therefore I added this to the automation script:

      condition:
      - condition: numeric_state
        entity_id: sensor.fan_value
        above: '1'

    Now it won't run the automation if the FAN speed is already at level 1. 

  • Setting up automation in Home Assistant!

    Marcel06/06/2022 at 17:27 0 comments

    In this log, I will try to create an automation in Home Assistant, that controls the ventilation speed in a smart way so that the indoor temperature during the summertime will not become as hot. The idea is basically to control the ventilation speed, based on this configuration:

    Increase ventilation speed to level 3:


    T
    riggers:

    - Someone leaves the house (leaves a zone)
    - It's 8 o'clock in the morning


    The conditions that should be met:
    - And: everyone is away from the zone (each smartphone is away)
    - And: the actual outdoor temperature should be below 20°C
    - And: time should be between 6 o'clock and 12
    - And: the forecasted outdoor temperature should be more than 25°C

    Actions:
    - Set fan speed level to: 2 or 3
    - Send a message to my phone (testing purposes)

    The HA script:

    - id: 'xxxxxxxxxx'
      alias: Start smart ventilation
      trigger:
      - platform: time
        at: 08:00:00
      - platform: device
        device_id: XXXXXXXXXXXX
        domain: device_tracker
        entity_id: device_tracker.marcel
        type: leaves
        zone: zone.home
      - platform: device
        device_id: XXXXXXXXXXXX
        domain: device_tracker
        entity_id: device_tracker.mywife
        type: leaves
        zone: zone.home
      condition:
      - condition: and
        conditions:
        - condition: device
          device_id: XXXXXXXXXXXX
          domain: device_tracker
          entity_id: device_tracker.marcel
          type: is_not_home
        - condition: device
          device_id: XXXXXXXXXXXX
          domain: device_tracker
          entity_id: device_tracker.mywife
          type: is_not_home
        - condition: numeric_state
          entity_id: weather.huis
          attribute: temperature
          below: '20'
        - condition: time
          after: 06:00:00
          before: '12:00:00'
        - condition: numeric_state
          entity_id: weather.huis
          attribute: forecast
          above: '25'
      action:
      - type: turn_on
        device_id: XXXXXXXXXXXX
        entity_id: light.fan_speed_setpoint
        domain: light
        brightness_pct: 2
      - service: notify.mobile_app_marcel
        data:
          title: Ventilation started!
          message: The ventilation speed is set to: 2
      mode: single
    


    Set back ventilation speed to level 1:


    Triggers:

    - Someone gets home (enters a zone)
    - The actual outdoor temperature has reached more than 20°C

    Actions:
    - Set fand speed level to: 1

    The HA script:

    - id: 'xxxxxxxxxx'
      alias: Stop ventilation
      trigger:
      - platform: device
        device_id: XXXXXXXXXXXX
        domain: device_tracker
        entity_id: device_tracker.marcel
        type: enters
        zone: zone.home
      - platform: device
        device_id: XXXXXXXXXXXX
        domain: device_tracker
        entity_id: device_tracker.mywife
        type: enters
        zone: zone.home
      - platform: numeric_state
        entity_id: weather.huis
        attribute: temperature
        above: '20'
      condition: []
      action:
      - type: turn_on
        device_id: XXXXXXXXXXXX
        entity_id: light.fan_speed_setpoint
        domain: light
        brightness_pct: 1
      mode: single

    As you can see from the script, the FAN speed is treated like a light (dimming), this "issue" is described in the project details section.

    Now it's waiting for the summertime to see if the automation works well..... but more importantly, if it really improves the temperature and air quality :)

View all 6 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates