Showing posts with label raspberry pi. Show all posts
Showing posts with label raspberry pi. Show all posts

Sunday, August 12, 2018

Some AREDN progress

We have been working on bringing up an AREDN mesh network at ARRL HQ and here at AA6E.  AREDN, the Amateur Radio Emergency Data Network, has developed from the HSMM project (High Speed Multimedia, see web sites here and here.)  AREDN supports a "mesh network" running under FCC Part 97 (Amateur Radio) rules on allocated frequencies some of which are close to standard "WiFi" (2.4 and 5 GHz).

Ubiquity Nanostation Loco M5 AREDN node
What is mesh networking?  Simplified, it is a way to interconnect more or less randomly located network nodes that may come and go, such as in response to emergency requirements.  Each node may originate data or may relay data to adjacent nodes. Networking software automatically routes packets by the best paths through the mesh, from source to destination.  Certain mesh nodes may have gateways to other networks, such as the commercial Internet.  Certain nodes may have special servers (web, email, file, etc.) that are made available to the network.  In general, AREDN mesh networks are set up to be independent of commercial communications services as much as practical.

At AA6E and ARRL, we have implemented a test network to learn about AREDN technology and to try out configurations that might support a variety of routine and emergency communications needs.  The first setup uses up to 4 Ubiquiti NanoStation Loco M5 devices with custom AREDN software.  These form a small-scale mesh, currently all within the ARRL Laboratory.

A test bed setup at AA6E uses two of these nodes to demonstrate network capabilities.  Below is a block diagram of the tested network.
The AREDN network is at the right.  One Loco M5 device supports a laptop computer (where I am writing this article).  Through the radio link at 5.9 GHz, the two Locos support a bit stream of up to about 30 Mb/s using a 10 MHz RF channel.  As seen by the laptop, the Loco provides an IP address through its own DHCP server.  Traffic is routed to the second Loco, which in turn supports two VLANs (partitions of a single Ethernet connection).  One is a generic "LAN" connection that will support Ethernet devices like the Raspberry Pi which is acting as a small webserver for our test.  The Pi will also support SSH, VNC, and many other services as needed.

The second switch port supports another VLAN for "WAN" connections, e.g., to the Internet.  Through the Internet router it obtains an address on the household LAN.



L to R: Raspberry Pi 3; Netgear GS105E VLAN-aware switch; Toshiba Laptop

This setup demonstrates many of the functions we would need in an operational network.  We still need to set up facilities for node to node bridging that we would need to build up a larger network, supporting multiple operating bands, etc.

There is nothing "new" here.  It's all been done elsewhere, but we are climbing our learning curve.

Wednesday, January 14, 2015

FlexControl for Linux+ #hamr

Lately I've been on the air with a FLEX-6700 from FlexRadio Systems.  It's a great rig, but that's a story for another day.

Today's subject is the beautiful FlexControl, which is a "USB Knob" ($99.99).  It is designed as an adjunct input device for the Flex software defined radios, for users who need something more traditional than mouse-based pointing and clicking for tuning and managing a radio.

The product is provided for SmartSDR for Windows, the principal interface program for the Flex 6000 series.  It has a great feel, and it has 3 nice buttons and status lights. SmartSDR provides a Windows driver to work with the FlexControl.

So that's fine, but I'm mainly a Linux guy.  For unfortunate but understandable reasons, Flex only provides Windows control software.  What does the FlexControl look like when plugged into a Linux system?  I could not find any documentation.

With help from Wireshark and VirtualBox, we can do some reverse engineering.

The FlexControl is recognized by Linux (Ubuntu 14.04, but probably most other versions, too).  It appears as /dev/ttyACM0 on my machine. "ACM" signifies that this is a CDC_ACM device.  That category is loosely based on ancient Hayes modem interfaces, but don't worry about that!  Really, it just emulates an old-fashioned serial I/O connection at 115 Kbps.

You can set up minicom or any other Linux program to talk to this device.  The only remaining question is the protocol.  It turns out to be simple.  No surprise, this is a simple device.  The scoop:

Sending from FlexControl to host:
All commands terminate with ';' (no returns or line feeds)
U; - knob CW (single tick) -- U02; U03; U04; etc - multiticks
D; - knob CCW (single tick) -- D02; D03; D04; etc - multiticks
S; - short press, main knob
L; - long press, main knob
C; - fast double click, main knob


The fast knob codes reflect multiple encoder ticks between USB polling times, so the knob should be able to keep track of fast spinning.  (Alas, SmartSDR will not always keep up so well.)

XnS; - normal press, key n=1,2,3
XnL; - long press
XnC; - fast double click

e.g. 
   U; (frequency up one tick)
   X2S; (normal press, button 2)

Sending from host to FlexControl:


Ixyz;  where x,y,z = 1 or 0 for LED 0, 1, 2 on or off
e.g.
   I001; set right hand LED on
   I000; set all LEDs off

   I111; set all LEDs on

Note that SmartSDR for Windows only uses a fraction of the FlexControl's button capability.

See a simple Python program to illustrate how to communicate at http://aa6e.net/wiki/FlexControl. 

