Archive for the ‘electronic’ Category


With the arrival from Hong Kong of the last adapter, I was finally able to finish my upgrade!

USB B panel mount connector

USB B panel mount connector

I enlarged the hole for the original cable and mounted there the panel connector. I can now use whatever USB cable (long or short) I like.

Joystick with USB B port mounted

Joystick with USB B port mounted

In the end, this was, after all, a ‘test project’. I’m not gonna use this joystick a lot because… well, I just bought a Thrustmaster Hotas Warthog, and it’s worth every cent I paid.

In conclusion, what I learned from this project?

  • When ordering more than one piece of electronic from eBay, especially from Hong Kong, it’s better to try everything when the items arrive, not just when one needs them.
  • Without both good gimbals and good springs there is not a good joystick. I did this upgrade because I’m attached to this joystick as it was my first “good” flight controller like 17 years ago and I didn’t want it to stay on the bottom of a box with other useless things. I don’t recommend anyone to buy this joystick with the purpose of upgrading it like I did. Maybe it’s better to buy an FCS Mark II or an X-fighter (better gimbals and better springs if what I read it’s true).
  • Cheap pots are cheap (Department of Redundancy Department here). What I mean is that I opted not to upgrade the pots with newer parts or hall sensors, partly because I’m lazy, partly because I think it was completely pointless (gimbals and springs). This means a lot of “garbage” on the analog inputs. Also, this means that the highest and lowest voltage levels change for various reasons (humidity, heat, planetary alignment…).
  • Flight Simulators are a niche product nowadays but the community is still alive and is doing fine. Cheap $5 Arduino’s clones are extremely versatile. They’re great, really great. Making the electronic parts for a flight controller (sensors excluded) has never been this cheap.
  • MMjoy2 is one hell of a software. It’s incredible, does everything, it’s free and open source (hosted on GitHub). I can’t be more grateful to the developer for making this fantastic work.

In the end,  my next project will be focused on the same upgrade to a Suncom F-15E Raptor joystick I bought used for €20. I’m also currently looking on eBay for old Thrustmaster TQSs (but the Hotas Cougar throttle it’s more appealing).

After all… it was fun. I’m not gonna use it very much, but I’m fine knowing I did this upgrade.



With two axis and one throttle the stick is suitable for a lot of activities (like flying a Cessna, with a set of rudder pedals), but not for military purposes. We need at least a trigger and a weapon release button (the trigger is used only for the gun, while the weapon release button, well release – or drop, or launch, or whatever – the selected weapon, except when the selected weapon is the gun) to use this joystick for combat sim.

Anyway, first things first: MMjoy2 allows two types of button’s connection.

  • Buttons connected via shift registers (any number up to 128 per device or a little less)
  • Buttons connected via button matrix (up to 100 via a 10×10 matrix but with some limitations because of the high number of I/O pins used)

If you want to connect a single button, you have to create a 1×1 matrix (silly concept, I know, but that’s the way it works). MMjoy2 guidelines states that over about 10 buttons, shift registers are the way to go. I agree, maybe not with 10, maybe over 16 I’d go with shift registers too.

Back to the Top Gun Platinum (by the way I’ve seen Top Gun – the movie – in a cinema recently for the 30 years anniversary! In – almost – 3D!), we have 4 buttons and a “China Hat” switch.
Let’s have a look to the “DASH 1” of the McDonnel-Douglas F-4E:

Stick functions from the T.O. 1F-4E-1

Stick functions from the TO 1F-4E-1

So we have the aforementioned trigger [TRG], weapon release button [WPR], an Air-Refueling Disconnect button [ARD] and a nose-wheel steering button [NWS]. Then we have the “China Hat” 4-way switch that is used for pitch and ailerons’ trim control.

In the Top Gun Platinum, as I already wrote in the first post of the serie, the hat switch was connected as an axis. I – more or less – destroyed the PCB under the switch to leave the four push buttons in the hat disconnected. Total numbers of buttons for the new configuration: eight.

After a quick glance at the MMjoy wiki to check how to connect the buttons in a matrix using as less cables as possible, I decided to go with a 2×4 matrix, 2 rows and 4 columns.

How to connect a button matrix to the MMJoy

How to connect a button matrix to the MMJoy

The diodes are used to prevent ghosting and masking. I found a rather interesting article about those two problems with really simple to understand images. You can read more here [link]. For the diodes, I found eight identical signal diodes. They worked and so I decided to use them. 1N4148s are good to go.

Here is the grip with the new connections:

Inside the grip


wp_20160921_07_21_45_pro Inside the grip

Once the buttons were connected to the Arduino, I started to setup the MMJoy settings for the buttons:

MMJoy setup utility

MMJoy setup utility

