Project tutorial
Oled Display with Arduino 101

Oled Display with Arduino 101 © GPL3+

After many failed attempts, find the way to connect my 128X64 screen with my Arduino 101, and make a mini tutorial for all users to use.

  • 6,865 views
  • 1 comment
  • 28 respects

Components and supplies

Apps and online services

About this project

Arduino and my OLED display

Months ago I bought my Arduino 101 and wanted to connect my shields and modules that I used in Arduino One, but there were always problems with the libraries and there were many headaches. I was looking for information on the internet and could not find my answers.

Today I finally found the way to connect my OLED screen of 0.96 inches with Arduino 101 and I want to share my discovery with this tutorial, since it could help many people with the same problem as me.

Steps

  • Materials

To do this tutorial, we need materials, in this case we will use an Arduino 101, the OLED screen with the model SSD1306 of resolution 128X64 pixels, cables, a potentiometer and a protoboard.

  • Code

Then open Arduino IDE and copy and paste the next code:

#include <Arduino.h> 
#include <U8g2lib.h> 
#ifdef U8X8_HAVE_HW_SPI 
#include <SPI.h> 
#endif 
#ifdef U8X8_HAVE_HW_I2C 
#include <Wire.h> 
#endif 
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);   // All Boards without Reset of the Display 
int a=0; //variable of value of analog read pin 
char taco[4];//variable to send text to the oled display 
void setup(void) { 
 u8g2.begin();// Oled display begins 
} 
void loop(void) { 
 a=analogRead(A0); //read potentiometer value 
 sprintf(taco,"%04d",a); //convert potentiometer value to string 
 u8g2.clearBuffer();					// clear the internal memory 
 u8g2.setFont(u8g2_font_inr38_mf);	// choose a suitable font 
 u8g2.drawStr(0,60,taco);  // write something to the internal memory 
 u8g2.sendBuffer();					// transfer internal memory to the display 
 delay(1000);   

For everything to work we must download the library u8g2.

All the information of this library is here.

After uploading the code, and having connected the potentiometer to the Arduino plate, the value of the potentiometer can be seen in the display, from 0 to 1023, as shown below.

With these steps, I was finally able to use my OLED screen with this board and I can go on, in my next projects.

Code

Code Arduino
Code to send information to the OLED display
#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);   // All Boards without Reset of the Display


int a=0; //variable of value of analog read pin
char taco[4];//variable to send text to the oled display
void setup(void) {
  u8g2.begin();// Oled display begins
}

void loop(void) {
  a=analogRead(A0); //read potentiometer value
  sprintf(taco,"%04d",a); //convert potentiometer value to string
  u8g2.clearBuffer();					// clear the internal memory
  u8g2.setFont(u8g2_font_inr38_mf);	// choose a suitable font
  u8g2.drawStr(0,60,taco);  // write something to the internal memory
  u8g2.sendBuffer();					// transfer internal memory to the display
  delay(1000);  
}

Schematics

My circuit
Normal bb zpqhcgz8zl

Comments

Similar projects you might like

Arduino 101 Connects with Raspberry Pi Zero W

Project tutorial by Alexis Santiago Allende

  • 8,408 views
  • 0 comments
  • 17 respects

Programmable Pocket Power Supply with OLED Display

Project tutorial by Shahariar

  • 6,324 views
  • 6 comments
  • 28 respects

(Updated) Digital Clock w/ Mirrored Display for UNO-R3 & 101

Project tutorial by LAGSILVA

  • 995 views
  • 0 comments
  • 3 respects

SMS alerts for arduino 101 BLE

Project tutorial by Alexis Santiago Allende

  • 2,062 views
  • 0 comments
  • 8 respects

Arduino 101 BLE App

Project in progress by Alexis Santiago Allende

  • 10,796 views
  • 26 comments
  • 51 respects

Arduino/Genuino 101 BLE Thermometer With TMP102 and Blynk

Project tutorial by Konstantin Dimitrov

  • 7,876 views
  • 1 comment
  • 26 respects
Add projectSign up / Login