HowTo: FHEM – install nanoCul

A smart home system is only really fun when it can communicate with other components.
Since many systems use radio connections for communication, it is only logical to make FHEM radio-capable as soon as possible.

In addition to WLAN and Bluetooth, most sensors and actuators in the smart home sector use frequencies in the 433 or 866 MHz range.
The last two are also used by various radio weather stations, shutter controls, motor controls, etc..

There are two ways to make FHEM radio-capable:
1. you buy a ready-made USB to wireless adapter which is ready-built but also expensive.
2. build your own USB to wireless adapter and save a lot of money.

Do-it-yourself is no problem in this case, because there is again a splendid open-source project for this:
The nanoCul.
The nanoCul is a USB-to-radio adapter that can be soldered and programmed from simple standard components. How the assembly works I have described in this article.

Safety instructions

I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.

Affiliate links/advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support in being able to offer other useful projects in the future. 🙂 


Helpful articles:
Before you can start with the installation of the nanoCul you should prepare the RaspberryPi so that it is accessible via Putty and FHEM is installed on it.
The following three articles describe what needs to be done to prepare the RaspberryPi:
RaspberryPi – setup for nerdiys!
RaspberryPI - The First Configuration!
Your own smart home - installation and introduction to FHEM
RaspberryPi – Control the RaspberryPi via SSH

Required material:

Required material:

In the following list you will find all the parts you need to implement this article.

Structure of the nanoCul

The nanoCul essentially consists of four important components:

1. the CC1101 radio module: This is available for 433Mhz as well as for 866Mhz.
2. a level converter: Since the CC1101 radio module(3,3V) and the Arduino Nano(5V) work with different logic levels, they have to be adjusted respectively.
3. an Arduino Nano: a microcontroller that is relatively easy to program and operate via the USB interface.
4. the circuit board on which everything is soldered together.
5. optional: a housing so that the whole thing is also protected.

Connect nanoCul to the RaspberryPi

To connect the nanoCul to the RaspberryPi you have to connect the nanoCul with the RaspberryPi via a USB cable. This can be (depending on the equipment of the Arduino Nano used) a micro or mini USB cable.
Plug the USB cable into the RaspberryPi. (It doesn't matter which USB port you use on the RaspberryPi).
Plug the USB cable into the nanoCul. As soon as your RaspberryPi is turned on, at least one LED on the nanoCul should light up. If this bothers you, you can either cover the LED on the nanoCul with tape, paint over it with a good covering pen or desolder it.

Install AVR C-Cross Compiler

To adapt the firmware(quasi the operating system of the nanoCul) to our needs, we have to compile it ourselves. First we have to install the AVR C-Cross Compiler.
After you have logged in via Putty logged in on the RasPi you can do this with the following command.

sudo apt-get install make gcc-avr avrdude avr-libc

During the installation you may be asked if you agree that the installation will use additional disk space. Confirm this request with a "j" and Enter. The installation will then continue.

nanoCul- Download Firmware

To download the latest firmware for the nanoCul you have to find the current link first. To do this go to:

There a download window will pop up first. Close this window, because you want to download the code to the RaspberryPi and not to your computer.
Now copy the download link by clicking with the right mouse button on "direct link" and then on "copy link address". The link is now in your clipboard and you can paste it into Putty. Before you click enter in Putty you have to put a "wget" in front of it so that the RasPi knows that it should download the file specified in the link.

For example, the full command would look like this for the current version(556):


The RasPi then downloads the file and shows the progress in a small animation.

Unpack firmware

The downloaded firmware is now still hidden in a zip archive. In order to continue working with it, we have to unzip it first.
This can be done (with the current version) with the command:


If the version (in the example 566) has changed in the meantime you have to adjust the part behind the "unzip" according to your version.

Change to the folder with the firmware

Now you have to change to the folder you just created by unpacking.
The command to do this is:

cd culfw-code-566-trunk/culfw/Devices/nanoCUL

Here is again the part with the "566" to note, whether the version has possibly changed with you

Set board.h correctly

Before we compile the firmware, we need to set the parameters to it
correctly. This is done in the file "board.h". This is located
in the folder you just changed to.
With the command

sudo nano board.h

you get to the text editor "nano" and can use it to edit the file
Edit "board.h".
Don't be alarmed: The console view disappears and everything looks a little different.

Various parameters can now be set here. For example the clock frequency of the microcontroller or the radio frequency of the radio module.

If you want to use a radio module with 433Mhz and your microcontroller or the Arduino board corresponds to an Arduino you don't need to change anything here.

If you use a radio module with 866Mhz you have to change the following part.
Navigate with the arrow keys of your keyboard to the place "#define HAS_CC1100_433" and write "//" in front of it.
This comments out this part and tells the compiler to use the
Firmware should be assembled in such a way that it is not suitable for a 433Mhz but a
is to be configured for an 866Mhz radio adapter.

To save your changes in the board.h file press CTRL+X, then press
“y” (because you want to save the changed file) and then click
Enter. Nano will close and you will be back in the console.

Assemble (have assembled) firmware

This step is easy. The command to do this is:


This command causes the firmware you just configured to be compiled now. This means that the code that is readable for us humans is translated into machine language and can then be programmed into the microcontroller of the nanoCul in the next step.

Program firmware

After the firmware has been compiled, it is now time to program it into the microcontroller of the nanoCul.
To do this, you need to enter the following command:

make program

The microcontroller is programmed and the programmed code is checked again afterwards.

Find out the ID of the nanoCul

In order to register the nanoCul in FHEM, we first have to find out its unique ID.
This is important because otherwise there could be conflicts if for example two nanoCuls are connected to one RaspberryPi. (e.g. because you want to operate one for 433Mhz and one for 866Mhz).
To get the correct ID nothing should be connected to the RaspberryPi besides the nanoCul.
The ID of the nanoCul can be found out with the following command:

ls /dev/serial/by-id

Thereupon an ID is output. In my case it is the "usb-1a86_USB2.0-Serial-if00-port0". Of course this ID can be different for you. We have to remember this ID now, because it is needed for the next step.

Register nanoCul in FHEM

To register the nanoCul in FHEM you have to switch to the web interface of FHEM. There is an input field in the upper area where we can enter the definition of the nanoCul.
This definition reads:

define nanoCUL CUL /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0@38400 1234

Here "nanoCul" stands for the name of your nanoCul in FHEM. So you can also choose another name here.
"CUL" describes the function of the defined device and must not be changed.
stands for the interface to the nanoCul. You must now click here
make sure that you use the ID determined in the previous step.
stands for the baud rate(~speed) with which FHEM is connected to the nanoCul
communicated. This value must correspond to 38400.
"1234" is a code that is actually only needed when the nanoCUL FHT diagrams
should send. Then this must be adapted accordingly. Either way, this must also be specified.

If you have "assembled" your definition of your ID accordingly, you only have to transfer it into the text field in FHEM and press Enter.
You will be redirected to this overview of the just created nanoCUL. Here you can set everything important concerning the nanoCUL.
To test if the nanoCul has been detected successfully set "get nanoCul ..." to "get nanoCul version" and click on "get".
You should get a message like: "nanoCUL version => V 1.67 nanoCUL868". If you don't get an answer check the ID of your nanoCul again as described in step 9. Otherwise it sometimes helps to disconnect the nanoCul from the RaspberryPi and reconnect it or to reprogram the nanoCul. Also a reboot of the RasPi often solves the problem.

If everything works remember to save your FHEM configuration by clicking on "Save Config" in the left bar.

So you should now have a nanoCul connected to your RaspberryPi and logged into FHEM.

Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂

PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂

Buy Me a Coffee at       


  1. Hi,
    sorry – I am not able to download the correct file.
    I tried to create the board.h file on the raspberry by just copying the code from the website, but when I try to start the “make” process, the output is “nothing to be done for 'board.h'.
    So can you please update your nice how-to by the new link to the updated file?
    Thank you very much!

    1. Hi Frank,
      could you please tell me which file you can not download? 🙂
      The culfw firmware seems to be downloadable.
      Best regards

          1. Hi Fabian,

            great, now it works 🙂

            Thank you very much for your support!
            Best regards

  2. Pingback: Fhem Cul Sign
  3. Pingback: Cul In Fhem Login
  4. Hello Fabian,
    First of all, thank you very much for this great guide, which even I, as a completely unsuspecting beginner, can get by with.
    Unfortunately I run into an error with the “make” command:

    ecki@raspberrypi:~/Downloads/culfw-code-r569-trunk/culfw/Devices/nanoCUL $ make
    Compiling C: ../../clib/somfy_rts.c
    ../../clib/somfy_rts.c: In function 'send_somfy_rts_frame':
    ../../clib/somfy_rts.c:200:85: error: stray '#' in program
    my_delay_us(30415 + (((frame[6] >> 7) & 1) ? 0 : somfy_rts_interval_half)); # 129341
    ../../clib/somfy_rts.c:200:87: warning: statement with no effect [-Wunused-value]
    my_delay_us(30415 + (((frame[6] >> 7) & 1) ? 0 : somfy_rts_interval_half)); # 129341
    ../../clib/somfy_rts.c:202:1: error: expected ';' before '}' token
    make: *** [makefile:328: ../../clib/somfy_rts.o] Error 1

    Do you have a tip for me?

    1. Hi Ecki,
      That looks to me like an error in the program components of the firmware. The file somfy_rts.c probably has a problem in line 202, which is why the package cannot be built. Unfortunately, you would have to contact the developers of the firmware. 🙂
      Best regards

  5. Hello Fabian,
    First of all, thank you very much for this great guide, which even I, as a completely unsuspecting beginner, can get by with.
    Unfortunately, when I run the "make" command, I run into an error:
    ecki@raspberrypi:~/Downloads/culfw-code-r569-trunk/culfw/Devices/nanoCUL $ make
    Compiling C: ../../clib/somfy_rts.c
    ../../clib/somfy_rts.c: In function 'send_somfy_rts_frame':
    ../../clib/somfy_rts.c:200:85: error: stray '#' in program
    my_delay_us(30415 + (((frame[6] >> 7) & 1) ? 0 : somfy_rts_interval_half)); # 129341
    ../../clib/somfy_rts.c:200:87: warning: statement with no effect [-Wunused-value]
    my_delay_us(30415 + (((frame[6] >> 7) & 1) ? 0 : somfy_rts_interval_half)); # 129341
    ../../clib/somfy_rts.c:202:1: error: expected ';' before '}' token
    make: *** [makefile:328: ../../clib/somfy_rts.o] Error 1
    Do you have a tip for me?

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.