User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: RF Bitbanger ported to Raspberry Pi

Thu Aug 23, 2012 1:41 pm

I can confirm: I can switch on and switch off Elro wall plugs by using the SARTANO protocol.

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: RF Bitbanger ported to Raspberry Pi

Thu Aug 23, 2012 2:00 pm

fabi280 wrote:Sorry - I can't edit my "Tutorial" Post - but here is a much shorter version how to compile rfbb and load the module

Code: Select all

sudo apt-get install linux-headers-3.2.0-3-rpi
git clone https://github.com/tandersson/rf-bitbanger.git
cd rf-bitbanger/rfbb
make KERNELDIR=/lib/modules/3.2.0-3-rpi/build
sudo insmod rfbb.ko
sudo mknod /dev/rfbb c 252 0
sudo chown root:dialout /dev/rfbb
sudo chmod g+rw /dev/rfbb
Note: It should work. I didn't have the chance to try the compiled module yet
Hmmm ...help needed: up to the 'make', all goes well, but the 'insmod' results in "Error: could not insert module rfbb.ko: Invalid module format". Googling that error, it looks like there is a mismatch between kernel (version) and module (version)?

Do I need to compile and install a whole kernel? Or is there an easier way? Maybe someone has rfbb.o for my Raspbian armhf 3.1.9+ ?

Code: Select all

[email protected] ~/rf-bitbanger/rfbb $ make KERNELDIR=/lib/modules/3.2.0-3-rpi/build
make -C /lib/modules/3.2.0-3-rpi/build M=/home/pi/rf-bitbanger/rfbb   modules
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-3-rpi'
  CC [M]  /home/pi/rf-bitbanger/rfbb/rfbb.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/pi/rf-bitbanger/rfbb/rfbb.mod.o
  LD [M]  /home/pi/rf-bitbanger/rfbb/rfbb.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-3-rpi'
[email protected] ~/rf-bitbanger/rfbb $ 

[email protected] ~/rf-bitbanger/rfbb $ ll *o
-rw-r--r-- 1 pi pi 124779 Aug 23 13:50 rfbb.ko
-rw-r--r-- 1 pi pi  17860 Aug 23 13:50 rfbb.mod.o
-rw-r--r-- 1 pi pi 107920 Aug 23 13:50 rfbb.o
[email protected] ~/rf-bitbanger/rfbb $ 

[email protected] ~/rf-bitbanger/rfbb $ sudo insmod rfbb.ko
Error: could not insert module rfbb.ko: Invalid module format
[email protected] ~/rf-bitbanger/rfbb $ 
Sander

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: RF Bitbanger ported to Raspberry Pi

Thu Aug 23, 2012 2:16 pm

FYI:

I bought the "RF Link Transmitter - 434MHz" for 3.95 USD from https://www.sparkfun.com/products/10534? . Sparkfun has very reasonable shipping costs.

With a connector I soldered it on a board. I added a LED + Resistor between port 2 and port 1 of the transmitter to see when something was transmitted.

The result: a working Elro remote control unit.

Picture:

Image

HTH

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: RF Bitbanger ported to Raspberry Pi

Fri Aug 24, 2012 1:36 pm

Thanks to ArjanW, I was able to compile rfbb on both Raspbian and Wheezy.

The method is based on https://www.grendelman.net/wp/compiling ... pberry-pi/ (so: installing the kernel source 3.1.9), but by installing the kernel source into a plain (user) directory. So no root-rights needed. That felt a bit safer. ;)

Step 1: get, unpack and prepare the kernel source version 3.1.9 which is used on both Raspbian and Wheezy (check with 'uname -a' first!). Downloading and untarring takes about 10 minutes.

Notes:
* I created a directory 'kul-rfbb-2012-08-24'. You can choose your own name
* This method does not compile the whole kernel.
* The 'raspberrypi-linux-775d4ce' was the version I got; your number may be different.

Code: Select all

