[Tutor] Using Python to send signals to the USB port

ALAN GAULD alan.gauld at btinternet.com
Wed Aug 17 22:19:46 CEST 2011


> Well, my application requires roughly 20 MHz ( :O ... I know )... 
> However, the DACs are not a problem, I can afford them.

OK, Well to digitize a 20M signal you need to sample it at 40M rate.
Then just send the digital levels out through the usb port one bit at 
a time  which will require around 8x40M = 320Mbps (plus protocol 
overheads). That's about the limit of USB2 (maybe even over the 
limit?). Looks like you will need to use USB3 or resort to compression.
And i'm assuming you only want 256 quantization levels, if you want 
to go to 16bit encoding then you need to double the bitrate. Definitely 
too high for USB2...

If you use compression you need to find a DAC that can unscramble a 
compressed signal. There are a number of encoding schemes that 
you could use. You can also save bandwidth by using a bitstream 
encoding provided the signal slew rate is not too high.

Lots of choices but it all depends heavily on the nature of the signal.
Its not a simple task, and although the mechanics of sending the data
through the usb port are not too hard the algorithms and protocols 
to generate the data are all documented and not too hard to code 
up, the plethora of choice is what makes it hard.

I'm also assuming that you can process this data in batch mode 
rather than in real-time and then transmit the digital signal in one go. 
If it all needs to be real time you might be pushed to use standard
Python and need to look at things like Cython or writing a C module.


I suspect you need to do a bit of digging on Wikipedia to get a 
feel for which algorithms/mechanisms are best suited to your needs.
Then find a DAC that matches that and use the spec for the DAC 
to guide your coding.

HTH,

Alan G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110817/afec5bb0/attachment.html>


More information about the Tutor mailing list