0% found this document useful (0 votes)
30 views6 pages

Adaptador de Joystick DB-15 Con Arduino - 3 Pasos - Instructables

This document provides a detailed guide on how to create a DB-15 joystick adapter using an Arduino Pro Micro board. It discusses the necessary components, wiring, and coding required to connect the joystick to a flight simulation program. The guide emphasizes the importance of soldering for reliable connections and includes sample code for the Arduino IDE to operate the joystick's functionalities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views6 pages

Adaptador de Joystick DB-15 Con Arduino - 3 Pasos - Instructables

This document provides a detailed guide on how to create a DB-15 joystick adapter using an Arduino Pro Micro board. It discusses the necessary components, wiring, and coding required to connect the joystick to a flight simulation program. The guide emphasizes the importance of soldering for reliable connections and includes sample code for the Arduino IDE to operate the joystick's functionalities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Adaptador de joystick DB-15 con Arduino

Por Palito en Circuitos Arduino

Introducción: Adaptador de joystick DB-15 con Arduino

Parafraseando a Lavoisier en este Instructable, no estamos tratando de crear algo ni destruir nada, solo
convertir una forma en otra.

Aunque podríamos decir que hemos conseguido un dispositivo bastante ingenioso.

Reciclar no es lo mismo que usar, de lo contrario eso suena a manipulación de basura.

Y esto suena como gestionar algunas ideas.

En la ola de la impresión 3D, preferimos la menor cantidad de materiales plásticos que sea
estrictamente necesaria.
Paso 1:

Digo todo esto porque he visto varios ejemplos de aficionados que desmantelan electrodomésticos y
los modifican por completo, o a veces solo para "recuperar" componentes, como si fueran nutrientes
para proyectos futuros inciertos.
Es preferible que descansen en paz (los artefactos, claro), completos, bien guardados si tenemos un
lugar de almacenamiento, hasta el día en que, por ejemplo, un niño nos pida uno.

Papá, ¿qué es eso? —Un teléfono, hijo. Lo que ves es un teléfono y si pones el dedo ahí, verás que
puedes girarlo y marca un número. —¿Y funciona, papá? ¿Podemos usarlo? Sí, claro... Ah, creo que
tendríamos que pelar el cable porque no tenemos un enchufe así en casa, pero... bueno, mejor lo
dejamos para otro día.

Esta conversación es absolutamente real; y el aparato que funcionaba en casa de mi bisabuela,


fabricado en Suecia hace mucho tiempo, todavía está esperando que un día encuentre o adapte algo
que funcione para él, porque realmente no queremos alterar su enchufe.

Si estás en Panne, en medio del desierto del Sahara, y uno de estos personajes se te aparece,
seguramente te pedirá que le dibujes un cordero. La petición no es como una orden judicial, pero es
igual de irrevocable.

Papá, recuerdo que vi que tenías un joystick guardado en una caja. ¿Puedo echarle un vistazo?

¡Zas! Ya tiene 7 años (el niño, el joystick más de 20) y le interesa mucho todo lo que le llame la
atención, que por cierto es bastante. Y además acaba de descubrir que hay programas de simulación
de vuelo muy realistas y que, por muy hábil que seas con el teclado…

¿Puedo…? ¿Puedo…? ¿Puedo echarle un vistazo?

¡¡¡MAY DAY!!!

Dentro de la caja efectivamente reposa el joystick, impecable, con su brevísimo manual de


instrucciones, y su ticket de compra con fecha de diciembre de 2000.

¡Ajá! DB-15, en otras palabras, un conector para conectar al puerto de juegos de la tarjeta de sonido del
viejo ordenador, ¡con 15 pines!

Seguro que Arduino nos echa una mano, ya veremos.


Paso 2:

Segunda pregunta
(ya que la primera fue "¿Puedo echarle un vistazo?", repetida varias veces): ¿Se puede conectar este
dispositivo o uno similar a una placa Arduino y obtener algún resultado? Respuesta: Sí.

The sense of including this question and its answer here is for those who have seen that it works, for
example the KY-023 joystick module in Arduino UNO with which you can turn on LEDs arranged in a
cross or also act on servo motors, but it wouldn’t behave like a joystick connected to a computer as
expected.

I should also mention that it was the first thing we did. I went to our box of 37 sensors to check if there
were one of the famous KY-023 to do the first tests as you can see in Figure 3, before moving on with
the big one. Because at this point I had already inferred that there should be several lines of code to
read and some libraries to download.

But I didn’t know that we should acquire something new for our beloved and modestly supplied
collection of electronic components.

So, third question.

Could the joystick (with its 15 pins plug) through the Arduino board comunicate with the flight
simulation program and take advantage of all its features (buttons, rudder, throttle)? Answer: Yes but no
but yes.

Yes, but not if you use the usual boards such as UNO, Nano or Mini based on the ATmega 328 chip (*).
And the answer would be yes if you choose the Pro Micro board equipped with the ATmega 32U4 chip
(**), and in this particular case We find and recommend the variant that instead of the micro usb
connector, it brings a mini usb, more manageable and resistant. (Although we actually get it for less
than u$s 5, remember that users may be under 8 years old!)

