STM32F103C8 As a Mouse With USB
by christidisp in Circuits > Microcontrollers
1821 Views, 0 Favorites, 0 Comments
STM32F103C8 As a Mouse With USB
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
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
Joystick works properly at 3.3V.
STM32CubeMX Configuration
Upload the STM32CubeMX.
To use STM32CubeMX file, change the .ino to .ioc.
Downloads
STM32CubeIDE Code
Upload the STM32CubeIDE.
To use STM32CubeIDE file, change the .ino to .rar.