[Added 4/24/2023: That link has gone dead.  A copy of the old file can be found at http://web.archive.org/web/20150226074911/http://aa6e.net/wiki/FlexControl. Note that the code is written in version 2 Python.  It will need updating for version 3.]

The FlexControl should be very useful for all kinds of DIY software projects.  Connect it to your Raspberry Pi, your Arduino, your Linux PC for any kind of control project! (There are cheaper USB based controllers available -- for games, etc., but few have the right "ham" esthetics IMO.)

Maybe FlexRadio or one of the designers (K6TD or K6TU) would have divulged the same data if they were asked nicely, but it was more fun to work it out on my bench.

Saturday, October 26, 2013

Data Footprint Control -- Your own email server!

Lately I've been talking up the idea of "data footprint".  It's a fact that we're spreading all kinds of personal data around the Internet in the course of our modern electronic and financial lives.   Our bank, Facebook, Google, Yahoo, Comcast and essentially everyone we do business with is collecting data about us. The data get bought and sold and snooped no matter what our wishes may be.

One concrete thing I could do, while having a bit of fun, was to move my Google email back to a server computer under my own control.  That's (a) a rather old-fashioned thing to do, (b) rather complicated to set up correctly, and (c) a losing game in terms of functionality.  No doubt Google Mail sets the standard for usability, especially for power users.  It also has the best anti-spam technology I've come across.  So if we step back to a local server, we will be losing some useful features.

It happens I have an older Raspberry Pi (256 MB Model B) which hasn't had a particular mission.  So now it is the household IMAP server, with my 1.6 GB email stash on a 16 GB SD card.  It would have been easier to use a big PC for this function, but I wanted a platform that I could leave on 24/7 without eco-guilt.  It uses just a couple of watts of power.

I am temporarily (until I forget all the details) an expert on Postfix, Dovecot, and SSH, allowing me to access the e-mail from any machine on the home network and (securely) from external machines. Fortunately, I have an external SMTP relay that is part of my web hosting service, so outgoing e-mail should be treated with proper respect by the big services.  (A user PC directly sending out SMTP mail is often shunned as a likely source of spam.)

It's a just a symbolic step. We have a long way to go before we get control of all our data.

UPDATE 1: The dirty little secret they don't tell you at e-mail school is that most e-mail is spam, and an e-mail server without spam filtering is ... not worth a lot.  On the client side, Thunderbird and some others make a valiant attempt, but it wasn't going to work for me.  Especially since I want to use an Android client like Kaitin (no spam filtering) for mobile e-mailing.  So I consulted  https://help.ubuntu.com/community/PostfixAmavisNew. (Ubuntu is close enough to Raspian.) Everything installed OK until it became clear that my 256 MB Pi might not support a big freshclam update.  OK, we don't need antivirus for Linux/Android, do we?  Anyway, the server has started bouncing spam pretty well now.  And the Pi can feel virtuous as it crunches on each message for a second or two.

UPDATE 2:  ClamAV is hopeless, taking way too much RAM and CPU.  Fortunately Amavis doesn't need antivirus, so it's OK just to remove it from the system.  Even so, Amavis & co. take a lot of RAM and just fit in the 256 MB machine along with Linux.  If I start doing package updates, for example, there is a lot of "disk" thrashing -- swap utilization climbs, and things go very slow for a while.  (But no crashes!) A 512 MB machine would be much better.  Spam scanning and message handling seem to take 5 to 15 seconds per message.  This is not a high volume solution, but it handles my load OK.

UPDATE 3: This project was a success technically, but Comcast woke up to it (maybe they read my blog?) and they blocked port 25 on my service. Maybe I could have argued my case, but I didn't pursue it. Instead, I moved my email action to Pobox.com, a commercial outfit that specializes in email - and doesn't sell my info to the highest bidder, hopefully.

Tuesday, May 07, 2013

Raspberry/Beagle/Core Benchmarks

Measured the other day using iPython:

iPython's "timeit" function is hardly the last word in benchmarking, but it can be very useful if you're thinking about Python applications.  Raspberry Pi is very powerful compared to Arduino, say, but very slow compared to modern desktop machines.   No surprises, but I haven't seen relative benchmarks before.

Monday, July 16, 2012

Interesting Little Boards

Shortly, I'll have three little computer boards to understand, play with, and possibly (just possibly) build into some useful projects.

The Arduino Uno is "slow" (16 MHz) ATmega328, has limited RAM and OS support, but is very flexible for interfacing and control applications. Easy C-style programming for simple applications. $27 at Digikey.
The Raspberry Pi is fast (700 MHz ARM) with 256 MB RAM, Fedora Linux, etc., and it's amazingly cheap ($35 US at Allied Electronics, if you can get one!).

As a full-blown Linux system, the Raspberry (and BeagleBoard, below) will require somewhat more software sophistication to get in the game.
The BeagleBoard XM is fastest (800-1000 MHZ ARM) with 512 MB RAM and full set of peripheral connections, running Ubuntu Linux, Android, and others. $149 at DigiKey.

This board has the makings of a DIY netbook computer or tablet, even including a camera interface.

You get extra points if you can program the built-in TMS320 DSP processor.  Usually for audio and video codecs, the DSP development environment is complicated. (To be charitable)

I've mostly been working the the BeagleBoard XM, and I use a lot of its I/O capabilities.  (This is the only board of the three that seems to directly support audio input.)  It provides all the fun and frustration of working in a full Linux environment (including video display, mouse and keyboard if you want), but there are few extra headaches dealing with the embedded aspect.  (E.g., configuring GPIO pins and boot files.)

The rule seems to be: use the simplest board that will support your project without elaborate daughter cards, etc.  In a one-off project it's really easy to use many hours and dollars to shoehorn a project onto a board that doesn't quite fit.  On the other hand, if all you need is blinking lights of one sort or another (even a complex Morse keyer) the Arduino's easy programming system can really save time.

These are all open source boards, making it possible to do your whole project in an open style (software and hardware), a big plus for Amateur Radio DIY work.  There is a huge amount of online information and help forums for all these boards.