cd
mkdir kul-rfbb-2012-08-24
cd kul-rfbb-2012-08-24
wget -O raspberrypi-linux-3.1.9.tar.gz https://github.com/raspberrypi/linux/tarball/rpi-patches
tar xvzf raspberrypi-linux-3.1.9.tar.gz 
cd raspberrypi-linux-775d4ce/
zcat /proc/config.gz  > .config
ll .config 
wget http://www.grendelman.net/files/raspi/Module.symvers
make oldconfig
make modules_prepare
pwd
Step 2: make rfbb, and let the KERNELDIR point to the directory where you untarred the kernel (and as reported by 'pwd' above)

Code: Select all

cd
cd kul-rfbb-2012-08-24
git clone https://github.com/tandersson/rf-bitbanger.git
cd rf-bitbanger/rfbb
make KERNELDIR=/home/pi/kul-rfbb-2012-08-24/raspberrypi-linux-775d4ce
... and that resulted in:

Code: Select all

[email protected] ~/kul-rfbb-2012-08-24/rf-bitbanger/rfbb $ ll
total 116
-rw-r--r-- 1 pi pi 18007 Aug 24 12:54 COPYING
-rw-r--r-- 1 pi pi   489 Aug 24 12:54 Makefile
-rw-r--r-- 1 pi pi    62 Aug 24 12:55 modules.order
-rw-r--r-- 1 pi pi     0 Aug 24 12:55 Module.symvers
-rw-r--r-- 1 pi pi 18668 Aug 24 12:54 rfbb.c
-rw-r--r-- 1 pi pi 29943 Aug 24 12:55 rfbb.ko
-rw-r--r-- 1 pi pi  1672 Aug 24 12:55 rfbb.mod.c
-rw-r--r-- 1 pi pi  3664 Aug 24 12:55 rfbb.mod.o
-rw-r--r-- 1 pi pi 27936 Aug 24 12:55 rfbb.o
[email protected] ~/kul-rfbb-2012-08-24/rf-bitbanger/rfbb $
Loading the kernel goes well, unloading too, but reloading does not work ...

Code: Select all

[email protected] ~/kul-rfbb-2012-08-24/rf-bitbanger/rfbb $ sudo insmod rfbb.ko
[email protected] ~/kul-rfbb-2012-08-24/rf-bitbanger/rfbb $ 
[email protected] ~/kul-rfbb-2012-08-24/rf-bitbanger/rfbb $ lsmod | grep rfbb
rfbb                   39450  0 
[email protected] ~/kul-rfbb-2012-08-24/rf-bitbanger/rfbb $ 
[email protected] ~/kul-rfbb-2012-08-24/rf-bitbanger/rfbb $ sudo rmmod rfbb.ko
[email protected] ~/kul-rfbb-2012-08-24/rf-bitbanger/rfbb $ 
[email protected] ~/kul-rfbb-2012-08-24/rf-bitbanger/rfbb $ lsmod | grep rfbb
[email protected] ~/kul-rfbb-2012-08-24/rf-bitbanger/rfbb $ 
[email protected] ~/kul-rfbb-2012-08-24/rf-bitbanger/rfbb $ sudo insmod rfbb.ko
Error: could not insert module rfbb.ko: Input/output error
[email protected] ~/kul-rfbb-2012-08-24/rf-bitbanger/rfbb $ 
Correspondig dmesg info:

Code: Select all

[  669.263365] rfbb 0.05 registered
[  669.263400] rfbb: dev major = 252
[  669.263412] rfbb: IRQ = -1
[  669.263421] rfbb: share_irq = 0

[  687.451317] rfbb: cleaned up module

[  693.556916] rfbbCould not request RFBB TX pin, error: -16
[  693.556950] rfbb: cleaned up module
[  693.557018] initcall rfbb_init_module+0x0/0x300 [rfbb] returned with disabled interrupts
Strange.

And: I have not tested whether the rfbb module actually works this way ... TBC

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: RF Bitbanger ported to Raspberry Pi

Sun Aug 26, 2012 1:56 pm

