Arduino bitstream-1.0 release

Status
Not open for further replies.

GroundLoop

Member
Premium Subscriber
Joined
Apr 17, 2011
Messages
233
After an energetic and fruitful discussion on serial bit slicers here:
http://forums.radioreference.com/trunking-control-channel-decoding/18043-data-slicer-unitrunker.html

I'm happy to release v1.0 of the Arduino multi-channel bitstream package.
You can download it here:
http://www.trix.com/GroundLoop/bitstream-1.0.zip

This package contains and Arduino sketch that samples one or two discriminator audio feeds and streams timed sample bits out the serial port. It also has a sample log and test application to decode packets.

It's a work in progress, and will hopefully be useful to programs like UniTrunker that sample data streams using audio input today. The source code is GPL, so you may use it for other projects.

There are a few advantages to using an Arduino instead of audio line-in:
  • Reduced CPU load, since there are fewer binary serial samples than 16-bit audio samples.
  • Scales to multiple systems. It's difficult to add audio inputs to most computers
  • Less expensive than added audio inputs. Arduinos are less than US$30 and can sample two inputs.

The current version samples two streams, but three or four may be possible in the future.

I'd be curious to hear from anyone that tries it, successful or otherwise.
 

scottbailey

Member
Premium Subscriber
Joined
Mar 30, 2005
Messages
75
Location
Texas
Now that is some nicely commented code!

I can't believe I didn't discover the Arduino sooner!
 

GroundLoop

Member
Premium Subscriber
Joined
Apr 17, 2011
Messages
233
It's fun stuff. I've been dorking around with Atmel AVRs since Butterfly, before Arduino, and the bar is that much lower with these pre-fab hacker boards. The price is right.

Arduino brings you a nice bootloader (so you can share the RS-232 port between your program and flash programming), and a slew of interesting and strange libraries of pre-existing code.

You do have to be careful with the Arduino convenience libraries, though.. some are too slow compared to raw avr-gcc calls or macros.

Anyway, let me know if you get the bitstream program running. Next up, the Tuner.
 

GroundLoop

Member
Premium Subscriber
Joined
Apr 17, 2011
Messages
233
Ah, where to get Arduinos.

There are many different kinds, with different features. Any board that boasts an "Arduino" name is likely to work just fine with the Arduino software package, but some are better fits than others. If you want to run code without modification, then your options are more limited:
Arduino Buying Guide - SparkFun Electronics

First, there's flash size.. ATmega168, ATmega328 -- this indicates how much flash memory is available for code.. 16K or 32K. This sounds like a big deal, but most of the small projects fit just fine into 16K, so either will work. The bitstream is less than 3K. There used to be a price difference, but lately there doesn't seem to be any reason not to buy 32KB. Same code runs on both.

Avoid any designs that are not based on those two chips, as they tend to be more specialized and have different in/out options.

Since the older radios are 5v logic, get a 5v Arduino, rather than the 3.3v "pro" board. This gives you more options for connectivity.

The Arduino UNO is the newest board, but arguably the weakest. It has a less-precise resonator (vs oscillator) for the main 16MHz clock, and a new RS-232 to USB interface chip that is faster, but less proven and universal than the venerable FTDI.

So.. Arduino Duemilanove, while discontinued, is still a fine choice:
Arduino - ArduinoBoardDuemilanove

You shouldn't spend more than about US$30.00 for it.
Amazon:
http://amzn.com/B004A7L3NC

There are 'clones'.. derivative designs that improve on certain things. I like the Seeeduino:
Seeeduino V2.21 (Atmega 328P) [ARD128D2P] - $22.50 : Seeed Studio Bazaar, Boost ideas, extend the reach
Smaller USB connector. Switch options.

If you're going to bury the board inside the MaxTrac or other radio, the Nano rocks:
Arduino - ArduinoBoardNano
Same stuff, smaller package. We're not using any add-on Shields anyway.
Arduino Nano 3.0 Atmel ATmega328 Mini-USB Board with USB Cable [bzb8780502] - $24.99 : Bizoner.com, Online Shop,Arduino Boards,Shield,Tools,Sensors,Robot,Cables,Hobby,Sell
I haven't tried them, but if I was ordering now, I'd get these.
 

claflash

Newbie
Premium Subscriber
Joined
Jan 5, 2011
Messages
2
Seems the bitstream file link is invalid now. Any chance groundloop or someone else could repost it?
 

GroundLoop

Member
Premium Subscriber
Joined
Apr 17, 2011
Messages
233
Yeah, I'm real sorry about that. The web host I was using got wiped out by some miscreants and didn't come back.
I do have backups.
If anyone has a stable host that wants the files, I'm happy to resend them.
By all means, pass 'em around.
 

SCPD

QRT
Joined
Feb 24, 2001
Messages
0
Location
Virginia
Speaking of Arduinos, what are your thoughts on the atmega32u8 in place of the atmega328?
 

SCPD

QRT
Joined
Feb 24, 2001
Messages
0
Location
Virginia
Here is the original 1.0 release with the sample log file removed to fit file size limits on this site.
 

Attachments

  • bitstream-1.0.zip
    18.6 KB · Views: 253

bilbolodz

Member
Joined
Sep 16, 2007
Messages
32
Thank, you I will try it. I'm thinking is it possible to implement into Arduino FFSK decoder. I'm interested in decoding 1200bps FFSK signal (MPT1327 control channel). What do you think about it?
I've found hardware decoder (CML FX429A) but it's very old IC and it's hard to buy. I've contacted CML sales department and fortunately they said that it's still in production but it's not recommended for new designs.
Now I'm waiting for answer from my local CML distributor. My idea is to implement on base of arduino hardware based MPT1327 scanner controller.

