(1)Simulink+Arduino:->Audio: Misconceptions

There is a large time gap between the previous post and this post.  I have been lazy to update the blog with my progress and problems and have only begun to do so now so only relevant/correct solutions the problem posed will be posted.


As a proof of concept I believe it is important to create a working prototype even if it requires using more than one input line (aka data+clock).  In doing so I can be sure that when implementing a pilot  to the data I will be able to know that the previous parts work.

In the process of making this, I have learned that the Simulink blocks often do not behave as u wish them to.

Firstly the digital output block.


Despite being requiring a uint8 input, it only outputs high and low aka 5V and 0V for an Arduino UNO and 3.3V and 0V for an Arduino DUE.  This misconception had me confused for several hours as I struggled to understand why it was only outputting 1’s even when I internally generated a DC biased signal as an input to the digital output block.

Secondly, was the sheer overhead Simulink has in C code.  Using the C code generation feature in Simulink I was surprised to find hundreds if not thousands of line of code for the simplest of block diagrams.  This is no wonder that the sampling rate when using the “Analog In->Digital Out” scheme did not reach anywhere near the 16MHz clock speed of the Arduino UNO.

This prompted the idea that using Arduino Due’s with a 84 MHz clock speed might be required if a sampling rate of 15KHz is to be achieved for 2 channels.

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 )

Connecting to %s