Tutorial 5

How to draw a Mandlebrot with NavSpark



This tutorial is for drawing a Mandlebrot with NavSpark. The LCD comes as a breakout from Sparkfun. Since the display uses SPI to communicate and its own frame buffer with a low power CMOS LCD. The graphic display has 84 x 48 monochrome pixels, and it uses the PCD8544 controller that is in the Nokia 3310 LCD. 


Breakout Pinouts

The monochrome display uses SPI to receive image data.  That means NavSpark will be able to display the through software SPI with 4 pins – clock, data in, chip select, and d/c (mode select). There are other pins that you want to use, so let’s look through them all.

·       VCC – Positive Power Supply (Input) – connect to 3 – 5 VDC

·       GND – Ground (Input)

·       SCE – Chip Select (Input)

·       RST – Reset (Input)

·       D/C – Mode Select (Input)

·       DN (MOSI) – Serial Data In (Input)

·       SCLK – Serial clock (Input)

·       LED – LED Backlight Supply (Input)


Breakout Wiring and Tests

Wiring up the display in SPI mode is easy and there aren’t many pins.

·       VCC connects to VCC33 (out) – red wire

·       GND connects to GND – black wire

·       SCE connects to GPIO 10 – yellow wire

·       RST connects to GPIO 5 – blue wire

·       D/C connects to GPIO 16 – yellow wire

·       DN (MOSI) connects to GPIO 28 – blue wire

·       SCLK connects to GPIO 30 – yellow wire

·       LED connects to GPIO 3 – blue wire


The Sketch

Download the NavSpark Example Code Files from our Resources page and open the GPS Graphic LCD demo (demo_fractal_on_graphic_lcd_Nokia5110)

Here is the sketch of the demo on drawing the Mandelbrot.


The Sketch in Action

NavSpark drawing Mandelbrot figure in 48x84 pixel resolution with each point computed and drawn. As the figure appear almost instantly, computation with an FPU is quite fast.