The main goal of this tutorial is to show how to convert monochromatic bit map for HEX file and run by Attiny85 and OLED display SDD1306.
Due to running campaign for Attiny25/45/85 PCB TINY CHEAP VERSATILE Arduino compatible on Indiegogo I receive question how did I do graphics for SDD1306 OLED display.
Instruction in pdf can be downloaded from Awesome PCB web page.
This tutorial will give expanation for this question.
Step 1 - What do we need?
Step 2 – Converting bitmap to HEX
Step 3 - Run AVR Studio
Step 4 – Preparing graphic file
Step 5 - Pacman on the screen
Step 6 - Extras
Step 1: What Do We Need?
Source code for driving ATtiny85 and OLED SSD1306 display.
Software can be download from Bitbucket.org
Monochromatic bitmap HEX converter.
Software can be download from Bitmap convrter to HEX
Software can be download from AVR Studio
In our case it will be a pacman graphics.
Step 2: Converting Bitmap to HEX
For converting bitmap to HEX we will use LED Assistant. This software allowed us to change bitmap to HEX file.
HEX can be digested by microcontroller.
Load image from dedicated folder.
Our file will be called pacman
After successful load you will see image.
Now you need to save output.
Give a name for file and save.
Step 3: Run AVR Studio
Depend on the AVR studio version GUI can be different.
Currently I'm using Version 4.18 which is still OK for this purpose.
Create new project
Choose AVR Simulator and ATtiny85
Copy source from bitbucket.org to project folder (D:\OLED_SSD1306\OLED_SSD1306)
In AVR Studio mount corelated files
First from subfolder called ssd1306xled_test load main.c
Then from subfolder called ssd1306xled load num2str.cssd1306xled.c and ssd1306xled8x16.c
If everything was done properly all files should be in the Source Files
Double click on main.c
On the main window you will see source code of the main.c file
Before we go further it is worth to check if source code can be compiled.
To do this go to the top bar Build and run function Build
On the bottom line of AVR Studio you will see statu after compilation.
Green lights and 0 warnings – this is our goal.
Step 4: Preparing Graphic File
Now it is time for pacman file prepared in Step 2
Open pacman file with text editor.
You will see char table with hexadecimal value.
This is the representation of bitmap file.
Mark everyhthing from brackets and copy (Ctrl+C)
Now open folder D:\OLED_SSD1306\OLED_SSD1306\ssd1306xled_test
and open file called img0_128x64c1.h
Structer of this file will be similar to pacman file.
Delete everything inside a brakets.
and copy content by (Ctrl+V) from pacman file
Save (Ctrl+S) and close the file.
Now go to AVR Studion and one more time Build and run function Build
After succesful compilation in folder D:\OLED_SSD1306\OLED_SSD1306\default we will find file called OLED_SSD1306.hex
Step 5: Pacman on the Screen
Upload OLED_SSD1306.hex file to Attiny85 via ISP programmer and ready – pacman is on the screen :)
Step 6: Extras
Attiny25/45/85 PCB project is created with the basic idea to provide tiny, cheap and versatile PCB for ATtiny25/45/85 microcontroler, that you can leave it in your project with no regret of losing expensive Arduino board.
Check running campaing on Indiegogo.
Tech spec of the Attiny25/45/85 PCB
- size: 33.5 x 11.2 mm
- package: THT DIP8 ATtiny25/45/85
- package: SMD SO08 ATtiny25/45/85
- reset switch, top and bottom side.
- reversible components THT - top side, SMD - bottom side
- standard 6 pin ISP programming connector.
- 2 output connector with access for all pins of uC