Arduino IL9341 LCD MATLAB/Python/Serial interaction

A very cheap method to realize a spatial light modulator one can simply use an off-the-shelf LCD module driven by an Arduino. When removing the backlight and putting the LCD in the optical path, it acts as a very cheap mask. Controlling the device via MATLAB or PYTHON is an easy task to do!


In my work I tried to implement a SERVER<-> Client interarction, where Matlab sends command and the Arduino executes them.

Writing an entire RGB image using the slow Serial protocol provided by the ARDUINO is not very efficient and takes up to 2 minutes .. Therefore one can define special patterns like rings, segments, etc. and send only the parameters to the arduino. This then selects the right shape and displays it using the parameters provided by the SERIAL connection as seen in the image bellow


Calling a patter from MATLAB is as simple as this:

%% Declaration of Serial Port
com_port= ‚COM3‘;

%Open Serial Port

% Set the global center/pixel of the LCD
setGlobalCentre( serial_port, x_centre, y_centre )


% Display Aperture on LCD for Fourier Ptychogrphy (just an example!)
setScanAperture( serial_port, round((X(i) + x_centre)), round(Y(i) + y_centre), dAperture, exposureTime ) % show centre dot (0,0)



the Arduino code as well as the MATLAB and PYTHON code can be found in my Github repository here:



Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

Du kommentierst mit Deinem Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )


Verbinde mit %s