Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

replex

Hex version API docs

Use Elixir to replay radio signals on a Raspberry Pi on GPIO 4

About

This was inspired by the project 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 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

You can see this in action and a little more on it's use-case in this lightning talk I presented at ElixirConf 2019:

How to Use

Install the dep:

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:

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
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:

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

  • Support compiling sendiq (I mainly compile and include in release)
  • Support more raspberry pi than rpi3
  • [] Support GPIO 6 and 20 pins for transmitting

About

Reply radio signals on a raspberry pi to control RF devices

Topics

Resources

License

Packages

No packages published