bskari / pi-rc

Turn your Raspberry Pi into a radio controller for RC toys.
GNU General Public License v2.0
139 stars 38 forks source link

How to send a signal just once? #21

Open probonopd opened 7 years ago

probonopd commented 7 years ago

I can successfully send this signal, with "+" being "27.145 MHz on", and "-" = off/other frequency:

+9024 -4512 +564 -564 +564 -1692 +564 -564 +564 -1692 +564 -1692 +564 -1692 +564 -564 +564 -1692 +564 -1692 +564 -564 +564 -1692 +564 -564 +564 -1692 +564 -564 +564 -1692 +564 -564 +564 -1692 +564 -564 +564 -564 +564 -564 +564 -564 +564 -564 +564 -564 +564 -564 +564 -564 +564 -1692 +564 -1692 +564 -1692 +564 -1692 +564 -1692 +564 -1692 +564 -1692 +564 -38628

I translated the above to

[
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 9024,
        "spacing_us": 4512,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 564,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 1692,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 564,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 1692,
        "repeats": 3
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 564,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 1692,
        "repeats": 2
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 564,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 1692,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 564,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 1692,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 564,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 1692,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 564,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 1692,
        "repeats": 1
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 564,
        "repeats": 8
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 1692,
        "repeats": 7
    },
    {
        "frequency": 27.145,
        "dead_frequency": 49.830,
        "burst_us": 564,
        "spacing_us": 1692000, 
        "repeats": 1
    }
]

I can successfully send the signal with:

sudo ./pi_pcm -v

# In another terminal:
cat mute.json > /dev/udp/127.0.0.1/12345

But it keeps repeating over and over. How can I make it send the signal just once? (Sending something all the time is not something I want to do.)

mute

probonopd commented 7 years ago

To be clear, I just want to send the signal once without repeats.

probonopd commented 7 years ago
"frequency": 27.145,
probonopd commented 7 years ago

Updated the original post.

bskari commented 7 years ago

Hello, I looked through your gist. Looks like a cool project! I think that gqrx can record samples to IQ files (under the tools menu), and you could use rpitx to replay that IQ file once on a Raspberry Pi. My repository here is more set up for broadcasting signals repeatedly for radio control stuff, and rpitx is the better choice for broadcasting single signals. rpitx also supports FT files, which I think you could convert the above signal specification into, although I don't know how to do it off hand.