Skip to content

Instantly share code, notes, and snippets.

@rxseger
rxseger / gptest.py
Created July 11, 2016 05:25
Raspberry Pi 3 GPIO testing pushbutton input and LED output
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
BTN_G = 11 # G17
BTN_R = 12 # G18
BTN_Y = 13 # G27
@rxseger
rxseger / gist:2c0aea05f47e162725f5ec703461d32a
Created July 4, 2016 23:07
inspectrum compile error against liquid-dsp 1.2.0
brew tap dholm/sdr
brew install dholm/sdr/liquid-dsp
# problem: installs liquid-dsp 1.2.0, released Apr 26, 2012,
# FIX: brew install --HEAD dholm/sdr/liquid-dsp
git clone https://github.com/miek/inspectrum
# https://github.com/miek/inspectrum/tree/fc9e575052a069923a21b496f73f2b4867539a2f
cd inspectrum
cmake .
make
@rxseger
rxseger / nec-pwr
Created July 4, 2016 03:24
Startup script /etc/init.d/nec-pwr for use with nec-pwr.py
#!/bin/sh
### BEGIN INIT INFO
# Provides: nec-pwr
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: NEC IR power-off daemon
# Description: Receives IR messages from a RTLSDR dongle
# and shuts down when the remote power button is pressd
@rxseger
rxseger / nec-pwr.py
Last active April 8, 2024 16:20
Script using RTL-SDR with IR to power off system when RTL remote power button pressed
#!/usr/bin/python
# Quick & dirty script to power down the computer when receiving
# a "power button" IR signal from the RTL remote over RTL-SDR dongle
# via rpc_ir librtlsdr: https://github.com/rxseger/librtlsdr/pull/1
# Intended for use with Raspberry Pi, which lacks a built-in power button
# Usage:
# rtl_rpcd -I 1235
@rxseger
rxseger / rtl_rpcd
Created July 4, 2016 03:21
Startup script /etc/init.d/rtl_rpcd for running rtl_rpcd + IR
#!/bin/sh
### BEGIN INIT INFO
# Provides: rtl_rpcd
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: rtl_rpcd RTL-SDR RPC daemon
# Description: Receives RF and IR messages from a RTLSDR dongle
### END INIT INFO
@rxseger
rxseger / pwr-nec-decoded.txt
Last active July 3, 2016 23:55
rtl_ir hand decoding
decoding NEC pulses for power down button (0x4d) of RTL remote
http://www.sbprojects.com/knowledge/ir/nec.php
pulse, pause = 0
pulse, pause pause = 1
received using rtl_ir https://github.com/librtlsdr/librtlsdr/pull/9
$ ./rtl_ir
press the power button on the RTL remote, shows pulses:
@rxseger
rxseger / file_atsc_rx2.grc
Created June 30, 2016 03:10
Enhanced file_atsc_rx with bladeRF and adjustable gains
<?xml version='1.0' encoding='utf-8'?>
<?grc format='1' created='3.7.9'?>
<flow_graph>
<timestamp>Tue Jul 22 14:34:09 2014</timestamp>
<block>
<key>options</key>
<param>
<key>author</key>
<value></value>
</param>
@rxseger
rxseger / file_atsc_rx2.py
Created June 22, 2016 07:33
Generated file_atsc_rx2.py from file_atsc_rx2.grc
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# see https://gist.github.com/rxseger/4c6fce39cffa149424a4780a37fae426
##################################################
# GNU Radio Python Flow Graph
# Title: Receive ATSC from UHD
# Generated: Wed Jun 22 00:27:50 2016
##################################################
from gnuradio import analog
@rxseger
rxseger / file_atsc_rx2.grc
Created June 22, 2016 07:32
Enhanced file_atsc_rx.grc, exploded view with additional debug/diagnosis blocks for testing
<?xml version='1.0' encoding='utf-8'?>
<?grc format='1' created='3.7.9'?>
<flow_graph>
<timestamp>Tue Jul 22 14:34:09 2014</timestamp>
<block>
<key>options</key>
<param>
<key>author</key>
<value></value>
</param>
@rxseger
rxseger / psipdump.py
Created June 22, 2016 05:50
MPEG TS (transport stream) ATSC (over the air digital television broadcast) PSIP (program information) Python script
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Show PSIP data (and other packets) from MPEG TS streams from ATSC broadcasts
# Warning: very rough, incomplete, you're probably better off using VLC 3.0 (show Media Information,
# go to Codec Details, then scroll down to the EPG (electronic program guide) sections)
import sys
import struct
def decodeTSpacket(packet):