Showing posts with label Raspberry Pi. Show all posts
Showing posts with label Raspberry Pi. Show all posts

Saturday, August 10, 2013

HSMM-MESH on Raspberry PI

Recently John Wiseman, GM8BPQ of Scotland wrote a good starting guide (full documentation is still being prepared) on how to use the Raspberry Pi for Broadband-Hamnet/ High Speed Multi-media Mesh networking. John's message was posted on the Amateur Radio Experimenters Corner and Raspberry Pi 4 Ham Radio yahoo groups.

Dongles

I've tried it with several, including a 1 Watt unit with option for an external antenna. (http://www.amazon.co.uk/gp/product/B003JTM9JY/ref=oh_details_o01_s00_i00?ie=UTF8&psc=1) . It is worth adding that to power the 1 watt dongle you need a version 2 PI, and a pretty high current PSU.

Installation

As there seems to be quite a bit of interest, I've put together some preliminary installation instructions. More technical info, build detail, etc will follow.

Download latest Rasbian image from http://www.raspberrypi.org/downloads and write to an SD Card in the usual way. (2GB is enough, but larger can be used). Leave card in PC.

Download https://dl.dropboxusercontent.com/u/31910649/meshautoconf0.4.3.zip and unzip, You should end up with a folder meshautoconf0.4.3.

Check that you have folders lib, proc, sys, dev, etc, bin, files, OpenWRTFiles, PIFiles. I've sometimes had problems with winzip not creating empty folders.

Open the boot partition of the SD card, and copy all the files and folders from meshautoconf0.4.3 into it.

Unmount the SD card, install in PI, and power up, If you have a monitor it is worth connecting it so you can see what is going on.

The PI should boot 3 times. The first time it uses the boot partition as the root partition, and copies a few files to the main partition on the PI. This takes a few seconds. The second time it uses the rc.local file just installed to install some packages (from the boot partition, so no internet is needed). and configure the node. This can take several minutes. It then boots again to activate the MESH configuration.

The files are set up to work the same as a WRT54 node - the LAN port is configured as 172.27.0.1, with DHCP enabled - so you can connect a PC and configure the node in the usual way (web browser to localnode:8080). Sometimes I've found the PC doesnt get an IP address the first time. If this happens, rebooting the PI should fix it.

I've found it easier to configure the LAN port with an address on my LAN, so I don't have to unplug the PC and connect it to the PI. You can edit file "interfaces" to set an address on your LAN instead of the 172.27 address. If you do this, remember to set the same address when you configure the Node. or you will loose access. You'll need to connect to the IP address:8080 to configure.

73,
John

(Footnote: The userid/password is the standard HSMM-MESH root/hsmm)

KK6DCI also has a project for building a BBHN node ("Broad Band Ham Net", the new name that replaces HSMM-MESH) on a RasPi at https://github.com/urlgrey/hsmm-pi. It has been used with a 1 watt Alfa AWUS036 USB wireless adapter (using the aircrack-ng driver for the rtl chip in the Alfa).

So what is the advantage of rolling your own this way, you may be asking?

The real advantage is that you can drive a cheap, relatively high-power USB wireless device, like the 2 watt Alfa AWUS036NH... Also the Alfa devices use the Atheros chipset, instead of the Broadcom chipset used in the WRT54.. devices. Atheros devices can be programmed to work outside of the normal Part 15 overlapping channels.

In addition utilizing different supported-rates, you can take advantage of the different channels with minimal or no overlapping. You may also be able to fit a ham only channel in in band segments not shared with Part 15, resulting in a lower noise floor.

The WRT54 and other embedded devices have a limited amount of on board memory and processor power. This is not an issue if you roll your own using a Raspberry Pi. The Pi will also be able to easily support many running services, like FTP, IRC, etc.

Friday, May 10, 2013

APRX running on a Raspberry PI using a sound card

Here are the steps to take to get APRX (as a receive only I-Gate)  to run on a Raspberry PI using a sound card.  Special thanks to Bob, KB8ZXE for providing the info.

This approach is cheap as it doesn't require a TNC or hardware tracker board.  You should be able to throw together everything minus a radio (The Pi, power supply, sound FOB, case etc) for less than $60.

This is assuming that you have taken the steps to make your usb soundcard your default soundcard.  You should refer to my earlier post about how to get that going.  Since then (using the latest Wheezy), I have been successful with USB other FOBs.  I did not need to manually provision /etc/asound.conf

