(6)Simulink+Arduino->Audio: Serial Receiver

Now that I know I can use serial transmission in Simulink with the Arduino without any hassle, I proceeded to use the same methodology as before to send data.  In retrospect now that I know the serial transmit block actually sends uint8 values there was no real reason to turn the 10bit analogread values to binary.  What I would have needed to do is to normalize it to 8 bit unsigned vales.  Regardless below is the receiver.Capture

The methodology has already been explained previously in part (3) except now the end is replaced with a Serial Transmit block.

Implementation (MATLAB R2015B)

https://mega.nz/#!DM0UEQjA

The receiver is what has changed.  The methodology is as follows

  1. Receive data/status from serial input
  2. Use the change from 0 to 1 of the status to trigger the start of the clock (to match the incoming data)
  3. Use the previous decomposition scheme to decipher data
  4. Scale output such that it runs between 0~4096

Capture.PNG

capture1

Inside the Subsystem: Enable uses the status as a trigger to generate a synchronized clock

The reason why this works even with interruptions is because the receiver generated clock will stop with the data such that it will not drift out of sync by running by itself.  And will only reset when the data stream is resumed.

There is an unaddressed issue though.  This scheme does not specifically help one identify the L/R channels specifically such that the L/R data might be flipped if reset.

Regardless, the highest possible sampling rate was around 1/250 sec @ 250 Hz and was impractical for any sort of use.  In order to eliminate the overhead that Matlab imposes upon the Arduino Due, my next task was to port this to IDE in C code.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s