Giter VIP home page Giter VIP logo

i2c-display-on-pi3's Introduction

I2C Display on balena Example

This is a simple and extensively commented example on how to use an I2C peripheral connected to a Raspberry Pi 3 running on the balena platform. (Disclaimer: I work for balena.)

The concepts shall be the same regardless of which I2C peripheral you want to use, but here I am using a little 128x64 pixels monochrome OLED display driven by an SSD1306 chip. It's similar to this Monochrome 0.96" 128x64 OLED Graphic Display by Adafruit.

Anyway, go check the code. It's well-documented.

Connections

A picture would definitely help here, but for now all I have is this:

Display Pin Raspberry PI GPIO Pin Number Raspberry PI GPIO Pin Description
VCC 1 3v3 Power
GND 6 Ground
SDA (Data) 3 GPIO 2 (I2C1 SDA)
SCL (Clock) 5 GPIO 2 (I2C1 SCL)

Actually there's not much margin to be creative when connecting I2C peripherals to a Pi, but you may want to check the Raspberry Pi Pinout website for some more info.

Further experiments (left as exercise to the reader!)

I2C Baud Rate

I was able to improve the refresh times of my display by increasing the I2C baud rate. In a balena world, you simply need to set the config variable BALENA_HOST_CONFIG_dtparam to i2c_arm=on,i2c_baudrate=1000000.

The magic is really done by i2c_baudrate=1000000, but you also need to add i2c_arm=on to ensure I2C is enabled. balena will enable I2C by default, but since we are manually changing the dtparams, we have to explicitly set all the values that matter for us. (This would be the same for other parameters that balena sets by default, like audio=on).

i2c-display-on-pi3's People

Contributors

lmbarros avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.