Once you have that going, install the following:

1.) apt-get install libax25 libax25-dev ax25-apps ax25-tools soundmodem screen

2.) Then edit /etc/ax25/soundmodem.conf.  Here is an example:

 <?xml version="1.0"?>  
 <modem>  
 <configuration name="AX25">  
 <chaccess txdelay="150" slottime="100" ppersist="40" fulldup="0" txtail="10"/>  
 <audio type="alsa" device="plughw:0,0" halfdup="1" capturechannelmode="Mono"/>  
 <ptt file="none" hamlib_model="" hamlib_params="" gpio="0"/>  
 <channel name="sm0"><mod mode="afsk" bps="1200" f0="1200" f1="2200" diffenc="1" inlv="8" fec="1" tunelen="32" synclen="32"/><demod mode="afsk" bps="1200" f0="1200" f1="2200" diffdec="1" inlv="8" fec="3" mintune="16" minsync="16"/><pkt mode="MKISS" ifname="sm0" hwaddr="W1AW-14" ip="44.94.11.8" netmask="255.255.255.0" broadcast="44.94.11.255" file="/dev/soundmodem0" unlink="1"/></channel></configuration>  
 </modem>  


3.) Next, edit /etc/ax25/axports
 # /etc/ax25/axports  
 #  
 # The format of this file is:  
 #  
 # name callsign speed paclen window description  
 #  
 #1     W1AW-14     1200     255     2     144.390 MHz (1200 bps)  
 sm0 W1AW-14 1200 255 2 VHF APRS (1200bps)  


At this point soundmodem should be installed and ready to run. To test this you can feed a radio or test audio file into your soundcard. If you start soundmodem in the background (soundmodem &) and then run axlisten -c -a you should see packets being received.

4.) Download aprx and compile it, (I am using version 2.07 SVN 539) Grab the latests tarball from here: http://ham.zmailer.org/oh2mqk/aprx
untar, run the configure script, make, make install.

5.) Edit /etc/aprx.conf  ( I have included a very simple conf file for aprx rx-only i-gate)
 #  
 # Simple sample configuration file for the APRX-2 -- an APRS iGate and Digipeater  
 #  
 # This configuration is structured with Apache HTTPD style tags  
 # which then contain subsystem parameters.  
 #  
 # For simple case, you need to adjust 4 things:  
 #  - Mycall parameter  
 #  - Select correct type of interface (ax25-device or serial-device)  
 #  - Optionally set a beacon telling where this system is  
 #  - Optionally enable digipeater with or without tx-igate  
 #  
 mycall W1AW-14  
 <aprsis>  
 server  noam.aprs2.net  
 </aprsis>  
 <logging>  
 pidfile /var/run/aprx.pid  
 # rflog defines a rotatable file into which all RF-received packets  
 # are logged. The host system can rotate it at any time without  
 # need to signal the aprx that the file has been moved.  
 #  
 rflog /var/log/aprx/aprx-rf.log  
 #  
 # aprxlog defines a rotatable file into which most important   
 # events on APRS-IS connection are logged, namely connects and  
 # disconnects. The host system can rotate it at any time without  
 # need to signal the aprx that the file has been moved.  
 #  
 aprxlog /var/log/aprx/aprx.log  
 #  
 </logging>  
 <interface>  
   ax25-device $mycall  
 #  #tx-ok   false # transmitter enable defaults to false  
 </interface>  
 <beacon>  
 beaconmode aprsis  
 cycle-size 20m  
 #  
 beacon symbol "R&" lat "4427.28N" lon "08756.22W" comment "sound modem"  
 #  
 </beacon>  


At this point your soundmodem is running and when you start aprx everything should work.  You may want to create scripts that will start soundmodem and aprx on boot. If you run mheardd you can use the command mheard to display recently heard stations.

Friday, April 12, 2013

Raspberry Pi web based rig control?


A while back my friend and I found hamlib, a development library designed to remotely control nearly any CAT/CIV capable transceiver or receiver.  It compiles and works just fine on the Raspberry Pi.

 Before-hand ensure you have these dependencies installed:  
 libltdl-dev or libltdl-devel or libtool-ltdl-devel (use yum/apt-get)  
 wget http://sourceforge.net/projects/hamlib/files/hamlib/1.2.15.3/hamlib-1.2.15.3.tar.gz  
 tar -xvzf hamlib*  
 cd hamlib*  
 ./configure  
 make  
 make install  
 ldconfig   

 


