433,92 Mhz transmitter/receiver for domoticz using gpio

I have connected a 433,92Mhz transmitter's data port to a gpio and a 433,92Mhz receiver to another gpio (respectivly gpio 1 and 2) and connected ground and 5V to the appropiate pins on the circuit board.

I have Domoticz_4.9700-2 package running and to test the working i have motherboard sensors running on it which reads out everything nicely and added a weather station that runs fine.

As of now i'm running into the problem of how to get the transmitter and receiver seen by OpenWrt/Domoticz. I have installed 1W and OWFS and been playing arround with these kind of packages a bit without any succes.

In the DTS file of my build i have these gpio's configured, should gpio 1 and 2 be removed or changed?

	gpio-export {
		compatible = "gpio-export";
		#size-cells = <0>;

		/* I2C */
		gpio1 {
			/* I2C_I2C_SD */
			gpio-export,name = "gpio0";
			gpio-export,direction_may_change = <1>;
			gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
		};
		gpio2 {
			/* I2C_I2C_SCLK */
			gpio-export,name = "gpio1";
			gpio-export,direction_may_change = <1>;
			gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
		};
	};

	gpio-keys-polled {
		compatible = "gpio-keys-polled";
		poll-interval = <20>;
		reset {
			label = "reset";
			gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};
		wps {
			label = "wps";
			gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_WPS_BUTTON>;
		};
	};

Or are there any other things i should try out, any help will be appreciated.

My current build is with kernel 4.14.114.

Without knowledge of your specific board (which I didn’t see mentioned), it will be difficult to answer.

Hmmmm..... what have you done to test high level gpio control.... have you followed the basic toggle on off tutorials on the wiki.

Jumping into the dts without first demonstrating control in the upperos seems a bit backwards.

It's an hlk-rm04 board

I'm pretty new to gpio...
I did try toggle on/off and get resource is busy.

1 Like
lsmod
rmmod *gpio*

surprised thr rmmod thing is not in all the top hits....
https://openwrt.org/docs/techref/hardware/port.gpio

edited due to error from my side whith first answer

lsmod gives

cfg80211              207120  2 rt2x00lib,mac80211
compat                  5472  3 rt2800soc,mac80211,cfg80211
crc_ccitt                960  2 rt2800lib,ppp_async
crc_itu_t                960  0
crc16                    960  1 ext4
crc32c_generic          1344  2
crypto_hash             8544  3 ext4,jbd2,crc32c_generic
ds2482                  2896  0
eeprom_93cx6            1984  0
ext4                  342848  1
gpio_button_hotplug     6176  0
hwmon                   6304  1 wire
i2c_core               19408  2 ds2482,i2c_dev
i2c_dev                 3920  0
ip_tables               9424  4 iptable_nat,iptable_mangle,iptable_filter
ip6_tables              9184 24 ip6table_mangle,ip6table_filter
ip6t_REJECT              896  2
ip6table_filter          608  1
ip6table_mangle         1088  1
ipt_MASQUERADE           640  1
ipt_REJECT               864  2
iptable_filter           608  1
iptable_mangle           832  1
iptable_nat              672  1
jbd2                   46192  1 ext4
leds_gpio               2752  0
mac80211              402048  3 rt2800lib,rt2x00soc,rt2x00lib
mbcache                 2672  1 ext4
nf_conntrack           49120 12 nf_conntrack_ipv6,ipt_MASQUERADE,xt_state,xt_nat                                                                                        ,xt_conntrack,xt_REDIRECT,nf_nat_masquerade_ipv4,nf_conntrack_ipv4,nf_nat_ipv4,n                                                                                        f_nat,nf_flow_table,nf_conntrack_rtcache
nf_conntrack_ipv4       4192 11
nf_conntrack_ipv6       4144  5
nf_conntrack_rtcache    2400  0
nf_defrag_ipv4           928  1 nf_conntrack_ipv4
nf_defrag_ipv6          4480  1 nf_conntrack_ipv6
nf_flow_table          12368  2 xt_FLOWOFFLOAD,nf_flow_table_hw
nf_flow_table_hw        1984  1
nf_log_common           2400  2 nf_log_ipv4,nf_log_ipv6
nf_log_ipv4             3232  0
nf_log_ipv6             3360  0
nf_nat                  8080  4 xt_nat,nf_nat_redirect,nf_nat_masquerade_ipv4,nf                                                                                        _nat_ipv4
nf_nat_ipv4             3152  1 iptable_nat
nf_nat_masquerade_ipv4    1392  1 ipt_MASQUERADE
nf_nat_redirect         1088  1 xt_REDIRECT
nf_reject_ipv4          1920  1 ipt_REJECT
nf_reject_ipv6          2272  1 ip6t_REJECT
nls_base                4736  1 usbcore
ohci_hcd               21520  1 ohci_platform
ohci_platform           3936  0
ppp_async               6176  0
ppp_generic            21104  3 pppoe,ppp_async,pppox
pppoe                   8000  0
pppox                   1168  1 pppoe
rt2800lib             106624  2 rt2800soc,rt2800mmio
rt2800mmio              5152  1 rt2800soc
rt2800soc               2480  0
rt2x00lib              32400  5 rt2800soc,rt2800mmio,rt2800lib,rt2x00soc,rt2x00m                                                                                        mio
rt2x00mmio              2208  2 rt2800soc,rt2800mmio
rt2x00soc               1120  1 rt2800soc
scsi_mod               86064  2 usb_storage,sd_mod
sd_mod                 28272  2
slhc                    4224  1 ppp_generic
usb_common              2208  1 usbcore
usb_storage            37296  1
usbcore               117328  3 usb_storage,ohci_platform,ohci_hcd
w1_gpio                 2240  0
wire                   15136  2 w1_gpio,ds2482
x_tables               12272 23 ipt_REJECT,ipt_MASQUERADE,xt_time,xt_tcpudp,xt_s                                                                                        tate,xt_nat,xt_multiport,xt_mark,xt_mac,xt_limit,xt_conntrack,xt_comment,xt_TCPM                                                                                        SS,xt_REDIRECT,xt_LOG,xt_FLOWOFFLOAD,iptable_mangle,iptable_filter,ip_tables,ip6                                                                                        table_mangle,ip6table_filter,ip6_tables,ip6t_REJECT
xt_FLOWOFFLOAD          2608  0
xt_LOG                   736  0
xt_REDIRECT              672  0
xt_TCPMSS               2688  2
xt_comment               448131
xt_conntrack            2176 14
xt_limit                 960 20
xt_mac                   576  0
xt_mark                  640  0
xt_multiport            1184  0
xt_nat                  1504  0
xt_state                 672  0
xt_tcpudp               1728 14
xt_time                 1568  0