Piotr
 

cg

Member
Premium Subscriber
Joined
Dec 13, 2000
Messages
4,571
Location
Connecticut
If anyone has been able to control an Astro Spectra, I would be interested trying that to monitor a digital system. Someone had remarked that it should be possible since it is similar enough to the Maxtrac.

chris
 

SCPD

QRT
Joined
Feb 24, 2001
Messages
0
Location
Virginia
I'm thinking is it possible to implement into Arduino FFSK decoder. I'm interested in decoding 1200bps FFSK signal (MPT1327 control channel).
This would be very easy. Use speaker audio so you don't need to filter out any subaudible CTCSS tone. At 18,000 bit-samples per second ... FFSK would have 15 bits per symbol. Ideally - the number of bits should be divisible by 6 (which 15 isn't) but should still be tolerable.

The "2 pi" 1200 Hz tone looks like ...

0000000x111111 or 1111111x000000 where "x" could be either 0 or 1 (don't care).

The "3 pi" 1800 Hz tone looks like ...

000001111100000 or 111110000011111.

The idea behind the bitstream is to defer processing these patterns on the host PC so that the Arduino code remains fast and simple. This also allows the bitstream to decode multiple protocols.

I have a faster version running at 28,800 that successfully decodes Motorola and EDACS (wide and narrow) control channels while still supporting MPT1327.
 

mancow

Member
Database Admin
Joined
Feb 19, 2003
Messages
6,879
Location
N.E. Kansas
There is a thread over at p25.ca in which a guy made a program to control various Motorola radios. It worked on the Spectra and legacy Astro stuff. It was a bit rough but it got the point across.

I would like to come up with a way to tap the tuning data inside a Pro197 or Uniden 996 or whatever and perhaps use an Arduino to control an Astro product. Offloading the receiver function to an Astro would provide an incredible receive improvement. The program the guy came up with was called Remoto but unfortunately he seems to have disappeared before he found a way to initiate the digital decoder but the application did allow for tuning in analog mode.

Maybe this is off topic but I thought it might be of some interest.
 

bilbolodz

Member
Joined
Sep 16, 2007
Messages
32
This would be very easy. Use speaker audio so you don't need to filter out any subaudible CTCSS tone. At 18,000 bit-samples per second ... FFSK would have 15 bits per symbol. Ideally - the number of bits should be divisible by 6 (which 15 isn't) but should still be tolerable.
Actually I've thought about putting all decoding stuff into Arduino (to get at RS232 "clear MTP1327" codewords). Because it's 1200 I can lower sample rate to release some CPU resources but I don't quite sure isn't to much for Arduino to do all decoding work: detect carrier, recover clocking, synchronize symbols, strip off preamble, count cheksum.
Of course I can chain two Arduino together: on for data slicing second to decoding but it still a lot of work with FFSK processing. Actually I'm not fluent with decoding analog signals into digital that's the reason why I was thinking about FX429A. It do all these stuf in hardware and give you clear received byte....

Piotr
 

SCPD

QRT
Joined
Feb 24, 2001
Messages
0
Location
Virginia
Actually I've thought about putting all decoding stuff into Arduino (to get at RS232 "clear MTP1327" codewords). Because it's 1200 I can lower sample rate to release some CPU resources
I think 7200 is the lowest you can go for FFSK at 1200 bps.
for Arduino to do all decoding work: detect carrier, recover clocking, synchronize symbols, strip off preamble, count cheksum.
The checksum is expensive. Some MPT1327 systems use nonstandard sync bits. This forces calculating CRC on every symbol until sync is found. 1200 CRCs per second on 16 MHz Atmega328 is a bit much.

An ARM based Maple or a Raspberry Pi might be better/cheaper than two Arduinos.
 

bilbolodz

Member
Joined
Sep 16, 2007
Messages
32
OK, I've working prototype (Arduino + FX429A). I can receive via Arduino decoded MPT1327 codwords so I can quickly implement "Inline Control Panel Decoding" but I don't know the format which UniTrunker require.... My final goal is to make full MPT1327 decoding in Arduino.

Piotr
 

SCPD

QRT
Joined
Feb 24, 2001
Messages
0
Location
Virginia
The interface you've constructed sounds very much like the modem required by Ian Wraith's FTrunk and PTrunk.

Talkback Systems Australia

Unitrunker expects a time sliced bitstream at 28,800 bps. The Arduino code samples an analog input. An external modem chip isn't used. MPT1327, Motorola and EDACS can all be decoded from this common format.
 

bilbolodz

Member
Joined
Sep 16, 2007
Messages
32
Yes, it's something like that. About Unitrunker:
if scanner is capable of it can listen to ("control channel" decoded from air to digital stream using RS232 (but decoded string, not just sample of analog data).
Unfortunatelly there is no scanner which can decode MPT1327 (I know that Uniden can decode Motorola, EDACS and LTR). So maybe it could be a good idea to make arduino based "control channel decoder"? I think it's not a problem but I don't know format which Unitrunker expects to receive.
 

SCPD

QRT
Joined
Feb 24, 2001
Messages
0
Location
Virginia
I think it's not a problem but I don't know format which Unitrunker expects to receive.
The expected format is as described above. If your Arduino does the extra work of decoding codewords, I'd have to modify the program to accept the codewords. It would be a new format.
 
Status
Not open for further replies.
Top