Grrr ... I was too early: I can't insmod the freshly made module on raspbian: "Error: could not insert module rfbb.ko: Input/output error"

Tips appreciated.

Code: Select all

[email protected] ~/kul-rfbb-2012-08-26/rf-bitbanger/rfbb $ sudo insmod rfbb.ko
Error: could not insert module rfbb.ko: Input/output error

[email protected]spbian-armhf-SJ ~/kul-rfbb-2012-08-26/rf-bitbanger/rfbb $ uname -a
Linux raspbian-armhf-SJ 3.1.9+ #272 PREEMPT Tue Aug 7 22:51:44 BST 2012 armv6l GNU/Linux
[email protected] ~/kul-rfbb-2012-08-26/rf-bitbanger/rfbb $
And the info from dmesg:

Code: Select all

[175321.866309] rfbbCould not request RFBB TX pin, error: -16
[175321.866342] rfbb: cleaned up module
[175321.866409] initcall rfbb_init_module+0x0/0x300 [rfbb] returned with disabled interrupts


Sander

LangePaul
Posts: 3
Joined: Sun Sep 23, 2012 7:10 pm

Re: RF Bitbanger ported to Raspberry Pi

Sun Sep 23, 2012 7:15 pm

I got it working with a local brand of remote switches called 'impuls' using sartano protocol with on/off reversed. But only with switch set to housecode 1(5bit), switchcode 1(5bit).
I have tried all logical guesses, so only thing left to try is bruteforcing all 1024 combinations.

Does anyone have any idea why i cant get other codes to work ?

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: RF Bitbanger ported to Raspberry Pi

Sun Sep 23, 2012 9:30 pm

LangePaul wrote:I got it working with a local brand of remote switches called 'impuls' using sartano protocol with on/off reversed. But only with switch set to housecode 1(5bit), switchcode 1(5bit).
I have tried all logical guesses, so only thing left to try is bruteforcing all 1024 combinations.

Does anyone have any idea why i cant get other codes to work ?
Paul, "meten is weten", so I used a logic analyzer to what my Elro was sending out, and to see the different protocols sent by rf-bitbanger.

So if you have a logic analyzer, use it.

BTW: Can't we use the Raspi itself as a logic analyzer? With a kind of reverse-bitbanger, so *read* a GPIO each x microsecond?

User avatar
tand
Posts: 20
Joined: Sat Jul 14, 2012 7:56 am

Re: RF Bitbanger ported to Raspberry Pi

Mon Sep 24, 2012 8:57 pm

Receiving signals with rfbb
There has been some initial, incomplete work done on reading RF signals with rfbb. One of the biggest challenges is to differentiate between noise and signal, as many RF RX modules tend to be very noisy.

RF Analysis
A rather simple way to do external RX bit stream analysis, is to connect an RX module through a resistor ladder to a PC sound input. You could either sample with a sound recording application or a more dedicated tool like "Protocol Analyzer", http://wiki.nethome.nu/doku.php/analyzer/start.
Be nice to your fellow threads!

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: RF Bitbanger ported to Raspberry Pi

Tue Sep 25, 2012 6:07 pm

FYI: Someone has created Panalyzer: a logic analyzer on your Raspi. See http://www.raspberrypi.org/phpBB3/viewt ... =37&t=7696

FWIW: So far I can't get it working: I can't load the module, and I can't compile it. :(

heikoheiko
Posts: 1
Joined: Thu Oct 04, 2012 8:02 pm

Re: RF Bitbanger ported to Raspberry Pi

Thu Oct 04, 2012 8:17 pm

Python, RPi.GPIO alternative for Elro

I wrote a Python module to control Elro devices using Python on Raspberry Pi. It's mostly is mostly a port from C++ and Wiring to Python + RPi.GPIO and can be found here: http://pastebin.com/aRipYrZ6

It might be worth a look if you don't want to recompile the kernel or use Python as your programming language.

I successfully used a "RF Link Transmitter - 434MHz" for 3.95 USD from Sparkfun to switch Elro devices.

