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

Add CustomRF / SubGhz (help needed) #66

Closed
eadmaster opened this issue Jul 16, 2024 · 19 comments
Closed

Add CustomRF / SubGhz (help needed) #66

eadmaster opened this issue Jul 16, 2024 · 19 comments

Comments

@eadmaster
Copy link
Contributor

eadmaster commented Jul 16, 2024

compatibile with flipper sub files
https://github.com/Zero-Sploit/FlipperZero-Subghz-DB

possibly reuse code from my repo.

I am looking for a way to convert sub raw codes to the format supported by the rc-switch lib, if you have some example code, please post here.

@bmorcelli
Copy link
Collaborator

what's up @eadmaster ,I really liked your suggestions and I've spoken to pr3y about what you are doing.

We are expecting your Pull Request to merger your Serial CLI solution into Bruce in the next update.

Feel free to contact us on Discord! @bmorcelli or Pirata#5263

@eadmaster
Copy link
Contributor Author

eadmaster commented Jul 17, 2024

no problem, i still have to test if the changes i've made did break some other feature (e.g. badUSB)
EDIT: added a test build here.

Regarding this issue, maybe i've found something here, i will try to see if it works.

@bmorcelli
Copy link
Collaborator

Nicee!!! I Pulled your repo this morning and I'm making changes over it regarding other Settings and other stuff..

eadmaster added a commit to eadmaster/Bruce that referenced this issue Jul 18, 2024
eadmaster added a commit to eadmaster/Bruce that referenced this issue Jul 19, 2024
@eadmaster
Copy link
Contributor Author

I've managed to add an experimental implementation via a new "Custom Subghz" menu, but has some important limitations:

  • only 433mhz freq. is supported, due to the RF433T module
  • only ASK/OOK supported, for the same reason

Switching to a CC1101 would remove these limitations, but there is no easy way to connect it via a Groove connector afaik.

In order to test if my current implementation is working correctly i need either:

  • rtl_433 -a 4 output of one of the remote signals in this repo
  • a raw .sub file ripped with a FlipperZero from a remote i own (look for the lines containing RfSend in this file)
  • a donation to buy a FlipperZero myself (prolly too much to ask, but will try anyway)

As a bonus, i've added a "Recent" menu to quickly select previously sent commands, but it is still not working correctly (suggestions are welcomed).

@eadmaster eadmaster changed the title Add CustomRF / SubGhz Add CustomRF / SubGhz (help nedded) Jul 19, 2024
@Petitoursbr1
Copy link

Petitoursbr1 commented Jul 19, 2024

Hi Mr. Eadmaster,

On this project https://github.com/bmorcelli/io433, you can find a diagram for the connection of a CC1101 to an M5Stick C+.

tGOFaofI

I don't know if it helps, but I'm trying because I'm very hyped about the project.

@eadmaster
Copy link
Contributor Author

eadmaster commented Jul 19, 2024

