Expandmenu Shrunk


  • Category Archives english
  • 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.


  • Trinket powered geiger counter

    Lately I have been messing around a bit with microprocessor powered geiger counters. One smart guy came up with the idea of generating high voltage using PWM signals from the microprocessor itself. With some additional external parts a HV supply and negative going pulse suitable for microprocessors is easy to make. Here is a schematic I came up with:

    gm counter interface

    The circuit works as follows: A ~1 Khz squarewave turns the MPSA44 high voltage transistor on and off, generating high voltage when the  inductors current is shut off. The voltage depends on the pulse width of the square wave which can be tweaked in software. The 1N4007 diode rectifies this voltage, and the HV cap removes most of the ripple on this voltage. The resistor limits current to the GM tube. The current pulses from the tube generate a voltage drop over the 100K resistor which turns on the BC546. When this happens the voltage through the 10K resistor is pulled to ground, generating a negative going pulse each time the GM tube detects an ionizing ray or particle.

    To drive this circuit I used my new Adafruit Trinket, a small board with a Attiny85 microprocessor. Using the tutorials on the Adafruit website it is easy to work with from the Arduino environment. Here is the code:

    void setup() {
     analogWrite(0, 30); //starts PWM on pin 0, generates about 400V
     analogWrite(1, 255); // needed to get LED to full brightness
     attachInterrupt(0,countPulse,FALLING); // attach interrupt to pin 2
     }
    void loop() {
     //nothing much really
     }
    void countPulse(){
     //pulse led
     digitalWrite(1, HIGH);
     delay(100);
     digitalWrite(1,LOW);
     }

    And here is a video of the setup in use:

     

    Of course it is rather wasteful to only use the microprocessor to generate PWM and flash a LED. I plan on implementing counting and serial output in software later. Unfortunately the Trinket does not have native serial USB capability but bit banging a serial signal on one of the pins should work fine according to several sites. Then it is just a matter of adding a cheap PL2303 serial to USB adapter.

    Update 18/4/2014

    Added serial logging capability. Using a tx only software serial library, the Trinket outputs the measurements in CPM each 10 seconds on pin 4. New code:

    // Trinket GM counter by Johan/dynode.nl
    
    //counting vars
    long count = 0;
    long countPerMinute = 0;
    
    // init softserial only tx on pin 4
    #include <SendOnlySoftwareSerial.h>
    SendOnlySoftwareSerial mySerial (4);
    
    void setup() {
      mySerial.begin(9600); // init serial 9k6
      analogWrite(0, 30); //starts PWM on pin 0, generates about 400V
      analogWrite(1, 255); // needed to get LED to full brightness
      attachInterrupt(0,countPulse,FALLING); // attach interrupt to pin 2
      mySerial.println ("Trinket GM counter starting..."); 
    }
    
    void loop() {
      delay(10000); //the count is incrementing during this delay
      countPerMinute = 6 *count;
      mySerial.println (countPerMinute);
      count=0; //reset the count
    }
    
    void countPulse(){
        count++;
        //pulse led when count is increased
        digitalWrite(1, HIGH);
        delay(100);
        digitalWrite(1,LOW);
      }

    Example serial output using cheap eBay USB<>TTL serial adapter:

    Trinket GM counter starting...
    84
    12
    6
    0
    402        <--- thorium bearing mantle held next to GM tube
    996
    1218
    1146
    1074
    1104
    
    

    There still need to be some tweaking done, the circuit is quite susceptible to electromagnetic interference which causes erroneous counts.


  • 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 1326


  • PMTs and scintillation probes

    quickprobe

    temporary probe with NaI(Tl) crystal, PMT, socket with voltage divider and BNC socket

    Following is a little guide to using photomultiplier tubes in DIY scintillation probes.

    Photomultipliers are vacuum tubes that convert light into electrons and multiply the resulting current up to millions of times. They are used to detect the minute flashes of light generated by scintillators, materials that convert gamma and x-rays into visible light.

    How to use these tubes? There are some things you need to remember when working with PMTs.

    Continue reading  Post ID 1233


  • Eye/oog update

    Posted on by Johan

    English follows below…

    Straks gaat er een ondertekende brief de deur uit en geef ik akkoord voor een behandeling aan mijn linkeroog en medewerking aan een wetenschappelijk onderzoek.

    Mijn linkeroog gebruik ik al tijden niet meer door lensintolerantie en ik zou graag weer eens met beide ogen willen zien.

    Volgens de oogarts is het voor mijn linkeroog mogelijk om een gedeeltelijke hoornvliestransplantatie (DALK) uit te voeren waarbij het achterste laagje, het endotheel, behouden zal blijven. Dit heeft een aantal bijzondere voordelen, de wond zal beter helen, de kans op afstoting is lager en het resultaat is duurzamer dan de transplantatie van de gehele dikte zoals in mijn rechteroog.

    Het wetenschappelijke onderzoek  gaat bekijken of een bepaalde methode om laagjes hoornvlies te scheiden voordelen biedt ten opzichte van de traditionele methodes. Dit is belangrijk, want bij DALK operaties komt het bij een vijfde van de operaties voor dat men de laagjes niet goed kan scheiden en dat men toch een ouderwetse transplantatie van de gehele dikte van het hoornvlies moet uitvoeren.

    Nu is het dus wachten op de operatie, een groffe indicatie van de arts is een half jaar. Uiteraard zal ik na de operatie weer de gebruikelijke updates geven.

    Continue reading  Post ID 1194


  • 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 1179


  • Ludlum Model 2A 500K cpm mod

    ludlum500krange

     

    I recently bought a Ludlum Measurements model 2A survey meter on eBay from Obtanium. This is a nice meter which features the well known rugged Ludlum design, adjustable HV and 3 ranges of 500, 5000 and 50000 counts per minute.

    Using a scintillation probe the meter easily saturates on the 500 cpm scale, and the 5k and 50k ranges are also overloaded with certain sources.

    So I thought of adding a 500k cpm range. I already read the manuals and associated schematics to find out how to do this.

    Ludlum model 2 and 3 offer about the same functionality and basically share the same PCB, circuit, knobs and switches. Depending on age and model there are certain differences, but a lot of the stuff and functionality is the same. Continue reading  Post ID 1165


  • Access bridged modem using Cisco router

    I have a Cisco 1811 with a Zyxel P2812HNU-F1 VDSL modem connected to it in bridge mode. The Cisco gets the public IP address through DHCP.

    I wanted to access the modem on it’s local IP address of 192.168.1.254. At first, this didn’t seem possible because all traffic out of the WAN interface is translated to the public IP address. To enable access to the modem I did the following:

    First, I added a secondary IP address to the WAN interface, Fastethernet0:

    interface fastethernet0
    ip address 192.168.1.100 255.255.255.0 secondary

    Then I added a nat pool to translate internal traffic with 192.168.1.100:

    ip nat pool nat_to_modem 192.168.1.100 192.168.1.100 netmask 255.255.255.0

    The global NAT command requires an access list to match traffic that is to be NATted. Here I define that all traffic to 192.168.1.0/24 is to be translated:

    ip access-list extended nat_to_modem
     permit ip any 192.168.1.0 0.0.0.255
     deny   ip any any

    Continue reading  Post ID 1144


  • YouTube beginning to suck

     

    I spend a lot of time watching video’s on YouTube. Lots of interesting channels about hardware hacking, radiation detection, electronics and stuff.

    But lately something has changed. YouTube continually tries to push unrelated or unwanted videos on me. On the right side I used to see only videos that were more or less closely related to the video. But nowadays completely unrelated videos pop up. The recommendations seem to be based on two things:

    – Whatever videos you watched in the past. But even with all the history deleted, videos that I watched continue to pop up on the right side, even when they are completely unrelated to the video being watched.

    – Random stuff that is supposed to be “fun” but are rehashes of other videos, memes and stuff. It seems that YouTube sells these spots for $$$ to enable people to promote push their videos onto the YouTube audience.

    Continue reading  Post ID 1128


  • Thrash metal appreciation post

    I grew up listening a lot of metal. When you are young you will get easily impressed by all kinds of music. I used to listen to highly accessible and melodic stuff, such as power metal, gothic metal, black metal with lots of keyboards. I don’t listen to much of that stuff anymore. As I got older I began listening to less technical and melodic music. One of the genres I knew but didn’t interest me in particular was thrash metal. Sure, as virtually every young metal listener I discovered bands like Metallica, Megadeth, Sepultura, Slayer etc…

    My interest in (hardcore) punk music of more recent years brought me back to listening thrash. Similar to punk it is loud, fast, contains anti-establishment lyrics and usually doesn’t dwell too much on the technical stuff.

    Some years ago thrash metal got a revival and showed that there are still a lot of good bands around. Also, some bands decided to use a more humorous approach in the lyrics. Since I like extreme music but often find the lyrics crap (the usual stuff about death, destruction, the apocalypse etc. over and over again) I think this is a good thing because in the end, a lot of people go to gigs to drink some beers and have fun!

    So, here some fine examples of thrash :)

    Kreator, one of the big German thrash bands, still raging on after decades:

    Municipal Waste is one of the revival bands and is highly influenced by crossover thrash. Also they make funny lyrics and videos which is GOOD!

    Continue reading  Post ID 1118