• Tag Archives raspbian
  • MP3 streaming of RTL-SDR receivers

    I have just made some progress with something I had been researching for some time. With the rtl-sdr software and the widely available USB DVB-T sticks it is possible to implement a cheap SDR receiver. I wondered whether it is possible to grab the sound output of the rtl_fm low cpu usage receiving utility and convert it into an MP3 stream.

    I came across this post on the Raspberry Pi forum and tried to make it work. After some messing around with settings I succeeded. The commands I am using are as follows:

    rtl_fm -s 22050 -f 145.575M -l 0  - | lame -b 32 -r -s 22.050 -m m -  | ezstream -c /etc/ezstream.xml

    Basically, it runs rtl_fm, sends the output the lame mp3 encoder which sends its ouput to the ezstream icecast stream generator. /etc/ezstream.xml is as follows:

    <ezstream>
            <url>http://dynode.nl:8000/rpi-rtl_fm-test</url>
            <sourcepassword>xxxxxxxx</sourcepassword>
            <format>MP3</format>
            <filename>stdin</filename>
            <!--
             Important:
             For streaming from standard input, the default for continuous streaming
             is bad. Set <stream_once /> to 1 here to prevent ezstream from spinning
             endlessly when the input stream stops:
            -->
            <stream_once>1</stream_once>
            <!--
             The following settings are used to describe your stream to the server.
             It's up to you to make sure that the bitrate/quality/samplerate/channels
             information matches up with your input stream files.
            -->
            <svrinfoname>RPi rtl_fm test stream</svrinfoname>
            <svrinfourl>www.dynode.nl</svrinfourl>
            <svrinfogenre>hamradio</svrinfogenre>
            <svrinfodescription>RPi rtl_fm test stream</svrinfodescription>
            <svrinfobitrate>32</svrinfobitrate>
            <svrinfoquality>2.0</svrinfoquality>
            <svrinfochannels>1</svrinfochannels>
            <svrinfosamplerate>44100</svrinfosamplerate>
            <!-- Turn off YP directory advertising -->
            <svrinfopublic>0</svrinfopublic>
        </ezstream>
    

    I run a dedicated icecast server on a separate server but it should be possible to host this on the RPi itself. The stream takes up about half of the RPi’s processor capacity. Currently, squelch does not work because it seems rtl_fm stops sending data when the squelch is on, causing lame and ezstream to stop. A possible workaround is to have rtl_fm output to the RPi line-out and generate the icecast stream from the line-in of another USB sound card plugged into the RPi. To solve this in software looks more elegant to me.


  • Streaming radio receivers with the Raspberry Pi

    rpi_audio_stream

    The Raspberry Pi is a small computer that has become very popular. Lots of applications and hardware hacks have been made for it. You can run various software like web/file/printservers, read out sensors, the possibilities are endless.

    I own multiple Raspberry Pi’s, one is a test platform for sensors, and a new one pictured above will be dedicated to audio streaming. I use the software packages darkice and icecast2 to capture the audio from an USB audio card and make it available on the internet.

    To stream audio with the RPi you’ll need the following hardware and software: Continue reading  Post ID 1481


  • Raspberry Pi remote sensors

    Posted on by Johan

    I recently bought a Raspberry Pi to experiment with. The first things I did with it was connecting and reading out Maxim Integrated DS1820 one wire temperature sensor and the cheap Chinese DHT11 temperature / relative humidity sensor.

    To connect the sensors, I soldered some female pin headers to a piece of PCB. For the one wire network I soldered a 4.7K resistor between Vcc on pin1 (3.3V) and GPIO4 on pin 7. GPIO4 is the data pin for one wire, I used GPIO2 as the data pin for the DHT11.  DHT11 “modules” with a PCB and three pins have their own pull up resistor, the separate 4 pin sensors don’t. Shown below is the quick setup, I soldered the DS1820 directly to the PCB, and connected the DHT11 with some wires for 3.3V, data and ground.

    rasp_gpio_ds1820_dht11

     

    GPIO pinouts differ between the Raspberry Pi versions, I found the following pinout to be correct for my Raspberry Pi, a model A version 2.

    Reading out the sensors is easy. For the DS1820, load the required kernel modules which are included in the Raspbian Linux distribution: Continue reading  Post ID 1481