Mandelbrot Set on Pi Pico / ILI9341

Mandelbrot Set is IMHO the most famous fractal. Read here for additional info: https://en.wikipedia.org/wiki/Mandelbrot_set

This project was inspired by https://hackaday.io/project/177884-mandelbrot-on-p… I reused most of the original code, but decided to implement it with 2.8″ ILI9341 SPI tft using Pico micropython driver from https://github.com/jeffmer/micropython-ili9341. This is my first project with Pi Pico and micropython.

Step 1: Set Up…

I assume you have Pi Pico with micropython loaded, Thonny IDE installed and you are somewhat familiar with Pico and micropython. If not – there is a great introduction on all subjects related at https://www.raspberrypi.org/blog/new-book-get-started-with-micropython-on-raspberry-pi-pico/

Step 2: Get the Software…

Install ILI9341 drivers into Pi Pico’s lib directory using IDE. Download attached file and open it in IDE.

Step 3: Wire the Hardware…

Code contains definition of wiring for button, potentiometers and tft (see comments and pin definitions in the source file). The button is wired with pull-down, so that when pressed it sets Pico’s pin to 3.3V. Wire button, tft and potentiometers as defined in the code. I had tft that had voltage regulator on board so I had to power tft from 5V. If your’s doesn’t have regulator, power it from 3.3V (Pico has outputs for both when powered from usb).

Step 4: Upload and Run…

Use IDE to upload file to pico. Upon start you’ll see in serial console window of IDE how potentiometers values are translated to zoom and pan values displayed every half second. Good starting values are 0 for pan_x and pan_y, and 1 for zoom. When you press button, mandelbrot set will be built and displayd on tft, it will look like first picture. You can play with zoom and pan to see enlarged parts of the set, like shown on the second picture.

Source: Mandelbrot Set on Pi Pico / ILI9341


About The Author

Muhammad Bilal

I am a highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Leave a Comment

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

Scroll to Top