How to control IKEA Ansluta with Raspberry PI

  • Hey there, as you landed on this article you're probably annoyed that IKEA isn't so smart yet and you can't integrate it into your smart home and can't control it via Google Assistant or Alexa. No worries I'll tell you how you can control the IKEA lamps with a Raspberry PI, which you right now control with an Ansluta remote. The remote must be the model with a 2.4GHz chip and not with a 433MHz one. On the back of my Ansluta remote is the model number YH-KZQ-FS. If you have such a remote you can continue reading. Otherwise this article might be useless for you.

    What you need

    The Ansluta remote is using the CC2500 chip, which you can get for 3€ on Amazon. To ensure we definitely are able to replicate the commands we're going to use the same chip as well. Then we will use a Raspberry PI 3, which you can get for 33.99€ on Amazon to control the chip. For sure you also can use an Arduino, NodeMCU, ATTiny/ATMega or any other MCU. I used an Raspberry PI because I wanted to try out the programming language Rust, which so far had no option to compile for AVR or Xtensa platforms. But luckily there are projects already to add AVR platforms and chips and Xtensa paltform to Rust and I hopefully just have to make minor changes to my code. To wire the CC2500 chip to the Raspberry PI you need a Breadboard and jumper wires, which you can get for 8.99€ on Amazon. Beside that you have to solder thee chip with small pins to place it as the breadboard.

    PS: The links to amazon in this article are partner links. If you want to support me buy the products via these links.

    Preparing the tool

    For those of you who are not able to program I pre-compiled my small cli tool to control the IKEA Ansluta with the Raspberry PI. Download the file cc2500-armv7-debug from my GitHub repository and put it on your Raspberry PI. The cli tool requires the CC2500 chip to be connected to the SPI1 Bus and the SPI to be enabled. You can enable the SPI interface using `sudo raspi-config` under Interfaces -> SPI.

    Once you enabled the SPI interface on your Raspberry PI you have to wire the CC2500 chip to the Raspberry PI as following


    CC2500 Raspberry PI
    GND Pin 20
    3.3V
    Pin 17
    MOSI Pin 19
    SCL Pin 23
    MISO Pin 21
    CS Pin 24


    Controlling the Ansluta remote with Raspberry PI

    Until now you've uploaded the cli tool to your Raspberry PI, enabled the SPI interface and wired the CC2500 chip. Now you have to run tun the binary `./cc2500-armv7-debug` with a light power parameter. These parameter can be `off`, `50` or `100` like `./cc2500-armv7-debug 50`. If you run the cli tool the first time it will try to read the address of an original IKEA Ansulta remote. Just hold the remote beside the CC2500 chip and press the button. The cli tool should receive the packet sent from the original Ansluta, extract it's address and save it to the disk for next executions. Now the cli tool always will just execute the command and if everything is correct and the cc2500 chip is in range of your IKEA lamps, the lights should switch to the power you specified.


    The output will look like this

    Code
    1. $ ./cc2500-armv7-debug 50
    2. Reading address of original ansluta. Press the button!
    3. Received packet
    4. Packet [55, 1, be, 33, 3, aa]
    5. Address found: 190 51
    6. Light 50

    Controlling Ansluta with Google Assistant or Alexa

    There are several options how you could add the IKEA Ansluta to your smart speaker. The easiest way would probably be (at least for me) to create a switch sensor for Home Assistant to just run the cli tool. Home Assistant already have an integration to Google Actions and will export your devices and actions to your Google Home app which makes it very easy to add new custom controls to your smart speaker :) Another option would be to create a Google Action or Alexa Skill to call a rest endpoint on your raspberry pi. For that you would have to create a tiny webserver to execute the cli tool or just the code once the rest endpoint is called from Google or Amazon. This also would require some public accessible url where the domain is always updated to your dynamic ip address. How to do that I explained in another article Control Sonos with Google Assistant - DynDNS - Part 2. I also explain in Part 3 how to create a google action to call your webserver.


    I hope that article helped you and everything worked. If not please notify my :)

Teilen