Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

100% cpu usage of RFSniffer #16

Open
manuel-domke opened this issue Jan 30, 2016 · 4 comments
Open

100% cpu usage of RFSniffer #16

manuel-domke opened this issue Jan 30, 2016 · 4 comments

Comments

@manuel-domke
Copy link

the rfsniffer uses 100% cpu when running. Adding a usleep definitely helps, but I need to test if it degrades the receiving accuracry.

@rotv
Copy link
Contributor

rotv commented Feb 10, 2016

You can have a look at https://github.com/sui77/rc-switch/wiki/List_KnownDevices to get some ideas of wait time. I think a sleep of 1-2 ms will work, the codes my FHT-7901 devices send are in the vicinity of 3,6-4,6 ms so by polling every second millisecond RFSniffer should be able to detect them.

Making RFSniffer interrupt based probably requires modifying the underlying rc-switch library.

@rotv
Copy link
Contributor

rotv commented Feb 10, 2016

Looks like there is one solution here: UrbaneChimp@3f2517e
although as I suspected it requires changes to rc-switch which I (due to #17) would rather see implemented in https://github.com/sui77/rc-switch.

@maditnerd
Copy link

If you want a reliable way to receive/send radio without heavy cpu use, you should really look into pilight.
www.pilight.org
It supports more protocol than rcswitch and if you add an attiny85 , or an arduino nano, the cpu usage is low (everything is explained on their website)
https://manual.pilight.org/en/electronics-wiring

It tried it with only the receiver/transmitter and it also works fine (but cpu usage is higher).

Once pilight is installed, you can send/receive code from a network socket.
There are examples of client here : https://github.com/pilight/pilight/tree/master/clients

If you install pilight on a Raspberry Pi without receiver, it will ,without any configuration, become a client to any Raspberry Pi with pilight installed.
This allow to use multiples Raspberry Pi to relay radio codes.

There is also a web interface to manage home automation with it, I didn't really try it.

In a nutshell it is pretty awesome.

@jainsarthak
Copy link

Adding a usleep(10000) in the while loop drops CPU usage to 11% from 100% (on rpi3). it does adds up to 10ms delay, which imho is acceptable for majority of the cases. Also most 433 transmitters repeat signal, checking a repeated signal before printing makes it a lot better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants