Smarter Phones In Your Hacks With TensorFlow Lite

One way to run a compute-intensive neural network on a hack has been to put a decent laptop onboard. But wouldn’t it be great if you could go smaller and cheaper by using a phone instead? If your neural network was written using Google’s TensorFlow framework then you’ve had the option of using TensorFlow Mobile, but it doesn’t use any of the phone’s accelerated hardware, and so it might not have been fast enough.

TensorFlow Lite architecture
TensorFlow Lite architecture

Google has just released a new solution, the developer preview of TensofFlow Lite for iOS and Android and announced plans to support Raspberry Pi 3. On Android, the bottom layer is the Android Neural Networks API which makes use of the phone’s DSP, GPU and/or any other specialized hardware to speed up computations. Failing that, it falls back on the CPU.

Currently, fewer operators are supported than with TensforFlor Mobile, but more will be added. (Most of what you do in TensorFlow is done through operators, or ops. See our introduction to TensorFlow article if you need a refresher on how TensorFlow works.) The Lite version is intended to be the successor to Mobile. As with Mobile, you’d only do inference on the device. That means you’d train the neural network elsewhere, perhaps on a GPU-rich desktop or on a GPU farm over the network, and then make use of the trained network on your device.

What are we envisioning here? How about replacing the MacBook Pro on the self-driving RC cars we’ve talked about with a much smaller, lighter and less power-hungry Android phone? The phone even has a camera and an IMU built-in, though you’d need a way to talk to the rest of the hardware in lieu of GPIO.

You can try out TensorFlow Lite fairly easily by going to their GitHub and downloading a pre-built binary. We suspect that’s what was done to produce the first of the demonstration videos below.

Continue reading “Smarter Phones In Your Hacks With TensorFlow Lite”

Getting Started with GNU Radio

Software Defined Radio (SDR)–the ability to process radio signals using software instead of electronics–is undeniably fascinating. However, there is a big gap from being able to use off-the-shelf SDR software and writing your own. After all, SDRs require lots of digital signal processing (DSP) at high speeds.

Not many people could build a modern PC from scratch, but nearly anyone can get a motherboard, some I/O cards, a power supply, and a case and put together a custom system. That’s the idea behind GNU Radio and SDR. GNU Radio provides a wealth of Python functions that you can use to create sophisticated SDR application (or, indeed, any DSP application).

If Python is still not up your alley (or even if it is), there’s an even easier way to use GNU Radio: The GNU Radio Companion (GRC). This is a mostly graphical approach, allowing you to thread together modules graphically and build simple GUIs to control you new radio.

Even though you usually think of GRC as being about radios, it is actually a good framework for building any kind of DSP application, and that’s what I’ll show you in the video below. GRC has a signal generator block and interfaces to your sound card. It even has the ability to read and write data to the file system, so you can use it to do many DSP applications or simulations with no additional hardware.

UPDATE: Don’t miss the follow-up post that uses SDRPlay to build a GNU Radio based receiver.

Continue reading “Getting Started with GNU Radio”

SDR Tutorials From Michael Ossmann

If you’re just getting into software-defined radio (SDR) but you find some of the math and/or terminology a bit of hurdle, you could absolutely do worse than to check out these SDR tutorials by [Michael Ossmann]. While they’re aimed at people using his HackRF One tool (which we love), most of the tutorial videos are very generally applicable, and we realized that we hadn’t mentioned them explicitly before. Shame on us!

Ossmann focuses on SDR using the open-source GNURadio Companion GUI tool, which makes implementing a lot of cool SDR techniques as easy as dragging and dropping items into a flow diagram. If you want an overview of GNURadio or SDR in general, these videos are a must-watch.

In particular, we loved his entries on complex numbers and complex numbers in DSP because he goes through the whole rationale behind using imaginary numbers in radio work with a graphical presentation that helps add rationale to the otherwise slightly spooky math. Heck, watch these two even if you’re not interested in radio.

The newest entry, covering DSP filters includes a great hands-on introduction to finite impulse response (moving average) digital filters. We really like the practical, simulation-based approach presented in the video — it’s just perfect for a quick introduction.

So if you’re looking for a relatively painless way to get into SDR, grab yourself an RTL-SDR dongle, burn yourself a GNURadio Live DVD, and work through these videos.

