4X4 Keypad Input Display Through OLED

In this tutorial basically we’re going to learn how to take input from keypad and show it on our desired OLED display. For this i would suggest you see my other tutorials as prerequisite Keypad Tutorial and OLED Display Tutorial

If you miss these tutorial you might not be able to do this.

Step 1: Working With the Oled DIsplay

Working With the Oled DIsplay
lib add.png
libinc.png
keylib2.png
FB5H28CIE7J5E55.MEDIUM.jpg

Including Library:

Both libraries below needs to be installed before you are able to continue with this instructable.
https://github.com/adafruit/Adafruit_SSD1306 (SSD1306 library)

https://github.com/adafruit/Adafruit_SSD1306 (GFX library)

The connections from the display:

VCC to arduino 5v GND to arduino GND SCL to arduino pin A5 SDA to arduino pin A4

Library Correction :

For Adafruit_SSD1306 Library:
Go to: C:\Program Files (x86)\Arduino\libraries\Adafruit_SSD1306 Open Adafruit_SSD1306.h (in a text editor like Notepad++ for example) Find and comment out the line: #define SSD1306_128_32 Uncomment the line: #define SSD1306_128_64 Open the ssd1306_128x64_i2c example in Arduino: Change address from 0x3D to 0x3C in void setup()

Step 2: Connecting the Keypad and Oled With Arduino

Connecting the Keypad and Oled With Arduino
GuWTi.png
keypad.png

Connecting keypad with aruduino digital pins:

keypadv

Keypad Pin Connects to Arduino Pin

1                              D9

2                              D8

3                              D7

4                              D6

5                              D5

6                              D4

7                              D3

8                              D2

Connecting OLED with aruduino Analog pins:

VCC to arduino 5v GND to arduino GND SCL to arduino pin A5 SDA to arduino pin A4.

Step 3: Uploading Code…

Heres the code….

#include <SPI.h>
#include <Wire.h>
#include <Keypad.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16

static const unsigned char PROGMEM logo16_glcd_bmp[] = { B00000000, B11000000, B00000001, B11000000, B00000001, B11000000, B00000011, B11100000, B11110011, B11100000, B11111110, B11111000, B01111110, B11111111, B00110011, B10011111, B00011111, B11111100, B00001101, B01110000, B00011011, B10100000, B00111111, B11100000, B00111111, B11110000, B01111100, B11110000, B01110000, B01110000, B00000000, B00110000 };
#if (SSD1306_LCDHEIGHT != 64)
#error(“Height incorrect, please fix Adafruit_SSD1306.h!”);
#endif

const byte numRows= 4; //number of rows on the keypad
const byte numCols= 4; //number of columns on the keypad

char keymap[numRows][numCols]=
{
{‘1’, ‘2’, ‘3’, ‘A’},
{‘4’, ‘5’, ‘6’, ‘B’},
{‘7’, ‘8’, ‘9’, ‘C’},
{‘*’, ‘0’, ‘#’, ‘D’}
};

 

byte rowPins[numRows] = {9,8,7,6}; //Rows 0 to 3
byte colPins[numCols]= {5,4,3,2}; //Columns 0 to 3

//initializes an instance of the Keypad class
Keypad myKeypad= Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);

 

void setup() {

Serial.begin(9600);

display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128×64) // init done // Show image buffer on the display hardware.

display.display(); //delay(2000);

display.setTextSize(1);

display.setTextColor(WHITE);

display.setCursor(10, 0);

display.clearDisplay();

display.println(“INPUT YOUR TEXT HERE: “);

// invert the display

display.invertDisplay(true);

display.invertDisplay(false);

display.display();

display.clearDisplay(); }

void loop() {

while (1) {

display.setTextSize(1);

display.setTextColor(WHITE);

display.setCursor(10, 0);

display.clearDisplay();

display.println(“input:”);

printText();

display.display();

}

}

void printText(void) {

String s;

char keypressed = myKeypad.getKey();
if (keypressed != NO_KEY)
{
Serial.print(keypressed);
display.println(keypressed);

display.display();

display.println(“\n”);
}
delay(4000);

}

 