So we have been using SSH and hamlib to control a remote Icom 706.  We have been using speak freely to stream the audio.



I have been meaning to try and create a PHP/CGI web based front end for this.  Couple that with darkice and icecast for a way to stream audio to that browser.

There is network daemon version of rigctl that works like so:

rigctld -r /dev/ttyUSB0 -m 311 & 


Then control can be done via TCP port 4532:
 root@darkpi-ice:/# telnet localhost 4532  
 Trying 127.0.0.1...  
 Connected to localhost.  
 Escape character is '^]'.  
 f <---- I sent this and got back below:  
 1590000  


Here is a screen shot of my web control front end:

Here is the radio with the Raspberry Pi, USB sound input, USB TTL converter for CIV.
Basically a way to enable web based control of a radio with CIV.  Remi, F4ECW has some example PHP code for this that I snagged from a Yahoo group.  It also appears to have a start for remote fldigi.

{Update}
http://ok1zia.nagano.cz/wiki/WebRig

Another good project would be to layout a small board with jumper selectable COR and PTT transistor configurations than can be interfaced to the Raspberry Pi GPIO.  So far I have just been bread-boarding this.

I just haven't had the time to create such art work and submit it to Far Circuits.


Again if anyone wants to beat me to the punch on either of this, please do.
Worth reading: "Raspberry Pi: A Tiny Computer for Big Projects" by; Matt, KB3TAN - CQ Magazine, March 2013

Monday, January 14, 2013

Raspberry Pi and Sound Input

If you are a Ham Radio Operator you've probably been looking at the Raspberry Pi with a lot of possibilities.

One of it's downfalls if the lack of an on-board input.  But once you add a USB sound fob, Echolink, remote rig applications, IRLP, and decoding various digital modes like PSK, and so on, are all a reality.


Finding a USB sound device and setting it up can be aggravating.

I recommend the SYBA SD-CM-UAUD USB CM119 audio adapter.



If lsusb doesn't report it as below, you have the wrong one:

root@pi:~# lsusb 
Bus 001 Device 005: ID 0d8c:000e C-Media Electronics, Inc. Audio Adapter (Planet UP-100, Genius G-Talk) 

Next you need to make the usb sound card (0) the default audio device
Check yours like so: cat /proc/asound/modules
0 snd_bcm2835
1 snd_usb_audio


Edit /etc/modprobe.d/alsa-base.conf comment out "options snd-usb-audio index=-2"
You want ""options snd-usb-audio index=0"

After a reboot it should always appear in this order:
0 snd_usb_audio
1 snd_bcm2835


Take this one step further and comment out the kernel module for the onboard sound and add the usb

cat /etc/modules should look like:
#snd-bcm2835
snd-usb-audio

While, I did not find the following necessary in my case, I have read to get better latencies out of USB audio devices, it is suggested to also add:

options snd-usb-audio nrpacks=1


Setup /etc/asound.conf to this:


 pcm.dmixer {  
   type dmix  
   ipc_key 1024  
   slave {  
     pcm "hw:0,0"  
     period_time 0  
     period_size 1024  
     buffer_size 8192  
   rate 48000  
   }  
   bindings {  
     0 0  
     1 1  
   }  
 }  
 pcm.asymed {  
     type asym  
     playback.pcm "dmixer"  
     capture.pcm "hw:0,0"  
 }  
 pcm.dsp0 {  
   type plug  
   slave.pcm "asymed"  
 }  
 pcm.!default {  
     type plug  
     slave.pcm "asymed"  
 }  
 pcm.default {  
   type plug  
   slave.pcm "asymed"  
 }  
 ctl.mixer0 {  
   type hw  
   card 0  
 }  


