Making a Pen Mouse Using Arduino

by AshkanK1 in Circuits > Arduino

371 Views, 2 Favorites, 0 Comments

Making a Pen Mouse Using Arduino

mouse.jpg

Have you ever wondered how the mouse or any other device capable of controlling the computer mouse pointer works?

In this tutorial, I'm going to teach you how to control a mouse pointer using Arduino

1-This series of training will consist of three videos, in the first video I will write a program for Arduino, using which you will be able to launch a touch screen and extract the desired values ​​for mouse control from it.

2-In the second video, you will learn to create a C# program to process the data extracted from the touch screen that is sent to the computer through the Arduino serial port to control the mouse.

3-In the third video we will create a pcb for the project.

If you understand well what is taught in this video, you can control the computer mouse through different ways, for example, you will be able to control the computer mouse through the gyroscope sensor, joystick, etc.

So stay with me until the end of the training :)

Supplies

What hardware do you need?

1 - Arduino uno or any other model

2 - Resistive Touch Screen Overlay

3 - A few jumper wires

What software do you need?

1 - Arduino IDE

2 - Visual Studio

What Is a Touchscreen

What is a touchscreen?

A touch screen sensor is the part of a touch screen device that takes input from the display screen and translates it into a suitable output action. Touchscreen sensors are layered on top of electronic visual displays and allow direct interaction with the information shown there. Some touch screens require special equipment, such as a stylus, while most can be operated using your fingers.

What are touch screen sensors used for?

Touchscreen sensors are used in mobile technology, gaming, point-of-sale systems, and other industrial applications.

Types of touchscreen sensors

Resistive touch screen sensors work by using two layers of material to measure a change in the resistance on the screen, which is then translated into an electronic signal. These are often used alongside industrial monitors, for example, as they can be operated while wearing gloves.

Capacitive touchscreen sensors consist of a pane of glass covered in a conductive material. The screen's electrostatic field is disturbed when touched, which is interpreted as an input. Capacitive touch screens require little pressure and are very sturdy.



Wiring of a Touch Screen

TS_pin-config.JPG

How is the wiring of a touch screen?

Of all the kinds of touch screens available, Resistive touch screens are easy to interface, cheap and have fair sensitivity. Resistive Touch screens are simply transducers. This touch screen has a resistive layer in both X and Y directions. According to the position of the touch, Their X channel and Y channel resistance changes. So, what we have to do is we have to determine the X and Y Channel resistance to get the position of the touch in terms of X and Y coordinates.

To Interface Resistive touch screen with a microcontroller, you will need a microcontroller with an inbuilt Analog-to-Digital converter having two or more channels. This is needed because, the touch screen will provide data in terms of an analog voltage on two different pins, using which, we have to determine position of the touch. Also, ADC input pins of the microcontroller should be configurable as general-purpose I/O (GPIO). As shown, in the figure, the touch screen has a total of 4 wires coming out. To read the position of the touch, we have to first read touch position sequentially i.e. first read X position and then read the Y position. To do this, connect X1 and Y2 pins of touch screen to ADC multiplexed GPIO pins of the controller. And connect X2 and Y1 pins of touch screen to simple GPIO pins of the microcontroller.

To better understand the function of a touch screen, you can read the attached pdf file.

In this project, the way to connect the touch screen to Arduino is as follows :

Artuino pin ------- TouchScreen pin

A3 ================>Y1 or Yp

A2================>X1 or Xm

9=================>Y2 or Ym

8=================>X2 or Xp


Downloads

Arduino Programming

آموزش ساخت قلم نوری با آردوینو و تاچ اسکرین مقاومتی صفر تا صد 🤯

In this project, I have used the touch screen library, you can download this library from the following link:

TouchScreen.h Library

I have recorded the corresponding code as a video file to avoid your laziness .

So watch the video till the end and try coding yourself. :)

NOTE : Never try to copy a tutorial project without taking the time to do it yourself