Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jjcarstens/replex
Reply radio signals on a raspberry pi to control RF devices
https://github.com/jjcarstens/replex
hacktoberfest
Last synced: 2 months ago
JSON representation
Reply radio signals on a raspberry pi to control RF devices
- Host: GitHub
- URL: https://github.com/jjcarstens/replex
- Owner: jjcarstens
- License: apache-2.0
- Created: 2019-08-20T21:48:54.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-30T10:49:36.000Z (about 3 years ago)
- Last Synced: 2024-10-19T14:02:44.640Z (3 months ago)
- Topics: hacktoberfest
- Language: Elixir
- Homepage:
- Size: 28.3 KB
- Stars: 19
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# replex
[![Hex version](https://img.shields.io/hexpm/v/replex.svg "Hex version")](https://hex.pm/packages/replex)
[![API docs](https://img.shields.io/hexpm/v/replex.svg?label=hexdocs "API docs")](https://hexdocs.pm/replex/Replex.html)Use Elixir to replay radio signals on a Raspberry Pi on GPIO 4
## About
This was inspired by the project [`rpitx`](https://github.com/F5OEO/rpitx) which allows
you to transmit signals from 5 KHz - 1500 MHz from a single GPIO pin. There is a lot
of really cool stuff in `rpitx`, but this only focuses on the [`sendiq`](https://github.com/F5OEO/rpitx/blob/master/src/sendiq.cpp)
binary for transmitting an I/Q recording file.If you're new to radio, SDR, and replaying radio signals, I have a full write-up
about the motiviation for this library and how to go through the full process at
[Nerves @ 434 MHz](https://embedded-elixir.com/post/2019-08-29-nerves-at-434-mhz/)You can see this in action and a little more on it's use-case in this lightning
talk I presented at ElixirConf 2019:[![](http://img.youtube.com/vi/PEheIY6gGhY/0.jpg)](http://www.youtube.com/watch?v=PEheIY6gGhY "Radio")
## How to Use
Install the dep:
```elixir
def deps do
{
#...other deps
{:replex, "~> 0.1"}
}
end
```Then you need to make sure you have your recording files as part of your project.
The easiest way to do this is to put into the `priv/` under your project root.From there, you can use it like so:
```elixir
defmodule Radio do
def fan_light() do
file = Path.join(:code.priv_dir(:radio), "fan_light.iq")
Replex.replay(file, 433907740, sample_rate: 250_000)
end
end
``````sh
iex()> Radio.fan_light
:ok
```## Caveats
Because of the nature of replaying radio signals, there is no guarantee on
the success or failure of your radio signal _actually_ being received. Devices
won't send back an `ack` or any response to the action. So this will always
return `:ok` as long as the binary ran and signal was attempted but you won't
_really know_ that it worked.A recommendation would be to just obnoxiously blast the signal asyncronously
and play the numbers game. _Surely_ the device will receive it 1 out of 5 times:```elixir
Task.async(fn ->
Room.lights_on
Room.lights_on
Room.lights_on
Room.lights_on
end)
```That said, if the signal is _binary_ (meaning it is the same signal to toggle
on and off), then this process won't really work. Unless you're hoping to bring
back disco and flashing lights 🕺
## Goals- [X] Support compiling `sendiq` (I mainly compile and include in release)
- [X] Support more raspberry pi than `rpi3`
- [] Support GPIO 6 and 20 pins for transmitting