Skip navigation

Raspberry Pi Projects

2 Posts authored by: dgashby



For the past 12 months or so after reading about the exploits of Dave Akerman and his first launching of a Raspberry Pi into near space I've been tinkering with the idea of launching a  balloon myself.  Although there isn't a huge HAB community in NZ there have been some previous launches, and there is plenty of good information and useful tools available via the UK HAS web site, and #highaltitude IRC channel.  The IRC channel in particular has been a great source of information with many friendly people willing to share their experience and knowledge. It's also been very interesting tracking and watching launches live. Even from the other side of the globe it's sometimes possible to watch live video streams of flight preparations at the launch site and from the chase cars as they track balloons across the country-side.  When video isn't available it's still possible to track progress via the live updates on the tracking site and running commentary on #highaltitude.


Slowly different aspects of the project have been coming together.  Most recently I reached my first major milestone, successfully transmitting and decoding telemetry.  I've decided to blog about my exprience with this so far as it may be useful or interesting to others wanting to do something similar.


System Overview


Starting from the payload end and working through to the receiving and decoding end my setup looks like this:

SystemOverview.pngFigure 1 - System Overview.


I'm planning on using a Raspberry Pi Model A for the payload although for development I'm using a Model B as I have a couple of these already on hand purchased from Element 14.  As my day job is J2EE development, Java was my preferred choice of language for the payload control software. The Radiometrix NTX2 seemed to be one of the more popular radio transmitters used in Europe and was readily available also from Element 14 (please note it has subsequently been superceded by the NTX2B). The NTX2 also fitted onto an early circuit board designed to interface both a uBLOX GPS receiver and radio transmitter to the PI's UART, kindly supplied by Dave Akerman.  Dave generously supplied this board as he has since changed his approach and currently uses the i2c interface to talk to the GPS receiver and the Pi's UART to talk to the transmitter.


On the receiving end, at the moment I'm using a cheap RTL2832/R820T based USB tuner brought off ebay from a Hong Kong based supplier.  A FunCube is another option or a dedicated HAM radio or portable scanner, the UK HAS site has recommendations on brands and models. HAB supplies also sell a range of filtered pre-amps that can provide additional gain and sensitivity.  I'm using gqrx, a QT based graphical front end to gnu radio on the iMac for interfacing to the USB tuner - more on this later.  Jack provides a way to directly connect the audio output from gqrx to the audio input dl-fldigi, this avoids having to use any cables or indirect sample from the external speakers to the mic.  It significantly reduces the amount of noise introduced to the signal.  Finally I'm using version 3.1 of dl-fldigi available from the UK HAS web site.



Why RXTX instead of WiringPi?


The typical approach for broadcasting telemetry with a Raspberry Pi and NTX2 is to use the built in UART serial interface to generate the signals.  This is because the OS on the Pi makes bit banging a a serial interface very difficult as it's not a realtime OS and timing is critical so it becomes a significant challenge.  The UART approach utilises the built in hardware to do do all the hard work.  Initially I started working with the WiringPi library and Java front end for doing the serial coms.  I eventually changed to use RXTX, the main driver for this decision was that RXTX provided control over the serial port flags such as the number of bits, parity, and stop bits whereas the WiringPi Java front end didn't provide an API for this.  As it turned out installing RXTX was reasonable straight forward.  There are several useful resources on-line that show you how to do it.  One thing that did take a little bit of tracking down was that by default RXTX didn't recognise /dev/ttyAMA0 as a serial device but that is easily fixed by setting the property before getting the port identifier:


String SerialPortID = "/dev/ttyAMA0";
System.setProperty("", SerialPortID);
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(SerialPortID);





Raspberry Pi to NTX2 Wiring


The following circuit diagram shows how the NTX2 was wired to the Raspberry Pi.  This is essentially the same as the schematic on the UK HAS page for linking the NTX2 to an Arduino, the only difference is the value of R1 which has been changed from 47K to 22K as VCC for the Pi is 3.3V instead of 5v for the Arduino.  The value of R! influences the carrier shift in Hz when transmitting.  A detailed explanation of how to calculate this is provided on the UK HAS site. They also have some good photos of how to assemble the circuit on a breadboard.

nt2x-schematic.pngFigure 2 - Wiring the NTX2.


Why GQRX instead of SDR#?


Initially I was using my oldish Sony Vaio laptop running Debian Linux as the receiver running SDR# and dl-fldigi.  I suspect the laptop was a bit under powered to run buth these applications at the same time, also it was getting quite hot and so the CPU was stepping the clock speed back to reduce heat output.  I've since given the laptop a good blast with the vacuum cleaner and dropped the average running temperature by about 25-30 degrees.  At some point I may dis-assemble it and give it a proper clean out and replace the thermal paste on the CPU.  In the meantime I had switched to using an iMac for the receiver, this is a quad core I7 with 16GB of RAM so it's more than up to the task.  The only problem is that SDR# isn't available for the OSX so this prompted a switch to GQRX, the QT based front end to Gnu Radio.  As it turns out, I find the GQRX interface much cleaner and simpler than SDR# under Linux.  SDR# seemed to have issues with font sizes and the layout of the left hand control panel always seemed to have far too much white space.  When I re-visit receiving on the laptop I'll try switching to GQRX and see if that runs better the SDR# in a mono runtime.