Heiko

Hoagie
Posts: 119
Joined: Sun Sep 23, 2012 7:19 pm

Re: RF Bitbanger ported to Raspberry Pi

Fri Oct 05, 2012 12:04 pm

I did something just like this, but without any kernel hacking. A user space program outputs all the data at a suitable speed. So far it's proved 100% reliable, despite other programs running on the PI fighting for CPU cycles.

http://www.hoagieshouse.com/RaspberryPi ... CPlug.html

salmonsalar
Posts: 1
Joined: Sun Oct 14, 2012 12:15 pm

Re: RF Bitbanger ported to Raspberry Pi

Sun Oct 14, 2012 12:31 pm

Sander wrote: BTW
I reverse engineered the keyboard and dip switch of my remote control, and this is the logic:

the DIP switch drives A0 - A4
switch A, B, C or D drive A5 - A8
"On" resp. "Off" drive A10 resp A11

Does that mean I can write 00000 - 1000 - 10 to the TX433N, and Switch A will go to on?
.
Hmmm, you just gave me an idea.
When I receive my recently ordered board I vill design a board with a CPLD/FPGA where you can write as you describe above and then the CPLD will create the pattern to the RF circuit.
Basically I can have several look up tables in the CPLD in order to support different systems. Which system to be used can ofcourse be selected with GPIO commands.
So my idea is to do an edgetriggered fire-and-forget interface.
The different look up tables should be available on different websites I guess.
If someone can do the SW stuff I will design the HW part. ;-)

stefangs
Posts: 7
Joined: Sat Jul 28, 2012 9:48 pm

Re: RF Bitbanger ported to Raspberry Pi

Mon Oct 15, 2012 6:30 pm