rmmod gpio gives

module is not loaded

comment out in these ( or shift the files somewhere safe ) and reboot

find /etc/modules* | grep led
( leds-gpio should do it )
1 Like

/etc/modules-boot.d/60-leds-gpio
/etc/modules.d/60-leds-gpio

rmmod leds_gpio

That gives module not loaded, which package has rmmod?

Can't seem to find it and google doesnt give much either.

I do get this tho;

root@RM04:~# rmmod
Usage:
        rmmod module
root@RM04:~# rmmod leds_gpio
module is not loaded

The leds are working fine tho...

I allread did change the default .dts file of this board tho, to make the default board with 8mb flash and 32mb ram working.

But nothing on the gpio part is changed only flash/memory parts is changed to accept the bigger flash/memory.

Ok i got 1 step closer in making this work, the replies didn't help much so far only that rmmod unloads a module....

By removing the gpio export from the dts file i was able setting up the gpio's according to;

https://openwrt.org/docs/techref/hardware/port.gpio

echo "1" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio1/direction
echo "2" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio2/direction

After adding sysfs as hardware in domoticz i got 2 devices detected now.

Now i need to make the system know what codes to send for switching on/off.
For the Pi they use a pigpio library to copy the commands. but it looks like that doesnt run wel on Lede/Openwrt at least according to this post/issue on github;

Anyone know if there is a way to make this work or copy the codes in another way?

Thanks in advance

https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

While the "export and poke" approach works,

THIS ABI IS DEPRECATED, THE ABI DOCUMENTATION HAS BEEN MOVED TO
Documentation/ABI/obsolete/sysfs-gpio AND NEW USERSPACE CONSUMERS
ARE SUPPOSED TO USE THE CHARACTER DEVICE ABI. THIS OLD SYSFS ABI WILL
NOT BE DEVELOPED (NO NEW FEATURES), IT WILL JUST BE MAINTAINED.

The "new" utilities are, as I recall, packaged as gpiod-utils

gpiod-utils don't excist, i think you mean gpiod-tools.

But will it help me record the code? maybe a link to explanation that directs towards a solution instead of a link that directs towards future problems would be better....

Sorry if that sounds irritated but it seems hard to find the right documentation about this...

The sysfs i use came as a default selected by openwrt tho. i didn't specificaly add it to the firmware.

At least a +1 for trying to reply tho.

More that if you’re going to write your own tools that using the newer interface might be a better long-term choice. Apologies for getting the name wrong.

Not knowing the transmission speed or protocol makes a link for this specific device difficult.

I typically scan and bit-bang devices like this in C or Python. The provided links explain how to set up, read, and write GPIO lines.

1 Like

Ah ok that wasn't clear in your answer, does it mean there is no solution for Openwrt like pigpio is for Raspberry? No apologies needed tho :slight_smile:

For your insight my programming skills are well let's say below beginner lvl in the required languages... :joy:
I do know how to install/configure/administer stuff very well.

So i don't think i will be able to easily create a similar solution myself in either C or Python or similar.

I do know that if it can be done the mentioned board will be way cheaper then using a RPi

And with the way OpenWrt works i could automate the whole process of setting up the system so that even programming skills or configure skills are hardly needed.

I think it would be able to open up the home automation market for a much bigger audiance.
It could become as easy as connecting a click on / click off remote to a switch.

But as of now i just need to figure out a way to make the device learn the signal and repeat it like pigpio or rflink using the gpio.

What tooling exists for the transceiver you're working with already?

It might be possible to adapt its source to use either the sysfs-approach or the newer approach instead of pigpiod (which is pretty Pi-specific, as I recall).

I will look up some sources for you and will update this reply tomorrow.
I know RFlink has tooling as well but as far as i have read it now it's all created for the Pi.
And i think there is a python library for it, but i will update this reply tomorrow.

Sorry for my late reply, but all i can find is http://www.rflink.nl
If this doesn't help ill open up a post on the domoticz forum and see what they will come up with.