The really good thing about MMjoy is that any button in the matrix can be assigned to any button on the device. For instance, I like to assign [TRG] to button 1, [WPR] to button 2, etc. Also, any button can be assigned to the “Hat” up-left-down-right press.

In the end, under Windows, this is a screenshot of the device check screen under Windows 10 control panel:

Windows 10 Joystick Control Panel

Windows 10 Joystick Control Panel

This pretty much sums up almost everything I’ve done. Next and final step will be about the finishing touches (but I’m still waiting for a pair of cables to arrive from Hong Kong).

Bye



With the arrival of two “Pro Micro” Arduinos from an eBay seller in Hong Kong (fast shipping, just two weeks, but one, unfortunately, is not working), work has started on the Top Gun Platinum!
My choice was to use the MMJoy2 firmware that is a really nice software. With MMJoy2 a compatible Arduino is seen as a HID device, so no drivers are needed and compatibility is assured 100% with every software. It’s a really powerful software and I really like it. Links here: MMjoy wiki (en).

Pro Micro Board

Pro Micro Board

The first step (at least for me) was to re-wire the pots (potentiometers) for the two axis and the throttle. The older game port connection worked as an ohm-meter by measuring the resistance of the pots used as variable resistance. The ATMega32U4 integrated ADCs simply read a voltage value between 0 and 5 Volts, from pots, hall sensors, external sources. That means that the pots have to be connected between Ground and 5V (Power or USB +5V) with the cursor connected to one of the ADC pins.

How to connect inputs to the MMJoy2-programmed board

Connecting inputs to the MMJoy2-programmed board

I decided to use wires from a CAT-5 Ethernet Cable for both the axis’ pots and the throttle’s pot.

Axis' pots rewired with wires from CAT 5 cable

Axis’ pots rewired with wires from CAT 5 cable

The throttle's pot with the new wires

The throttle’s pot with the new wires

I also put some grease on the gimbals and on the throttle axis. I used some teflon grease that should last some years (I hope).

I then connected all the wires to a sort-of “shield” so I can easily swap the board, just in case…

Ghetto shield for axis connection

Ghetto shield for axis connection

Just to make a simple test, I decided to close the base, leaving the board outside.

Board hanging outside the joystick base

Board hanging outside the joystick base

And then a final picture before connecting the base to the PC to test the pots and their connections.

The base closed before a quick test

The base closed before a quick test

The quick test went fine. Next part will be about connecting the grip’s buttons and China HAT (POV) switch.

Bye



(Part 1 of X as, honestly, I have absolutely no idea of how many parts this series of articles will last, anyway).
Oct. 1, 2016 update: Part 1 of 4 😉

If you’re reading this you probably know which company Thrustmaster is, what’s its main business and what are their most known products. Probably you’re a simmer.

If you’re not a simmer, that means a person which is interested in simulation (usually flight simulation), then maybe you don’t know Thrustmaster. This is their website: Thrustmaster.com (US).

Some Thrustmaster products really made history and any good simmer knows them:

  • Pro Flight Control Stick
  • X-Fighter Joystick
  • Rudder Control System
  • Weapons Control System – a programmable throttle controller
  • F-16 TQS and FLCS – full size programmable replicas of the F-16C’s throttle and stick
  • F-22 PRO – a full size programmable replica of the YF-22 stick (almost exactly the same as an F-16C, F-22A’s stick is different)
  • HOTAS Cougar – a renewed F-16’s HOTAS replica controller
  • HOTAS Warthog – a replica of the A-10C’s HOTAS

Back on topic, around year 1998/1999 my father bought me a Thrustmaster Top Gun Platinum joystick. The original “Top Gun” (the joystick, not the movie) was an X-Fighter joystick with simpler gimbals and directly attached potentiometers (from now on pots for short). The Top Gun Platinum added a throttle to the base of the controller with an all-black colour style.

Thrustmaster Top Gun Platinum

The joystick we’re talking about

Top Gun and Paramount logos on the joystick

The joystick model with a big logo of Paramount

And now some (interesting?) technical details:

  • The stick is really similar to (but not exactly a replica of) a B-8 grip. The B-8 was a very widespread grip that was used on many US and NATO aircrafts, like the F-4 “Phantom II”, the A-10A “Thunderbolt II”, the Bell 206 “JetRanger III”, the Aermacchi MB-339 and many others.
  • The stick, as usual for that time was connected via game port.
  • It has 3 axis, four buttons and a four way “china hat” switch, usually used in simulators for changing the player’s Point of View (and therefore sometimes named HAT/POV) while in real airplanes is used for pitch and roll trim.
  • Thrustmaster used a “hack” for connecting the hat switch on this and many other joysticks before USB became the standard connection. Because game ports allowed to connect a total of 4 axis and 4 buttons, and the hat switch usually is implemented with 4 microswitches, there was a shortage of buttons that can be connected. Thrustmaster used an axis line and some resistors to send various resistance values to the game port. An “ad-hoc” driver inside the game or the operating system decoded the resistance values and used it as if 4 different buttons were pressed. The drawback is that only “up”, “down”, “left” or “right” directions were allowed (both mechanically and electrically) as it wasn’t possible to combine two commands simultaneously.