Steal This Ham Radio (Technology)

Although I see a lot of wireless projects, I’m always surprised at the lack of diversity in the radio portions of them. I’m a ham radio operator (WD5GNR; I was licensed in 1977) and hams use a variety of radio techniques. If you think hams just use Morse code and voice communications, you are thinking of your grandfather’s ham radio. Modern hams have gone digital and communicate via satellites, video, and many different digital techniques that could easily have applicability to different wireless projects.

Of course, Morse code may have been one of the first digital modes. But hams have used teletype, FAX, and other digital modes for years. Now with PCs and soundcards in common use, hams have been on the forefront of devising sophisticated digital radio techniques.

Continue reading “Steal This Ham Radio (Technology)”

Hackaday Prize Entry: DIY Guitar Multieffects

Guitar effects and other musical circuits are a great introduction to electronics. There’s a reason for this: with audio circuits you’re dealing with analog signals and not just the ones and zeros of blinking a LED. Add in the DSP aspects of audio effects, and you have several classes of an EE degree wrapped up in one project.

For his Hackaday Prize entry, [] is building a guitar multieffect. Instead of just a single distortion, fuzz, or chorus circuit, this tiny little PCB is going to have several flavors of pitch shifting, a flanger, chorus, echo, harmony, and stranger ‘digital-ish’ effects like bitcrushing.

This effects unit is built around a PIC32 and a TI audio codec which processes the audio at 64k 32-bit samples/second. This takes care of all the audio processing, but the hard work for a guitar pedal is actually the enclosure and mechanicals – it’s a hard life for stage equipment. For the foot pedal input, [randy] is using a magnetic position sensor, but there’s no word if he’ll be using a fancy die-cast enclosure or a plastic injection molded unit.

The 2015 Hackaday Prize is sponsored by:

DSP 01: Real, Legit Audiophile Goodness

About six months ago, we saw [tshen2]’s work on the DSP 01, a 2-input, 6-output DSP and crossover for extreme audiophiles, and we’re not talking about oxygen free rooms here. The DSP 01 turns a USB audio output into six outputs that will give you perfectly flat eq across bass, mids, and highs, integrates with a 6x100W amplifier, and compensates for room noise. There was a huge update to the project recently and [tshen] is more than happy to share the details

Getting to this phase of the project hasn’t been without its problems. To get the DSP communicating to a computer through a USB port, [tshen2] found a potential solution in the CP2114 USB to I2S Bridge. This device should function as a USB audio sink, translating digital audio into something the DSP understands. This chip did not work in [tshen]’s design. The CP2114 simply does I2S wrong; the I2S spec says the clock must be continuous. This chip implements I2S with a SPI, firmware, and a few other things, making it incompatible with to-spec I2S.

While there was some problems with getting audio in to the device, the core of the device has remained unchanged. [tshen2] is still using the Analog Devices DSP, with the interesting SigmaStudio being used to compensate for the frequency response of the room. This real, legit, science-based audiophile territory here, and an impressive development for a field that – sometimes understandably – doesn’t get the respect it deserves.

Morse Decoder’s Lean and Sexy Search Algorithm

Often the Morse Code centered projects that we feature are to help you practice transmitting messages. This one takes a tack and builds an automatic decoder. We think [Nicola Cimmino’s] project is well worth featuring simply based on his explanation of the Digital Signal Processing used on the signal coming in from the microphone. Well done. But he’s really just getting warmed up.

What makes this really stand out is a brilliant algorithm that allows conversion from Morse to ASCII using a lookup table of only 64 bytes. This provides enough room for A-Z and 0-9 without chance of collision but could be expanded to allow for more characters. Below is a concise description of how the algorithm works but make sure you take the time to read [Nicola’s] project description in its entirety.

The algorithm can be decribed as follows. Have an index inside the lookup string inizialied to zero. Have an initial dash jump size of 64. At every received element (dot or dash) halve the initial dash jump and then increase by 1 the index inside the lookup string if a dot was received and by dash jump size if a dash was received. Repeat until a letter separator is reached, at that point the index inside the lookup string will point to the ASCII corresponding to the decoded morse.

Have you heard of this technique before? If so, tell us about it in the comments below. Before you jump all over this one, realize that Magic Morse uses a different technique.