Since there are some USB issues, I suggest setting the device to boot the USB hub in  USB 1.0 mode, this should fix choppy audio. (I did not find this necessary in my case, but it's not a bad idea)
Add "dwc_otg.speed=1" to /boot/cmdline.txt.

Pulseaudio might be part of your raspberry wheezy default image.  Personally I am not a fan of it, and have read it wasn't working well on the Pi.  I am not sure if that still holds true.  I just removed it:
apt-get purge pulseaudio
I recommend replacing it with Alsa.  It has been around a bit longer:
apt-get install  sox alsa-oss alsa-utils alsa-tools  

Also, I suggest updating the firmware on your Pi.
https://github.com/Hexxeh/rpi-update/


This should be a good starting point for most.  Hopefully in the future, newer Raspberry wheezy images can make this a bit easier, and more kernel support for other USB sound FOBs.

For my fellow hams you may want to check out these places to congregate:
https://groups.io/g/RaspberryPi-4-HamRadio/

http://amateurradiopi.com/forum/

And for those of you still interested in D-Star:
http://groups.yahoo.com/group/RaspberryPi-DVAP/ 

I have been running my Pi using a 5 volt, 1 amp supply via the micro USB power port.  I do not use a USB hub.  My model B rev 2 has been running reliably for a few weeks now.

Just as a note.  If you are making connections to the GPIO for keying a radio or whatever, check your local Radio Shack for "Schmartboard Jumpers ."  These are a new thing they are carrying, and are handy.





Sunday, January 6, 2013

Raspberry Pi Autofox?

I stumbled into a wiki on Turning the Raspberry Pi Into an FM Transmitter.

The code uses the hardware on the raspberry pi that is actually meant to generate spread-spectrum clock signals on the GPIO pins to output FM Radio energy.  Just add a quarter wave length of wire to GPIO 4 to act as an antenna.



root@raspberrypi:~# ./pifm
Usage:   program wavfile.wav [freq] [sample rate]




Looking at the source, it seems simple enough to narrow it a bit: 
In pifm.c look for:


float dval = sample*15.0;  // actual transmitted sample.  15 is bandwith (about 75 kHz)

Obviously this isn't a clean transmitter implementation, so don't expect much more than an autofox.

For a low power foxhunt it might amusing to wire a motion sensor to the other GPIO to adjust your transmit and announce timing cycle, when folks are getting close.


{Update 3/13}
Apparently some people think like me:
https://github.com/DanAnkers/WsprryPi

https://github.com/threeme3/WsprryPi

Plenty of folks using the basis of this for Weak Signal Propagation Reporting

And:

http://www.instructables.com/id/Raspberry-Pi-security-Slow-Scan-Television-Camera/?ALLSTEPS

It would also be interesting to use it as a Part 15 FM transmitter with modified code to allow a GPS for transmitter phase locking.

{Update 8/14}
Alessandro, IK1PLD released a binary to the Yahoo Raspberry_Pi_4-Ham_RADIO group:
Narrow Band FM transmitter derived from pifm. It is able to transmit FM from VLF to UHF with a settable deviation and pre-emphasys, frequency correction and subtones. It runs under debian distr.   In a SSH session type ./nbfm.out for help.

Tuesday, November 20, 2012

Revisits

I haven't blogged in a while.

I have been messing with the low cost Raspberry Pi computer for some off-network ham  VOIP linking.


(The left-most (white FOB) is a CM-108 chipset; the Virtual 7.1 ch sound one is a CM-119, the LogiLink UA0053, and an unknown one.)


Adding a USB sound device is easy (as it doesn't have an on-board audio input), configuring the mixer and getting the sample rate stuff right so it works and sounds decent has been aggravating thus far.

I don't understand why it has to have custom configuration's defined/setup in .asoundrc, for various sample rates.  I am used to command line tools like play and record and sox just working with whatever I am trying to play.  

If you are in the same boat as me, these threads seems to offer some clues:
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=10848

http://www.raspberrypi.org/phpBB3/viewtopic.php?f=38&t=20866 

For us hams you may want to check out these places to congregate:
http://groups.yahoo.com/group/Raspberry_Pi_4-Ham_RADIO/ 

http://amateurradiopi.com/forum/

And if someone comes up with a nice step by step how-to on the audio thing to share, please let me know!

This radioreference post seems pretty detailed.  Here the thread author is adding a USB sound device to provide an input for use with DSD.  However I wasn't successful with this either.



In the advent of cheap RF hardware, I have also been messing with GNU radio.  Alas, seems I don't really have a fast enough computer to run it well.  I was hoping a 3 GHz, P4 with be enough.



Never-the-less, while I seem to lack new topics, there are some older ones that perhaps someone in your local club can contribute to:

NWR SAME software decoder - Looks like someone has added EAS / SAME support to multimon

HSMM BDA -

P25 Software Repeater -



Misc:

http://forum.xda-developers.com/showthread.php?t=1982149 - App to enable all wireless channels on Android. This might be useful for amateur networks.

And lastly, am I the only one that is disgusted with the series of QST articles on the variations of PL-259 installations?