(*) There is a way to do this , it consist in reprogramming the usb protocols translator chip
ATmega16U2 -which is the other or second chip- in the UNO board, but it surpasses this work (also mi
knowledge). By the way the ATmega32U4 chip is very powerful and makes the Pro Micro board a nice
masterpiece.

(**)The Arduino Leonardo and Micro are also microcontroller boards based on the ATmega32U4, and of
course they would work the same way.

Ok so what do we need besides the Pro Micro?

Solder. You don’t have to be an expert by any means, but the Pro Micro board (unless we already have
it) can come with the pins without soldering. And it is also necessary to solder resistors, some wires,
and connector terminals to each other.

One DB15 Female D-Sub Solder Type Connector

Four 100KΩ resistors


Six Dupont Jumper Wires Male to Male 20 cm Length (which will be cut in half to connect its terminals
to the breadboard and solder the opposite ends to the DB-15 connector), preferably of different colors,
because they are soldered and with the connector clamped in place, it is difficult to identify them and
connect the corresponding pin.

One 170-point mini breadboard (usually comes with double-side tape).

Pliers, tweezers, wire strippers, soldering gadgets, magnifying glass, enough light, etc.

Any piece or assembly of parts that allows something similar to what we achieve with pieces of a
Meccano game, and whose final weight of 75 grams is enough to remain stable even if the cables
move.

There is almost always more than one way of doing things. We opted to develop a detachable device. In
a matter of hours we can find something, like for example an RC plane, and we would have to recover
our Pro Micro board if it was useful for the new project. Although my children are delighted to "lend" me
their toys, including Arduino, so that we can do new experiments, we all know that they must return to
their original state immediately at the slightest requirement. They know exactly what each piece of
Lego is and what place it occupies in what can be a clock hand, or a plastic separator between shields
and supports. But it is not a prodigy of memory, but a relentless power of control! Of course, if you are
not harassed by a couple of Sheriffs of Nottingham, or you are looking for something smaller and more
permanent, soldering everything to an experimental board, without having to have printed circuit, may
be the best solution. Among the pages I have read as research for this project, I found mention of
distortions in the signals received by the PC due to connection failures to the breadboard, so it is
recommended to solder. So far in our tests everything works perfectly as we have arranged.

This joystick consists of four potentiometers, two that respond to the X and Y axes, another for the
throttle and another for the rudder, with variable resistance values that could be between zero and 100
kΩ approx. In each of them, one end of the potentiometer is connected to the 5 volt input pin and the
center contact is connected to the analog input of the joystick. The other contact of the potentiometer
is left unconnected. This arrangement requires ground discharge through four 100kΩ resistors, one for
each analog input from the four joystick potentiometers, as we will see in the schematic circuit. The
digital pins correspond to the operation of the buttons.
Step 3: From Now on You Can Fly Alone, It’s Part of the Game.
To use the Pro Micro board, you need to download and install a driver.
Here is the link for downloading and installation instructions for both Linux, Mac or Windows:
https://learn.sparkfun.com/tutorials/pro-micro--f...

And now the code for the Arduino IDE

// To make use of this Joystick Library, we must first download it at the address:
// https://github.com/MHeironimus/ArduinoJoystickLib...

#include

#define BUTTON_1 4 #define BUTTON_2 5 #define BUTTON_3 6 #define BUTTON_4 7

#define DELAY 100

Joystick_ Joystick;

void setup() {

pinMode(BUTTON_1, INPUT_PULLUP);

pinMode(BUTTON_2, INPUT_PULLUP);

pinMode(BUTTON_3, INPUT_PULLUP);

pinMode(BUTTON_4, INPUT_PULLUP);

Joystick.begin();

Joystick.setYAxisRange(1023, 0); // You can reverse the order of these values to shift up or down

Joystick.setXAxisRange(1023, 0);

Joystick.setThrottleRange(1023, 0);

Joystick.setRudderRange(1023, 0);

void loop() {

Joystick.setXAxis(analogRead(A0));

Joystick.setYAxis(analogRead(A1));

Joystick.setThrottle(analogRead(A2));

Joystick.setRudder(analogRead(A3));

si (digitalRead(BOTÓN_1) == BAJO) {

Joystick.setButton(0, 1);
}

demás{

Joystick.setButton(0, 0);

si (digitalRead(BOTÓN_2) == BAJO) {

Joystick.setButton(1, 1);

demás{

Joystick.setButton(1, 0);

si (digitalRead(BOTÓN_3) == BAJO) {

Joystick.setButton(2, 1);

demás{

Joystick.setButton(2, 0);

si (digitalRead(BOTÓN_4) == BAJO) {

Joystick.setButton(3, 1);

demás{

Joystick.setButton(3, 0);

retrasar(RETRASO);

You might also like