Arduino Nano clone from China

23. juni 2018 09:11 by Ron in Arduino  //  Tags:   //   Comments

The Chinese Arduino clones will do just fine for most cases but there are some differences. 

They look the same, will do the same but when you like to upload a sketch
to it you need to set some configuration fifferently than for the original.
  • Board type: Arduino nano
  • Processor: ATmega328P (old bootloader)
  • Programmer: AVRISP mkII
  • Speed: 9600 bps

Arduino Nano + OLED 0,98" display

10. juni 2018 08:49 by Ron in   //  Tags:   //   Comments

Some time has passed since my last post, still getting goodiez from China but sometimes also some ather things come along..

So here we are with a Arduino Nano and a small 128x64 0,98" OLED display.

 The OLED display has 7 pins to connect:

 OLED Arduino
1 GND - GND
2 VCC - +5v
3 D0 - D10
4 D1 - D9
5 RES - D13
6 DC - D11
7 DC - D12

You need some libraries to use with your Arduino, in this case the display comes from Adafruit so I need the Adafruit_SSD1306 driver..

For the 128x64 you need to edit the source of the library, the default is 128x32.
In the library folder you need to edit the Adafruit_SSD1306.h file and find this part:

/*=========================================================================
    SSD1306 Displays
    -----------------------------------------------------------------------
    The driver is used in multiple displays (128x64, 128x32, etc.).
    Select the appropriate display below to create an appropriately
    sized framebuffer, etc.

    SSD1306_128_64  128x64 pixel display

    SSD1306_128_32  128x32 pixel display

    SSD1306_96_16

    -----------------------------------------------------------------------*/
   #define SSD1306_128_64
//   #define SSD1306_128_32
//   #define SSD1306_96_16
/*=========================================================================*/

I commented out the #define SSD1306_128_32 line and removed the slashes in fromt of the 128x64 line..

Now some code for the arduino..

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>

// If using software SPI (the default case):

#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

void setup()   {                
  Serial.begin(9600);
  
  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC);
  display.display();
  display.clearDisplay();

  // Scroll
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(10,0);
  display.clearDisplay();
  display.println("scroll");
  display.display();
 
  display.startscrollright(0x00, 0x0F);
  delay(2000);
  display.stopscroll();
  delay(1000);
  display.startscrollleft(0x00, 0x0F);
  delay(2000);
  display.stopscroll();
  delay(1000);    
  display.startscrolldiagright(0x00, 0x07);
  delay(2000);
  display.startscrolldiagleft(0x00, 0x07);
  delay(2000);
  display.stopscroll();
}

void loop() {

//Here you can add some code
}