ATmega1608 Driving Multiple SH1106 Displays Using PCA9548A
by sergei_iliev in Circuits > Microcontrollers
42 Views, 0 Favorites, 0 Comments
ATmega1608 Driving Multiple SH1106 Displays Using PCA9548A
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
- ATMega1608 adaptor board
- Microchip/AVR Studio program to build and flush the project source code
- OLED display 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
- UPDI programmer
Connect Mega1608 to PCA9548A
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
- task controlling RS232 communication byte stream with PC computer
- task dealing with OLED I2C protocol communication
- Download firmware source code from github repo - mega1608_pca9548a_oled_sh1106
- Find and open project file pca9548a_sh1106.asmproj in Microchip AVR Studio
- Build project to generate HEX file
- Flash Hex file using UPDI compatible programmer
Web Browser Editor App
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.
- OLED Chanel selector - selects the target OLED to send the image to
- 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
Display Image on Single OLED
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
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