Advertisements

Using Minim OSD in NAZA

So if you dont wanna break your bank for an iOSD module for you DJI Naza , here are some simple (yet DIY complicated) stuffs to follow.
NOTE: TRY AT YOUR OWN RISK (VERY LOW RISK IF YOU FOLLOW THE INSTRUCTIONS PRECISELY WITHOUT ERRORS OR SYNC FAILURE. YET, I AM NOT RESPONSIBLE FOR A FRIED NAZA, THERMONUCLEAR WAR OR YOU NEIGHBORS DEAD CAT
  • Arduino board (Pro Mini, 16Mhz, 5V) and serial connection (works with DJI Naza-M v1, v1 Lite and v2)
  • Teensy 3.1 board + TeensyDuino (tested with version 1.20) + CAN transciever and CAN connection (works with DJI Naza-M v1 and v2 with PMU, does not work with v1 Lite).
I did not test in flight, all the tests were done on the ground.
It converts data from Naza GPS/FC data into Mavlink and provides the following information via the MAVLink GPS_RAW_INT, ATTITUDE, VFR_HUD, SYS_STATUS and RC_CHANNELS_RAW messages:
  • latitude
  • longitude
  • altitude (barometric for CAN adapter and from GPS for serial adapter)
  • speed over ground
  • number of satellites
  • GPS fix
  • compass heading (not tilt compensated with serial adapter) or course over groud (selectable)
  • pitch and roll (for artificial horizon)
  • VSI – Vertical Speed Indicator (barometric for CAN adapter and from GPS for serial adapter)
  • battery level/percentage (CAN adapter only)
  • RC channel values (CAN adapter only)
  • flight mode: MANUAL = ACRO, ATTI = STAB, GPS = POSI, failsafe = RETL (CAN adapter only)
In addition to that HEARTBEAT is also sent periodically.
Connection diagrams and Arduino sketches are attached.
For serial adapter you need the following libraries to compile this sketch: – NazaDecoder (v20141130 or newer) – AltSoftSerial (needed because adapter communicates at 115200 baud with Naza GPS and at 57600 baud with the OSD)
For CAN adapter you need the following libraries to compile this sketch: – NazaCanDecoder (v20140921 or newer) – FlexCAN library (included in Teensyduino since v1.20 – see https://www.rcgroups.com/forums/show…&postcount=481, you can also download it separately from here)
There are follwoing configuration options in the sketch:
  • Selecting serial or CAN adater (default is serial). You need to uncomment/comment out proper #includes. For serial adapter use: Code:
// Select the adapter type you are using (either serial or CAN) by commenting/uncommenting the right includes below
// These two lines below shall be commented out when using the CAN adapter and uncommented when using serial adapter
#include "NazaDecoderLib.h"
#include "AltSoftSerial.h"
// These two lines below shall be commented out when using the serial adapter CAN adapter and uncommented when using CAN adapter
//#include "NazaCanDecoderLib.h"
//#include "FlexCAN.h"
For CAN adapter use:
Code:
// Select the adapter type you are using (either serial or CAN) by commenting/uncommenting the right includes below
// These two lines below shall be commented out when using the CAN adapter and uncommented when using serial adapter
//#include "NazaDecoderLib.h"
//#include "AltSoftSerial.h"
// These two lines below shall be commented out when using the serial adapter CAN adapter and uncommented when using CAN adapter
#include "NazaCanDecoderLib.h"
#include "FlexCAN.h"
Selecting heading source. Default is GPS, uncomment the #define line to use compass (note it is not tilt compensated for serial adapter)
Code:
// By default the course over ground from GPS will be used. Uncomment the line below to use magnetometer heading instead (not recommended when using Serial adapter as it will not be tilt compensated).
//#define USE_COMPASS_HEADING
Number of bettery cells needed for correct battery percentage calculation (3 by default). Set the number matching your battery in the following #define
Code:
// Number of battery cells (only needed for CAN adapter to show proper battery percentage)
#define BATTERY_CELL_NUM 3
Make sure that the Arduino board is disconnected from the Flight Controller/GPS for programming.
Note that you can also connect it to QGroundControl to have telemetry. The connection can be done directly or remotely (e.g. via XBee or 3DR radios).
This is not a ready to use product so don’t expect any support. It is a DIY project and you need to have some understanding of electronics and Arduino (please don’t ask me how it works or how to upload the sketch, there are many tutorials available online).
It is still in development stage so there may be errors. Use at your own risk, try to not fry your Naza..

LM35 Temparature Sensor With Arduino

LM35 Temperature Sensor With Arduino

LM35 Temparature Sensor With Arduino :

Its quite an easy project…

Step 1: Connecting on Breadboard & Code

Connecting on Breadboard & Code

 

Code: 
TMP36 Pin Variables

int sensorPin = 0; //the analog pin the TMP36’s Vout (sense) pin is connected to //the resolution is 10 mV / degree centigrade with a //500 mV offset to allow for negative temperatures /* *

void setup()

{

Serial.begin(9600);

}

void loop()

{

int reading = analogRead(sensorPin); // converting that reading to voltage, for 3.3v arduino use 3.3

float voltage = reading * 5.0;

voltage /= 1024.0; // print out the voltage

Serial.print(voltage);

Serial.println(” volts”); // now print out the temperature

float temperatureC = (voltage – 0.5) * 100 ;

Serial.print(temperatureC);

Serial.println(” degrees C”); // now convert to Fahrenheit

float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;

Serial.print(temperatureF);

Serial.println(” degrees F”);

delay(1000); //waiting a second

}

You can download the source code .ino file from here :

Instructables

BlogSpot

FB Page

 

Adjustable Voltage Regulator 317T

Adjustable Voltage Regulator 317T with minimal circuit diagram.

Parts List:

1) LM317T

2) 10uF

3) 0.1uF

4) 240 ohm

5) 50k variable resistor

6) Socket

Tools :

1) Solder Iron

2) Solder Paste

3) Rojon

Step 2: Circuit Diagram

Circuit Diagram
pinout_lm317.gif
adjustable regulator brdboard.png

Now put your LM317T on your breadboard pin 1 is adjustable voltage, pin 2 output voltage pin 3 is input voltage positive part of the 10uF capasitor should be connected with pin 1 and a 0.1uF capasitor will be connected with pin 3. The positive part of the 0.1uF capasitor should be connected with pin3. and rest of the pin of capasitor is ground. 220 ohm resistor is connected between ground and pin 2. Wiper pin of variable resistor should be connected to pin 1.Input voltage should be in the range of 7V-30V

 

Instructables

BlogSpot

DIY 5v linear voltage regulator circuit

This is a 5v linear voltage regulator circuit.Input voltage should not be more then 35V.

Step 1: Test It on the Breadboard

Test It on the Breadboard

Parts List :
1) LM7805

2) 100 nF (ceramic capasitor)

3) 10 uF (electrolite capasitor)

4)100 uF (electrolite capasitor)

5)Breadboard (optional)

Step 2: Connecting the Parts

Connecting the Parts

Now put your LM7805 on your breadboard pin 1 is input voltage pin 2 ground pin 3 is output voltage
positive part of the 10uF capasitor should be connected with pin3 and a 100nF capasitor will connected with this in parallel. Then the positive part of the 100uF capasitor should be connected with pin1.Input voltage should not be more than 25-30V and input voltage should be at least 7V. The Capacitors are for secure circuit you can ignore it if you want. The circuit is done.

0.96 OLED Display With Arduino & Getting Text From Serial Monitor

Now we start to work with 0.96′ OLED Display with arduino and we will try to display

text from the serial monitor input…

 

FTV56SDJ48PTOPH.LARGE

 

In this tutorial i will show you how to connect and test and write some data from serial monitor to a 0.96″ i2c OLED display module to an arduino.

 

Parts:

 

Breadboard and hookup wires Arduino The OLED i2c display

The connections from the display:

VCC to arduino 5v GND to arduino GND SCL to arduino pin A5 SDA to arduino pin A4

Both libraries below needs to be installed before you are able to continue with this instructable.

Step 2: Correction in Library N Code..