Audio Patching


I've used Jack Audio to directly patch the audio output from GQRX to DL-FLDIGI. This eliminates any background noise and makes for a much cleaner signal being passed into dl-fldigi.


You need to start up both gqrx and dl-fldigi and then use the jack configuration tool to wire the out from gqrx to the input for dl-fldigi.


jack-pilot-config.pngFigure 3 - Jack Configuration


Reciever Screenshots


The first two screen shots show the gqrx and dl-fldigi interfaces while the transmitter is on but not transmitting data.  In this case you can see a spike on the FFT plot in gqrx where the carrier signal is. If the transmitter is disconnected or the enable pin low then you won't see a spike on the FFT plot or waterfall below.


Figure 4 - gqrx screen when transmitter is on but not transmitting data.

(Note: We're zoomed in quite a bit here, on the Mac you can zoom using the mouse wheel while hovering over the frequency or db labels)


Figure 5 - dl-fldigi screen when transmitter is on but not transmitting data.



Figure 6 - gqrx screen when transmitter is transmitting data.


Figure 7 - d-fldigi screen when transmitter is transmitting data.



Figure 8 - dl-fldigi RTTY settings.


The settings in Figure 8 need to match the serial port parameters set in your code, i.e. buad rate, bits per character, parity, and stop bits.  The value of the custom shift is dependent on the value of the resistor R1, in the example above I have the value slightly lower than what the calculated value should be (~636Hz). The receiver filter bandwidth controls how wide the range for the signals can be, this is displayed graphically in the waterfall the two thick horizontal red lines.




This post was written to share my experience with getting the Raspberry Pi to transmit RTTY data via a NTX2 radio transmitter.  I'm by no means an expert in this, in fact I'm learning most of it as I go, but I thought others trying to do the same may benefit from some of experimentation.  If you spot anything glaringly wrong please let me know so I can make corrections.  I'm still refining things, experimenting with a more accurate carrier shift, and tweaking the signal gain in particular.  Following that will be some range testing to see how far this rig is going to work, and how different aerial configurations are going to impact range.  If you have any questions please feel free to add comments and I'll endeavour to answer them.



My family and I (wife plus two young children) are away travelling the South Island of New Zealand for our summer holiday.  At least one of the places we are staying hasn't upgraded their TV to go digital, the owners usually take their Sky decoder with them.  With our car already loaded to the gunwales with a double buggy, two kids car seats, buckets and spades for the beach, fishing rods, a small selection of christmas toys, and enough clothes to cover four seasons, packing anything extra was out of the question.


The plan was to take the Raspberry Pi Media Centre loaded up with RaspBMC and my laptop (which was going on holiday too).  I had loaded up ISO images from a few of the kids favourite (legimately purchased) DVDs as well as one or two for the grown-ups.  The Pi could be hooked up to the TV, and after a long day at the beach the kids could enjoy a bit of The Wiggles or Hi 5 while winding down for the day.  True, I could have just used VLC or something similar on the laptop, but the laptop can't beat a 48" display when several people are watching, and curious little fingers are kept well away from my laptop! :-)  A bit of research has revealed that playing ISO images is not straight forward with XBMC but there has been quite a bit of work done on this recently and people seem to be getting better milage with the built in player.  I also realised I was probably going to need an MPEG2 codec licsense to get this working.  I figured there was probably going to be a bit of tweaking involved to get all of this working successfully.


The media center also offers a whole host of other options via the myriad of add-on plugins.  As a big fan of NASA TV and Youtube, there were plenty of options available there.  And if I had the time then I might also try and get the MythTV backend up and running on my laptop with a USB DVB-T tuner and using RaspBMC as the front end.  Finally, with the addition of an Element 14 WiPi there was a possibility of hooking up directly to my iPhone's wireless hotspot.


As it turns out NZ Customs were overloaded with the extra Christmas post and although dispatched promptly by the team at Element 14, the Rasperry Pi Media Center kit hadn't arrived by the time we had cleaned up all the leftovers from Christmas Day, loaded up the car, and hit the road for sunny Nelson.  Having prepared for this possibility, I already had a spare Pi floating around, and downloading and installing RaspBMC image was quite strait forward.  I don't have the mini keyboard and trackpad, or the Pi Control and Display (which to be honest I haven't figured out how I'm going to integrate that yet).  The keyboard will be dearly missed though as already using just a wireless mouse with limited range for the initial install and configuration has tested my patience more than my 11 month old son's glee in fiddling with the controls on the home theatre.  He can't walk and he can't talk but he sure knows how to wind up his old man!  So all is not lost and my review will probably be in two parts, the first related to our experience with the cut-down backup version while travelling and the second related to the full blown kit once we return home and organise for the courier to redeliver.

Filter Blog

By date: By tag: