Arduino Pills – Setting up IDE and Libraries

Another quick pill about Arduino, this is about setting up the IDE and manage libraries.

Arduino IDE (Integrated Development Environment) is not as advanced as other solutions but it’s quite light and easy to use. It can be found here.

Once installed, you might want to change the default sketchbook location by opening FilePreferences.
Now download, save and open a source file, for instance the one we are using in the Step by Step guide (it can be found here on AM-STUDIO’s GitHub) then compile it. You will get a number of errors, let’s review them.


Libraries are, simply put, a collection of methods and functions that tell the board how to perform certain tasks. The default package contains only a little fraction of the available libraries, not to mention the fact that you can write your own. The “Joystick” library, that our project requires, does not come by default so we have to install it in a specific location. That location is the “libraries” subfolder of the aforementioned default sketchbook location.

“libraries” subfolder location

Let’s download the Joystick library from GitHub and install it.
Careful though to respect the order of the subfolders: the ZIP file comes with a folder called “ArduinoJoystickLibrary-master”; if you copy this folder in your libraries your project won’t compile. So:

  1. open the ZIP file;
  2. open the “ArduinoJoystickLibrary-master” folder;
  3. copy the “Joystick” folder;
  4. Paste it into your Arduino “libraries” folder.

A couple of friends had to install the “keypad” folder as well. This library can be installed in a different and faster way. Go to SketchInclude LibraryManage Libraries and look for “keypad”. Scroll until you find the library I have selected in the following screenshot and install it.

Installation of the Keypad library

Lord of the boards

Last step is selecting the correct board and the relative port. Depending on which board you have bought, select either “Arduino Leonardo” or “Arduino/Genuino Micro” from the ToolsBoard: “xyz”. Then, in a similar way, select the correct port from the “Port” menu: ToolsPort: “xyz”.
Both entries report the last option selected.

Quick troubleshooting

Always try to isolate the issue. Since we are using a source code that definitely work you should fairly easily found the issue, at this stage is either a library problem or missing or a connectivy issue. The IDE suggests you where the problem is. The following, for instance, is caused by the selection of an incorrect Port.

Arduino uploading error: wrong port selected


Arduino Control Box: a Step by Step Guide – Part 6 – Release the Solderer!

“Solderer” – Is that even English? Not sure.. I’ve just seen the release trailer for the Kraken in Star Citizen and I got carried away..

Anyway, part 5 ended with every component allocated and screwed in its location. Now it’s time to replicate the wiring diagram into reality.


Soldering the wires is not difficult at all, it’s just a matter of practice. Here are a couple advices that might help you:

  • Don’t overheat! don’t leave the soldering iron in contact with wires and components for too long. You can melt the plastics of both the components and the wires.
  • Leave the Arduino board for last. Especially if you are not used to solder, it might happen to drop drops of melted solder wire. If one of them falls on the board, it might cause severe damages to it.
  • Place the wires first. Most of the components have a small hole on their pins. You can usually place your wire there before soldering it.
  • Pre-solder wires and contacts of any component that haven’t the aforementioned hole. By doing that you will need to hold your wire with one hand, the soldering iron with the other and that’s it: the solder material is already in place.
    To pre-solder just place the iron and the solder in contact with the uncovered core of a wire. You will notice that it will be quickly covered by the solder; making your life much, much easier.
  • Clean your soldering iron every now and then. Solder and antioxidant might accumulate on the iron after a while (they usually form a black mass). Hold the soldering iron tight with your hand, make sure there’s nothing in the area underlying the iron and hit your table with your fist: the burnt material will drop from the soldering iron. Nice and easy.
  • Save your furniture! Melted solder and the iron itself are hot, easily more than 300+ deg C. Although the solder becomes cold in milliseconds, it can still damage your furniture. Place some cardboard or do your soldering on an appropriate surface. You will thank me when your wife won’t kill you for damaging her precious table 😉
  • If you have to connect a wire where another one is already soldered, add some solder and pre-solder the new wire. The new material will help spreading the heat.
  • Same as the previous point, if you do a mistake and can’t remove a soldered wire, add some solder: it may sound unintuitive but it helps spreading the heat uniformly.