Now the project itself is about completely rewiring the joystick and converting it to USB using a cheap Arduino reprogrammed as a HID device.

Part 2 of X will follow when work will actually start.

Bye


Fahrenheit 896

posted by Viking
Apr 13

Paper burns at 451° F (~233° C). Ray Bradbury decided to title one of his novels after this temperature.

Solder melt at 370° F (~188° C). No one titled a novel after this temperature, and the reason is pretty obvious: it isn’t always true.

The most common solder was, when I was small and Xmas trees were tall (Bee Gees anyone?), the alloy made of tin and lead.
More precicely, the alloy made 60% from tin and 40% from lead.
It was cheap, it was good, it was easy to use for the average electronic use, that is building a circuit from scratch or repair a factory-made device (they used more or less the same alloy).

Now we are tall, and Xmas trees are small (“First of May”, by The Bee Gees) and lead is nowhere to be seen anymore. Not in gasoline, nor in solder alloys used in factory-made devices.
The problem is that when a component (maybe a SMD) is soldered on the ground plane of the circuit board with a ROHS-compliant solder, not even 896° F (~480° C) are able to melt the d**n thing!

I will make d**n sure not to buy any ROHS-compliant solder for the following decades.

Bye



A fast update just to say that the adapter is fully working on the Raspberry Pi running NetBSD 6.99.
Connection parameters are 115200-8-N-1 with flow control OFF (ON by default on PuTTY).
The adapter should work also on Rev. 1 Raspberry Pi B models, but there is no P6 (soft reset) header on that revision.

As standalone serial interface, works flawlessly with my old D-Link DSL-G624T wireless modem router. Being a rather old device, it use a slower 38400 bps connection (38400-8-N-1), but, nevertheless, works pretty well.

