Categories
Hardware Technology

Benchmarking the Arduino based CV/Gate controller

I wrote some code that wraps the serial interface and the control commands of the Arduino CV/Gate into a MATLAB class. I used the following example code in MATLAB to benchmark the speed.

a = cvgate('/dev/tty.usbserial-AH01DRO4', 115200);

a.voltage = 0;
a.gate    = 0;

c = 0;
t = tic;
while true
  a.voltage = 5 * (0.5 + sin(2*pi*toc(t))/2); % fluctuate at 1 Hz
  a.gate = ~a.gate;                           % flip the gate on and off
  update(a);
  c = c + 1;
  if mod(c, 100)==0
    % display the number of updates per second
    disp(c/toc(t));
  end
end

The video below shows  the control voltage (red LED) fluctuating at 1Hz from 0 to 5V. The gate (green LED) is flickering on and off, but that is at a rate too fast to capture on camera. It manages  approximately 100 updates per second.

The Arduino is running this sketch which is controlled by this MATLAB class.

Leave a Reply

Your email address will not be published. Required fields are marked *