That being said, this phase is quite straightforward as long as you follow a plan. I usually follow the same order I adopt when designing the wiring diagram; therefore I start from the wire that comes from the top pin of the board (although the board is always my last step) then proceed with every common connection such as GND. When the matrix is completed I then solder the encoders.


After completing the soldering of the circuit we can proceed and perform a quick test the continuity of GND, lines and buses by means of a multimeter. Do this check before connecting the board to the USB. The board is protected and we are working with low tensions but you know, better safe than sorry.
If the test doesn’t show any issue we can plug the board, load up Arduino IDE and write our firmware.

Ka-50 A-10C – Sharing Data IV: Bearing & Distance and Final Thoughts

The last part of the guide covers an alternative method of sharing a target (or, more precisely, any point) location. The reference point must be known by both parties (it can be the bullseye or an IP, just to name a couple). This method is not precises as latlong coordinates but it’s worth knowing nevertheless.

Bearing and distance

Lat/long coordinates actually are not the only way to provide the location of a target to another aircraft. As you can see in the picture regarding the ERBL, both bearing and distance are displayed besides lat/long coordinates. However those data are referred to your position, which usually changes often. Fortunately we can choose a different reference point, pressing the “MARKER” FSK. This point can be, e.g. the Bullseye used by A-10s or an IP, previously communicated and inserted with the PVI-800 (as the picture below shows).
The “MARKER” function can be activated only when the ABRIS is in ERBL mode. First of all place the ERBL cross over the Bullseye or the reference point. Now press the “MARKER” FSK. The cross will turn in a triangle, a new one will appear and all you have to do is just move it over the target. Distance and bearing to target (as well as other data) are real-time calculated.

Providing bearing and distance can be useful sometimes, but is not an accurate method. Each step you follow adds an error, which increases considerably over long distances. Moreover, bullseye coordinates saved via PVI-800 aren’t precise and the approximation introduced rounding heading values can result in an error that can be calculated as:

Position_Error = Range * Bearing_Error [in radians]

Therefore ½ degree of bearing measurement error would result in ~8.7m position error per kilometer of range from the reference point.

Moreover remember that Ka-50s use True bearing, but A-10s use Magnetic bearing. Therefore you have to subtract the magnetic declination value (MVR) every time you provide a bearing. Also remember that default unit of measurement for distance is in metric system (km).

However bearings and distance combination can be useful, especially to provide an approximated indication of target’s position. For this purpose a distinctive geographical element close to the target can be efficiently used as the reference point.

Bearing & Distance from the ABRIS

Final considerations

Even if A-10s and Ka-50s haven’t a common system which should allow them to share data directly, there is more than a way to move around the problem. Summing up, the Ka-50 can use:
1. ABRIS to provide lat/long coordinates;
2. ABRIS to provide distance and bearing;
3. PVI-800 to provide lat/long coordinates;
All you have to do is choose the most performing way, basing your evaluation on your task and the situation around you.

Additional final thoughts

This guide is definitely old; there are so many new aircraft in the DCS’ skies compared to when I wrote it. Nevertheless we lack a real attack helicopter besides the Ka-50 and that makes this platform a niche yet a still relevant module.
I plan to write a similar guide for the Mi-24P and the AH-1S, depending on the capabilities of their simulated avionics.

Aye, it will take a decade 🙂

Ka-50 A-10C – Sharing Data III: Ka-50 to A-10C

Part 3 covers the acquisition of the target latlon location; information that can be shared with other platforms. Back in the days was the A-10C, now it can be a AV-8B N/A or a F/A-18C.
This part also cover the reception of latlong coordinates and how are the fed into the Ka-50’s avionics.

There are two possible ways to get a target’s coordinates: with the ABRIS or the PVI-800. The first one is more precise (~20m), the second one is far less precise (~200m) but it’s faster.