I guess this is slightly off topic, but there is actually an interface that is a bit easier to use: the audio output. There you get drivers and timing for free! The downside is of course that you need some components to adapt signal levels (see http://wiki.nethome.nu/doku.php/homehwtrans), but the software gets a lot simpler.

dauhee
Posts: 59
Joined: Fri Sep 07, 2012 1:50 pm

Re: RF Bitbanger ported to Raspberry Pi

Sat Oct 20, 2012 10:54 pm

I am on 3.2.27+ so the Module.symvers copy will not work. Is there a 3.2.27 Module.symvers available for download, or an alternative route to enable installation of rfbb?

Any assistance would be greatly appreciated!

User avatar
tand
Posts: 20
Joined: Sat Jul 14, 2012 7:56 am

Re: RF Bitbanger ported to Raspberry Pi

Sun Oct 21, 2012 9:52 pm

dauhee wrote:...or an alternative route to enable installation of rfbb?!
I can send a compiled rfbb module to you if you PM me with your mail address.
The module seems to work OK with the following kernel:
Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux
Be nice to your fellow threads!

probono
Posts: 9
Joined: Thu Nov 01, 2012 5:28 pm

Re: RF Bitbanger ported to Raspberry Pi

Thu Nov 01, 2012 5:30 pm

Can you please post the exact steps to compile the kernel module for Linux pi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux

Thanks!

probono
Posts: 9
Joined: Thu Nov 01, 2012 5:28 pm

Re: RF Bitbanger ported to Raspberry Pi

Thu Nov 01, 2012 6:58 pm

Thanks to the instructions on http://www.raspberrypi.org/phpBB3/viewt ... 71&t=17666 I got it to work

Code: Select all

sudo bash
cd /usr/src
wget  https://github.com/raspberrypi/linux/tarball/rpi-3.2.27
tar xzf rpi-3.2.27

cd raspberrypi-linux-*
zcat /proc/config.gz > .config
make oldconfig
make modules_prepare

wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers

KSRC=`pwd`
pushd /lib/modules/`uname -r`
ln -s ${KSRC} source
ln -s ${KSRC} build
popd

pushd /usr/src
ln -s ${KSRC} linux-`uname -r`
ln -s ${KSRC} linux
popd

cd $HOME
git clone https://github.com/tandersson/rf-bitbanger.git
cd rf-bitbanger/rfbb
make KERNELDIR=/lib/modules/3.2.27+/build
sudo insmod rfbb.ko
sudo mknod /dev/rfbb c 252 0
sudo chown root:dialout /dev/rfbb
sudo chmod g+rw /dev/rfbb

probono
Posts: 9
Joined: Thu Nov 01, 2012 5:28 pm

Re: RF Bitbanger ported to Raspberry Pi

Thu Nov 01, 2012 8:01 pm

I get

Code: Select all

[email protected] /usr/src/rf-bitbanger/rfbb_cmd $ dmesg | grep rfbb
[ 2482.386955] rfbb: disagrees about version of symbol module_layout
[10861.897686] rfbb 0.05 registered

[email protected] /usr/src/rf-bitbanger/rfbb_cmd $ lsmod | grep rfbb
rfbb                   38846  0 

[email protected] /usr/src/rf-bitbanger/rfbb_cmd $ sudo ./rfbb_cmd -d /dev/rfbb -i RFBB -p SARTANO -c 0001001000 -l 0
Error writing to RFBB device: Invalid argument
What am I doing wrong?

User avatar
tand
Posts: 20
Joined: Sat Jul 14, 2012 7:56 am

Re: RF Bitbanger ported to Raspberry Pi

Thu Nov 01, 2012 10:56 pm

probono wrote:I get

Code: Select all

[email protected] /usr/src/rf-bitbanger/rfbb_cmd $ dmesg | grep rfbb
[ 2482.386955] rfbb: disagrees about version of symbol module_layout
Did you compile the driver with the same code/headers as the kernel you use?
probono wrote: [email protected] /usr/src/rf-bitbanger/rfbb_cmd $ sudo ./rfbb_cmd -d /dev/rfbb -i RFBB -p SARTANO -c 0001001000 -l 0
Error writing to RFBB device: Invalid argument
[/code]

What am I doing wrong?
Could you check that you have the rfbb device in place?:

Code: Select all

ls -al /dev/rfbb
Be nice to your fellow threads!

probono
Posts: 9
Joined: Thu Nov 01, 2012 5:28 pm

Re: RF Bitbanger ported to Raspberry Pi

Fri Nov 02, 2012 4:10 pm

Thanks tand, indeed the device is missing:

Code: Select all

$ cd /usr/src/rf-bitbanger
$ sudo insmod rfbb/rfbb.ko 
$ ls -al /dev/rfbb
ls: cannot access /dev/rfbb: No such file or directory
$ dmesg | tail -n 1
[   80.931258] rfbb 0.05 registered
This is the kernel I am running (the stock kernel from the official Raspberry Pi distribution -- i am not in the business of mucking around with the kernel ;-) )

Code: Select all

$ uname -a
Linux pi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux
The steps I took for compiling the module are documented above. Do you have any idea what I could do differently, short of compiling the entire kernel?

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: RF Bitbanger ported to Raspberry Pi

Tue Nov 20, 2012 8:04 pm

For those that need the pins for soldering:

https://github.com/tandersson/rf-bitban ... rdware.txt tells the connections between the pins:

Code: Select all

RPI               TX433N
Pin, function  -  Pin, function
P1-01, 3V3     -  3, VCC
P1-06, GND     -  1, GND
P1-11, GPIO17  -  2, Data in
No connection  -  4, Antenna. Connect a 170mm wire as antenna 
RPI-connector nummbering: with the connector in the upper left corner, the left lower pin is 01, the left upper pin is 02. See the drawing on http://elinux.org/RPi_Low-level_periphe ... .28GPIO.29

