Here, an AVR microcontroller (Atmega-8) is used to design a bare minimum motion sensing joystick for controlling games in computer.
Components Used:
An Atmega-8L, overclocked at 12MHz runs virtual USB library and emulates an USB keyboard in HID mode. It senses the motion data from a 2-axis accelerometer using the ADC.
A video demonstration where NFS is played using this joystick.
Components Used:
- ATmega-8 Microcontroller
- 2-axis accelerometer (MMA6361)
- Resistors,Capacitors & Zener diodes
- USB female connector and cable
- Headers, Connecting wires
An Atmega-8L, overclocked at 12MHz runs virtual USB library and emulates an USB keyboard in HID mode. It senses the motion data from a 2-axis accelerometer using the ADC.
The accelerometer is set at high 'g' and the voltage range obtained was around 0.8V to 2V with 1.35V at neutral position for both axis. For example, an extreme left tilt will give 0.8V and on the right side would be 2V. We added a filter capacitor to each axis output to minimize the noise in voltage. The following sketch was rendered by diptrace.
The initial position (null position) is taken as reference by Atmega-8 using its ADC. The tilts are computed and are compared with the threshold values. Whenever the ADC values from X and Y axis cross the threshold, the corresponding keys are relayed to the PC. Since Atmega8 runs vusb library for USB keyboard, any key can be customized based on game requirements.
A video demonstration where NFS is played using this joystick.
Here, motion sensor's data is mapped to 4 keys and are transmitted to PC through USB port. Similarly one can add push buttons along with accelerometer and can increase the controllability of the game by customizing the required keyboard keys.
Comments
Post a Comment