Coordinates acquisition by means of the ERBL function of the ABRIS

Getting coordinates with the ABRIS

Before using this method you need to lock a target and save it into your PRTz, so it will appear in your ABRIS.
To get the coordinates of a target we will use the ABRIS in ERBL mode. To enter this mode, cycle with the 5th FSK, entering the NAV mode. Pressing this FSK enable the ERBL mode: a cross will appear and, below the map, you will find coordinates of the position under the cross as well as other data, like bearing and distance. As you have already imaged, you can now move the cross over the symbol of a target acquired with the PRTz and read its coordinates.
To move the cross use the right knob on the ABRIS. Press it to toggle from vertical and horizontal slew and vice-versa. To obtain the best result, use the Zoom in FSK.

This procedure is not very fast and requires a lot of attention, therefore it’s not a bad idea to recon a Battlefield Area, save your targets in the PRTz, move into a safe and covered position and only then communicate the coordinates.

An alternative to this procedure uses the “Info” function (first FSK in the picture above). This functions provides some info like coordinates and elevation of the selected position. However, while acting as an AFAC, you usually need bearing and distance from a known position (usually an IP) in order to provide a complete 9-line procedure and you can’t get those data with the Info function.

Getting coordinates with the PVI-800

We’re now going to see how to save a target position and get its coordinates. This method is faster than the one which uses the ABRIS, but it’s less accurate.
First of all, we have to prepare the PVI-800:

  1. set the PVI mode in ‘EDIT’ with the PVI Master Mode knob;
  2. set the switch next to the PVI Master Mode knob (‘INU/UPDATE’) to the ‘INU’ position (“I-251V Shkval – Fly over INU update” – see the Black Shark manual, page 6-65);
  3. select the ‘NAV TGT’ button on the PVI-800.

A number will appear on the PVI-800. This number represents how many NAV TGT points are stored inside PVI-800’s memory. Now select a number, press the Shkval designate key (with the laser in STAND-BY position) and the coordinates of the position pointed by the Shkval will appear on the PVI-800. Now you can save this data by pressing the ‘ENTER’ key.
NAV TGT points saved with the PVI-800 are represented in the ABRIS by a rectangle with a number written into. Each number corresponds to the number assigned to each NAV TGT point saved.
A NAV TGT point can be assigned directly to a PRTz target, just select a target type (first row on the PRTz) and press ‘SEND/MEM’.
Just remember to restore the PVI-800 to previous settings, turning the PVI Master Mode knob on ‘OPER’ position, and the switch next to it in ‘UPDATE’ position.

Receiving coordinates

As you can read coordinates with the PVI-800, so you can enter coordinates with it.
The procedure is quite similar to the one used to get coordinates of a target locked with the Shkval:
1. set the PVI mode in ‘EDIT’ with the PVI Master Mode knob;
2. select the ‘NAV TGT’ button on the PVI-800;
3. select a number, which will identify this NAV TGT point.
Now you can enter the coordinates. Remember to use the button 0 (zero) for North and Eest, and button 1 for South and West. When you have finished, press ‘ENTER’ to save. Again, restore the PVI Master Mode knob to its previous position.

NAV TGT points are represented by a square with a number in the middle (this number identifies the NAV TGT point). Therefore, pressing a number in the PVI-800 while in NAV TGT mode will select the corresponding point. Selected points will flash on the ABRIS.

A NAV TGT point added by means of the PVI-800 is displayed on the ABRIS

Ka-50 A-10C – Sharing Data II: Ka-50 to Ka-50

Part 2 of my ancient guide, covering the coordination within Ka-50s.

A Ka-50 flight is composed of up to four aircrafts. Each pilot is assigned a unique ID number from 1 to 4. You can see your wingmen (or your leader) and recognize them on the ABRIS by this number.
Assuming that you have already locked a target, you can now save it for your use or send its data to the rest of your flight.

Note: each aircraft must have the same frequency set on the R800L1 (VHF-2).

Ka-50 PRTz target displayed on the ABRIS

Saving a target with the PRTz

Saving a target and making it appear on your ABRIS is very easy. Just select the correct target type button in the PRTz’s first row and press SEND/MEM.
E.g. if we have locked an enemy T-80, we will first select the armor target type, then press SEND/MEM. A diamond with a number (#1 for the first target) written into will appear in the ABRIS. This number is incremental, if you save another armoured target with the PRTz, it will appear as a diamond with a #2 in the middle.

This target representation will be later used to get its coordinates and send it to others (A-10s, for example). But we will delve into this aspect later.

Sharing data between Ka-50s

In order to send data about target you must select the recipient (from #1 to #4, or the whole flight), cycle between your saved targets by the corresponding target type button and then press “SEND/MEM”. The selected recipients will receive your data.
Now let’s see what happens if you are one of those recipients: some buttons on the PRTz will begin to flash (letting you understand who and what type of target you are about the receive), Betty will warn inviting you to take a look at the EKRAN and it will finally tell you that you have just received some data (“RECEIVE DL TARGET”). Press “SEND/MEM” to save, and the target will appear on your ABRIS. Quite easy, isn’t it?
Last important thing: the number written into target’s symbol couldn’t always be the same for the whole flight. E.g. if we have already saved an armoured target (target type #1, a diamond on the ABRIS) and your wingman will send you data about another one, you will see two diamonds on your ABRIS. The one we have saved before is the #1, and the one just received is the #2. But your wingman could have just one armoured target in his ABRIS, and it is identified by the #1. This means that our #2 is his #1 and vice-versa, and you don’t know that. So pay attention and try to avoid confusion!

Automatic ingress to target

This is a very useful function. It allows to release the Shkval directly on a target received or saved with the PRTz.

  1. select a saved or received target by its corresponding target type button;
  2. enable the AUTO TURN function (not mandatory but useful);
  3. put laser on STAND-BY;
  4. uncage the Shkval.
    1. And your aircraft will magically turn and lock the target.

Ka-50 A-10C – Sharing Data I: Introduction

What follows is a doc I wrote for my former group when BS and A-10C were merged and later become DCS. It is probably 6-7 years old but the fundaments haven’t changed.
This article covers the acquisition of a target, the determination of its position and later a couple ways to share this information with other Ka-50s or an A-10C.

Back in the day the A-10C was DCS’ flagship and the only study-level module available for DCS other than BS. Nowadays instead we have a variety of modules and these procedures can be applied to any of them as long as their avionics allow for latlong coordinates or bearing and distance input.

Sharks and Togs: Introduction

Ka-50s and A-10s are very different aircrafts. Just think that the Ka-50 is Russian and uses the metrical measurement system and the A-10 is American and uses the Imperial system. Knowing that, there should be no surprise when I tell you that there isn’t a way for sending and receiving data between these two aircraft directly. Therefore we have to find a measurement system supported by both of them.

The short paragraphs below are just a small reprise of concepts that you may have already learned. To deepen your understanding, read through the ED manuals.

Preparing the ABRIS

One of the instruments we are going to employ is the ABRIS, but first of all we have to match A-10’s unit of measurement. The ABRIS can represent lat/long coordinates in one of two ways:

  1. XXX°YY’ZZ” (degrees, minutes and seconds – ABRIS default)
  2. XXX°YY.YY’ (degrees, minutes and decimals – PVI-800 default)

A-10s use the second representation mode hence we have to set the correct unit of measurement. To do this, go to the ABRIS setup, select the UNITS FSK, and change the setting (see the Black Shark manual, page 7-26).

Ka-50 ABRIS units setup

Different bearing types

Ka-50s and A-10s represent bearings in two different methods: Ka-50 uses True Bearings while A-10 uses the Magnetic bearings. You can toggle the ABRIS between each methods in the Options menu, entry “Track/heading”.

PRTz Datalink

The PRTz is a very important part of a Ka-50’s avionics. This device allows sharing data directly to each Ka-50 in your flight. It is composed of three rows of buttons, from top to bottom:

  1. target type: Armor, SAM/AAA, Other, and Ingress point;
  2. recipient: select who will receive your data, from #1 to #4 or the whole flight;
  3. functions: erase the selected target from the memory, perform the automatic ingress to target, send or receive data.

Locking a target

First of all we have to spot a target in order to lock it. This task can be performed in many ways, exempli gratia:

  1. Put laser switch on STAND-BY position;
  2. Activate the HSM and position it over the target;
  3. Uncage the Shkval;
  4. Adjust the gate around the target;
  5. Press the Lock button.

Arduino Control Box: a Step by Step Guide – Part 5 – Drilling time!

Part V of the guide, we’re almost there: the wiring diagram is ready, we have our buttons and encoders and we have our box. Before starting the assembling phase, let’s review some of the tools that might come handy.

Drill driver: I have an old DeWalt cordless drill driver, it holds drill bits max Ø10mm. It does the job.
Drill bits: I used to build model for WH40k years ago and I have a 1-5mm set. I have bought another cheap set, max Ø10mm. I recommend two sizes: a small one, to prepare a guide for wider holes (2-3mm will do, whatever you have in your garage). Most of the smaller buttons I have found have a diameter of 5-6mm so a second drill bit of that size will come handy.
Cone drill bits: I have bought a cheap set only recently and damn, they make your life so much easier. Since we will be working mostly with plastic, even quite cheap sets work like a charm.
Countersink drill bit: optional. Before buying the Cone bits I used this tool to make holes wide enough to host some particularly wide buttons. It comes handy when dealing with unusual diameters or to “clean” the hole instead of using sandpaper.
Caliper: the real man best friend 🙂 Simply a must have; you need one.
Thin permanent marker: you can decided to either mark the points to drill with a marker or cut them into the plastic. It’s up to you, I personally do both.
Multimeter: a must have for debugging the wiring. Unless you have done everything perfectly and I bow to you 🙂

Mirror mirror

IMPORTANT! We will drill on the internal part of the enclosure. Therefore, when planning and defining the position of the holes, remember that our wiring diagram is the specular image of what we actually need.
The easiest solution is to paste the image in GIMP and flip it.

Marking time

Get the wiring diagram on your PC and calculate the distances between the borders or the box and the centre of the buttons. I’ve found that drawing a reference matrix is actually easier. If you are using LibreOffice Draw, this operation will take just a few minutes and will be also very precise if you have draw your components and the box in 1:1 scale.

Now get the cover of the enclosure and the calipre. Measure the distances between the borders of the box, both vertically and horizontally and mark the points where your components will be placed with the marker. Proceed until every button of your UFC has is respective dot on the cover. For sake of clarity and to avoid confusion, you can write the expected diameter of every hole near every reference dot.

This is a detail of my Auxiliary Box. As you can see, the marks and cuts are clearly visible inside the enclosure cover (green arrows).

Reference marks and cuts inside the enclosure cover

Once every reference is marked, it’s time to start drilling. I usually start with a drill bit of very small diameter, then enlarge it depending on the final diameter required. This is a fairly quick operation, assuming every button is Ø12mm, you can start with the 2mm drill, check that the hole is exactly where you want it then use any other drill to make the hole wider enough to use the Cone drill bit. The Cone drill bit cuts throught the plastic very easily so pay attention and avoid making an excessively large hole.

When everything is done, get your buttons and encoders, place them in their slots and clamp screws and nuts and check the result.
Don’t put the encoders knobs in place, you risk unnecessary scratches.

Some buttons won’t be perfectly aligned but remember we are not using a CNC or any very precise tool. Small errors and imperfections might occur.

The manual part is almost over. Next step is soldering and then, finally, my favourite part: coding!

PS: it may sounds taken for granted but remeber to drill a hole for the USB cable 🙂