For Adafruit_SSD1306 Library:

Go to: C:\Program Files (x86)\Arduino\libraries\Adafruit_SSD1306 Open Adafruit_SSD1306.h (in a text editor like Notepad++ for example)

Find and comment out the line: #define SSD1306_128_32 Uncomment the line: #define SSD1306_128_64

Open the ssd1306_128x64_i2c example in Arduino:

Change address from 0x3D to 0x3C in void setup()

 

 

From examples go to adafruit SSD1306 upload the 3rd sketch.

Step 4: Getting Text From Serial Monitor to OLED Display…

Here is my code :

 

#include <SPI.h>

#include <Wire.h>

 

#include <Adafruit_GFX.h>

 

#include <Adafruit_SSD1306.h>

#define OLED_RESET 4

Adafruit_SSD1306 display(OLED_RESET);

#define NUMFLAKES 10

#define XPOS 0

#define YPOS 1

#define DELTAY 2

#define LOGO16_GLCD_HEIGHT 16

#define LOGO16_GLCD_WIDTH 16

static const unsigned char PROGMEM logo16_glcd_bmp[] = { B00000000, B11000000, B00000001, B11000000, B00000001, B11000000, B00000011, B11100000, B11110011, B11100000, B11111110, B11111000, B01111110, B11111111, B00110011, B10011111, B00011111, B11111100, B00001101, B01110000, B00011011, B10100000, B00111111, B11100000, B00111111, B11110000, B01111100, B11110000, B01110000, B01110000, B00000000, B00110000 };

 

#if (SSD1306_LCDHEIGHT != 64)

#error(“Height incorrect, please fix Adafruit_SSD1306.h!”);

#endif

 

void setup() {

Serial.begin(9600);

display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128×64) // init done // Show image buffer on the display hardware.

display.display(); //delay(2000);

display.setTextSize(1);

display.setTextColor(WHITE);

display.setCursor(10, 0);

display.clearDisplay();

display.println(“INPUT YOUR TEXT HERE: “);

display.invertDisplay(true);

display.invertDisplay(false);

display.display();

display.clearDisplay(); }

 

void loop() {

while (1) {

display.setTextSize(1);

display.setTextColor(WHITE);

display.setCursor(10, 0);

display.clearDisplay();

display.println(“input:”);

printText();

display.display();

}

}

 

void printText(void) {

String s;

if (Serial.available()) {

s = Serial.readString(); //getting string input in variable “s”

display.println(s);

display.display();

display.println(“\n”);

}

delay(4000);

}

 

You will find the arduino .Ino file in the link below…

Instructables

Blog Spot

FB Page

Arduino Keypad 4×4 Tutorial

Arduino and 4X4 Matrix Keypad

In this tutorial we will learn how to connect a keypad with arduino and get started.

keypadv

After connecting as shown here we need to upload a code on our arduino.

Connecting keypad with aruduino digital pins:

Keypad Pin Connects to Arduino Pin

1                                          D9

2                                          D8

3                                          D7

4                                          D6

5                                          D5

6                                          D4

7                                          D3

8                                          D2

 

Adding the library :  

To add the library go to Skeetches –>>Include library–> Type the libray name “keypad” then press install. Heres how:

Here’s the  Code :

#include <Keypad.h>

const byte numRows= 4; //number of rows on the keypad

const byte numCols= 4; //number of columns on the keypad

char keymap[numRows][numCols]=

{

{‘1’, ‘2’, ‘3’, ‘A’},

{‘4’, ‘5’, ‘6’, ‘B’},

{‘7’, ‘8’, ‘9’, ‘C’},

{‘*’, ‘0’, ‘#’, ‘D’}

};

byte rowPins[numRows] = {9,8,7,6}; //Rows 0 to 3

byte colPins[numCols]= {5,4,3,2}; //Columns 0 to 3

Keypad myKeypad= Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);

void setup()

{

Serial.begin(9600);

}

void loop()

{

char keypressed = myKeypad.getKey();

if (keypressed != NO_KEY)

{

Serial.print(keypressed);

}

}

Instructables

BlogSpot

FB Page