ATmega1608 Driving Multiple SH1106 Displays Using PCA9548A

by sergei_iliev in Circuits > Microcontrollers

67 Views, 1 Favorites, 0 Comments

ATmega1608 Driving Multiple SH1106 Displays Using PCA9548A

33.png

The main goal of the project is to show how to draw images on multiple OLED displays SH1106 using PCA9548A I2C multiplexer, Web Serial API and Acorn micro-kernel operating system [github].

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. Each OLED display corresponds to a chanel which is selectable by the app. There are 8 separate chanels and additional "Select All Displays" which correspond to PCA9548A multiplexer chanels connected to separate OLEDs - one diplay per chanel.

The processor recieves [chanel:command:bytes] block,parses it, selects the chanel and then sends changes over I2C protocol to OLED display and pixel changes are displayed instantly on screen.


Components

33.png
  1. ATMega1608 adaptor board
  2. Microchip/AVR Studio program to build and flush the project source code
  3. OLED display SH1106
  4. TTL Serial Port Converter Module DB9 Connector For Arduino
  5. Web Browser to access OLED Editor App
  6. DB9 RS232 cable to connect Arduino serial port to PC serial port
  7. UPDI programmer


Connect Mega1608 to PCA9548A

0.png

Connect CPU PORTA SCL pin 1 to PCA9548A PIN4 SCL pin 4

Connect CPU PORTA SDA pin 32 to PCA9548A PIN4 SDA pin 3


Connect PCA9548A to SH1106 OLEDS

Connect PCA9548A addressing pins A0,A1,A2 to ground zero to make the I2C address 0x70 and use it in MCU programming code

Connect PCA9548A channels to each and every OLED using pull up resistor for each I2C connection.

Connect Mega1608 UART to TTL Serial Converter

Connect CPU UART-0 PORTA RxD pin 31 to RS232 TTL Converter

Connect CPU UART-0 PORTA TxD pin 30 to RS232 TTL Converter

Build Project From Source Code

Firmware project is based on acorn micro kernel operating system driving 2 separate tasks

  1. task controlling RS232 communication byte stream with PC computer
  2. task dealing with OLED I2C protocol communication


  1. Download firmware source code from github repo - mega1608_pca9548a_oled_sh1106
  2. Find and open project file pca9548a_sh1106.asmproj in Microchip AVR Studio
  3. Build project to generate HEX file
  4. Flash Hex file using UPDI compatible programmer


Web Browser Editor App

1.png

Navigate to OLED Editor App and click Connect button to connect to ATMega1608. Default baud rate is 57600 , Data Size: 8-bit ; Parity: None ; Stop Bits: 1 ; Flow Control: Off.

  1. OLED Chanel selector - selects the target OLED to send the image to
  2. Escape or Cancel - resets drawing operation
  3. Draw - free style bixel by pixel drawing
  4. Eraser - remove pixes from canvas
  5. Clear Canvas
  6. 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.
  7. Load Icon - load from predefined embedded in app icons

Description of Bottom buttons

  1. Connect - open Serial RS232 communication channel
  2. Disconnect
  3. Update OLED - send all canvas pixel or image changes to OLED display screen.
  4. Clear OLED


Display Image on Single OLED

22.png

Select an OLED chanel number from the list in Web app and load an image or draw pixel by pixel on canvas

Send the image to CPU and view the resule

Display Image on All OLEDS

11.png

Select "Apply to All Chanels" from the list in Web app and load an image or draw pixel by pixel on canvas

Send the image to CPU and view the resule

Project Source