There are no free Gpio pins on the cardputer, i think i need another solution like this:
https://www.reddit.com/r/M5Stack/comments/17lwkrd/i_was_disappointed_with_the_number_of_useful_pin/
(Which i'd like to avoid)

Maybe a bridge like this would be better, but i am not sure if fast enought for this use case:
https://www.dfrobot.com/product-2002.html
https://learn.adafruit.com/adafruit-mcp23017-i2c-gpio-expander/arduino

@bmorcelli
Copy link
Collaborator

We intend to use the ext I/O from M5Stack to integrate with cc1101, but there's a lot of things to consider to make it work, like:

  • Voltage issue,going from 5 to 3,3V
  • Mimic SPI communication with the Ext I/O (something that needs a lot of study)

Other thing that should work (easily I think) is programming a ESP32S3 mini to interface with CC1101 through SPI and with Cardputer/StickCs with I2C(Grove port)... It would be an easy port though, but will need to buy an extra mcu ..

I have all these devices at home, but need time to make things happen

@eadmaster
Copy link
Contributor Author

eadmaster commented Jul 21, 2024

I am not very fond of this solution because:

  • would need an extra module + a lot of wiring, reducing the portability of the whole thing (unless a custom PCB or case is also made)
  • need to (partially) rewrite the RcSwitch lib to make use of it. May not work correctly for RAW signal streaming due to the higher latency.
  • i already have a CC1101 connected via SPI to a regular ESP32 running this Tasmota fork.

Another solution could be using one of these modules, since they only require 1 data pin, you could re-purpose the SDA and SCL pins on the groove connector to drive them directly (e.g G1->TX, G2->RX). I actually have 1 set of these so i might give it a try in the future.

Btw in the meanwhile i'll stick to the RF433T module i already have. Since It is able to use the same codes i've captured on Tasmota (tested with this serial cmd), I am going to add an unofficial protocol to the Subghz File Format to support these codes directly. e.g.:

Filetype: Flipper SubGhz Key File
Version: 1
Frequency: 433920000
Preset: FuriHalSubGhzPresetOok270Async
Protocol: RcSwitch
Bit: 24
Key: 44 55 33
TE: 174

This should correspond to {"Data":"0x445533","Bits":24,"Protocol":1,"Pulse":174,"Repeat":10}'

I've also made this script to generate raw codes, but it not working as expected, so i will use these custom sub files in the meanwhile.

@bmorcelli
Copy link
Collaborator

Me neither.. but the only downside of the M5modules and these single pinned modules is that they work only in 433Mhz..

But the thing is, we keep developing for what we have in hand, that are the M5 RF433T and R (that will work with the cheaper ones, regarding the pin setting)

I'm very curious and excited to see your code running in this project..

@eadmaster eadmaster changed the title Add CustomRF / SubGhz (help nedded) Add CustomRF / SubGhz (help nedded) + Recent submenus Jul 23, 2024
eadmaster added a commit to eadmaster/Bruce that referenced this issue Jul 23, 2024
@eadmaster
Copy link
Contributor Author

Can work like this I think image

In theory it could, but in pratice there are a few caveats to sort out as stated before: different logic voltage, rc libraries expecting to write directly to gpio pins instead if i2s, extra latency due to the i2c bus itself. I've tried bitbanging SPI in the past and it is not an easy task, so i won't be trying this again here.

The easier solution would be having 4 extra gpio pins on the cardputer. According to this table there are actually GPIO16-18, 45, 47, and 48 which are unused, but afaik they are not easily accessible , maybe they could via an hardware mod.

@eadmaster
Copy link
Contributor Author

eadmaster commented Jul 25, 2024

Prolly this is easier:

  1. reconfigure the groove port as a software serial / uart port
  2. wire a 2nd microcontroller running this firmware https://github.com/mcore1976/cc1101-tool

No need of bitbanging spi, no voltage shifting required, and much easier protocol to work with.

do you know if 1. can be done on a cardputer?

@IncursioHack
Copy link
Collaborator

I didn't really have time to test much, but come on.

M5Stack's PCA9554 can solve this problem with CC1101, this insight came from an old Everson project that demonstrates the use of PCA9554 with radio frequency devices.

https://www.youtube.com/watch?v=ft_q9qrzepI

With reference to the voltage regulator, a KIA1117PI33 is used to reduce from 5V to 3.3V, I believe that this can be fitted to the CC1101 itself, not generating a cost or a large amount of wires.

https://semiconductors.es/datasheet/KIA1117PI33.html

Another possibility is to get the 3.7V from the battery and bring a wire to the outside area of the Cardputer, this increase in voltage is about 10%, the CC1101 should hold up without problems, but more tests are needed.

https://docs.m5stack.com/en/core/Cardputer

@bmorcelli
Copy link
Collaborator

reconfigure the groove port as a software serial / uart port
wire a 2nd microcontroller running this firmware https://github.com/mcore1976/cc1101-tool
No need of bitbanging spi, no voltage shifting required, and much easier protocol to work with.

This is what I mean by:

Other thing that should work (easily I think) is programming a ESP32S3 mini to interface with CC1101 through SPI and with Cardputer/StickCs with I2C(Grove port)... It would be an easy port though, but will need to buy an extra mcu ..

But your idea of inteerfacing them by Serial is much better! the MCU is very cheap

eadmaster added a commit to eadmaster/Bruce that referenced this issue Jul 25, 2024
pr3y added a commit that referenced this issue Jul 25, 2024
added Recent submenu in CustomIR (#66)
@eadmaster eadmaster changed the title Add CustomRF / SubGhz (help nedded) + Recent submenus Add CustomRF / SubGhz (help needed) Jul 26, 2024
@eadmaster
Copy link
Contributor Author

quick recap on this:

Test build here for the cardputer only.

@mmjud
Copy link

mmjud commented Jul 27, 2024

Has anyone tried using the HC-11 RF module?

@eadmaster
Copy link
Contributor Author

eadmaster commented Jul 27, 2024

HC-11 and HC-12 cannot be used for custom SubGhz:

the main purpose of the HC-12 is to create a transparent wireless link between two HC-12's rather than being a generic board. If you are looking to have wireless detectors, switches and other "home automation" gadgets then it's probably not the way to go.

(source)

Little update for CC1101 support:

  • this firmware provides CC1101 support for the M5StickCPlus2 only, but it is currently closed source
  • this library could help bitbanging SPI on PCA9554PW, but as i've said i prefer other solutions not requiring a library rewrite.

The uSD card mod could also work via ribbon cables, as suggested on reddit. So no need to desolder the SD socket, but would need to solder the ribbon cable to the CC1101 module.
I've fould also these breakout boards that may be easier to work with.

Speaking of ribbon cable mods, the LCD is also using SPI, and 2 devices can share to the same bus via the CS=ChipSelect pin. The hard part here is to make a PCB to split the lines between the 2 modules.

@eadmaster
Copy link
Contributor Author

Closing this as it was merged already, open other issues for bugs/improvements /etc

eadmaster added a commit to eadmaster/Bruce that referenced this issue Aug 7, 2024
pr3y added a commit that referenced this issue Aug 7, 2024
added initial support for CC1101 via SPI (#66)
pr3y added a commit that referenced this issue Aug 7, 2024
reworked RCSwitch_Read_Raw for CC1101 support, added subghz rx cmd (#66)
eadmaster added a commit to eadmaster/Bruce that referenced this issue Aug 10, 2024
pr3y added a commit that referenced this issue Aug 11, 2024
added support for cc1101 raw send (#66) + more debug serial cmds
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

6 participants
@eadmaster @mmjud @bmorcelli @IncursioHack @Petitoursbr1 and others