Free Hand Drawing and Image Rendering on OLED SSD1306 and SH1106
by sergei_iliev in Circuits > Microcontrollers
763 Views, 4 Favorites, 0 Comments
Free Hand Drawing and Image Rendering on OLED SSD1306 and SH1106
The main goal of the project is to show how to draw text and images on OLED display SDD1306/SH1106 using Web Serial API and Acorn micro-kernel operating system.
Web OLED browser editor app was develop to run online (no need to install any programm localy on desktop) and communicate pixel changes over web serial api directly to an AVR processor running acorn micro-kernel. The processor sends changes over I2C protocol to OLED display and pixel changes are displayed instantly on screen.
Components
- Arduino NANO board
- Microchip/AVR Studio program to build and flush the project source code
- OLED display SDD1306 or SH1106
- TTL Serial Port Converter Module DB9 Connector For Arduino
- Web Browser to access OLED Editor App
- DB9 RS232 cable to connect Arduino serial port to PC serial port
Connect SSD1306 or SH1106 OLED Display to Arduino NANO
- Connect wires SDA(Yellow wire), and SCL(Green wire) from I2C OLED Display to A4(PC4) and A5(PC5) Arduino ports
- Connect wires TxD(Gray wire) and RxD(Brown wire) from DB9 TTL Serial Adaptor to D0(PD1) and D1(PD1) Arduino ports
- Connect Serial Adaptor cable to PC Com Port
Build Project From Source Code
Firmware project is based on acorn micro kernel operating system driving 2 separate tasks
- task controlling RS232 communication byte stream with PC computer
- task dealing with OLED I2C protocol communication
- Download source code from github repo - oled_ssd1306_sh1106
- Find and open project file oled_ssd1306_sh1106.asmproj in Microchip AVR Studio
- Modify source code in regard to OLED display being used -
#define SSD1306
OR
#define SH1106
Comment out the display that is not used and leave definition for the one being used
4.Build project to generate HEX file
5.Flash Hex file in NANO using ISP port (There are tones of articles on how to do this) I am using AVRISP programmer
Web Browser Editor App
Navigate to OLED Editor App and click Connect button to connect to Arduino NANO. Default baud rate is 57600 , Data Size: 8-bit ; Parity: None ; Stop Bits: 1 ; Flow Control: Off.
Description of header buttons
- Escape or Cancel - resets drawing operation
- Draw - free style bixel by pixel drawing
- Eraser - remove pixes from canvas
- Clear Canvas
- Load Image - load and display on canvas png image. Image must be 128x64 to fit the screen and will be converted to 1 bit per pixel image.
- Load Icon - load from predefined embedded in app icons
Description of Bottom buttons
- Connect - open Serial RS232 communication channel
- Disconnect
- Update OLED - send all canvas pixel or image changes to OLED display screen.
- Clear OLED