Pico & SSD1306 Icons

by tonygo2 in Circuits > Microcontrollers

3015 Views, 12 Favorites, 0 Comments

Pico & SSD1306 Icons

PicoIcon2-1a.jpg
Notepad.jpg

After my previous SSD1306 Instructable I had a request from Rafael Lozano for information about how to create alternative images like the Raspberry for the SSD1306 and Pico combination.

I suggest you look at that first if you have not yet connected up your Pico and the SSD1306. Some of the supplied files will be needed for this project.

Supplies

Raspberry Pi Pico microcontroller

SSD1306 screen

Breadboard - optional

Jumper wire for connections

Downloadable software - FREE

NotePad - text editor in Windows

Thonny Editor

SSD1306 library driver file

Get the Software and Design Your Image

PaintDotNet.jpg

Download paint.net and LCD assistant from here:

https://www.getpaint.net/download.html

http://en.radzio.dxp.pl/bitmap_converter/

Using paint.net create a New drawing with 32 x 32 pixels.

You probably need to zoom in quite a lot. Use CTRL ++ to enlarge image.

Select the pencil tool.

At the top, near the middle disable antialiasing.

In the bottom left of the screen click on the black square to pick black brush colour.

Draw your design on the picture. I left the edge pixels white, like the Raspberry image.

Save as a 1-bit, BMP image, with 0 dithering. ie Image.bmp

Convert Your Image to Bytes

LCD Assistance.jpg

Start LCD Assistant and open the file you just created.

Set orientation to HORIZONTAL, Size endianness(?) to Little and Pixels/byte to 8

Save Output as a txt file ie Image.txt

Edit the Data

Notepad.jpg

Open the file in NotePad

This now needs a bit of editing:

Copy the block of code starting const and paste into the code under the buffer definition in Thonny.

Delete the semi colon at the end. Change the braces {} to brackets ()

Find and replace ‘ , 0’ ( -- comma space zero) with \

Edit the start of each line and replace the initial 0 with a \

Delete the commas from the end of each line.

Insert b” after the opening bracket and “ before the closing bracket.

Insert bytearray between the = and the bracket

Delete the newlines to make a single very long line starting:

buffer4 = bytearray(b”\x00\x ………… “)

Carefully compare the syntax with the original buffer line. (The original Raspberry code has some ‘funny’ characters. The new code should be consistent in its format: \xNN\x…)

Comment out the original buffer line

Change the line

fb = framebuf.FrameBuffer(buffer3, 32, 32, framebuf.MONO_HLSB)

To

fb = framebuf.FrameBuffer(buffer4, 32, 32, framebuf.MONO_HLSB)

Save and run your program.

You may need to look at my previous Instructable if you have not yet set up your Pico with an SSD1306 as you will need a special library.

(SSD1306 With Raspberry Pi Pico : 6 Steps (with Pictures) - Instructables )

You can download the final version here:

Update

PicoBounce

After viewing the original video and picture I noticed that there were a few moved pixels on the upright part of the P.

I have investigated and found that in editing to a single long line I had 'lost' a few 'x' s. The download program has been corrected and replaced so it now works properly. I have reshot the example video

Advice: Check very carefully the format of the long line.