At last, just to leave no doubts about the SP3232 IC, as mentioned in this article (http://www.fullmeta.it/?p=379):

Sì, sono proprio quelli

Bye



2012 was the year of the Raspberry Pi. This credit card sized computer has become a huge worldwide success.
Running GNU/Linux or other operating systems is an easy task, it just requires to flash an image on an SD Card, put it in the Raspberry and switch on the power supply.

The Raspberry Pi version B sports two USB 2.0 ports (only one on vers. A), a Fast-Ethernet connection (no network on vers. A), HDMI, Composite Video and stereo audio output.
It seems there’s nothing missing on the connection side. You can just plug a TV/monitor, a keyboard (and a mouse) and you’re ready to use the system.
You can also access it via SSH if you’re using Raspian or another OS that automatically enables the network connection and runs sshd or some telnet server at startup.
But, if you don’t have an available TV/monitor and you can’t connect to the Raspberry via network (because there is no DHCP server on your current network or there are no SSH/telnet servers running on the OS), your last chance is a serial console.

I’ll leave the basics to this simple and short article by Joonas Pihlajamaa: http://codeandlife.com/2012/07/01/raspberry-pi-serial-console-with-max3232cpe/
In a nutshell, the Raspberry Pi does have a serial port and a serial console is usually enabled by default by the OS on it, but there isn’t a standard UART/RS-232 connector. Two pins of the GPIO header must be connected to a level shifter like the Maxim MAX3232 in order to have a fully working RS-232 connection.

While the solution by Joonas Pihlajamaa works pretty well, I decided to make some changes:

  • I wanted an interface circuit with a standard DB-9 male connector. This way I can just change some settings, disable the serial console and use the circuit as a simple serial port for the Raspberry PI.
  • I wanted something like an Arduino’s shield, to just plug over and be ‘solid’ with the Raspberry.
  • I wanted the other GPIO pins to be available for other connections, like displays, I2C devices, RTC modules, etc.
  • I wanted the two pins of the soft-reset headers to be available for use even with the circuit plugged over.
  • I also wanted to use the circuit as a standalone RS-232/3.3V level converter to be able to connect to other embedded systems’ serial consoles (like the serial console found in many routers).
  • In the end, I came out with this solution, made with a MAX3232 compatible IC (the cheaper and more versatile SP3232ECP), some stackable headers, the usual five 100nF capacitors and a DB-9 male connector coming from a scrapped old motherboard.

    Serial Port Circuit mounted over a Raspberry Pi B rel. 2

    The P6 header “repeater” (as I call it) also serves to support the circuit on the side of the DB-9 connector.
    A four pin AUX header is also provided for standalone use, with 3.3V, GND, RX and TX connected.
    24 out of 26 GPIO pins are present on the circuit. Of course GPIO pins 8 and 10, TX and RX, are not available for other connections.

    Serial circuit P6 header detail
    Serial circuit AUX header detail

    I’m currently trying the adapter on the Raspberry and seems to be working well. On the PC I’m using an old Prolific USB-to-Serial adapter with a null-modem cable.

    Bye



    I was very busy during the last two months so, as a result, I had little to no time to write something.
    Something interesting at least…

    During some spare time of the last week,  I built a really simple and cheap headphone amplifier. I needed one because sometimes I like to listen to some sat radio station (especially for news) and I don’t want to leave the TV on only to use it as an headphone amplifier.

    I  wanted to keep the complexity low, really low, so I decided to use a pair of ICs instead of four ( one amplifier and one buffer per channel ) or more transistors.
    There are various IC audio amplifiers. Some are huge AB class amplifiers able to deliver dozens of Watt to a 4 Ω load. That is not my case, because headphones usually have an impedance of 16 Ω or more.

    The one I selected was the National LM386, a small 8 pin IC in a DIL package.
    Considering the low output power, there is no need for a heatsink. Moreover, the air inside the case shouldn’t be hotter than the air outside, despite the little heat generated by the voltage regulator.
    Using the LM386, only two external cap per channel are required. Without any further component, it’s easy to obtain a fixed gain of 20.

    Talking about the PS (power supply), my idea was to use a cheap wall mount PS but, as many people know, sometimes ( *almost always* ) “cheap” means “unregulated-with-an-output-voltage-completely-different-from-the-rated-one”. Furthermore, a PS like that usually have different type and size of plugs, some with inverted polarity ( many devices use a plug with the negative/ground on the outside ).
    So my amplifier needed to have its own voltage regulator and at least a diode to prevent damages in the case I or someone else accidentally connect a PS plug with the wrong polarity.

    Now lets see the schematic:
    Amplifier schematic

    • Vps ( and GND of course ) must be connected to a PS with a minimum rated output of 12 V;
    • D1 could be any 1 A diode, same for D2. 1N4001, 1N4002, etc are perfects;
    • L1 is not essential. Without it I hear a stronger 100Hz noise, depends by your PS;
    • C1 could be smaller or bigger, again depends by your PS;
    • U1 is the standard LM7809 3 pin fixed voltage regulator in the TO220 package. A very small heatsink is ok;
    • The value of C4 is not critical, but should be mounted close to U2 and U3;
    • Lin and Rin are the two audio input from RCA plugs;
    • R1a and R1b are two halfs of the double 100 kΩ potentiometer R1. R1 should be logaritmic;
    • C2 and C3 could be smaller (but equals);
    • About C5 and C6, the larger, the better;
    • R2 and R3 must be equals and not bigger than 8 Ω;
    • Lout and Rout are the output to the jack plug.

    Now some technical details:

    • Vps must be greater or equal to 12 V and lower than 35 V. Assuming a 2V drop on U1 and a 0.7 V drop on D1, this lead to a minimum Vps of 11.7 V. As Vps raises, so do the temperature of U1 so be careful about heat generation;
    • The input impedance of the LM386 is 50 kΩ, so the value of C2 and C3 can affect the bandwidth. Keep in mind that usually there is also a cap on the output stage of the audio source, so actually there are two caps in series: the total capacitance is smaller than that of the smallest cap;
    • If you want to add a LED, simply connect it in series with a 1 kΩ resistor between the output of U1 and GND;
    • R2 and R3 are sorta short circuit protection;
    • There isn’t a Zobel network in this project. If you think you need one ( e.g. the amplifier oscillate ), add a 10 Ω resistor in series with a 50 nF cap between the outputs ( before R2 / R3  ) and GND.

    I have used many spare parts to build this amplifier, but I think that 15 € should be enough to buy all the components.
    Some spaces I left on the board are needed because of the various connectors that are very close to the board itself.

    Amplifier board

    I used a 0.5 mm solder wire and I made most of the link on the copper side of the board.
    I used a plastic enclosure, but if you plan to use a metallic one, beware of ground loops and remember to insulate any plug from the enclosure chassis.
    Could be a nice project if you are relatively new in building electronic circuit, but I don’t suggest it as the first circuit to build, because doing problem solving on audio circuit could be really frustrating.

    The result (mine) is this, black and only a bit greater than a mouse.
    Amplifier compared with the size of a mouse
    The front side of the amplifier with the power LED, power switch and the volume knob.
    Amplifier front side
    The rear side of the amplifier with the RCA plugs, 6.3mm jack plug and the PS plug.
    Amplifier rear side

    Bye