Sending Data from Arduino to Smartphone using Matrix Keypad

Arduino UNO 18-01-25
34 0

Tutorial plan

1- What is a 4x4 matrix keyboard ?

2- How Arduino send data from matrix keypad to Smartphone ?

3- Components Needed

4- Wiring the Components

5- Arduino program

6- Mobile application with MIT App Inventor

 

 

What is a 4x4 matrix keyboard ?

A 4x4 matrix keyboard is a type of input device commonly used in electronics projects and embedded systems to capture user input. It consists of 16 keys arranged in a 4-row by 4-column matrix, forming a grid. This matrix layout minimizes the number of microcontroller pins required to interface with the keypad, making it efficient and easy to use.

Working Principle

1. Scanning Process:

The microcontroller activates one row at a time by sending a signal (logic HIGH or LOW) to that row.

It then checks each column to see if a connection is made (i.e., if a key is pressed).

2. Key Press Detection:

When a key is pressed, the corresponding row and column are shorted.

The microcontroller identifies which row is active and which column is shorted, allowing it to determine the pressed key.

3. Matrix Encoding:

By mapping each row-column pair to a specific character, the microcontroller can interpret the key pressed.

How Arduino send data from matrix keypad to Smartphone ?

This project demonstrates how to send input from a 4x4 matrix keypad connected to an Arduino to a smartphone using the HC-06 Bluetooth module.

System Workflow

1. The user presses a key on the matrix keypad.

2. The Arduino detects which key is pressed and sends the corresponding data (e.g., number, letter, or symbol) to the HC-06 Bluetooth module.

3. The HC-06 Bluetooth module transmits the data wirelessly to the smartphone.

4. The smartphone app receives the data and displays it on the screen.

 

Components Needed

Arduino Uno :

Arduino Uno

Processes the input from the matrix keypad and communicates with the HC-06 module.

4x4 Matrix Keypad:

User input device for entering numbers, letters, or commands.

HC-06 Bluetooth Module:

HC-06 Bluetooth Module

Handles wireless communication between the Arduino and the smartphone.

Connecting Wires:

Jumper wires

For connecting the keypad and HC-06 to the Arduino.

Smartphone:

Receives data via Bluetooth and displays it using an App Inventor app.

App Inventor:

Used to design and build the smartphone app for receiving data.

 

Wiring the Components

4x4 Matrix Keypad to Arduino:

We connect the 8 outputs of the keypad to the 8 pins of the ESP32 card following this order: D2, D3, D4, D5, D6, D7, D8 and D9.

HC-06 Bluetooth Module to Arduino:

VCC → Arduino 5V

GND → Arduino GND

TXD (Transmit) → Arduino RX (Pin 10)

RXD (Receive) → Arduino TX (Pin 11)

 

Arduino program

The following code reads input from the keypad and sends it to the smartphone via the HC-06 module.

We must install Keypad library.

 

Mobile application with MIT App Inventor

Designing the Interface

1- Open MIT App Inventor (appinventor.mit.edu).

2- Create a new project and design the app interface with:

A ListPicker for Bluetooth device selection.

A Label to display the received key data.

A BluetoothClient component for communication.

3- Setting Up the Blocks

a) Starting with Android 12, Bluetooth permissions have been enhanced to improve security and user data protection. This is why we must declare the authorizations that your application needs in the AndroidManifest.xml file. For Bluetooth, you'll need to include ACCESS_FINE_LOCATION, BLUETOOTH_SCAN, and possibly BLUETOOTH_CONNECT permissions, depending on the features you're using.

b) Add the the necessary blocks to connect the smartphone to the HC-06 Bluetooth module

c) Receive and Display Data:

Use the BluetoothClient.ReceiveText block to continuously read data sent from the Arduino.

Display the received data in the Label.

 

Testing the System

1-Connect the Arduino to your computer and upload the code.

2- Ensure the HC-06 is connected and powered properly. The LED on the HC-06 should blink, indicating it's ready for pairing.

3- Pair the HC-06 with your smartphone via Bluetooth settings.

4- Launch the App Inventor app, connect to the HC-06 using the ListPicker, and wait for the connection.

5- Press keys on the matrix keypad and observe the data appearing on the smartphone app.

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info