Selbstbau CUL USB Stick 868/433

Busware CUL Stick Nachbau

Click here for English version

Wie baue ich einen CUL USB Stick?

  1. Arduino Nano und CC1101 kaufen
  2. Nano mit dem CC1101 verdrahten
  3. Arduino Nano an den PC anschließen
  4.  a-culfw Firmware flashen

Motivation

Ein CUL USB Stick (85 EUR!) ist mit einiger Löterfahrung relativ einfach und günstig für wenige Euros zusammengebaut und bildet die Basis für das SmartHome. Mit dem CUL kann man die verschiedensten Automatisierungsgeräte ansteuern, wie z.b. HomeMatic, Brennenstuhl Funksteckdosen, Intertechno oder ähnliches (Unterstützte Protokolle: FS20, FHT, EM, KS300/S300TH, HMS, ESA, ASKSIN (aka BidCos(R)), einfache OneWire Protocol durch den DS4282 (nur CUNO), UNIRoll).

Wer nicht Löten mag, kann Bauteile mit PINs und Female Jumper Kabel kaufen und die Schaltung zusammenstecken. Der CUL kann dann mit der entsprechenden Firmware geflasht werden und mit FHEM betrieben werden.

Versionen

Zunächst sollte man sich entscheiden, ob man 868 oder 433Mhz verwenden möchte. Das hängt insbesondere von den verwendeten Endgeräten ab. Intertechno verwendet 433Mhz, Homematic 868Mhz. Man kann zwar zwischen den Frequenzen hin und herschalten, aber die Reichweite ist nicht so gut in der fremden Frequenz. Der Cul kann kurzzeitig auch Frequenzen zum Senden umschalten, empfängt aber permanent nur auf einer Frequenz.

Materialliste

Bei dem Arduino mit einem Atmega328 Microcontroller ist darauf zu achten, daß er einen echten FTDI Chip hat um Ärger zu vermeiden und keinen CH340. Letzterer kann durch Treiber von FTDI beschädigt werden. Unter Linux könnte man einen CH340 betreiben, er besitzt jedoch keine eigene ID im Gegensatz zum FTDI. Der CC1101 sollte auch für die entsprechende Frequenz ausgelegt sein. Damit ergibt sich

Bauteil
Arduino Nano FT232RL mit USB Kabel (AmazonAliexpress)*
CC1101 868 oder 433 Mhz (AmazonAliexpress)*


Verdrahtung

Die Verdrahtung ist wie folgt vorzunehmen.

ArduinoCC1101
VCC 3,3 VVDD
PIN GNDGND
PIN D02GDO2
PIN D03GDO0
PIN D10CSn (SS)
PIN D11SI (MOSI)
PIN D12SO (MISO)
PIN D13SCK

Flashen der Firmware

Nun kann man unter Linux die Firmware auf den Arduino flashen. Man lädt zB die a-culfw Firmware herunter und entpackt sie.Nun kann der Arduino angesteckt werden. Mit dem Befehl

ls -l /dev/serial/by-id

kann man die ID des Arduinos erfragen. Die Antwort ist zum Beispiel

total 0
lrwxrwxrwx 1 root root 13 Nov 30 19:17 usb-FTDI_FT232R_USB_UART_12345678-if00-port0 -> ../../ttyUSB0

wobei 12345678 für die ID steht.

Ich wechsle in das Verzeichnis ../Devices/nanoCUL und trage bei der Variable AVRDUDE_PORT in der Datei Makefile den Wert

/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_1234678-if00-port0

mit meiner ID ein, damit beim Flashen der Arduino auch gefunden wird. Nun muss ich nur noch die Datei board.h bzgl. der Frequenz anpassen sollte ich 868Mhz verwenden wollen. Dazu kommentiere ich die Zeile

/* if you are using a CC1101 module for 868MHz disable the next line */
/*#define HAS_CC1100_433*/

mit einem /* und */ aus. Mit dem Befehl

make

wird das Programm kompiliert und am Ende erscheint etwas wie

...
Linking: nanoCUL.elf
Creating load file for Flash: nanoCUL.hex
Creating load file for EEPROM: nanoCUL.eep
Creating Extended Listing: nanoCUL.lss
Creating Symbol Table: nanoCUL.sym
Size after:
text data bss dec hex filename
24642 74 1013 25729 6481 nanoCUL.elf

und das hex File wurde erfolgreich erzeugt. Zum Flashen gibt man

make program

ein. Fertig! Man kann nun den CUL in FHEM einbinden und wir sind bereit für das SmartHome!

Um unseren selbstgebauten CUL Stick in auf unserem Raspberry Pi Server einzubinden, geben wir

define CUL1 CUL /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_12345678-if00-port0@38400 1234

mit 12345678 als der ID des CUL und dem Hauscode 1234.

Damit kann man nun Funkrauchmelder koppeln, HomeMatic Module steuern, Funksteckdosen schalten oder einen Chatbot mit Telegram einrichten!

Pro Tipp: Stellt sicher, daß ihr den Optiboot Bootloader auf dem Board habt. Damit läuft Euer cul stick sehr stabil.

Telegram Chat mit SmartHome

English Version

How do I build a CUL USB Stick?

  1. Buy a Arduino Nano and CC1101
  2. Wire Arduino Nano and CC1101
  3. Connect the Arduino Nano to the PC
  4. Flash a-culfw firmware

Idea

A CUL USB Stick (85 EUR!) with some soldering experience is relatively simple and inexpensive to assemble for a few Euros and forms the basis for the SmartHome. The CUL can be used to control a wide variety of automation devices, such as HomeMatic, wireless sockets, Intertechno or similar (supported protocols: FS20, FHT, EM, KS300/S300TH, HMS, ESA, ASKSIN (aka BidCos(R)), basic OneWire Protocol through the DS4282 (CUNO only), UNIRoll).

If you don’t like soldering, you can buy components with PINs and female jumper cables and plug the circuit together. The CUL can then be flashed with the appropriate firmware and operated with FHEM.

Versions

First you should decide if you want to use 868 or 433Mhz. That depends in particular on the end devices used. Intertechno uses 433Mhz, Homematic 868Mhz. You can switch between the frequencies, but the range is not so good in the foreign frequency. The Cul can also switch frequencies to transmit for a short time, but receives permanently only on one frequency.

Used Material

Part
Arduino Nano FT232RL with USB cable (AmazonAliexpress)*
CC1101 868 or 433 Mhz (AmazonAliexpress)*

Regarding the Arduino based on a Atmega328 Microcontroller you have to make sure that it has a real FTDI chip to avoid trouble and no CH340. The latter can be damaged by FTDI drivers. Under Linux you could run a CH340, but it doesn’t have its own ID in contrast to FTDI. The CC1101 should also be designed for the corresponding frequency. This results in

Wiring

The wiring is as following

ArduinoCC1101
VCC 3,3 VVDD
PIN GNDGND
PIN D02GDO2
PIN D03GDO0
PIN D10CSn (SS)
PIN D11SI (MOSI)
PIN D12SO (MISO)
PIN D13SCK

Firmware flashing

Now you can flash the firmware on the Arduino under Linux. For example you download the a-culfw firmware and unpack it. Now you can plug in the Arduino. With the command

ls -l /dev/serial/by-id

you can ask for the Arduino’s ID. The answer is for example

total 0
lrwxrwxrwx 1 root root 13 Nov 30 19:17 usb-FTDI_FT232R_USB_UART_12345678-if00-port0 -> ../../ttyUSB0

with 12345678 as the ID.

Please change to the directory ../Devices/nanoCUL and assign to the variable AVRDUDE_PORT in the file Makefile the value

/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_1234678-if00-port0

with your ID, so that the Arduino can also be found when flashing. Now adjust the file board.h regarding the frequency if Iyou want to use 868Mhz. If so, comment out the following line

/* if you are using a CC1101 module for 868MHz disable the next line */
/*#define HAS_CC1100_433*/

using /* und */ . With the command

make

the program is compiled and at the end something like

...
Linking: nanoCUL.elf
Creating load file for Flash: nanoCUL.hex
Creating load file for EEPROM: nanoCUL.eep
Creating Extended Listing: nanoCUL.lss
Creating Symbol Table: nanoCUL.sym
Size after:
text data bss dec hex filename
24642 74 1013 25729 6481 nanoCUL.elf

and the hex file was successfully created. For flashing you type

make program

Done! Now you can integrate the CUL into FHEM and we are ready for the SmartHome!

To setup our self made CUL Stick on our Raspberry Pi Server, we enter in the command field of FHEM

define CUL1 CUL /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_12345678-if00-port0@38400 1234

with 12345678 as the ID of the CUL and the house code 1234.

Now we can pair smoke detectors, connect HomeMatic modules, switch on / off wireless socket outlets or create a Chatbot with Telegram!

Pro Tip: Make sure that your board uses the optiboot bootloader to ensure maximum stability.

Telegram Chat mit SmartHome

*Affiliate Links

Eine Antwort zu „Selbstbau CUL USB Stick 868/433”.

  1. Avatar von Funkrauchmelder 433Mhz vernetzt und smart gemacht – Der schnellste Weg ein Smarthome zu erstellen …

    […] habe ich den Raspberry Pi Home Server aufgesetzt sowie mein 433Mhz CUL angeschlossen. Den CUL habe ich mit dem […]