Skip to content

Latest commit

 

History

History
55 lines (35 loc) · 3.39 KB

Arduino.md

File metadata and controls

55 lines (35 loc) · 3.39 KB

VJoySerialFeeder using Arduino

General usage

It is very easy to use VJoySerialFeeder with Arduino. You can use this simple sketch to make your Arduino board ready to send data over IBUS protocol. Refer to the comments in the beginning of the sketch for instructions on how to configure your board.

Analog data is read using the 10-bit ADC which results in channel values between 0 and 1023.

Digital data is read from the digital pins and is send as channel values 0 for LOW and 1023 for HIGH or up to 16 digital pins can be encoded as bits (0 or 1) in a single channel (channel values are 16-bit integers).

Analog channels are most easily implemented with potentiometers and digital - with switches.

Using old toy-grade RC controller for PC simulators

If you have an old toy RC controller it is quite easy to read its pots with Arduino. Here is an example how such a controller has been modified.

RC

In general, every potentiometer in the RC controller has three pins - the two outer pins are for Ground and +Voltage and the center pin is for reading the output (it varies between 0 and +Voltage, depending on the rotation).

The center pins of the four pots must be connected to four of the analog pins of the Arduino.

Then you must identify the Ground pins of the pots and connect them to a GND pin of the Arduino. You need to connect just one of them because they are all connected inside the controller anyway.

Finally, for the +V pins of the pots there are two options:

(a) If the RC controller has its own power supply and you want to use it, you should connect the +V pins (again just one is needed) to the AREF pin of Arduino. In this case you must be sure that you have this definition in your sketch:

#define ANALOG_REFERENCE EXTERNAL

In this scenario the RC controller will supply the positive voltage to the pots and Arduino will use it as a reference for the ADC.

RC

(b) If you don't want to use the RC controller's power supply you can connect a +5V pin of the Arduino to the +V pins of the pots.

WARNING!
In this case the 5V you supply will most certainly propagate to the circuits of the RC controller and the controller may be powered up. If the 5 Volts are insufficient or are too high for the RC controller it might be damaged. If you are not sure what to do, the safest thing is to use (a).

If after all you decide to use Arduino's supply you should:

#define ANALOG_REFERENCE DEFAULT

A hole has been drilled in the back of the controller and 6-wire cable has been put through. Four of the wires are soldered to the four middle pot pins. The remaining two are soldered to GND and +V pins of one of the pots: RC

A 6-pin JST SM connector is glued to the case: RC

The cable connecting the controller with the Arduino Nano: RC

In VJoySerialFeeder select the correct COM port. Select IBUS protocol and hit connect.

You should click the Setup button next to IBUS and choose Use 16-bit Channels. Normally Flysky hardware uses 12-bit channels. This leaves 4 unused bits in every other byte. Thus three half-used bytes allow to pack one additional 12-bit (3x4bits) channel. When using Arduino it's not worth it to make this complicated bit packing so it's easier just to use the whole 16-bit, even though they are probably not really used.

Map your channels and enjoy!