TX433 numbering: from left (1) to right (4). (see http://dlnmh9ip6v2uc.cloudfront.net/dat ... _Sheet.pdf PDF-alert!)

I made a setup using a general purpose PCB, two arrays of connectors, some wires and the TX433.
If you want a quicky, I guess you could just put three (short?) wires between between TX433 and the Raspi: solder them on the TX433, and have 'shoes' / connectors on the other side of the wire to connect them to the Raspi.

Oh ... best is probably to start with a breadboard.

If you still need to buy the TX433, check out https://www.sparkfun.com/products/10534

HTH

User avatar
tand
Posts: 20
Joined: Sat Jul 14, 2012 7:56 am

Re: RF Bitbanger ported to Raspberry Pi

Fri Nov 30, 2012 5:13 pm

Sander wrote:For those that need the pins for soldering:

https://github.com/tandersson/rf-bitban ... rdware.txt tells the connections between the pins:
...

Code: Select all

RPI               TX433N
...
P1-01, 3V3     -  3, VCC
...
HTH
Some time ago, I modified my hardware to run the TX433N on 5V, by connecting the module's VCC pin to +5V on RPI. The RPI 3.3 V logic seems to be able to still drive the input pin!
I have updated the pin connection description in rfbb_hardware.txt accordingly:

Code: Select all

RPI               TX433N
Pin, function  -  Pin, function
P1-02, 5V0     -  3, VCC
P1-06, GND     -  1, GND
P1-11, GPIO17  -  2, Data in
No connection  -  4, Antenna. Connect a 170mm wire as antenna 
Be nice to your fellow threads!

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: RF Bitbanger ported to Raspberry Pi

Sun Dec 02, 2012 5:54 pm

Thanks pronobo, that worked for me on Linux raspberrypi 3.2.27+

BTW: why aren't the Raspbian release managers putting rf-bitbanger / rfbb.ko in Raspbian itself?


probono wrote:Thanks to the instructions on http://www.raspberrypi.org/phpBB3/viewt ... 71&t=17666 I got it to work

Code: Select all

sudo bash
cd /usr/src
wget  https://github.com/raspberrypi/linux/tarball/rpi-3.2.27
tar xzf rpi-3.2.27

cd raspberrypi-linux-*
zcat /proc/config.gz > .config
make oldconfig
make modules_prepare

wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers

KSRC=`pwd`
pushd /lib/modules/`uname -r`
ln -s ${KSRC} source
ln -s ${KSRC} build
popd

pushd /usr/src
ln -s ${KSRC} linux-`uname -r`
ln -s ${KSRC} linux
popd

cd $HOME
git clone https://github.com/tandersson/rf-bitbanger.git
cd rf-bitbanger/rfbb
make KERNELDIR=/lib/modules/3.2.27+/build
sudo insmod rfbb.ko
sudo mknod /dev/rfbb c 252 0
sudo chown root:dialout /dev/rfbb
sudo chmod g+rw /dev/rfbb

BlackEdder
Posts: 8
Joined: Fri Jul 27, 2012 7:18 am

Re: RF Bitbanger ported to Raspberry Pi

Tue Dec 04, 2012 9:10 pm

I've used the directions in Sander's post above and got everything installed fine. Rfbb is loaded and /dev/rfbb is made. Still when I try to issue commands I always get:
Error writing to RFBB device: Invalid argument

Anyone any idea what might cause this? Could it be that my transmitter is not connected correctly (I would expect that to fail silently)? Any other ideas?

I even tried to execute rfbb_cmd as root, but that didn't change anything.

User avatar
Sander
Posts: 174
Joined: Wed Aug 31, 2011 1:01 pm

Re: RF Bitbanger ported to Raspberry Pi

Tue Dec 04, 2012 9:30 pm

BlackEdder wrote:I've used the directions in Sander's post above and got everything installed fine. Rfbb is loaded and /dev/rfbb is made. Still when I try to issue commands I always get:
Error writing to RFBB device: Invalid argument

Anyone any idea what might cause this? Could it be that my transmitter is not connected correctly (I would expect that to fail silently)? Any other ideas?

I even tried to execute rfbb_cmd as root, but that didn't change anything.
Does /dev/rfbb exist? So:

Code: Select all

ls -al /dev/rfbb
Post the output here.

And what is the exact command you use?

Return to “Automation, sensing and robotics”