The blog of a dedicated radio amateur and electronics enthusiast

"Having fun on the air and in the workshop - communicating and creating"
Showing posts with label I2C. Show all posts
Showing posts with label I2C. Show all posts

07 April 2019

More progress with the I2C OLED

OLED displaying real time data from MCU ADC
0.96" 32 x 128 pixel two colour OLED with I2C interface
I think the OLED is very cool. Since my last post I have been doing more with it than just turning it on or off. It quickly became obvious that mine has a 32x128px display area and not as advertised by the seller; however not really a limitation for my present purposes.
Having removed the Si5351 breakout board ( refer to previous post ) incorporating the I2C bus pull-up resistors on the SCL and SDA lines, I then had to provide these resistors separately ( 10K Ohm each ) for the OLED.
In my firmware, written in 'C' language, there is a look-up table of characters I created, with font based on a 8x8 pixel grid which gives exactly 16 characters per 128 pixel row. I have so far included only capital letters, 0 to 9, =, -, +, space and a few common punctuation marks; 41 in total.
It is essential to have the documentation for the Solomon Systech SSD1306 OLED driver. This was located and downloaded.
As in my post of 17 February 2019, the 10 bit analogue to digital converter ( ADC ) on my micro-controller unit ( MCU ) development board was used to sample the voltage on the slider of a potentiometer ( POT ) every 0.5s, and the result sent over I2C bus to be displayed on the OLED.
I now have the basics in place and ready to adapt to a future project which uses an OLED.
I would also like to try a white on black monochrome OLED which I might find easier to read.
( Note : OLED = Organic LED display ). 
     

27 March 2019

Demonstrating I2C serial communications bus

Continuing the theme on serial interfaces from the last post, Inter Integrated Circuit, ( I2C ), is another type of serial communications interface, also called '2-wire bus', and is a very common peripheral interface. There is a master device, slave device(s), addressing and also a clock, making communication synchronous. Two connections are required; serial data ( SDA ) and serial clock ( SCL ).
In this post I demonstrate using I2C with a Silicon Labs Si5351 frequency synthesiser chip and a miniature 0.96" 128/64px two colour OLED display. Both have I2C interfaces but different addresses, hex60 and hex3C respectively, and so can be connected on the same bus. 

Master reads 1 byte from slave ( SCL = clock, SDA = data )
 The I2C protocol is more complex than that for RS232/485 in the previous post. The image above shows that a 4 byte transaction is required in order for the master to read in one byte of data from a slave, ( in this case Si5351 ). Compare to RS485 in the previous post.
The master is my usual micro-controller unit ( MCU ) development board which does have embedded I2C modules. I programmed it with my own firmware to enable and setup I2C to communicate with the Si5351 and OLED.
Top MCU, bottom L OLED, bottom R Si5351 board
Using I2C, I tested the OLED by turning the display on/off and switching between normal and reverse video. I configured the Si5351 on the purple coloured break-out board to generate two square-wave output signals, on my favourite frequency 137.7KHz in the 2190m amateur radio longwave band. See image immediately below.

Si5351 generates two separate output signals simultaneously