Speed brake indicator

Following the great idea, models, and post of Diabolo_101 on viperpits, I decided to build a speed brake indicator as well. I revised a bit his design, which implies that all the 3D models, and electronic components changed a bit. For example, differently from Diabolo_101’s one, the speed brake indicator I developed is based on a PIC12F675, and uses only a couple of signals which come from the great psCockpit to do the job. The reason for the change I implemented is due to my will to spare digital I/O on the satellite board, and possibly CPU workload on the mainboard (digging a bit on the way stepper motors are implemented, I understand it is a relatively complex routine.

Real system: high level description

In the real jet (F-16) the speed brake indicator is placed just below the landing gear panel, is a rather simple indicator which is meant to provide to the pilot a visual clue on the position of the speed brake indicator, and whether its system suffers of any malfunction.

The indicator is physically made by a circular label, which carries three indicators:

  • CLOSED white label on a black background
  • Diagonals @ 45º (which indicate that the system is inoperative)
  • SPEED BRAKE SYMBOL (white dots) on a black background (which indicate that the speed brake is open).

Therefore we are dealing with a discrete indicator, no clue on the percentage of the opening of the speedbrake is provided. According to some reference, differently to a car brake system, the speedbrake (or Airbrakes) activation in the real jet is quite fast, hence it is indeed a “binary” system, which is either opened or closed. The indicator resolution therefore is representative of the system (which is possibly a good definition of sensor/indicator).

Home cockpit instrument layout

Now, switching to the simulated indicator: the design relies on a simple case (basically made of two shells), and a wheel with three labels. The wheel is actioned by means of a stepper motor; the case, and wheel are both 3D printed. I chose to fit the assembly with a PCB, so to keep the design and connections clean and tidy, but in principle it is possible to simply wire/solder the components together.

3D visualization of the Speedbrake indicator CAD

Stepper Motor x27.168

The x27.168 stepper motor is a relatively inexpensive stepper motor, originally designed to drive the speedometer needle in cars or trucks. It features microstepping which, if properly driven, allows to have an actuation which resembles the analog motion. Being meant to be used in automotive applications, as indicator, it doesn’t provide great torque performance, hence the needle has to be as light as possible.

Full step, Half step, microstep operation, courtesy of aprendiendoarduino
x27.168 stepper motor

Needle diet

In order to improve the performance of the x27.168 stepper motor, the wheel model, which takes the place of a needle, was modified so to be as light as possible (~6 to ~2g), and so as to reduce as much as possible the inertia tensor as well (from ~1500 g/mm2 to 670 g/mm2).

Needle wheel optimization

Following the same design, I also reduced the needle wheel diameter (a couple of millimeters), so to have a more compact overall layout.

Wheel design revisions

3D printed model

The 3D printed version of the model is shown below. The two shells and the wheel will be coupled with the stepper motor and the PCB.

After a couple of tests I decided to print the wheel in white PLA, so to reduce a bit the glare on the sticker (yet in the figure below, the transparent PLA version is shown).

You can find the model here.

3D printed components

Indicator

The indicator itself is a rather simple sticker, as described in the introduction topic, with 3 labels: the “CLOSED” label, the “WHITE DOTS”, for speedbrake open indication, and the 45º white stripes, to inform of the unpowered device.

The figure below shows the image of the custom sticker I made. I then printed it on an adhesive paper, not glossy to avoid glare. This is possibly the most difficult part of the design, as there is the need to obtain a decent surface without reflections, with a deep black, so to prevent any bleeding when backlitted.

The custom sticker

At least I have some spares …

PCB

I designed custom PCB so to keep compact the overall assembly (there is not so much space inside the speedbrake indicator case). The PCB layout relies only on two inputs which come from the psCockpit, and are processed through a PIC12F675 microchip. The chip then is interfaced with an AX1201728 stepper driver which takes care of provide microstepping to the x27.168 stepper motor.

The needed inputs from the psCockpit are the speedbrake open and power on bits. When not powered on the commanded position to the speedbrake indicator is the white striped, non operative. As soon as it is powered on, the position depends on the “speedbrake open” bit, if 1 shows the white dots, while if 0 shows the “CLOSED” label. I mention here the psCockpit system, but I understand this layout could work fine with other configurations as well (pokeys for example), given that two outputs are available to identify the powerOff, and speedbrake open conditions.

The PIC12F675 takes care of processing the inputs, and sends the right command to the stepper driver board. When the microchip is powered on, a built in test (BIT), also takes place, and finally, after a consolidation, it powers the stepper driver, by putting high the RESET pin.

The stepper driver board, AX1201728SG takes care of driving the x27.168 stepper, it can drive up to 4 stepper, and only needs two inputs, (and the RESET). The inputs indicate the direction and angle needed, the board will take care of producing the 4 signals required to feed the 2 coils of the stepper motor.

The AX1201728SG also features 8 fly-back diodes, which simplifies considerably the design of the PCB, as they protect the microchip against any induced current.

PCB design: easyEDA

To design the board I relied on the (fee easyEDA webpace) which features a remarkably populated component’s library, as well as some powerful tools for routing and creating the gerber file.

In the picture below, a simple overview of the block diagram type schematics of the board, and a 2D rendering of it.

The input signals from the psCockpit are named In1 and In0, and are treated as pull-down (note the two 10kOhm resistors connected to them).

You can find the gerber file in the GitHub repository.

easyEDA schematics

PCB Layout

PCB manufacturing: jlcpcb

As for previous projects I relied on jlcpcb for the manufacturing of the pcb, the web offers fast shipping, great finish and customization options and unbeatable prices. Purchasing from them is ultra easy, simply upload your Gerber .zip files and let their test platform do their magic to find if it is all good. Then pick the color, finish, number of PCBs and preferred shipping option and you are good to go!

AX1201728SG Stepper driver

The board relies on the AX1201728SG stepper driver to provide microstepping (12 steps per degree instead of 3) to the x27.168. Stepper motors This stepper driver is rather undocumented, the best match I found is in the great post of Guy Carpenter. Anyway below I report the DIP28 pinout of the board. A neat feature of the board is that it can drive up to 4 stepper motors, features microstepping, only requires two pins signal for each stepper motor and carries fly-back diodes to provide coil induced current protection.

The AX1201728SG comes in SMD format; in order to test it in a breadboard, it needs to be adapted to dip 28. A SOP to DIP28 adapter comes handy, as shown below.

Courtesy of M-S Quad Driver X12.017 datasheet

PIC microchip

Speaking about the components, as mentioned before, I wanted an autonomous, compact and clean design. Therefore even if using an Arduino is perfectly doable, fitting a ProMicro in such environment would be a bit of an overkill for the job.

For the records I tested the ProMicroed configuration, in particular to understand the performance of the AX1201728SG stepper driver, and was working really great. The 16MHz clock speed made it even too fast for the acceleration curves, and that resulted in some missed steps (not a big deal, by accordingly tweaking the acceleration curves it is definitely possible to have a fast and smooth operation).

Instead of using an Arduino, for the design I decided using the rather famous 8-bit family of processors of Microchip, as they provide a compact yet powerful way to implement a controller. Among the jungle of different chips, I bought few PIC12F675 and PIC12F683, amazed by the versatility in a so tiny form factor. The form factor advantage becomes very clear when an Arduino ProMicro and the PIC12F675 are compared close to each other.

Arduino ProMicro, compared to a PIC12F675 dip8 microchip

Microchip description

The PIC12F675 is a DIP-8 microchip, which can handle as much as 6 I/O pins, and has built in Analog to Digital Converter capabilities (among other nice features). It runs at 4MHz, and hence, it is inherently slower than an Arduino ProMicro (which supports 16MHz). It is way more compact and has some really interesting features, such as two Timers (Timer0 and Timer1), ADC module, analog read, Watchdog, but is considerably more difficult to program than an Arduino. The challenge is not the programming language per se (the most efficient way would be Assembler, but PIC12F675 supports C), but it is needed to program each and every function, moreover there are a lot of processor specific fuses/configs and commands, that need to be learned.

Luckily enough, Microchip provides (for free) a complete development environment, MPLAB X IDE, which really helps find the way out. To program the board I relied on the freeware MPLAB X IDE v5.50, developed by Microchip, which handles not only the environment but also carries a very useful debug tool, and the capability to burn the firmwares on the chips.

A part from the chip I also purchased a board to burn their firmware (Pickit3), and a support with a socket which helps performing the operation.

Schematic

I decided to design the system by having:

  • PIN2 (GP5) : Digital input: receives the Power ON BITs from the psCockpit (pscockpit simply provides an HIGH when the Power ON bit is done).
  • PIN3 (GP4) : Digital input: receives the Speed brake open status from the psCockpit (pscockpit simply provides an HIGH when the speedbrake is open).
  • PIN5 (GP2) : Digital output : RESET pin to the AX1201728 stepper driver (it could possibly be avoided and directly connect to VCC the RESET pin on the AX1201728.
  • PIN6 (GP1) : Digital output: direction indication to the AX1201728 stepper driver for channel A (yes, the AX1201728 can handle up to 4 stepper motors).
  • PIN7 (GP0) : Digital output: stepper frequency to the AX1201728 stepper driver.

Due to the relatively simple program, it is possible to code it in C, for more complex programs (or for more efficient ones), Assembly shall be used.

Apart from that, the circuit is ultra simple and features a capacitor 0.1 uF between VDD and VSS to clean the line (as per Microchip Developer Guidelines). The circuit (and chip) runs at 5V.

The program relies heavily on the great library written for Arduino (it is merely an adaptation on my side). In particular the SwitecX12.h and SwitecX12.cpp were used.

The implementation uses the PIC12F675 at 4MHz, and 1:1 prescaler. It enables and uses Timer1 (a 16bit timer), which with the above mentioned settings, should be able to deal with the ~10us timescale required to efficiently drive the stepper.

The result is less responsive with respect to the Arduino implementation (which I also tested), but being on the safe side of speed means that no missed steps are found, so that the movement is overall repeatable.

Breadboard prototype

Pushbuttons

The breadboard circuit below was designed and tested simply to provided a visual clue / proof-of-concept. The configuration as far as components is the same as the one that will be implemented in the PCB, with the only difference that instead of having the two signals coming from a psCockpit 16 digital I/O board, it comes with a couple of pull up pushbuttons.

Breadboard schematic (btw what a great tool fritzing!)

Breadboard integration with psCockpit

With the basic functionalities tested through the pushbuttons, it was time to test the functional model. Just after the pushbuttons, I therefore connected a couple of signals coming from a psCockpit 16 digital I/O satellite board, and put a common ground between the breadboard and the psCockpit.

The 2 signals of the satellite board are set to output led, while any ground does the job (the lowest row of pins in the image below).

psCockpit 16 I/O satellite board

Code PIC12F675

The program is nothing fancy, the most complex parts being related to the specific microchip configuration instructions. It is written in C, and uses 80% of the space of the PIC12F675. Most of the space needs are due to the implementation of the great library SwitecX12 to control the stepper driver.

In order to program the PIC I started by reading the marvelous tutorials of circuit bread, really top class, frankly unparalleled ability to explain relatively complex matters with simplicity. I won’t be able to reach that level, so it is worthless to copy everything back here I just suggest you, if you are into this topic, to take your time and go through the tutorials. After this “landing” phase with PIC microcontrollers I relied a lot on microchip forum, where most of my Newbie doubts were addressed extensively. A final very useful piece of info is found in developer.microchip guides.

The PIC microchips have several options or fuses, that need to be configured during initialization to enable or disable features, and configure the general purpose pins. The MPLAB IDE guides through the available options as far as configuration bits is concerned, nevertheless a deep read of the Microchip’s datasheet is very needed to manage to understand the various possibilities. In the program below, the internal oscillator is used, then all the optional features: Watchdog, Power-up timer, Master Clear, Brown out detection, code protection and data code protection are disabled.

As no analog channel is planned to be used, the ANSEL bit is cleared, so is the ADCON0, which enables (disable s in this case the ADC). Also the comparator isn’t used, this explains why the CMCON is set to 0x07 mode. The instruction that follow in the setup of the chip are related to the input / output, as described before, and to the weak pull-up feature, which is enabled.

Git repository

Code PIC12F683

The implementation of the design with the PIC12F675 is sound and responsive, anyway it is somewhat limited by its (not exactly overwhelming) clock speed. A very similar microchip device, the PIC12F683, does provide the built-in option to run at 8MHz, relying on an internal oscillator (so no need to connect any pin to a crystal). As mentioned above, the Arduino ProMicro is running at 16MHz, so yet again a factor of two, but doubling the clockspeed with respect to the PIC12F683 should already provide an even faster response system.

The differences in the code implementation are minimal, namely a couple of configuration registers that change and the name of the comparator variable and few other minor things.

Assembling the PCB

The images below show the assembly process of the PCB designed with easyEDA, and purchased at jlcpcb. The components fit quite tightly together and the resulting case is relatively compact.

The first item to be soldered is in my opinion the stepper driver, technically it is not a through hole component, is an SMD, nevertheless, the pins are quite separated, which makes the soldering relatively straightforward (different story in TWP 40 I/O microprocessor). To solder it, I simply applied a decent amount of flux on the pins and on the pads, then positioned the stepper driver, secured the diagonal pins in place, and finally soldered all the pins in a couple of passes. As a very last minute choice, I decided to mount the PIC12F683 on top of a DIP8 microchip carrier, this allows to swap, update easily the microchip (if needed).

All the holes fit perfectly with the components (with the only possible exception of the capacitors, whose holes are relatively close to each other). Once all the components where soldered I’ve to admit that I’m really pleased with the result, it is very compact and space efficient.

After testing the custom PCB, I chose to play a bit with the acceleration table of the stepper motor library, as I noticed it was driving them at the verge of stall (and was missing steps all way long). With the adjusted values the wheel is rotating a bit slower, but in a very sound way.

Git repository

Painting

Last but not least I desired to get rid, to a minimum extent, at least of the 3d printing marks. For this reason I sanded the 3D printed case ( I find rather useful using wet sand paper ) , then added a thick spray filler, sanded again, and finally painted with an intense black spray paint.

Integration with the psCockpit

As always the integration with the psCockpit software is really smooth. The software already has the option to set a couple of outputs which fits perfectly our purposes.

The idea is to use one of the Power Bits to provide the signal to the sensor which tells that the aircraft is powered on (actually due to the way it is wired, I used an Inverted Bit), thus the speedbrake system hydraulic can be used, and a second speedbrake Bit (you can find such output in the lights section. Both settings can be found in “F16 Model” panel.

Speedbrake light, which is used to send the bit to the sensor when the speedbrake is in the open position
Inverted Power Off bit, which is used to assess whether the aircraft is powered on.

Repositories

You can find the PIC code, the gerber files in the gitHub repository.

And the 3D STL models in Thingiverse.

Leave a comment

Blog at WordPress.com.

Up ↑