Introduction
It so happened that my baby, as befits a boy, is fond of cars. When he grew to 5 years old, he started playing Master Rally simulator. Playing alone is not interesting, so I began to take part in it. It soon became clear that discrete keyboard control did not allow me to compete equally and fight for victory. Then I thought about the second wheel.

It turned out that every time to get and install 2 steering wheels is not an easy and very annoying procedure. So I decided to buy a pistol-type joystick - how to control radio-controlled cars.
')
Searching on the Internet, I realized that these are not produced and not sold. Since I was already familiar with the AT91SAM7 controller, I quickly decided to make a USB joystick based on it using the simplest joystick from an old radio-controlled toy. This article describes how to do this. I've been using it for a year now, but I decided to share it.
What to use?
The joystick is made on the basis of the Olimex debug
board . You can read more about this board in this
document .

We also need a joystick from some old radio-controlled toy and a USB cable. That's what happened in the end. A standard joystick with 3 buttons and two LEDs was added to the debug board. The most difficult element of the design was the connection of the trigger with a variable resistor R1. (See
diagram ). Here I used a resistor with a non-linear characteristic to obtain a larger change in resistance at a small angle of rotation.


Initially, the return spring on the steering wheel was missing (Resistor R2). But practice has shown that it is difficult to control, because the fingers do not feel the current position of the steering wheel, which leads to a violation of the tactile feedback between the steering wheel and the person. The photo below shows how the spring is installed.

Scheme
This is the
scheme :

It is necessary to add that variable resistors can be from 1 to 15 kΩ, and preferably with a linear characteristic for the steering wheel, for gas and brakes - at will. At first I put the old wire (as I thought more reliable) resistor on the steering wheel, but after a couple of months it died, so it was replaced with the usual imported one, which turned out to be more reliable. LED VD1 flashing, it flashes short flashes, if the device is successfully connected to the computer. VD2 lights up when the S3 button is turned on.
Software
For writing programs used examples from the disk company Atmel, which are freely available on the Internet. Here
you can find a project . In this project is a working binary for version AT91SAM7S256. (\ Mouse \ FLASH \ Exe \ USB.bin) It can be directly poured into the controller. For version S64, the binary is not checked directly when writing a blog. Those who want to tinker or change something can set themselves an IAR Systems environment and indulge. The advantage of the project is that it does not require a special driver for Windows XP or 7, it is picked up by the system as a standard joystick. If you wish, you can change the number of buttons and axes. The controller contains an 8-channel ADC and many ports. To program the controller through the USB port, you need to use the SAM-BA 2.15 program. All information and this program is available on the Atmel website.
