Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Arduino Board Response Rate
Index -> General Discussion
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
whoareyou




PostPosted: Thu Mar 01, 2012 8:14 pm   Post subject: Arduino Board Response Rate

I just have a general question regarding an electrical signal and an Arduino board. So let's say that there is an electrical signal coming through 7 of the 9 pins of a VGA cable and the cable has been split up so that each individual wire is placed into a pin on the Arduino board. I want to read the signal coming from ALL of the pins. So I used digitalRead 7 times, for each pin. What worries me is that not all of them will be read because I'm assuming that the signal will only be sent once and that the board might not be fast enough to read all of the pins at once. Is this what would actually happen? Or would all the pins be read?
Sponsor
Sponsor
Sponsor
sponsor
md




PostPosted: Thu Mar 01, 2012 8:43 pm   Post subject: RE:Arduino Board Response Rate

What is the signalling rate of the signal you are trying to capture?
Are you trying to capture VGA signals (which are analog) or a digital signal sent over a VGA cable?
whoareyou




PostPosted: Thu Mar 01, 2012 8:49 pm   Post subject: RE:Arduino Board Response Rate

It is not specified in the package Neutral. It's a signal coming from a SR-07 Speech Recognition Kit. Of all the pins on the VGA cable, 7 are data pins, and if a certain piece of data is sent (a word) a specific pattern of voltage is passed through the VGA cable (ie. D1, D5, D7 and D8 have voltage for a specififc word).
md




PostPosted: Thu Mar 01, 2012 9:31 pm   Post subject: Re: RE:Arduino Board Response Rate

whoareyou @ 2012-03-01, 8:49 pm wrote:
It is not specified in the package Neutral. It's a signal coming from a SR-07 Speech Recognition Kit. Of all the pins on the VGA cable, 7 are data pins, and if a certain piece of data is sent (a word) a specific pattern of voltage is passed through the VGA cable (ie. D1, D5, D7 and D8 have voltage for a specififc word).


If you're using a circuit similar to the one on here http://www.imagesco.com/articles/hm2007/SpeechRecognitionTutorial03.html then you should be ok. Usually you want a sampling rate of at least 2 times your signal rate.
whoareyou




PostPosted: Thu Mar 01, 2012 9:35 pm   Post subject: RE:Arduino Board Response Rate

Is there something special about this circuit than the Arduino UNO? Neutral
md




PostPosted: Thu Mar 01, 2012 9:47 pm   Post subject: Re: RE:Arduino Board Response Rate

whoareyou @ 2012-03-01, 9:35 pm wrote:
Is there something special about this circuit than the Arduino UNO? Neutral


The one I linked to idientifies the word through a LED which means that the signal is fairly long lived (long enough for you to be able to read it). Seeing as I don't know what your circuitry is like I have no idea how long the signal is and therefor is the Arduno would be fast enough to accurately sample it.
chrisbrown




PostPosted: Fri Mar 02, 2012 12:02 pm   Post subject: Re: Arduino Board Response Rate

If you're trying to read a byte at a time, you'll have better luck using direct port access rather than digitalRead which is very slow and as you know, is limited to one pin at a time. You can find some info here: http://www.arduino.cc/en/Reference/PortManipulation.

What this lets you do is read 8 pins at once and interpret the value as a single byte, all in less time than a single call to digitalRead.

Assuming you connect to digital pins 0-7:
code:

DDRD = 0;  // Enable input on pins 0-7
int byteValue;
while (1) {
    byteValue = PORTD;   // Read the byte value on pins 0-7
}



EDIT2: After rereading OP's post, I realize it's not digital audio but probably ASCII @ < 1KHz, which the Arduino can certainly keep up with. So ignore the edit below, but I'll keep it there for the curious.


EDIT: Let's look at some numbers just for fun.

Typical speech lies between 400 and 4 thousand Hertz. Sample rate must be twice the source frequency, so let's assume the device you're interfacing with is delivering 8 bits @ 8KHz. That means you'll need the Arduino to sample at least 16KHz.

The Arduino runs at 16MHz. That means per loop iteration, you have 1000 clock cycles with which to read, compute, and loop.

This is best case. If the device uses 16 bits instead of 8, you lose half those cycles. If the source frequency is 16KHz (more typical of regular audio), say goodbye to 3 quarters of your available cycles.

8 bits @ 4KHz : 1000 cycles per loop - easy
16 bits @ 16KHz : 125 cycles per loop - not so easy
whoareyou




PostPosted: Sat Mar 03, 2012 9:23 pm   Post subject: RE:Arduino Board Response Rate

Thanks for all your help, but I realized that this problem wouldn't matter anymore. I found out that once a word has been said, the SR-07 maintains the voltage pattern until a next word is said. So there will be ENOUGH time for it to recognize the pattern and make an appropriate output.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> General Discussion
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: