STM32F103C8 As a Mouse With USB

by christidisp in Circuits > Microcontrollers

1751 Views, 0 Favorites, 0 Comments

STM32F103C8 As a Mouse With USB

1637932994972.jpg
1638194605340.jpg

The goal of the project is the creation of a mouse for the computer via STM32F103C8. The programs used for the code are STM32CubeIDE and STM32CubeMX.

A joystick is used so that the user is able to move the mouse. Essentially, it replaces the movement of the mouse by the other mice. This is achieved by reading the two joystick values ​​(x and y axis) from the adc. Also, the MAP library is used to reduce axis boundaries.

Furthermore, 2 buttons as well as 2 X 10k resistors were selected for the right and left clicks. The reason 10k resistors were chosen was because of the external interrupt. The right button activates the interrupt only on the rising edge, while the left on the rising and falling edge. This is done, so that the use of drag and drop can be applied.

Finally, the mouse encoder wheel and 2 X 220 resistors were chosen to be able to act like the wheel on other mice.

Circuit Diagram of the Mouse

Στιγμιότυπο οθόνης 2021-11-26 182210.png

Buttons

10k Resistors

Left button -> A8

Right button -> A9

Encoder Wheel

220 Resistors

Left pin -> A6

Right pin -> A7

Middle pin -> GND

Joystick

VCC -> 3.3V

GND -> GND

xAxis -> A0

yAxis -> A1

Components

1638194605015.jpg
1638194605094.jpg
1638194605172.jpg
1638194605240.jpg
1638194605472.jpg

Joystick works properly at 3.3V.

STM32CubeMX Configuration

Στιγμιότυπο οθόνης 2021-11-27 153537.png

Upload the STM32CubeMX.

To use STM32CubeMX file, change the .ino to .ioc.

Downloads

STM32CubeIDE Code

Στιγμιότυπο οθόνης 2021-11-26 182734.png

Upload the STM32CubeIDE.

To use STM32CubeIDE file, change the .ino to .rar.

Downloads

Project Video

STM32F103C8 As a Mouse With USB