Cockpitbuilders.com

Main => General Discussion Board. => Topic started by: Mach7 on November 02, 2020, 04:55:31 PM

Title: Segment displays
Post by: Mach7 on November 02, 2020, 04:55:31 PM
Hello all,

I want to use 3 thumb wheel switches ( one +/-, and the other two graduated from 0 to 9)to interface with a 3 digit 7 segment led display to give me N1 values. For example, I would like to set a value on the thumb wheel switches to +15 ( denoting temperature) and have the corresponding N1 value to read 93.5. As the temperature is increased, I would like the N1 value to also decrease, showing a final value of 87.8 at +40. I s this feasible and if so how would one go about constructing such an apparatus?

Thank you in advance

Jim
Title: Re: Segment displays
Post by: ame on November 02, 2020, 05:12:50 PM
Very feasible, I'd say.

Do you have a link to the kind of switches you'd like to use? You have given an outline for how the system might work, so it comes down to practical choices such as the specific switches, size of display, power supply availability and input/output requirements (i.e. connecting to other systems or subsystems). Since these practical choices dictate how some parts of the device must operate it's best to have a few specifics nailed down as soon as possible.

Depending on how you want to integrate this with other systems I'd start with an Arduino, BCD thumbwheels, and an LED matrix with I2C or similar driver. At first glance the software would be pretty easy, but the devil is in the details and quite often people forget to mention stuff...
Title: Re: Segment displays
Post by: Mach7 on November 03, 2020, 02:44:30 AM
Thanks Ame

Yes...the details are important.

Basically I am trying to replicate a Bae 146 TMS.

I am using some stock parts off an old tms cdu I have..namely the aforementioned thumb wheel switches.

I will give more details tonight..just running to work

Thanks!

Title: Re: Segment displays
Post by: Mach7 on November 03, 2020, 06:18:19 AM
So...to complete my story...the system will run off 5 volts, the thumbwheel switches i have are identical to the omron type, and the LED display would be a store bought unit .4 inch or so. I am at the work computer,so I cannot post pics here, but if you go to my youtube page (the bae 146 project) it will show the unit i have installed now...basically I control the rated thrust N1 with the takeoff button and the reduced thrust N1 wit a RDU (reduced) thrust button...but this is not the was the system actually works.,..so I am trying to inject some reality into the project.

In reality, the system always knows the pressure altitude through a static pressure sensor, so pressure altitude input will not be an issue as I am identifying all my thrust setting at 0 to 1000 feet.

In simple terms, The thumbwheel switches are called Tref (temperature reference) inputs...so...if you are doing a full thrust takeoff, you put the actual oatside air temp in the window, press the TOGA button, and you get your N1 ref value, ( in this case 93.5 percent).

If you want to 'flex' the takeoff, that is reduce thrust, then you put a temperature in the Tref window that is above the actual OAT, (like +40) to give you a lower N1 target, hence a reduced thrust takeoff. When you press the same TOGA button, you will see the new N1 value, (which in actuality is 87.6 percent).

So this is where I am attempting to go with this, the reason for the lower N1 value at the higher temperatures is due to the thermodynamics of the engine ALF502-R5. This particular engine is 'flat rated' to standard day conditions...this means you can derive full thrust (6970 lbs) up to 15 degrees C...then above this you hit a temperature limitation, (882), in which case you have to start rolling back the N1, (and thrust output), to maintain the temperature (TGT).

Going the other way...say below +15, you will note that the N1 is also reduced as you are up against the fan gearbox limitation, although you are always in the rated full thrust range as you are moving colder air back with the fan giving you 6970 lbs of thrust at all times below 15 c.

I am not too worried about having my system tabulate N! speeds below the minus range...in fact if I can display values from +15 to +40 I would be happy.

I have all the values in between the aforementioned temperature ranges (from a thrust chart), so it should not be difficult on that side of the equation.

I will say that I have never used Arduino, if that is the direction I have to go to make this work.

Jim
Title: Re: Segment displays
Post by: ame on November 03, 2020, 11:57:12 AM
Thanks for the update. The detail you have added has clarified things, but hasn't suddenly made things impossible.

There is no need to use an Arduino specifically. There are lots of ways to hook up switches and displays to your choice of microcontroller, or even to a PC or a Raspberry Pi. However, Arduino is easy to use, ubiquitous, and cheap, and should be fine for this project.

Where does the pressure altitude come from? Or is it a constant that you won't change in your simulator?

Do you have a part number for the Omron thumbwheel switches? The only thing we need to know is the output configuration, which I am hoping is BCD.
Title: Re: Segment displays
Post by: Mach7 on November 03, 2020, 12:26:56 PM
Hello ame

Yes, you are correct the pressure altitude is a constant for this application, in fact it nor the temperature will be interfaced th FS as this will be nothing more than a stand alone device to give an n1 value at the aforemention temperature range.

The thumb wheel switches ..as far as I can tell with what I have read online ARE BCD type....

I might have misled you with respect to the omron brand..these particular switches are actual switches from an actual TMS cdu...however they look identical to the omron brand.

I will be home from work on Thursday to give a better perspective...but what I can rememberers from these switches is tat they all have a 'C' connection which I suspect is "common".. then 4 or 5 additional outputs
(inputs.) numbered 2..3..4. Etc.

I have included a rough draft of how I see this coming together.

Jim
Title: Re: Segment displays
Post by: ame on November 03, 2020, 01:41:17 PM
Perfect!

Since this is a standalone device we can afford to be wasteful with the Arduino pins, and not worry too much about how we talk to the device from the simulator (we don't!).

If we assume the thumbwheels are BCD then we will have 4 inputs for each digit wheel, and one input for the +/- wheel. There will be one further input for the TO pushbutton, and probably two, maybe three, outputs for the LED display module. That will fit comfortably within the Arduino I/O pin limits. The C pin is 'common' and the other pins (there should be four) are the bits for the BCD-encoded digits. Decoding them is simple. For the +/- switch there will still be four 'bits', but only the least-significant bit will be used.

In terms of display, there are several driver chips to choose from. A popular one is the TM1637. It is available on a board with LEDs, and generally has a group of four digits. Perhaps you can mask off the unused digit? You will find them in clock format (with a colon in the middle) or with decimal points, so you have to watch out precisely what you are ordering. They are available in a range of common LED colours, red, green, yellow, blue, white.

Here's an example:
https://www.aliexpress.com/item/32995775969.html

It has 4 digits with decimal points. The digit height is 0.36", which is a little shorter than your original specification.

Here's another option, using the 74HC595 as a driver. This one has 3 digits, but it's 0.5" high, and it needs three control lines:
https://www.aliexpress.com/item/32707015238.html

Or you can make your own by finding a 7-segment display you like, then couple it with a driver of some kind. I've only trawled AliExpress briefly- you can take your time.

Regarding Arduino. The 'classic' Arduino is the Uno, which is great for experimenting, but it might be a little bit big to hide behind a control panel. The next "smaller, but essentially identical" is the Arduino Nano. There is a physically smaller one called the Pro Micro, but you need a USB->serial board to go with it for programming. Not really a problem if you really need the smaller size.

In terms of software, Arduino runs a program loop perpetually. So in this case I imagine the software would be:

read BCD low digit
read BCD high digit
read +/- switch
store thumbwheel reading into Tref variable in memory
fetch pressure altitude P (it's a constant, but it would be worthwhile to remember it might come from elsewhere in the future)
Given Tref and P calculate N1 (is Tref and P sufficient for this?)
(The calculation could be real, or could be a lookup table)
If TO is pressed, send N1 to be displayed on 7-segment display

For testing and development this can be split up into three simple tasks that can be worked on independently. If you have never used Arduino before then these are quite straightforward tasks that would make for a challenging-but-achievable learning experience:


* Read and parse the thumbwheel switches

* Given Tref and P return N1 - Even though N1 is a percentage with one decimal place I'd recommend handling N1 as an integer representing percent x10, and placing the decimal point in the right place later.

* Given any integer number N1 between 0 and 999, copy the digits to the 7-segment display and turn on the decimal point before the last digit. Do you want to display leading zeros or not?


Again, if you have never used Arduino before it's a lot of fun, and pretty easy to get started. You could order everything off AliExpress and wait, but I have found that a lot of places these days have local entrepreneurs who are stocking up on 'useful' parts from China and reselling them locally. The prices are usually only a little higher, but delivery time is much reduced, so shop around.

If you decide that you despise Arduino and everything to do with it then you can easily transfer the knowledge you gained from working on this to another microcontroller or system.
Title: Re: Segment displays
Post by: ame on November 03, 2020, 03:57:31 PM
Just curious, will it look something like this?

(https://www.picclickimg.com/d/l400/pict/113019333277_/Bae-146-Tms-Display-Computer.jpg)
Title: Re: Segment displays
Post by: ame on November 03, 2020, 04:03:13 PM
Also, the software loop in the Arduino could be altered to:

Do nothing until TO is pressed
Read BCD switches
Calculate N1
Display N1

The effect is the same, and there are probably a number of other variations you could choose from. Usually the structure is dictated by whatever else is going on, but in this case there's not much to it.
Title: Re: Segment displays
Post by: Mach7 on November 04, 2020, 01:25:43 AM
Hello ame

Yes! That's is exactly the CDU..

Also, in addition to the N1 setup with the takeoff button, would it be possible to have a separate function to display 857 on the led display when the MCT button is pressed?

 Note the takeoff and mct buttons would never be operated at the same time.

Jim
Title: Re: Segment displays
Post by: ame on November 04, 2020, 11:08:14 AM
Yes, of course. You can display any pattern on the LEDs any time.

What happens when the device is powered up? What should be displayed then? And is there an indicator to show whether TO or MCT was recently pressed?

Once something is displayed on the LEDs does it remain there indefinitely?

I'm sure more details will be revealed later, but the code for what you have described so far could be written now. It could be written in a modular style so that the LED driver code, for example, can be added later when the hardware is chosen. That code deals with how to display something, but is independent of what to display.

Title: Re: Segment displays
Post by: ame on November 04, 2020, 04:18:41 PM
Very briefly, I put your numbers for N1 into a spreadsheet and came up with a formula N1 = Tref * 0.173 + 93.433

I think you missed the value for +10, so I moved everything down by 5.

I wrote a simple Python function to use integer calculations to produce N1, starting with multiplying by 173 so that the first term was 1000 times too large, then dividing by 10 so that it was 100 times too large and adding 9343, which is also 100 times too large. Then divide by 10 to give a result that is 10 times too large, or N1x10. Integer maths is faster and more efficient on an Arduino, but as you can see, it has its limits and introduces some rounding errors. Anyway, here's what you get:

def N1(Tref):
   i = int(Tref * -173)
   i = int(i/10)
   i = int(i + 9343)
   i = int(i/10)
   return i

for Tref in range(0,41,5):
   print(Tref,N1(Tref))

0 934
5 925
10 917
15 908
20 899
25 891
30 882
35 873
40 865

It's possible that N1 is not linear with respect to Tref, so let me know. Otherwise, it's a reasonable approximation. It will also go negative, because it is just a linear graph:

for Tref in range(-40,1,5):
   print(Tref,N1(Tref))

-40 1003
-35 994
-30 986
-25 977
-20 968
-15 960
-10 951
-5 942
0 934

The Python function is representative of what's in the Arduino code, so the numbers should be the same.
Title: Re: Segment displays
Post by: Mach7 on November 04, 2020, 05:05:42 PM
Hello ame,

To answer some of the questions...when the system is powered up the led readout would remain blank. The takeoff mode is selected just before take off and deselected after takeoff...( in reality the system is armed and displays the take off n1 once takeoff is selected, then activates automatically once the thrust levers are advanced to above  flight idle, driving all the actuators 5o full extend...once 75 knots is reached the system goes into a fail safe mode). To simplify my application, the system will be deactivated after takeoff by deselecting the Takeoff switch to off, extinguishing the n1 led value.

I am going to send some pictures of the thumbwheel switches when I get home tomorrow nite...

Apparently the internet has been down at home for two days, so I will have to sort that problem before I send you more info.

With respect to the N1 settings, I have an actual thrust setting chart based on pressure altitude and temperature from minus 40 to plus 50  degrees c.

I'll try and dig that up as well

Jim
Title: Re: Segment displays
Post by: ame on November 04, 2020, 09:12:41 PM
Sounds great. All do-able. I wrote some code that might actually work, which you're welcome to have when you are ready.

It sounds like your TO button is latching, i.e. it is push on/push off. Is that correct? Or is it a momentary button that you'd like to operate in a latching manner, i.e. push once to display N1, push again to blank the display?

The same goes for MCT.

But first, fix the Internet! :)
Title: Re: Segment displays
Post by: Mach7 on November 06, 2020, 04:19:26 AM
Hello ame,

Internet fixed!, just a loose cable.

I have included some pictures of one of the thumbwheel switches, as you can see they all connect together to form one +/- input, and the other two are graduated from 0 to 9.

I don't think we have to worry about interfacing the +/- thumbwheel, as the N1 values will look somewhat identical at +40 as they would at -40.

Just to recap my application, the TMS CDU that will be installed in my sim will not be "identical" to the CDU you and I are both familiar with.

Due to my LCD monitors that are used for the flight instrument information, the monitor itself protrudes slightly into the slot where the TMS unit slides in, therefore I have have to make some physical adjustments in order to "fit" the unit, (most notably not including any push button switches on the far right hand side).

I have been able to accomplish this by constructing a somewhat identical replica using my 3D printer.

So basically what my unit will look like is included as a rough draft below...

Onto your question regarding the switches...the Takeoff button will be a latch on and off type of switch with the MCT and TEST buttons being a momentary on type pushbutton.

Depending on how far we get with the aforementioned functions, if enough room allows me to move the Tref thumbwheels up to the top right of the CDU, I would like to include the TGT button (function) as well.

I might be able to 'make' extra room by downsizing my LED display.

If we were to include the TGT button, this button would be a latch on off type of switch as well.

I will now discuss each button in detail for this application;

Takeoff button.....

Just before takeoff this button will be selected to display the required takeoff N1 in the LED window. if the (actual) oatside air temperature is +15 degrees, and we set +15 in the Tref thumbwheel(s) then it will show the max N1 setting for takeoff. Since we normally never use full power for takeoff, I would dial in a higher temperature into the thumbwheels, (say +40 or +50) to give me a lower N1 value.

To amend my earlier calculation, I have found my thrust setting charts and have derived the N1 values as follows;

+00 = 89.9
+05 = 91.2
+10 = 92.4
+15 = 93.7
+20 = 92.4
+25 = 91.2
+30 = 89.9
+35 = 88.7
+40 = 87.5
+45 = 86.2
+50 = 85.0

Note that I have extended the temperature range from +0 degrees to +50 degrees using a constant factor of 1.25 between temperature ranges.

Also note that since these engines are flat rated to +15 degrees C, any temperature below this value is considered a flat rated range as you are getting the maximum thrust out of the engine at the specific N1 setting, and any temperature above +15 puts the engine into the 'full' rated range, which means you cannot take full thrust with the associated N1 setting as you hit a temperature limit in the engine, (most notably TGT).

For this reason, you will notice that the N1 values below +15 also decrease so as to maintain a constant thrust output of 6970lbs. Exceeding the n1 value in this range would exceed the fan gearbox limitations. but as the temperature increases to +15 my N1 value increases as well in order to maintain that constant thrust output up until it hits +15, then begins to decrease again all the way to +50.

In brief any N1 setting above +15 will be somewhat less than 6970 lbs of thrust.

After takeoff, once I deselect the Takeoff button, the LED readout will go blank.

MCT button,

The MCT button (max continuous thrust) function would be to display 857 in the LED window for short time, followed by a value of 96.7 indefinitely until the MCT button is selected OFF. (857 corresponds to the maximum TGT value, and 96.7 is the max obtainable N1 value for the engine). The time period for the 857 indication should be approximately 6 seconds.

TEST button,

The actual TMS CDU,(in the real aircraft), communicates on a bi-directional ASCAB bus to a computer. The CDU and TMS Computer make the same calculation with respect to N1 settings etc, and if there is a disagreement will display a fault code on the LED display beginning with the letter "F", followed by a numerical value with which maintenance can interrogate through a list of fault codes.

In this application, when the test button is momentarily pressed, the code of "F14 should display for as long as I hold the switch in, then extinguish once the switch is released.

TGT button,

This may be a long shot, but I have an identical set of thumbwheels exactly like the Tref wheels that are (all) graduated from 0 to 9. therefore if I can fit these wheels back into the CDU I could utilize this function as well.

With respect to the TGT switch, it is a latch on off type, and when pressed would display whatever you have set in the thumbwheel switches.

For example, if I dial in "7" "9" "3", then the LED display should read 793 when the TGT button is pressed in.

The TGT value will show as long as the switch is closed, so if I decide to change the thumbwheel values to a different setting, (say...830), then the LED should display the changes I am making as I cycle through the digits without having to cycle the switch off and then back on.

Once the TGT switch is selected OFF, the LED display will go blank.

Note that at no time will I be making simultaneous switch selection, in other words I will never be selecting the Takeoff button at the same time as the TGT or MCT buttons.

Again ame, I cannot thank you enough for helping me with this, hopefully we can make this work!

-Jim
Title: Re: Segment displays
Post by: Mach7 on November 06, 2020, 04:23:23 AM
Almost forgot to include my 'rough draft' of CDU setup...20201106_082907.jpg
Title: Re: Segment displays
Post by: ame on November 06, 2020, 11:10:42 AM
Hello again.

I can confirm that the Internet is working again. Thanks!

Ok, none of the behaviour you have described will be hard to implement in software. If Arduino is new to you then let me tell you you are entering a world of tedium and wonder.

Your message was full of dull details and minutiae, which is precisely what we need. You could develop the idea slowly and think about each aspect of the design as it comes to mind, but having such a detailed overview in advance is extremely helpful.

I am happy to assist with writing the code, but also happy to reassure you that all the parts you need are simple to use and widely available if you want to go it alone.

Let's look at the hardware you have and the hardware you need.

Microcontroller:
It's an Arduino. It's always an Arduino. For space reasons I recommend you use Arduino Nano. It will cost about $3 or $4. It hooks up to a PC through a USB port for power and programming. Once programmed it can operate standalone with a 5V power supply.

Thumbwheel switches:
Looks like BCD to me. We can be wasteful with our I/O pins and use four for each digit and one for the +/- switch. I would connect C to ground then 1248 to pins on the Arduino. I would keep the Arduino close to the front panel to keep all wires to the switches and display short to reduce the susceptibility to electrical noise. Software to read the thumbwheel switches is easy.

Latching buttons:
One side of the switch goes to an I/O pin, the other to ground.

Momentary buttons:
Same wiring as latching buttons.

LED display:
You need to choose one. It will need power and ground connections and two or three I/O pins for data. Note that the assembled modules you can buy have a PCB that is slightly larger than the display itself. If space is limited you can desolder the display from the PCB and run wires between them.

TGT:
Again, sounds straightforward, however I would pass on that initially. If a unit that deals with Tref only is immediately useful then stick with that. You will learn a lot while building it, which you can use to add TGT later.

Where to from here?

My recommendation would be to buy an Arduino (Nano or Uno) and hook up the thumbwheel switches. We can use the Arduino serial interface to print out the state of the thumbwheels. Since you haven't used Arduino before this would be an ideal starting point.
Title: Re: Segment displays
Post by: Mach7 on November 06, 2020, 01:41:01 PM
Hello ame,

Yes, thank you I will definitely need your help, and like you said, once we program the Tref function, then I might be able to figure out some of this stuff out on my own.

Good idea to wait on the TGT function as well

I am going to most likely go with the nano, as you said it is a lot smaller and it would most likely fit better within the CDU.

I will have to do some measurements before I decide on the size of the LED display, but I am leaning towards a .4 inch, yellow illumination.

I will order parts tomorrow and when they arrive I will let you now then we can begin...

I will most likely be asking a lot of simple questions, but once I understand it I'm like a dog with a bone...so please bear with me.

Thanks again!

jim
Title: Re: Segment displays
Post by: Mach7 on November 06, 2020, 02:34:47 PM
So...here is the first of my simple questions...as I have never worked with a complicated LED layout before...or Arduino...

With respect to the LED, am I looking for just the 3 digit display itself, or does it need to be coupled to a driver of some type I think you mentioned something in one of your posts with respect to this, but I am not exactly sure what an led driver does.

Also, with respect to the Arduino unit. is there any other hardware I need for connection...programming...etc?

Thanks ame!
Title: Re: Segment displays
Post by: ame on November 06, 2020, 05:16:43 PM
Hello again,

It's good that you have specific questions. I'll try and focus on specific answers, but I'll just point out that there are a myriad ways of solving any particular problem. If you keep the hardware and (to some degree) the software modular then you should see if you change one thing here it is completely independent of (and will not affect) that thing over there.

Ok, so, getting started with Arduino. Very simple- you need an Arduino, a USB cable for it, and the Arduino programming environment.

The Arduino you buy will often come with a USB cable, but if not, they are easy to come by. In general Arduino Nano has a mini-USB socket, so that's the cable you need. You'll also need a USB port on your PC to plug the Arduino into.

The Arduino programming environment is free and available from arduino.cc (which seems to be down at this very moment).

https://www.arduino.cc/en/guide/windows

You might also need to download drivers for the USB to serial chip on the Arduino, which should happen automatically when you plug the Arduino in.

Since it's such a popular device there are tons of tutorials on the web, so pick one and have a play. You might have some problems getting it going, but for most people it's plain sailing and Just Works. The first thing that most people do is open the "Blink" example program (or "sketch"), which turns the built-in LED on and off, alter the timing a little, upload the altered code, and get excited that the LED flashes at the rate they specified. If you can get to that stage then everything is set up and working.
Title: Re: Segment displays
Post by: ame on November 06, 2020, 05:41:37 PM
Now to the LED display.

Firstly, a 7-segment display is just 8 LEDs (don't forget the decimal point) arranged in a pattern. For convenience, one leg of all the LEDs is commoned to a single pin. The other 8 legs are individually connected to their own pin. But, which pin is common? The anodes? Or the cathodes? Well, you can choose! Generally you don't have to because you will be using a module which includes a driver, which I'll get onto shortly.

Once you have more than one digit the number of pins starts to go up quite quickly, so in the multi-digit displays the segments and digits are wired up in a matrix. Then you can turn a particular segment on by driving the segment line and the digit line in the matrix. If you rapidly scan through the digits and change the segments you are driving then you can make any pattern on the LEDs. Persistence-of-vision means that the viewer thinks the display is constant, but in reality only one digit at a time is lit.

Driving the matrix can be done by the microcontroller- 8 lines for the segments, and one more line for each digit. But, generally we don't do that and instead use a driver chip. The micro talks to the driver and the driver scans the matrix, turning the segments on and off.

Obviously, knowing that an LED module comprises a 7-segment display and a driver you could build your own. If you do, you have to choose the display you want, then wire up the matrix to the driver. Don't forget to choose common anode or common cathode to match the driver.

In your software there will be a point where you have the number you want to display in a variable somewhere, then you will call a software function which knows how to send data to the driver chip, then magic happens* and your number appears on the display. If you change your driver hardware you need to replace the software function with a new one, but it doesn't affect anything else.

Now you are narrowing down what you need, so it becomes easier to pick out specific components.

I already mentioned the TM1637 driver chip. Here it is on a board with a 0.36" yellow 7-segment display with decimal points:
https://www.aliexpress.com/item/32962489291.html

You could mask off one digit with black insulation tape or something.

Here's a 3-digit 0.4" yellow display:
https://www.aliexpress.com/item/32717990061.html

But you'd need to choose a driver and hook it up yourself. Not impossible, but tedious. Or you could do it later if you decided you really wanted.

* there is no magic, but you knew that.
Title: Re: Segment displays
Post by: Mach7 on November 06, 2020, 08:24:52 PM
Hello ame,

I did some review and understand that the segment display must have a driver.

I looked at the 4 digit TM1637 LED plus attached driver chip, and although this is good setup, it is just a bit too big for my application.

the other suggestion, (4031BG) is actually a perfect fit for the CDU.

If I went with this model, I am assuming that I would need to connect each individual pin (12)to a driver of some sort...I scoured the internet to find a 3 segment display with an attached driver, but no such luck.

Attaching wires to the pins then connecting them to a driver may be a better fit for my anyway as it frees up a lot of space at the back of the CDU.

So next question, is there a specific type of driver I should be looking for with respect to this model of LED? or will any segment display driver do the trick?

Jim
Title: Re: Segment displays
Post by: ame on November 06, 2020, 08:46:53 PM
Hello again,

Yes.

There are two things to draw to your attention with that specific linked display.

1 I picked it at random. It might be suitable for you, but there are others. Maybe.
2 It's yellow/green, so the colour might not be exactly what you are looking for. However, it might be good to get you under way.

In terms of drivers, yes, pick one and hook up 11 wires from the display to the driver. Make sure that the display type (common anode, CA, or common cathode, CC) matches the driver. The driver chip itself also needs some components to make it work, so in this case what you are looking for is driver-chip-plus-components-on-a-pcb and the display. I'll post a couple of examples if I can find some.

Designing something like this is a fairly long process, and can be frustrating. If you have a well-supplied junk box you can get a head-start, but even if you can find local suppliers there is a research-buy-evaluate loop that has an intrinsic delay and no guarantee of success. Having said that, it's fun, and rewarding when everything works. Plus, if you designed it yourself you know exactly what to do if you ever want to change something.
Title: Re: Segment displays
Post by: ame on November 06, 2020, 09:16:19 PM
LED drivers
Popular ones
TM1637
MAX6219
HT16K33
74HC595 (generally one chip per digit)

I don't think you will find a 0.4" yellow 3-digit display attached to the driver of your choice, but once you know how this stuff works you can bend it to your will.

For example, the TM1637 boards typically look like this:
https://m.aliexpress.com/item/4000093386794.html

Scroll through the pictures and it looks like a 12-pin display soldered to the board. I haven't traced the pins, but if the 4-digit display has pins in the same order and spacing as the 3-digit display then a straight swap might be possible.

Here's an example of a MAX7219:
https://m.aliexpress.com/item/32830440792.html

The board is very long, but look at the green one: the display is socketed. Easy to remove and connect your own wires.

Here's another one. Option 1 is "solder it yourself". Would give you a square board be with the chip on it and access to the LED output matrix.
https://m.aliexpress.com/item/32580532205.html

HT16K33:
https://m.aliexpress.com/item/1005001713347520.html

74HC595:
Probably a lot of work, and no good for a matrix, just individual digit displays.

https://m.aliexpress.com/item/32707015238.html

Would be ok if you found single digit 0.4" yellow displays.

I didn't check which are common cathode or common anode.
Title: Re: Segment displays
Post by: ame on November 06, 2020, 10:13:10 PM
Ok. In my junk box I have one of these:
https://www.aliexpress.com/item/1005001525520773.html

0.36" 4 digit, red, with clock colon

And one of these:
https://www.aliexpress.com/item/4001283388143.html

0.36" 6 digit, yellow, with decimal points

Both have the TM1637, which I have found to be common anode (CA). 0.36" is a little smaller than you want, but the 6-digit display is made of two 3 digit displays. The 3-digit display is CL3631BY. The pinout is here:
https://www.aliexpress.com/item/32737097670.html

As you can see, the pinout for both modules matches! And, really, the pinout for the 3-digit display is the same as the 4-digit display, but pin 6 is missing. Pin 6 is the common anode for digit 4, which is not present in a 3-digit display.

But...

The longitudinal spacing of the pins is standard at 0.1" (2.54mm), but the spacing across the width of the 0.36" module is 10.16 mm, and across the 0.4" module is 12.7 mm.

So, although the pins are in the right order, they are on a wider track. However, they have a reasonable length so it might be possible to jam the widely spaced leads of the 0.4" display into the holes vacated by the 0.36" display.

I would be very tempted to buy this:
tm1637.jpg

Desolder the installed 0.36" 4-digit display that looks like this:
3641_CA_display.jpg

And jam in a new 0.4" 3-digit display that looks like this:
4031_CA_display.jpg

What do you think? Don't just take my word for it.

It means the display itself is no bigger than it needs to be, but the driver PCB is a little bit bigger all around, and set back a little behind the back of the display. You mentioned that you haven't used Arduino before. How are your soldering skills?

One caveat- datasheets pulled off AliExpress products often, er, don't match reality. But I'm confident with my conclusions.
Title: Re: Segment displays
Post by: Mach7 on November 07, 2020, 04:11:14 AM
Hello ame,

Thank you for the information, it is very helpful in navigating a choice.

What do you think of this...I would like to use the 4031BG coupled with the HTK16K33 led control drive unit.

https://www.aliexpress.com/item/32717990061.html

My soldering skills are quite good...so I was thinking I could solder individual wires to the LED pins leading back to the driver unit...what are your thoughts on this?

This way it solves my lateral space problem on the CDU head.

Jim
Title: Re: Segment displays
Post by: ame on November 07, 2020, 09:50:59 AM
Yes, that would be fine. The HT16K33 is a common cathode driver, so make sure you get the right display.

It's also my current favourite display chip, and has the capability for switch input as well as LED output. I'd recommend connecting the switches to the Arduino to start with however.

Here's an example of using the HT16K33 to drive a 4-digit 7-segment display:
https://protosupplies.com/product/ht16k33-led-controller-module/

You will wire yours up in a similar fashion, except you will use only C0 C1 and C3. I'm not sure why the example does not use C2. It is explained in the text, but I don't understand the reasoning. It's for the colon in a clock display, so maybe it's hard-coded in the library. I would prefer to use C0 C1 and C2, but we can figure that out later.

Basically you hook up your display to the HT16K33 board with 11 wires (8 segments, 3 digits) then you hook up the HT16K33 board to the Arduino with 4 wires (5V, GND, SCL, and SDA). SCL is A5 on the Arduino, and SDA is A4. Your display is done!
Title: Re: Segment displays
Post by: ame on November 07, 2020, 10:16:43 AM
There's also this:
https://m.aliexpress.com/item/33049299832.html

It's a clone of the Adafruit LED backpack, based on ht16k33.

This time the leads are spaced too wide, but again I think the 3-digit module could be persuaded to fit.

It might be an option if you have space for the PCB just behind the displays.
Title: Re: Segment displays
Post by: Mach7 on November 07, 2020, 10:37:31 AM
I just noticed that the  4031BG model LED display is yellow/green....not my preference as I am looking for yellow.

I did not realize how hard it is to find a 3 digit, 7 segment, yellow common cathode LED display in my size range.

Maybe all out of stock due to COVID..can't transport from China(?)

My search continues.....
Title: Re: Segment displays
Post by: ame on November 07, 2020, 11:19:41 AM
Is 0.36" acceptable?
Title: Re: Segment displays
Post by: Mach7 on November 07, 2020, 11:30:27 AM
Yes for sure...do you have a link?

BTW is there a reason for the lack of 3 digit displays? I am even looking on eBay now.
Title: Re: Segment displays
Post by: ame on November 07, 2020, 11:41:37 AM
I searched on AliExpress with "display segment yellow 0.36" and got a few hits. Remember to choose common anode or cathode to match the driver, and double check the colour. Price, batch quantity, and shipping seems to vary a lot.

You could hand-wire the display to a driver as discussed, or find an existing module and remove and replace the display. As, er, also discussed. :)

You could also buy any module for the purpose of development, and replace it with something "better" later.
Title: Re: Segment displays
Post by: ame on November 07, 2020, 12:05:32 PM
I don't know why 3-digit displays are uncommon. I think it's more a case of 4-digit being extremely common (for clocks, I expect).

And once you start getting very specific about your requirements the chances that that particular combination is common become vanishingly small.
Title: Re: Segment displays
Post by: Mach7 on November 07, 2020, 02:04:58 PM
So....i have found a suitable LED display solution...it is the CL3631BH
which comes in bright yellow
...a bit smaller, but will do perfectly for my application...the only problem is that it is a common anode type so my search now turns to a compatible LED driver....any thoughts or links?

Having a hard time finding a common anode driver now:(

On the bright side...im getting close to ordering some bits and pieces!



Title: Re: Segment displays
Post by: ame on November 07, 2020, 02:57:46 PM
Just for completeness I am reviewing the driver list I made earlier:

TM1637  Common Anode, 8 segments x 6
MAX7219 Common Cathode, 8 segments x 8
HT16K33 Common Cathode, 16 segments x 8

I am ignoring the 74HC595 as it is a single chip per digit, not a matrix driver.

So, you have found 0.36" 3-digit yellow common anode.

It will work with the TM1637.

Here is another common anode:
https://www.aliexpress.com/item/32804978824.html

This is indeed labelled CL3631BH, but often the photos don't match the specific component.

That 3-digit CA display is also found on the 6-digit board from Robotdyn:
https://www.aliexpress.com/item/32798344970.html

There are two of them, to make 6 digits. The TM1637 will drive a maximum of 6 digits.


If you wanted to use the MAX7219 or HT16K33 you would need common cathode. Like this guy:
https://www.aliexpress.com/item/32642714446.html


Frankly, it's really hard to stay focused. Even though I know what I am looking for I have to keep double-checking what I am looking at.
Title: Re: Segment displays
Post by: ame on November 07, 2020, 03:09:52 PM
As I said, I am a fan of HT16K33, but, I happened to have some TM1637 modules in my junk box. The 4-digit display is red. The 6-digit display is yellow:
IMG_20201108_112855~2.jpg
IMG_20201108_112930~2.jpg

I desoldered the 4-digit display, and one of the 3-digit displays:
IMG_20201108_122650~2.jpg

Then moved the 3-digit display to what was the 4-digit board:
IMG_20201108_122742~2.jpg

Not tested yet, but it ought to work. You can imagine soldering 11 small wires from the display to the board if you didn't want to have the board right behind the display.
Title: Re: Segment displays
Post by: Mach7 on November 07, 2020, 05:01:08 PM
I know what you mean....i have about 25 windows open for various parts etc...and my head is beginning to swim....

Having said that, I think I have found a compatible solution after reviewing your last two posts..

I am looking at the LED display 3631BH which is a common cathode 3 digit 7 segment display.

https://www.aliexpress.com/item/32642714446.html

The driver will be the TM1637 Red Digital Tube LED Display Module & Clock LED

https://www.aliexpress.com/item/32948103200.html?spm=a2g0o.cart.0.0.47213c00qpG5wp&mp=1

Before I order these units...i do have a question...first...I cannot find anywhere in the specifications that tells me that this unit is a common cathode type..

and second, i am a bit concerned with the text in the explanation of the driver that says "red digtal tube display".

I am assuming that since the LED is yellow, the driver should not have an impact on the emitting color (?).

so...have I picked the right combination of display and driver...or am I back to square 1 in my continued search.

Thanks ame

Jim
Title: Re: Segment displays
Post by: ame on November 07, 2020, 05:01:43 PM
Well, that worked. It's hard to capture the colour properly, but it looks fine on the bench. I set the driver brightness to 3. The range is 0 (off) to 8 (full). I'd recommend you put a piece of smoked acrylic over the front as a display filter. It will make it look much nicer, and boost the contrast a bit.

The Nano is plugged in to a base PCB with screw terminals. Easy to find, and cheap, but it adds bulk. You probably want one, or a breadboard for development, but not for the final assembly.
Title: Re: Segment displays
Post by: ame on November 07, 2020, 05:11:17 PM
Quote from: Mach7 on November 07, 2020, 05:01:08 PMI know what you mean....i have about 25 windows open for various parts etc...and my head is beginning to swim....

Having said that, I think I have found a compatible solution after reviewing your last two posts..

I am looking at the LED display 3631BH which is a common cathode 3 digit 7 segment display.

https://www.aliexpress.com/item/32642714446.html

The driver will be the TM1637 Red Digital Tube LED Display Module & Clock LED

https://www.aliexpress.com/item/32948103200.html?spm=a2g0o.cart.0.0.47213c00qpG5wp&mp=1

Before I order these units...i do have a question...first...I cannot find anywhere in the specifications that tells me that this unit is a common cathode type..

and second, i am a bit concerned with the text in the explanation of the driver that says "red digtal tube display".

I am assuming that since the LED is yellow, the driver should not have an impact on the emitting color (?).

so...have I picked the right combination of display and driver...or am I back to square 1 in my continued search.

Thanks ame

Jim

Back to square one I'm afraid. TM1637 is common anode...

If you want to know why, read the data sheet:
https://www.mcielectronics.cl/website_MCI/static/documents/Datasheet_TM1637.pdf

Also, don't worry about digital tubes. I don't know for sure, but I think it is a confusion with, or mis-application of, "Nixie tubes".

And indeed, the driver does not affect the colour. The colour is set by the LEDs in the display. The driver just turns them on and off.
Title: Re: Segment displays
Post by: Mach7 on November 07, 2020, 06:33:52 PM
oK...Actually no problem, I will stick with the same driver and revert back to the original 3 digit yellow display;

https://www.aliexpress.com/item/32804978824.html?spm=a2g0o.cart.0.0.2a003c00cMffwI&mp=1

This display is denoted as an anode, so this combination of driver TM1637 and this change in LED should work....(?)
Title: Re: Segment displays
Post by: ame on November 07, 2020, 06:49:04 PM
Reckon so.

You'll have to desolder the red 4-digit display from the board then solder the yellow 3-digit display in place (or attach it with 11 wires).

Then you will have exactly what I just made, which I (now) know works.

In the meantime, if you can get hold of an Arduino (Uno or Nano) we can play with the thumbwheels.
Title: Re: Segment displays
Post by: Mach7 on November 07, 2020, 08:13:16 PM
Ok...like I said...i will have a lot of questions.

Here is my Arduino question...

When I go to the Arduino website, the nano is listed at 20 dollars and change...when I go to Aliexpress, they have the nano's on for a couple of bucks.

The price is not a concern for me...but I notice that the arduino models on Aliexpress do not use the word "Arduino" which makes me think they are a knock off of the original ??

If so...would you suggest buying the original equipment, or would a copy of a nano work sufficiently?

thanks ame

Jim
Title: Re: Segment displays
Post by: ame on November 07, 2020, 08:30:56 PM
Ah.

Well.

It's like this. The Arduino design is Open Hardware and can be legitimately copied and sold by anyone. Fundamentally it's a $2 Atmel ATmega328 microcontroller on a PCB and there's not much to it. However, only official Arduinos can carry the Arduino name, and if you do buy an authentic Arduino then you are supporting the development of the hardware and the software that comprises the Arduino ecosystem and makes it so easy to use. You'll also have aftersales support, a warranty, and all that good stuff.

You can get it straight from the horse's mouth here:
https://blog.arduino.cc/2013/07/10/send-in-the-clones/

If you buy an "official Arduino" for $5, it's probably fake and illegally using the name and logo. If you buy an "official Arduino" for $20 from some guy in a van, it's probably fake, and you've been robbed. If you buy an "official Arduino" for $20 from a legitimate store, good for you! You're helping everyone. If you buy a "Nano microcontroller board" from somewhere cheaply it probably does not say Arduino on it, so it's a clone, and it's probably ok. You've saved some money, but you are educating yourself, which is the whole point. The next person you excitedly tell all about Arduino might altruistically buy an official part. Or maybe you will later.

I generally buy clones from AliExpress. I've never had a dud, but they are out there. Once you've started getting into it then you're going to need more than one...
Title: Re: Segment displays
Post by: ame on November 07, 2020, 09:03:03 PM
Ok. I've hacked together some code. I decided to connect the thumbwheels in a matrix fashion so that there will be enough pins for TGT later.

I have a dimming potentiometer, which you can include if you like. It activates the 8-step dimming function of the TM1637.

I have implemented the TEST button, and the MCT button. Everything can be changed, of course.

I have code to read the thumbwheels, but I don't have any to test. I can also calculate N1 from Tref. Everything should work (when it's finished), and I can't see any reason why you can't build something that works in the way you described.

Once you have an Arduino you can hook up a thumbwheel and test it. Arduino has a serial I/O port which can be used to print out the state of the internal program. So you could change the thumbwheel and see the results printed on your PC screen.

I suggest you buy several of any of the cheap parts you are using (including Arduinos, following on from the previous message). It will allow you to keep going if you want to build something new, or another copy of what you have or replace any parts that become inexplicably inoperative.
Title: Re: Segment displays
Post by: Mach7 on November 08, 2020, 04:40:19 AM
That all looks and sounds great...i can hardly wait to see this think in action!!

So here is where I stand..

I have ordered all the parts off Aliexpress, plus a number of other bits and pieces such as different size displays, connection leads, etc etc so I have enough parts to become flexible with the project.

I have also ordered a handful of nano, and UNO boards, plus the (bulky) connection board you referred to in one of your last post along with compatible usb connection cables.

So know we will have to wait for the parts to start trickling in!

-Jim
Title: Re: Segment displays
Post by: Mach7 on November 08, 2020, 10:29:23 AM
Hello Andrew,

Just a quick question...

I am mapping out the pushbutton switch outputs for the takeoff button.

Is Arduino capable of outputing illuminating a single green LED on the switch once the button is pressed to activate the thumbwheel/led segment display information?
Title: Re: Segment displays
Post by: ame on November 08, 2020, 11:14:50 AM
Somehow I just knew you were going to ask something like that...

The short answer is yes.

But I'm running out of pins.

There are solutions to "running out of pins", because it happens all the time.


A Nano has
14 digital only pins
6 analog/digital pins
2 analog only pins

Two of the digital pins are used for serial communication, and one is attached to a built-in LED, which leaves 11 digital only pins.

So far, I have allocated 4 pins for thumbwheel bits, and one for each thumbwheel. There will be 6 thumbwheels, so 10 pins are required.

The LED module requires 2 digital I/Os.

The switches, TO, MCT, TGT, and TEST need one each, so that's another 4.

Total is 16, and we have 11+6=17 digital I/Os available. Leaving one for the LED. Hooray.

The brightness pot is hooked up to one of the analog-only inputs.

We could connect the switches to the thumbwheel bit inputs, then we'd only need one more pin for four switches instead of four pins, which would release three pins, leaving four free.

I know I said originally we could afford to waste pins. Now we can't, but there are solutions if we need them.

Title: Re: Segment displays
Post by: Mach7 on November 08, 2020, 12:08:30 PM
Ok thanks Andrew,

If I did need an LED lamp output, it would only be for the Takeoff button to illuminate a single chevron when pressed in, and at that I might not need it at all.

Just looking at my initial CDU construct and trying to use some existing inputs and outputs.

Jim
Title: Re: Segment displays
Post by: ame on November 08, 2020, 12:16:55 PM
No worries. As I said, there is currently one pin left, which you could easily connect to a single LED. You need a resistor inline with the LED, then connect it from the pin to ground, or from 5V to the pin.

I've been working on a CDU too. Originally for a Bombardier Challenger 300.
Title: Re: Segment displays
Post by: Mach7 on November 08, 2020, 01:18:49 PM
Cool, I currently fly the CRJ900.
Title: Re: Segment displays
Post by: ame on November 08, 2020, 03:08:52 PM
Back to details.

The photo of the thumbwheel switches showed that there are diodes fitted. Are there diodes on all of the thumbwheels? Only one diode is needed on the +/- switch, but it doesn't matter if there are four.
Title: Re: Segment displays
Post by: Mach7 on November 08, 2020, 04:46:28 PM
Yes, each set of thumbwheel switches has diodes, there are 4 on each of the 0 to 9 and two on the + and -.
Title: Re: Segment displays
Post by: ame on November 08, 2020, 05:31:56 PM
Ok. Cool. For the pushbutton switches I will suggest another four diodes, then they can all be put in a matrix which will use the I/O pins efficiently. That means four I/Os are currently free.

So, for all switches there are four defined inputs, which will connect to all of the thumbwheel 'numbered' pins. Currently pin '1' on the thumbwheels is connected to D2 on Arduino. All thumbwheel pin '1's are connected together.

Similarly, all thumbwheel pin '2's are connected together and to Arduino D3.

All thumbwheel pin '4's are connected together and to Arduino D4.

All thumbwheel pin '8's are connected together and to Arduino D5.

Then, the 'C' pins on the thumbwheels are connected to other Arduino pins. Tref units 'C' pin to Arduino D6. Tref tens 'C' pin to Arduino D7. Tref +/- 'C' pin to Arduino D8.

D9, D10, and D11 are free at the moment.

Later, TGT thumbwheels can be connected. Pins 1, 2, 4, and 8 as before. 'C' pins to A0, A1, and A2.

I think the pushbuttons are as follows:
TO is a latching pushbutton.
MCT is a momentary pushbutton.
TEST is a momentary pushbutton.
TGT is a latching pushbutton.

Each pushbutton will be connected through a diode to another pin (in this case, D12).

So, from D2 through a diode to one pin of TO, then from the other pin of TO to D12.
From D3 through a diode to one pin of MCT, then from the other pin of MCT to D12.
From D4 through a diode to one pin of TEST, then from the other pin of TEST to D12.
From D5 through a diode to one pin of TGT, then from the other pin of TGT to D12.

Thus, when D12 is high the switches have no effect on anything else connected to D2-D5. When D12 is low, the state of the switches can be read by reading D2-D5. It's a classic matrix design.

Similarly, by grounding the 'C' pins of the thumbwheels individually we can read each thumbwheel by reading D2-D5.

The diodes stop other switches in the same row from affecting the switches in the selected column.

I could draw a schematic, but I haven't tested it all yet. When your Arduino arrives you can connect a single thumbwheel and test it, then add another and see that they work independently, and so on.

Although I have written the bulk of the firmware now I won't post it in one chunk. I will suggest that you test each part and then try the whole thing. That way you can see how all the parts work, and how they fit together.

I know you haven't done anything with Arduino, but have you done any programming of any type?
Title: Re: Segment displays
Post by: Mach7 on November 09, 2020, 08:14:26 AM
Hello Andrew, yes...a little bit of programming using 629 chips for PWM gauges using the Melabs programmer.

I have never written a word of code in my life, but I had a close friend of mine in the UK, (Peter Barnes) who would write the code in notebook format...i would run it though MPLAB IDE change it to gcode...then download it with the programmer from my laptop.

That is the beginning and end of my knowledge stream....although Peter did show me how to manipulate the code somewhat to change needle movement etc etc....,
Title: Re: Segment displays
Post by: Mach7 on November 09, 2020, 08:26:20 AM
And yes...you are correct about the switches

Takeoff is latching
MCT is momentary
TGT is latching
Test is momentary.

A diagram would be greatly appreciated when it is all said and done.

Not sure when the parts will arrive....the lead time is 15 to 30 days:(
Title: Re: Segment displays
Post by: ame on November 09, 2020, 11:24:40 AM
Quote from: Mach7 on November 09, 2020, 08:26:20 AMAnd yes...you are correct about the switches

Takeoff is latching
MCT is momentary
TGT is latching
Test is momentary.

A diagram would be greatly appreciated when it is all said and done.

Not sure when the parts will arrive....the lead time is 15 to 30 days:(

Ok. Do the thumbwheels all have diodes?

Also, is this the first time you have ordered from AliExpress? Lead times were variable in the Before Times. Now, moreso.

Here in New Zealand we have some local stockists who sell on the local equivalent of eBay. The prices are a little higher for the same thing, and delivery is not free, but it's stocked locally so you can get stuff much quicker. Anything like that where you are?
Title: Re: Segment displays
Post by: Mach7 on November 09, 2020, 11:57:21 AM
Yes, all the thumbwheels have diodes...there are 4 diodes on each of the 1 to 9 digit wheels and two on the plus minus wheel.

We do have an electronics shop here, but they don't stock a lot of product:( I have checked with them in the past and they can order the items...but I can get them just as fast at a better price.
Title: Re: Segment displays
Post by: ame on November 09, 2020, 12:20:33 PM
Ok. Now we wait.

Well, you do.

Sorry, I already asked about diodes, and you already replied.

If you were going to build a panel identical to the original I'd suggest the HT16K33 as it supports many more LEDs and has a matrix switch scanner. It only needs two wires back to the microcontroller. I'm going to use one for the KT76C I am working on in another thread in this forum. Waiting for parts from AliExpress...

However, your reduced requirements can easily be handled by the Arduino, and the TM1637 is very easy to use, so it's definitely a goer. I haven't been pushing the HT16K33 too hard as I have only used it with a Raspberry Pi. I haven't used it with Arduino yet, although I see there is a library for it, so it should work.

I hope that other people reading this thread will get curious about building standalone widgets to fit in the cockpit. It's probably as compelling as the 'connected' devices that are being made.
Title: Re: Segment displays
Post by: Mach7 on November 09, 2020, 12:55:11 PM
Andrew, you are absolutely correct on your comment regarding stand alone wigets versus connected devices.

for example, my hydraulic panel operates identical to the real aircraft, as does the landing gear selector lamps, however they do not communicate with flight sim, except for an output from the gear lever to the 836x joystick board for up and down information to FS9.

I have a number of items that work independent of the flight sim program, but to the operator it all appears seamless.
Title: Re: Segment displays
Post by: Mach7 on November 09, 2020, 01:23:55 PM
As i type this, my 3D printer is busy building me another TMS CDU...will inlcude a pic when it is done...should be another 26 hours or so of printing...
Title: Re: Segment displays
Post by: ame on November 10, 2020, 11:46:07 PM
Quote from: Mach7 on November 09, 2020, 08:26:20 AMAnd yes...you are correct about the switches

Takeoff is latching
MCT is momentary
TGT is latching
Test is momentary.

A diagram would be greatly appreciated when it is all said and done.

Not sure when the parts will arrive....the lead time is 15 to 30 days:(

Do you want latching switches? I mean, are they latching on the original device? Or do you want to use momentary buttons for all four, and have the latching behaviour done in software?

Either is easy. Currently I have it set up as you specified, with two physically latching buttons.

Regarding a schematic, have you used any schematic capture software, or do you have a preference? My preference is for KiCAD, but I could dump it as a PDF very easily.
Title: Re: Segment displays
Post by: Mach7 on November 11, 2020, 05:15:54 AM
Hello Andrew, i think i will stick with the original plan regarding the switches, but thanks for asking.

I am not good at reading schematics, so to give you an example of what I did in the past with Peter Barnes...he would write the script and identify which output ports had to go where off the 629 chip, and after i programmed said chip i would draw out a plan on how i was going to solder it up...i'll include a pic of an example of one of my breadboards.

I am thinking (hoping) the Arduino connection(s) will be somewhat straight forward as well.

Jim
Title: Re: Segment displays
Post by: ame on November 11, 2020, 09:39:23 AM
Ok. No worries.

Did your 3D print finish?

I hope your components arrive soon. The Arduino is the core, so when that arrives you can start getting up to speed.

Wiring is really up to you, but it can get quite untidy quite quickly. If you have any common techniques that you like to use then I am sure you can apply them here. In this project there are no special things to be careful about, just a bunch of wires from the Arduino to the other parts.

The Nano screw-terminal block is handy for prototyping, but you can solder wires directly to the Nano later to save space. You'll probably also need some way of connecting several +5V lines and GND because you can't jam many wires into the screw terminals.

I suggest that you will build everything as a rat's nest on the bench first, then figure out how to put it tidily behind the front panel. Luckily, although matrix wiring is a little more complicated, there are fewer wires.

You will see other examples of "behind the scenes" on this website, some tidy, some still a rat's nest. I am sure you have figured out how to hook things up and make them work.

I'll do a schematic and use it to talk about the actual components. I think it will become clear to you. I am enjoying helping on this project because it is very well defined and has a clear finish point.
Title: Re: Segment displays
Post by: Mach7 on November 11, 2020, 10:47:04 AM
Hello Andrew,

I actually ordered one of those nano boards with the screw terminals, so I might utilize that depending on available space.

The good think about the CDU is that i have all kinds of space behind the unit within the confines of the panel cutout.

I agree 100 percent with bench testing and setting it up before I tidy up the final product for installation...that is basically how I have approached the entire project.

The print is complete...i had some issues with the nozzle and print quality, so I ended up doing the entire print over again....that seems to be a normal aspect of 3D printing...for me anyway.

The TMS CDU was printed in basically three parts...the bottom portion holds my AML21 series switches, then there is the top face CDU, then the individual buttons which are designed to hold an LED.

The switches will be glued to the AML21 button so they don't fall out.

You might ask why I just didn't use the buttons directly...its a long story but suffice to say I wanted the unit to look as 146 specific as possible. I could have used the original switches form the real CDU..but they are dark, dirty and worn out...I wanted something fresh and new looking..

My current TMS CDU was constructed with the exact same principles, and nothing has fallen off or failed on it yet...so i stuck with what works.

The print will look a lot better after I sand down the rough edges and paint the unit....there is a lot of excess plastic on the buttons right now due to the printer brim...but after I clean them up they will slide nicely in and out.

I have included some pictures....

Just another question for you regarding the TREF thumbwheel input...we talked about N1 values in 5 degree increments...if the wheels are set at something in between...say 17 or 18 degrees...what will the LED value read?

I am assuming that it would read the +15 value at 16,17,18,19, then change to the 20 degree value at "20"...this is of course a perfect setup for me...just curious if we are on the same page.

Jim
Title: Re: Segment displays
Post by: ame on November 11, 2020, 11:31:05 AM
Nice print! It will look fantastic once everything is "animated" and things light up.

Regarding N1 display- the device will do what you specify it will do.

Currently you listed N1 per 5 °C steps. I used your list to derive a linear function. The function will return N1 for any input value of Tref. I showed some sample output where Tref was stepped up in 5 °C increments, but that was just to keep the message short.

I may have mentioned already that there is no magic. The output for any input can be specified in advance, or determined by examining the code.

If you want discrete values of N1 based on Tref changing by 1 unit, that's fine. If you want N1 to change only when Tref is on a multiple of 5 units that is also fine. If you don't specify it you get my interpretation of what I thought you wanted. If what you get is not what you want it can be changed.

While we (you) are waiting for parts we can discuss minutiae like this.

What range of Tref do you want to deal with? The thumbwheels will allow you to select -99 to +99. If your expected range is -40 to +40 then what do you want to happen if the thumbwheels are set beyond that range?

Then, specifically, what is the relationship between N1 and Tref? Do you want N1 to change when Tref changes by one unit? Do you want it to change only when Tref is a multiple of 5?

The function for N1 can be implemented as an algebraic equation (e.g. y=mx + c) or as a lookup table (literally a list of expected values of Tref and the corresponding value of N1). We talked about pressure being constant, but it could be incorporated into the formula even though it doesn't change.
Title: Re: Segment displays
Post by: Mach7 on November 11, 2020, 02:38:43 PM
I actually did not know we could be that flexible with Arduino...this is exciting!So yes...lets have the N1 change with each degree of temperature, hitting the target (listed) N1 values at every 5 degrees.

To answer some of your questions..if we could have a temperature range then -40 to +50 would be the temperature range we would need. Going outside of this range would never happen as it is outside the aircraft's operating limitations for takeoff and landing anyway.

If we were to go from -40 to +50, I will send you the complete thrust values within these temperature ranges based on a pressure altitude of between 0 and 1000 feet. (The chart is graduated in 1000 foot chunks of pressure altitude, and the temperature range is graduated in 5 degree increments)

Like you stated earlier, to get those in between N1 values would be nothing more than a applying a linear function between the temperatures to in order for the N1 to change a small amount in single degree increments.

Title: Re: Segment displays
Post by: ame on November 11, 2020, 03:56:09 PM
Arduino is basically a tiny computer. It can read input pins, drive output pins, interface with other chips, communicate via serial and other means, and do maths.

If you ever had a home computer in the 80s, an Arduino has similar processing power. So it can do a quite a lot, but has limited resources.

I know that you won't select a value of Tref out of range, but I need to know what to do if you do. If you go above or below the top and bottom of the range the calculation for N1 can still be made, and the result can be displayed, but maybe that's not what you want.

You could, for example, clip the values to the range, so that anything over 50 is treated as 50, and anything below -40 is treated as -40. Or you could detect that Tref is out of range and display an error message, or three "-" signs, or blank the display. Or something.
Title: Re: Segment displays
Post by: Mach7 on November 11, 2020, 04:07:18 PM
Now you have me thinking....I flew the real 146 for 23 years and never dialed in any values above or below the limitation, so I am not sure exactly what would be displayed on the display....but for sure there must be something displayed.

I will dust off my TMS manual and see if it has information regarding this.

I am thinking maybe we can display ERR for error if a value below -40 (starting at 41), or above +50 (starting at 51).



Title: Re: Segment displays
Post by: ame on November 11, 2020, 04:23:41 PM
Yup. Can do.

The same goes for all other weird but possible conditions. Even if no-one would actually do it I need to know what to do. Even if it's "do nothing".

A QA engineer walks into a bar...
Title: Re: Segment displays
Post by: ame on November 12, 2020, 12:20:55 PM
Ok, attached is a draft schematic. It looks a bit busy, but if you look at any individual component, or any single line to the Arduino it's pretty clear. I can talk you through it, but here are the key details:

TM1637 needs power, ground, and two data lines. The symbol shows four LED digits, but you will have replaced the 4-digit module with a 3-digit module.

The thumbwheels have diodes built-in, but I am showing them as discrete components so that you (or anyone else reading) will know they are supposed to be there. You can see that each switch line (1, 2, 4, and 8 ) is connected to the same line on all the other switches. i.e. all 1's are connected (to D2), all 2's are connected (to D3) etc. But, the C lines for each individual switch are connected to different pins on the Arduino. That way, we can turn on the C line for each switch one by one, read the switch value, then turn it off and move on to the next one. This forms a matrix, which is an efficient way to have many switches with a few I/O pins.

LED1 is the TO LED you asked for. It is turned on and off by D9 under software control.

RV1 is the dimming potentiometer that you didn't ask for. Its value can be read, and then a brightness command can be sent to the display.

That's it. I will send code later.
Title: Re: Segment displays
Post by: Mach7 on November 12, 2020, 02:01:47 PM
Andrew...your schematic is a piece of art!..thank you!

Although I am sure I will have some questions, your drawing is very straight forward and easy for me to understand.

I have attached the thrust setting chart as promised. As you can see the chart goes beyond the -40 to +50 range, but the Aircraft certification does not, so I will stick with the -40 to +50.

As discussed, the -40 N1 value increases to it's peak at +15, (zero feet pressure altitude), then begins to decrease again.

I had a couple of emails over the last couple of days from Aliexpress telling me some of the parts have been shipped!

Jim
Title: Re: Segment displays
Post by: Mach7 on November 12, 2020, 02:05:43 PM
Andrew, let me know if the chart is legible, I saved it as a jpeg file assuming you could zoom in on the values.

I can try and send a better format if you want..let me know

Jim
Title: Re: Segment displays
Post by: ame on November 12, 2020, 02:18:17 PM
Yup. Legible. Thanks.

Glad you like the schematic. It is drawn with KiCAD, which is a great free schematic program and PCB design package.
Title: Re: Segment displays
Post by: Mach7 on November 13, 2020, 01:28:23 PM
Andrew, just familiarising my self with the schematic as I can most likely begin connecting some of these items up while I wait for the parts, most notably the takeoff, mct and tgt buttons to the thumbwheel switches.

In reviewing  the diagram, i notice that all of the  aforementioned switches are connected to both the Tref and the TGT thumbwheels...

I was just curious as to why the takeoff button would need to be associated with the tgt thumbwheels and visa versa...but most likely that would be taken care of with t the programming software (?)

Jim
Title: Re: Segment displays
Post by: ame on November 13, 2020, 02:50:01 PM
Good question.

I'd recommend holding off with construction until the Arduino arrives. I've drawn the schematic based on my understanding of multiplexing thumbwheel switches, but I don't have any to test it.

Since you do have the switches, I propose that you hook up a couple of them to the Arduino, confirm that they work, then carry on.

The principle is described here

https://www.embedded.com/keyboard-and-display-multiplexing-the-traditional-approach/

and here

https://www.avrfreaks.net/comment/2713611#comment-2713611

So I am confident that it will work.

I might have to put some code in to handle the case where the readings jump around during the change between numbers, but I have already thought of some solutions to try if necessary.

To answer your question, a switch is just a switch. Once the state of the switch has been captured we can assign meaning to it. The method of capturing the switch state is entirely independent of its meaning (and this is an important and key point).

The thumbwheels are essentially just four switches, mechanically and electrically bound together. Since I am using a common technique to read the thumbwheels (as a series of 4-bit reads) it was expedient to treat the other four switches as just one more group of switches like the four switches in the thumbwheels. The diodes are necessary to stop any actuated switches in one group from affecting the readings made from another group.

In the software I use the matrix scanning technique to get the state of all the physical switches, then assign meaning to them in groups (the thumbwheels) groups of groups (the value of Tref or TGT) or individual switch states (TO, MCT, TEST, and TGT).

Anyway, asking the question tells me that you actually read and thought about the schematic, which I thoroughly appreciate. Thank you.
Title: Re: Segment displays
Post by: Mach7 on November 13, 2020, 03:05:51 PM
Thanks Andrew...good idea...ill wait for the other parts to show up and then we can bench test.

Also, I am not going to put a dimming circuit as per schematic, as I have no room to install it on the CDU...if I leave out the dimming potentiometer from port 26 (A7) on the Arduino board do we have to revise that connection?

Jim
Title: Re: Segment displays
Post by: ame on November 13, 2020, 03:49:09 PM
Glad you agree. I am confident that the individual sections of the design will work, but I don't want you to build everything in one go and then become disappointed because I overlooked something. Plus, it's going to be a bit fiddly.

Regarding the dimming pot. You have several options, but it's there because I wanted to play with the dimming function of the TM1637 driver :)

Options include, but are not limited to:

Fixed brightness value in software. If you want to change it, edit the code and upload it to the Arduino again.

Software variable brightness. Change the brightness somehow in software. This could be by hooking up the Arduino to a PC via USB and sending a command through a serial terminal program to change the brightness. Or something devious like "hold down the TEST button at power-up and use the lowest digit of Tref to set the brightness" or "hold down TEST and MCT at the same time any time". We can store the last chosen setting in permanent memory so it's the same the next time the Arduino is powered up.

Hide the pot. You could keep the pot, so that you can alter the brightness freely, but put it behind the panel, so you have to unscrew the panel to change it. Or run longer wires to a hidden part of the cockpit. Or mount the pot in a way that is accessible by a screwdriver through a tiny hole in the panel.

To be honest, I expect you will want to alter the brightness at some point, so it's worth thinking about how you might do it. In general terms the brightness is a number from 1 to 8 (or 0-7 if you like) and it has to come from somewhere. It can be a constant that is loaded once at startup, but if it is intended (or required) to be changed then the method of changing it must be decided and implemented.
Title: Re: Segment displays
Post by: ame on November 13, 2020, 04:12:45 PM
I entered the data for N1 into a spreadsheet and drew a graph (attached). It's quite interesting.

It looks like the left side of the graph (before the inflection point) is linear, and on the right side, mostly linear. I know you only want one line of data, but it would be worthwhile to consider how to implement the function for Tref and PA inputs (and why!? Why is one parameter metric, and the other is not?!?!!).

Currently I have a linear formula, but it does not deal with the inflection point, so I need to re-implement it. I will start with a lookup table (with 5 degree resolution) and consider interpolating it later.

The lookup table is basically a two-dimensional array. One dimension would be PA (from -1 to 15, in steps of 1), the other dimension would be Tref (from -50 to 60 in steps of 5). Given Tref and PA we can round Tref to the nearest multiple of 5, then use it with PA as an index into the table. The table contains N1 for that combination of PA and Tref.

Even if PA never changes, the table approach is worth investigating although, obviously, the function will always select the same row of the table.

I'll probably return zero for N1 if PA is out of range, or Tref is out of range, or Tref lands in one of the blank spaces in the table. Then, the display function can display the actual returned value or '---' if the result is zero.

In programming terms there are good reasons for implementing things like this as tables, or as mathematical functions. There is always a trade-off, so you have to decide what's "best". Tables are really fast, for example, but take up a lot of space. Functions are small, but can take a lot of time to execute. As for which is best, as always "it depends".
Title: Re: Segment displays
Post by: ame on November 13, 2020, 04:26:23 PM
I can't attach an Excel file, so here's the raw data. I'd appreciate if you could confirm the numbers match the chart you posted, although only the Alt=0 row is important.

    Tref (°C)
Alt -50  -45  -40  -35  -30  -25  -20  -15  -10  -5    0    5    10   15   20   25   30   35   40   45   50   55   60
15      96.7 96.7 96.7 96.7 96.7 96.3 95.7 95.1 94.7 94.3 93.9 93.5 92.6 91.7 90.8 90.0 89.1
14      96.7 96.7 96.7 96.7 96.7 96.4 95.8 95.1 94.8 94.3 94.0 93.6 92.8 91.9 91.0 90.2 89.3
13           96.7 96.7 96.7 96.7 96.5 95.9 95.2 94.9 94.4 94.1 93.7 92.9 92.0 91.1 90.3 89.5 88.4
12           96.7 96.7 96.7 96.7 96.5 96.0 95.3 94.9 94.5 94.1 93.8 93.0 92.2 91.3 90.5 89.6 88.6
11           96.7 96.7 96.7 96.7 96.6 96.1 95.3 95.0 94.6 94.2 93.9 93.1 92.3 91.4 90.6 89.8 88.7 88.2
10                96.7 96.7 96.7 96.6 96.1 95.3 95.1 94.7 94.3 94.0 93.3 92.4 91.5 90.7 89.9 88.9 88.3
 9                96.7 96.7 96.7 96.6 96.2 95.4 95.2 94.7 94.4 94.0 93.4 92.5 91.7 90.8 90.1 89.1 88.4
 8                95.5 96.4 96.7 96.6 96.2 95.5 95.2 94.7 94.4 94.1 93.5 92.6 91.8 90.9 90.2 89.2 88.5 88.0
 7                94.3 95.2 96.1 96.7 96.2 95.5 95.2 94.7 94.4 94.1 93.6 92.8 91.9 91.0 90.3 89.3 88.6 88.1
 6                93.0 93.9 94.8 95.7 96.2 95.5 95.2 94.8 94.4 94.1 93.6 92.8 92.0 91.1 90.4 89.5 88.6 88.2 87.7
 5           90.8 91.8 92.7 93.6 94.6 95.5 95.5 95.2 94.8 94.5 94.2 93.6 92.9 92.0 91.2 90.5 89.6 88.7 88.3 87.8
 4      88.6 89.6 90.5 91.4 92.3 93.2 94.1 95.0 95.2 94.8 94.5 94.2 93.7 92.9 92.1 91.1 90.6 89.8 88.8 88.4 87.9
 3      87.5 88.4 89.3 90.3 91.1 92.1 92.9 93.8 94.7 94.8 94.5 94.2 93.7 92.9 92.1 91.2 90.6 89.8 88.9 88.5 88.0 87.6
 2 85.3 86.2 87.1 88.0 88.9 89.8 90.7 91.6 92.5 93.3 94.1 94.5 94.2 93.7 92.9 92.1 91.3 90.7 89.9 88.9 88.5 88.0 87.6
 1 84.0 84.9 85.8 86.7 87.5 88.4 89.3 90.2 91.1 91.9 92.7 93.6 94.2 93.7 92.9 92.1 91.4 90.7 89.9 88.9 88.5 88.1 87.7
 0 82.8 83.6 84.5 85.4 86.2 87.1 87.9 88.8 89.7 90.5 91.3 92.1 92.9 93.7 93.0 92.2 91.4 90.7 89.9 88.9 88.6 88.1 87.7
-1 81.7 82.5 83.3 84.1 84.9 85.7 86.6 87.4 88.2 89.0 89.9 90.7 91.5 92.3 93.0 92.2 91.4 90.7 89.9 89.0 88.6 88.2 87.8
Title: Re: Segment displays
Post by: ame on November 13, 2020, 04:27:57 PM
Ok, well it looked fine until the forum software squeezed it into a narrow column.
Title: Re: Segment displays
Post by: Mach7 on November 13, 2020, 07:14:55 PM
Actually, hiding the pot behind the CDU is a great idea...so we will go with that and implement the dimming circuit!.

Yes...aviation is a bit odd...but it has always been that way...altitude is always in feet and weather reports, thrust calculation etc etc have always been in celcius.

with respect to the pressure altitude calculation, I think i will stick with a constant on that one,(that being the discussed 0 feet).

The chart values do not have to be 'exact' as well...for example if the N1 chart says 93.7 and we decide that a linear constant will equate to 93.4, then that is fine as well.

Ill take a look at the chart tomorrow...at first glance it appears confusing to me due to the format...but I will try and figure it out...

I am assuming that the values correspond to zero feet pressure altitude line that I sent you...as long as the 5 degree increment numbers are close to accurate, then the linear constant between those values does not have to be exact, as long as it shows an increase up to +15 degrees C, then a decrease as oat increases to +50
Jim
Title: Re: Segment displays
Post by: ame on November 13, 2020, 07:20:40 PM
Yes, the forum squished the result. It's actually the whole chart, with all N1 values for all pressures and all temperatures.

I've implemented a lookup table for this, although only one row of the table (PA=0) will be used.

I will look again at the PA=0 row and see if I can implement it as two linear equations, for the left and right part of the graph. That will allow you to have N1 values for any value of Tref, and not just for 5 degree steps.

Glad you agree to use the pot. Even if you only adjust it after you finish building it is useful to have and probably frustrating to not have.
Title: Re: Segment displays
Post by: ame on November 13, 2020, 07:41:18 PM
This is the same table, but printed from within the firmware. If you copy and paste it into Notepad or something, with a fixed-width font, it should all line up.


  0 967 967 967 967 967 963 957 951 947 943 939 935 926 917 908 900 891   0   0   0   0   0
  0 967 967 967 967 967 964 958 951 948 943 940 936 928 919 910 902 893   0   0   0   0   0
  0   0 967 967 967 967 965 959 952 949 944 941 937 929 920 911 903 895 884   0   0   0   0
  0   0 967 967 967 967 965 960 953 949 945 941 938 930 922 913 905 896 886   0   0   0   0
  0   0 967 967 967 967 966 961 953 950 946 942 939 931 923 914 906 898 887 882   0   0   0
  0   0   0 967 967 967 966 961 953 951 947 943 940 933 924 915 907 899 889 883   0   0   0
  0   0   0 967 967 967 966 962 954 952 947 944 940 934 925 917 908 901 891 884   0   0   0
  0   0   0 955 964 967 966 962 955 952 947 944 941 935 926 918 909 902 892 885 880   0   0
  0   0   0 943 952 961 967 962 955 952 947 944 941 936 928 919 910 903 893 886 881   0   0
  0   0   0 930 939 948 957 962 955 952 948 944 941 936 928 920 911 904 895 886 882 877   0
  0   0 908 918 927 936 946 955 955 952 948 945 942 936 929 920 912 905 896 887 883 878   0
  0 886 896 905 914 923 932 941 950 952 948 945 942 937 929 921 911 906 898 888 884 879   0
  0 875 884 893 903 911 921 929 938 947 948 945 942 937 929 921 912 906 898 889 885 880 876
853 862 871 880 889 898 907 916 925 933 941 945 942 937 929 921 913 907 899 889 885 880 876
840 849 858 867 875 884 893 902 911 919 927 936 942 937 929 921 914 907 899 889 885 881 877
828 836 845 854 862 871 879 888 897 905 913 921 929 937 930 922 914 907 899 889 886 881 877
817 825 833 841 849 857 866 874 882 890 899 907 915 923 930 922 914 907 899 890 886 882 878
Title: Re: Segment displays
Post by: ame on November 13, 2020, 07:46:05 PM
This is the data from PA=0

828 836 845 854 862 871 879 888 897 905 913 921 929 937 930 922 914 907 899 889 886 881 877

There should be a decimal point there, but it's easier to use integers in Arduino, so that's N1 x 10.

Here's the same line from Excel (actually, I am using LibreOffice):
82.8   83.6   84.5   85.4   86.2   87.1   87.9   88.8   89.7   90.5   91.3   92.1   92.9   93.7   93.0   92.2   91.4   90.7   89.9   88.9   88.6   88.1   87.7

And, attached is a graph of the two sections of the data either side of the inflection point.

As you can see, the left side is pretty much linear. But the right side its a bit off.

Are my numbers right? If they are then you can choose linear-with-differences-from-the-original, or table-lookup-with-interpolation-between-5-degree-points. Neither of which I have implemented yet...
Title: Re: Segment displays
Post by: Mach7 on November 14, 2020, 03:05:34 AM
Hello Andrew...wow...the graph looks amazing, and yes...your values are spot on.

Why don't we go with the 'linear with differences from the original'

I am assuming that if we go with the aforementioned there will still be values displayed between 5 degree intervals...like at -12 or +14 etc etc ?

Also another question...since Arduino is calculating in integers, will it still display the decimal point when all is said and done...ie 937 or 93.7?
Title: Re: Segment displays
Post by: ame on November 14, 2020, 04:40:50 AM
Hi Jim,

The graphs were just plotted in LibreOffice Calc. Nothing special. I added a "best fit" line to show me the equivalent linear function.

The input will be Tref, which can have any unit value, so yes, the calculation will produce results for values in between the 5 degree points in the original table.

Regarding the display. Well, if you haven't realised by now, everything is an illusion. To convert integers to decimal I will just light up the appropriate decimal point. Don't be disheartened that it's all trickery. After all, nothing in the simulator is real.

I sent you a PM with a link to a draft of the code. Did you get it? A bit much to take in in one go, but everything we discussed so far is there, except the linear function we are talking about now.
Title: Re: Segment displays
Post by: Mach7 on November 14, 2020, 07:28:04 AM
Yes!...got your PM and was reviewing the program...It sort of looks similar to the melaps program that I have been doing with 629 chips.

If I haven't said it yet I greatly appreciate the work you are putting in here..this (to me) is no small task!

With respect to line 110

DISP_TEST, // Test button is pressed. Show test value until it is released.

can we change that so when the test button is pressed and released, the fault code of F14 remains on for 6 seconds?

Looking at your code I might be able to figure that out myself....lets see how intuitive I am...
Title: Re: Segment displays
Post by: ame on November 14, 2020, 11:48:51 AM
Quote from: Mach7 on November 14, 2020, 07:28:04 AMYes!...got your PM and was reviewing the program...It sort of looks similar to the melaps program that I have been doing with 629 chips.

If I haven't said it yet I greatly appreciate the work you are putting in here..this (to me) is no small task!

You're welcome. I enjoy this sort of thing, and it gives me something to do. In particular, I hope that others who are reading can see the steps involved and see that it's all possible.

QuoteWith respect to line 110

DISP_TEST, // Test button is pressed. Show test value until it is released.

can we change that so when the test button is pressed and released, the fault code of F14 remains on for 6 seconds?

Looking at your code I might be able to figure that out myself....lets see how intuitive I am...

But! That's not what you asked for... :)

The answer is yes, of course. Just think about what should happen if someone holds the button down for longer than 6 seconds, or presses the button again during the 6 seconds. Obviously, if you don't think about it it will do something, which might be what you want, or might be tolerable, or might be no good at all.

I'll leave the code alone for now. I still have to implement the two linear functions for N1, and I will implement this change for the Test button if you get stuck.

You can load the code into the Arduino IDE if you've installed it. You'll be able to compile it, but obviously not upload it to an actual Arduino, which in your case you have not got.

If you want to compile the code you will need to add the TM1637 library. Google around for how to do that.

Title: Re: Segment displays
Post by: Mach7 on November 15, 2020, 03:34:12 AM
Hello Andrew,

I will be back to work tomorrow, but will check our thread from time to time through the week. Should be back on Saturday.

-Jim
Title: Re: Segment displays
Post by: ame on November 15, 2020, 10:21:36 AM
No worries. There's not much to be done until the hardware shows up.
Title: Re: Segment displays
Post by: Mach7 on November 15, 2020, 05:45:41 PM
Andrew, as I wait for the parts, I am studying your schematic and working out ways in my head on how to wire up my switches.

I find the best way for me to understand is to make a simplified drawing with the parts in basically the same geographic location that they would be on the CDU.. and then draw connection lines as to how it would all connect up.

I have included a draft for your review, (excluding the diodes on the thumbwheel switches for simplicity,

Jim
Title: Re: Segment displays
Post by: Mach7 on November 15, 2020, 05:46:59 PM
I realize your schematic says the same thing...but it helps me to understand what goes where when I draw it out a couple of times for myself.
Title: Re: Segment displays
Post by: ame on November 15, 2020, 08:15:05 PM
That's fine. The schematic is a logical representation, so the layout doesn't have to match reality, although it's handy if it does. I wasn't sure precisely where things would be, so feel free to move them around.

I could give you the KiCAD files if you like.

I have acquired three thumbwheel switches (actually they are pushwheel switches- turns out they are slightly different). I will add diodes (they are not present on mine) and I can test Tref input or TGT input, and either in conjunction with the pushbuttons to confirm they don't interfere. Will report back later.

Also I will study your schematic and let you know if you have overlooked anything.
Title: Re: Segment displays
Post by: ame on November 16, 2020, 12:01:53 AM
Ok. TO LED is missing. DIM pot is missing.

Tref_sign switch only needs pin 1 connection. Pins 2, 4, and 8 can be left disconnected.

TGT_units needs all four pins connected. You have missed 1 & 2.

Other than that, you have exactly the right idea. If the re-arrangement helps you picture how you're going to assemble it then you're on the right track.

I'll hook up the pushwheel switches I got sometime soon and test them out.
Title: Re: Segment displays
Post by: Mach7 on November 16, 2020, 03:16:47 AM
Thanks Andrew...made the changes thanks.

Yes, i left the LED and dimming pot off this particular diagram just to concentrate on how I was going to route the wires between the switches, thumbwheel, and arduino.

Title: Re: Segment displays
Post by: Mach7 on November 16, 2020, 05:29:02 AM
Hello Andrew, I have attached my draft wire drawing for your viewing with the corrections.

Also...I am looking at the best ergonomic way to wire the thumbwheel switches and the AML21 switches (TO, MCT, TGT, TEST),

Here is my plan and tell me what you think....

First off, I noticed that the TGT thumwheels each have two output lead wires off of ports 1..2..4..and 8 whereas the Tref thumbwheels only have one output wire at that same locations.

The Tref will be located at the top right of the CDU and the TGT located at the bottom left.

My plan is to connect the single output leads off the Tref wheel to the corresponding (second) output lead on TGT...so wire 1 Tref output connects to wire 1 output TGT, wire 2 tref output to wire 2 output TGT etc etc....

This leaves another wire output from all three TGT wheels at locations 1..2..4..and 8 which will connect direcly (through a diode) to there respective switches.

Since the 'common' wire(s)all go to different ports are arduino...these will be wired separatley

what do you think?
Title: Re: Segment displays
Post by: ame on November 16, 2020, 11:32:56 AM
Looks better now, and still ok, except you need a ground connection for the TO LED.

If some of the switches have two solder pads for each connection then it would be practical to take advantage of them. But, if not you can always jam two wires into one hole.

Don't forget, I haven't tested the thumbwheels in a matrix configuration, although I do expect them to work.
Title: Re: Segment displays
Post by: ame on November 20, 2020, 11:33:11 PM
Ok, I made a mock-up. It was no trouble, and better than having wires untidily over the bench. Instead, the wires are hidden away.

The panel is made from FAA-approved cardboard and hot glue. The purpose was to show the correct operation of the switch matrix. I only have one set of three thumbwheels, but they can be read independently of the four pushbuttons (and each other).

As you can see, no attempt has been made to cram everything in to as small a space as possible, nor to make the wiring even slightly neat and/or tidy.

But, currently everything works, although TGT is not tested. I haven't made the change to "TEST" you suggested, and I haven't sorted N vs Tref using a formula, but if you can get the hardware going then the software can be changed independently.
Title: Re: Segment displays
Post by: Mach7 on November 23, 2020, 04:19:40 AM
Hello Andrew...still waiting on parts...but i think they are getting close.
Title: Re: Segment displays
Post by: ame on November 23, 2020, 12:04:45 PM
Quote from: Mach7 on November 23, 2020, 04:19:40 AMHello Andrew...still waiting on parts...but i think they are getting close.

Referring to an earlier post you made: this is why people spend $30 on an Arduino they can get locally the next day instead of $3 on one that willmay arrive in three weeks...

I always find it to be a careful balancing act, although I generally decide to wait.
Title: Re: Segment displays
Post by: Joe Lavery on November 23, 2020, 11:36:25 PM
I agree with you Ame, although some of the clones use different chips and don't always work until you download new drivers.
Recently I've been buying the Elegoo ones from Amazon. They seem to be better quality than the run of the mill Chinese ones.
Incidentally I tried to create a joystick controller recently using Mmjoy2 and I couldn't get the arduino to be recognised. I didn't realise that there were two kinds of mini USB cables. I saw a comment on the arduino forum. I changed the cable for an older one, instead of the nice new shiny one that came with my new phone and hey presto the arduino popped up.
I thought perhaps some of you might have had the same experience.
Joe
Title: Re: Segment displays
Post by: Mach7 on November 24, 2020, 07:47:47 AM
Hello Andrew,

I am going to have to change one of the switch positions from momentary on/off to latching...

Here was our original plan;

TO is a latching pushbutton.
MCT is a momentary pushbutton.
TEST is a momentary pushbutton.
TGT is a latching pushbutton


I want to change the MCT button from momentary to latching....

The reason is basic hardware availability. I ordered some AML21 series momentary push/on off switches through eBay, and like the last couple of orders, they are refused at Customs...(I find this happens a lot lately).

Anyway, I have more than enough latching switches, and one extra momentary on/off AML series 21, which will be used for the test function.

Jim
Title: Re: Segment displays
Post by: ame on November 24, 2020, 10:37:05 AM
I think that will still work with the software I have written, but it would be easy to accommodate.

However, a lot of switches that have latching and non-latching models can be modified. The latching ones have a tiny spring and a pin that runs in a small groove to perform the latching operation.

In some, it is possible to remove the pin and convert the switch from latching to non-latching. You might have to partially disassemble the switch.
Title: Re: Segment displays
Post by: ame on November 24, 2020, 09:56:52 PM
Incidentally, I tried scaling the photo of the TMS and decided it measures 3.5" wide by 5.5" tall. I also decided that the buttons themselves were 11/16" square in a 13/16" bezel.

These switches have 11/16" (17.4mm) actuators:
https://www.aliexpress.com/item/4000464398618.html

They could be inset into a repeated 13/16" grid on a 3D-printed frame.

Might have to get creative with squeezing some LEDs in there, but they are backlit, so a simple mask might work, to let the light through where it's needed.

Momentary only, but latching can be done in software.
Title: Re: Segment displays
Post by: Mach7 on November 25, 2020, 09:49:24 AM
Your dimensions are somewhat accurate..the CDU is 130 mm by 84 mm.

The switches look good, but what I have done...(and I will include pics when I get home on sat) is build a backing box that holds all the AML21 switches so that they are recessed by 9 mm from the CDU. I then print buttons (19 x 19mm and 10 mm thick) that insert through the CDU cutouts, which are glued to the (original) switch face.

The buttons themselves are printed with 5.2 mm holes to allow a 5 mm LED insertion, and a 2 mm raised surface inside the button dimensions which makes positive contact with the switch to allow a clean on off switch action when pressed.

I considered running the LED wires through the switch body...but the better option was to keep them outside and run them around the AML switch cluster then out through the top of the cdu for connection.

The wires themselves are light gauge and tuck neatly into the groves printed into the 2mm base that makes contact with the switch.
Title: Re: Segment displays
Post by: ame on November 25, 2020, 10:22:13 AM
Sounds cool. I can see from your earlier pictures what you are doing. I'm keen to see the final thing.

I have just received some parts from AliExpress that were ordered a month and a half ago. And some other parts that were ordered a month ago. Occasionally things are faster, but there's no real pattern.

I hope yours arrive soon.
Title: Re: Segment displays
Post by: ame on November 25, 2020, 11:13:51 AM
Quote from: Joe Lavery on November 23, 2020, 11:36:25 PMI agree with you Ame, although some of the clones use different chips and don't always work until you download new drivers.
Recently I've been buying the Elegoo ones from Amazon. They seem to be better quality than the run of the mill Chinese ones.
Incidentally I tried to create a joystick controller recently using Mmjoy2 and I couldn't get the arduino to be recognised. I didn't realise that there were two kinds of mini USB cables. I saw a comment on the arduino forum. I changed the cable for an older one, instead of the nice new shiny one that came with my new phone and hey presto the arduino popped up.
I thought perhaps some of you might have had the same experience.
Joe

Hello Joe,

I've never had that problem. It's possible that the 'faulty' cable was intended for power only, and did not contain the two USB data wires. Or it could have just been faulty.

For this project it is not necessary to have a data connection. I expect Jim will power the Arduino directly through its 5V and GND pins.

Andrew
Title: Re: Segment displays
Post by: Mach7 on November 28, 2020, 05:52:47 PM
Andrew, some of the parts arrived...the Arduino nano and some 4 digit LED displays attached to the driver, still waiting for the 3 segment displays.

I am also re-doing some of the printed parts, and also found room to include the dimmer pot.

I will take some pic's of the project tomorrow and post under the new (as discussed) thread.

Jim
Title: Re: Segment displays
Post by: ame on November 28, 2020, 09:08:06 PM
Excellent! You can start playing with the Arduino immediately if you like. Find a tutorial or some examples and follow along. Just getting the Arduino environment installed and getting the 'blink' program running (after you have modified it- generally, stock Arduinos arrive with 'blink' already installed, so change the delays a bit so it's obvious that it's different).

The display will work with my software as-is, but the fourth digit will be blank or garbage. Put some tape over it. :) It would be a good idea to get that working before you replace the 7-segment module anyway, otherwise you won't know if you made an error.

Looking forward to your design and construction thread.

Title: Re: Segment displays
Post by: Mach7 on November 29, 2020, 04:30:22 AM
Andrew, some good new and bad news.

Good new is that I might be able to ustilize the 4 digit displays by modifying the CDU face somewhat. Like you said, I would just need to cover the forth digit.

Not sure yet if I can do this, it all a matter of space as it sits right next to the Tref thumbwheels.

The bad news is that they send me the wrong USB connection for the Nano...they sent me the standard not the smaller one.

I might have a USB connection with the same port around here somewhere...would it suffice to say if I find a plug in that successfully plugs into the nano it should work for programming?

Jim
Title: Re: Segment displays
Post by: ame on November 29, 2020, 10:17:42 AM
Regarding the LEDs, I'd suggest waiting until the 3-digit module arrives before deciding to modify things to accept the 4-digit module. Although functional it might just not look quite right. However, if you do decide it's acceptable then be aware it is possible to modify the software to use the rightmost three digits (so the unused one is on the left) instead of the current configuration where the unused digit is on the right. This might help you with the structural design.

It might be better than trying to desolder the 4-digit module and replacing it with the 3-digit module.

Regarding the Nano, generally they have a mini-USB connector. If you have a cable from elsewhere it should work.
Title: Re: Segment displays
Post by: Mach7 on November 29, 2020, 11:37:02 AM
Hello Andrew,

Unfortunately the 4 digit display (plus attached TM1647) will not fit...over budget on space...

As it is I will have to de-solder one of those boards...pry the 4 digit display from its hold, then attach wires from each output to the corresponding connection on the 3 digit display, (when it arrives).

I purchased enough drivers with attached segment displays so if I foul one up, it is not a big deal.

I did find a small USB connection that I have for a scanner...so hopefully it will work OK for the Nano programming...(it fits ok, so it should work).

I am going to start the new thread under BAe146 TMS Construct, will include some pictures tonight.

I am not happy with the TMS cdu base...the one that holds the AML switches, so I am presently re-printing it....already 2 hours into a 20 your print.

I was having some printer issues, PLA was extruding around the nozzle and I would have to pause the work every 4 hours and clean the control head off....only to find the solution was to tighten the nozzle itself...regardless, will most likely reprint the CDU face as well.

Its not a high end 3D printer...so everything has to be just right to get a decent print job..

Jim
Title: Re: Segment displays
Post by: Mach7 on December 01, 2020, 07:09:04 AM
Hello Andrew,

Received another package from ALIexpress today :)...

just waiting for the three digit LEDs and we are good to go.

I will start to assemble and solder up the parts once the CDU housing is complete as I have had to redue the whole process over again.

As you know, I was having issues with my printer, as I was having to pause the print at 30 percent 'done' intervals...clean the nozzle...then resume...the only problem was that it left weak joints when it was paused to where it was resumed...

I think using hairspray to have the print adhere to the glass on the first layer was part of the issue. however the hairspray works 100 percent of the time and I never have warped or

As they say, for every action there is an equal an opposite reaction...so now my prints stick perfectly to the platform...but the nozzle becomes plugged with excess spray causing it to clog on the first couple of layers of print.

I Found that increasing the nozzle temperature from 200 to 220 seemed to solve most issues...
Title: Re: Segment displays
Post by: ame on December 01, 2020, 10:01:20 AM
Very good. You could get the display running on the bench (with four digits) before dismantling and re-soldering it.

My 3D printer is also a cheap one, but it has been quite reliable. I use only PLA, and a temperature of 200 °C. I also heat the bed (about 60 °C) which helps adhesion, and the bed has a layer of blue painter's tape.

Hopefully the rest of the parts will be there soon.


Title: Re: Segment displays
Post by: Mach7 on December 02, 2020, 05:58:22 AM
Hello Andrew, wiring up the thumbwheel switches and AML's today. Should have a test bed set up by tonight. Having some computer issues now...trued to download the Arduino IDE from the site and the drivers changed my computer...now the resolution is all screwed up and I cannot fix it. I have run a system restore, but nothing seems to work.
Title: Re: Segment displays
Post by: ame on December 02, 2020, 06:30:08 AM
That shouldn't happen. I suspect something else is going on.

Where did you download the Arduino IDE from?
Title: Re: Segment displays
Post by: Mach7 on December 02, 2020, 09:17:49 AM
Downloaded it from the official site;

https://www.arduino.cc/en/software

Ran my AVG, no threats found.

It actually occurred when it asked me if I wanted to download the driver software...once I clicked 'yes' the resolution went a bit array.

I uninstalled all the files, and tried to run a system restore but it tells me it is still open in windows explorer...

anyway, i donloaded the same IDE on my other laptop (windows 10) with no issues.
Title: Re: Segment displays
Post by: ame on December 02, 2020, 10:39:16 AM
Ok. Well now you can become a hotshot embedded systems programmer!
Title: Re: Segment displays
Post by: Mach7 on December 02, 2020, 03:06:59 PM
So..i am at the stage where is all is wired up, (test bench) and I am at the point of arduino download....so...your program is on Github, how do I get it to the Arduino IDE for download....I have tried to copy and paste...but it give me an error..
Title: Re: Segment displays
Post by: Mach7 on December 02, 2020, 03:15:58 PM
i think i am on the right track as I can get the file to the IDE..but when i verify it gives me acopy error message....(TM1637h. no such file or directory)
Title: Re: Segment displays
Post by: ame on December 02, 2020, 03:54:16 PM
Sorry, no time to chat, but it's a library. Google Arduino libraries and follow your nose.
Title: Re: Segment displays
Post by: Mach7 on December 02, 2020, 04:14:55 PM
oK...I am sure i can figure it out.
Title: Re: Segment displays
Post by: Mach7 on December 02, 2020, 05:40:57 PM
Well...I figured it out, but I think I might have an issue with my (generic) USB plug in. In my wisdom I also ordered a UNO board, and was able to successfully download the program, (after installing the correct libraries). With respect to the Nano...the port is correct, everything checks out...once plugged in the green light comes on (on the board)...but during download, the red light comes on and the error message appears.

It failed the connection test as well.

I have confirmed that the correct board is selected and went though all the troubleshooting tutorials....so tomorrow I will see if I can't get my hands on a new USB plug in.

Will this program work if I wire it up to the uNO?...or is it nano specific...the reason I ask is that some of the output numbers/letters are not the same when compared board to board.
Title: Re: Segment displays
Post by: Mach7 on December 02, 2020, 06:45:46 PM
success!

I selected ATmega328p (old bootloader) and it allowed me to download onto the Nano....now let's wire it up and see what it looks like!
Title: Re: Segment displays
Post by: ame on December 02, 2020, 06:47:51 PM
Sorry I didn't have time to give you detailed instructions, but I guess you found the library menu in the Arduino IDE and found the AKJ7 TM1637 library.

Regarding Nano/Uno, fundamentally they are the same, and you can consider the Nano to be a small form-factor Uno. It's the same microcontroller on board, and the pins are numbered the same although some extra ones are broken out on the Nano I think. The problem that may have bitten you is the revision of bootloader on the Nano. The bootloader is factory programmed into the chip at manufacture, and there is generally only one for Uno, but at least two common ones for Nano. When you select Nano in the Arduino IDE there is a further option under Tools, and that is 'Processor'. You can choose ATMega328P and ATMega328P (Old Bootloader). For your Nano, check what had been selected earlier and choose the other one and try again.
Title: Re: Segment displays
Post by: ame on December 02, 2020, 06:48:15 PM
Haha! We crossed posts.

Great news. Progress is made.
Title: Re: Segment displays
Post by: Mach7 on December 02, 2020, 08:02:57 PM
Hello Andrew,

It's been a big night for me!

So I connected everything up, I actually and bench tested the lot...here is what I found.

When Takeoff button is pressed, I get an N1 of 91.3, regardless of Tref selection. I tried cycling the switch off...changing the temperature up and down...then reselecting the TO button, but still get 91.3 at all selections of temperature.

The MCT function works very well!...press the button and I get 857...then 96.7...however the values remain even when the switch is selected off.

I cannot get the TGT function or the Test function to work at all.

Anyway, very excited so far.

I will double check the connections tomorrow morning when I get up, I am pretty confident that the thumbwheel switches were wired correctly...I even tested them with a multimeter to make sure the tref 1's were connected to the tgt 1's and the tref 2's were connected to the  tgt 2's etc etc.

The other consideration would be that the thumbwheel switches are suspect...they are over 30 years old....

Jim
Title: Re: Segment displays
Post by: ame on December 02, 2020, 08:12:02 PM
Hi Jim,

That's great news. I expected things to mostly work, and they mostly do! Thanks for trusting me enough to put in the effort to construct this.

I didn't modify the code for a latching MCT button. If you press it in and out again the display will clear.

The thumbwheels could be a problem, but I'd expect them to have dirty contacts and give you some changes in some positions, but apparently not. It could be the diodes. Or unicorns.

We can spend a little time troubleshooting, and I could hack together something that tests the thumbwheels only, so you have more direct feedback and diagnostics. There are actually some diagnostics in the code right now. If you start the Arduino serial monitor (button top right in Arduino IDE) and set the speed to 115200 you should get little messages about what is going on inside the box. There may be sufficient to help you figure it out, especially as you have the source code so you can see what is supposed to be happening.
Title: Re: Segment displays
Post by: Mach7 on December 02, 2020, 08:16:12 PM
I think maybe we should have done what you suggested initially....and that was to get the tref working only, then include the tgt once we worked the bugs out.

If I disconnect the TGT thumbwheels will we have to modify the existing program?

Jim
Title: Re: Segment displays
Post by: ame on December 02, 2020, 09:01:25 PM
Nope. The switches are in a matrix. If they are physically not there it's the equivalent of just not being pressed. The diodes prevent the switches that are present from interfering with the others.

You can leave them connected and we'll figure out if they are broken or if I have misinterpreted how they work.
Title: Re: Segment displays
Post by: Mach7 on December 02, 2020, 09:23:22 PM
It could be that I have simply wired them incorrectly....

I attached a very simple diagram of how I wired tref and tgt thumbwheels using the TO mode example.

I only show how I wired the TO button to make the diagram less cluttered. The rest of the connections are exactly the same.

Title: Re: Segment displays
Post by: ame on December 02, 2020, 10:15:38 PM
Yes, that looks right.

Can you show a photo of the wiring to the solder pads on the switches, including a view of the diodes?

This was all visible in an earlier photo, but it might be different when installed.

If you disconnect the thumbwheels we can focus on the four pushbuttons? They should all do something.
Title: Re: Segment displays
Post by: Mach7 on December 03, 2020, 12:10:44 AM
Andrew,

I have included some pics...not sure how much help they will be as it sort of looks like a dogs breakfast.

For test purposes, I am actually using only one AML on/off switch (with diode)...moving it around from port to port when I want to test that specific function.

During takeoff mode testing I have noticed some action on the arduino unit...the green light is always on with power, and when you select the TO switch, the red LED begins to flash rapidly...(I am assuming this is data transfer of some sort (?)), but again, moving the thumbwheels to any setting will still only give a constant N1 value as previously outlined, and does not change.

The MCT function works as advertised...and like you said, if the button is cycled the display goes blank.

Selecting TGT does nothing at all...in fact the red flashing led lamp does not illuminate at all.

The test function does not operate as well, (no flashing red light on arduino), which is strange because of all the functions you would think this would be the operational one as it does not rely on the thumbwheel switches.

Also take note of the tref +/- wheel...I basically used the existing wires on this one, so I am confident the "C"ommon wire is correct, and the only other options would be a "+" or a "-" connection as this wheel has no "1"s, "2"s, "4"s or "8"s.

As you can see the "+" connection is used in lieu of the "1" to join the rest of the thumbwheels together for takeoff mode operation.

Here are some other points that may influence the operation;

The dimming pot is not yet connected for test bed purposes.

The segment display 5 volt and ground connections are teamed up with the arduino supply input, i have not gave this TN1637 a separate supply source as outlined in your schematic.

I am using a 5 volt dry cell battery while running this test.
Title: Re: Segment displays
Post by: ame on December 03, 2020, 12:52:22 AM
Dog's breakfast to some, but it looks awesome to me!

The flashing red light you see is diagnostic data going to the PC. You will see this if you open the Arduino serial monitor I mentioned earlier.

It is not necessary to supply the LED driver with its own 5V supply, it just looks that way on the schematic, so no worries. Basically everything marked as 5V is the same, and everything marked GND is the same.

If the dimming pot is not connected it means the display will stay at minimum brightness. No worries.

Everything else is fine. I suspect a rest and a good dose of 'peering at' is needed. Definitely hook up the Arduino to a PC and turn on the serial monitor. My debug information might help.

Don't give up. This is (I think) all new to you, but partially working is actually good enough to tell me that it's all going to work. (Not working at all is a lot trickier).
Title: Re: Segment displays
Post by: Mach7 on December 03, 2020, 05:00:56 AM
Hello Andrew,

I ran the serial monitor and have attached the information for the takeoff mode, test mode, and MCT mode.

The TGT mode does not even register when the button is pressed for some reason...all connections re-confirmed.

Does this get us any closer to the problem?

Jim
Title: Re: Segment displays
Post by: Mach7 on December 03, 2020, 09:05:25 AM
Hello Andrew,

I made another test bed for the bits and bytes...just to make sure everything was where it was supposed to be for troubleshooting..(see attachments).

I checked and double checked all the wires to ensure I did not solder a 1 to a 2 or a 4 to an 8 etc etc.

Wire continuity also tested fine.

I am thinking that the thumbwheel switches are serviceable, because if the internal contacts were a bit dirty, then the values would vary as well.

It almost seems as though the wheels are not being recognized by the program...except the 91.3 and the MCT function.

Jim

Title: Re: Segment displays
Post by: ame on December 03, 2020, 10:46:49 AM
Hello Jim,

Well, you have made progress. Yesterday you said TEST wasn't working. Today it is! I have one working here (but only Tref, no TGT), so I am confident that it works in general.

TGT should also emit a message when it is pressed. If you are not seeing it then there is a problem with the wiring.

Tref is reporting 0 all the time, which is what you'd get if the switch was not present. Hmm.

There are a lot of interconnections, so it is going to be a bit fiddly, but we'll get there.

You could start with only the four pushbuttons. They connect to four I/Os through four diodes and a common connection to another I/O. Each button should cause a message to be emitted when pressed. May need another press to return to the 'idle' state before you test the next button.

If you are really stuck I will write some test code that tests only one thing, but I think there are enough diagnostics in the main code to figure out what is going on.

I'm in and out all day today, but I will send messages when I can.
Title: Re: Segment displays
Post by: Mach7 on December 03, 2020, 11:14:25 AM
Sorry Andrew,

Might have mislead you...

The test function (button) although shows in the serial montior as being pressed, does not display anything on the led display, and when I press the TGT button it does nothing...it does not even show up on the serial monitor as being pressed...as if the switch is not recognised.

Title: Re: Segment displays
Post by: Mach7 on December 03, 2020, 11:44:23 AM
Actually just ran another serial monitor on the test button....it is not even recognised now...before it was...so maybe the wiring is array...(?)

The only solution right now is to remove all the old wires and replace with new ones...unless you have another option?

Like I said...the wires themselves are sound...i checked them all out earlier today so I don't know why the test button would not show on the monitor now....

Can you modify the program to include only the tref function?, excluding the tgt wheels so I can disconnect them.... I think you said you had it working on your side of the pond...if so we could start there and work our way up.

Jim
Title: Re: Segment displays
Post by: Mach7 on December 03, 2020, 12:09:36 PM
My friend I am making progress!!!!

I disconnected both thumbwheels and tested the buttons only....Still nothing on the TGT, but the test function now displays F14 like your previous diagram!!!

I am going to connect all the thumbwheels back up and see what happens....
Title: Re: Segment displays
Post by: Mach7 on December 03, 2020, 01:18:17 PM
Andrew...I cannot thank you enough...the program is now a complete success!!!!

the TO mode works...the MCT works...the Test function works...and the TGT...all works!

I am almost too embarrassed to tell you what the problem was...but I will anyway....

So...I disconnected all the thumbwheels, and tested the switches, which all worked except TGT..as I was running the TEST mode...I reached for for my mini screwdriver to change the leads and inadvertently pressed down on the board itself and noticed the "F14" flicker on and off.

As I am not familiar with these boards, it never occurred to me to solder the through pins into place once it was placed in the wire connection cradle...realising this I soldered all pins on the top of the board, connected all thumbwheel switches and wires....and the rest is history!!!!!

Everything is up and running perfectly!!

I cannot thank you enough Andrew...

Once I clean things up a bit I will run some additional tests...but from what I can see so far, the programming is all there and complete!
Title: Re: Segment displays
Post by: ame on December 03, 2020, 01:41:35 PM
Great! That is excellent news, and I'm happy it's all working.

Don't be too hard on yourself that you didn't spot the problem at first. Experience is what you get just after you need it. :)

Now the core functionality is present and working you can modify it to get it more like what you want, but first get used to what it does and plan what changes you would like. You can hack on the code yourself, or I'll help you out.
Title: Re: Segment displays
Post by: Mach7 on December 04, 2020, 08:20:21 AM
Hello Andrew,

Yes, will definitely still need your help, but for what I can see so far the N1 values look spot on...will have a better idea once I run a complete temperature range.

I spent the remainder of last night and this morning re-checking the wires to make sure none of them came loose at the solder joint, (thumbwheel), boards due to movement during the test bed phase...found a couple and re-soldered them.

Now in the process of gluing the units to the CDU platform.

Still waiting for my 3 digit LED segment displays...if I knew they were going to be this long I would have modified the print to accommodate the 4 digit, then blank out the last digit as you suggested...too late now.

I do have a question regarding the TM1637...when I de-solder and remove the 4 digit display, the 3 digit will have less pins...so am I correct to assume I would run my pin wires from the TM1637 to the segment display corresponding to the current digital readout, except the pin outputs left over would only be used in the fourth digit anyway?

Thanks Andrew

Jim
Title: Re: Segment displays
Post by: ame on December 04, 2020, 10:22:46 AM
Hi Jim,

The N1 values are calculated from a lookup table based on the chart you posted, but only at 5-degree intervals. I think I was going to replace the lookup table with a linear equation, which would produce a result for every degree.

I'm happy to help with the software later, but the whole point of giving you the schematic and source code is that you don't have to rely on me.

The 3-digit display will only have one less pin, so one solder pad on the display PCB will be unused. Otherwise it's just a one-to-one pin mapping from the old display to the new one.

I'm sure your 3-digit display will arrive soon. Unfortunately there's no way around Hofstadter's Law.

I'm actually really happy that it all works. Thank you for involving me.

Andrew
Title: Re: Segment displays
Post by: Mach7 on December 04, 2020, 01:33:41 PM
Sounds good Andrew, I am sure I will have more questions.
Title: Re: Segment displays
Post by: ame on December 04, 2020, 03:40:01 PM
Quote from: ame on December 04, 2020, 10:22:46 AMI'm happy to help with the software later, but the whole point of giving you the schematic and source code is that you don't have to rely on me.
Upon re-reading, this came out wrong, and I didn't mean to imply that I didn't want any further involvement. Which, maybe I hadn't, but now that I mentioned it maybe you are now considering that I might.

Curse this emotionless communications medium.
Title: Re: Segment displays
Post by: Mach7 on December 04, 2020, 04:45:46 PM
Andrew,

Not at all my friend...I didn't get that from your previous post.

Jim
Title: Re: Segment displays
Post by: Mach7 on December 10, 2020, 11:46:43 AM
Hello Andrew,

Should be posting some pics of the TMS build in the next couple of weeks or so...(in between work etc). I have been wiring the entire project up over the last couple of days, of course still waiting on the 3 digit displays.

Jim
Title: Re: Segment displays
Post by: ame on December 10, 2020, 02:45:41 PM
Very good. I hope the remaining parts will arrive soon, but shipping from China is not an exact science.

Looking forward to the rest of the build, and I hope you inspire other people to build more stuff.

Andrew
Title: Re: Segment displays
Post by: Mach7 on December 16, 2020, 08:05:23 AM
Andrew,

Going to post a short video of the TMS on my youtube channel. I will post the link here without described content. I would like to mention your name (first only) in the description for credit purposes only if that is OK with you.
Title: Re: Segment displays
Post by: ame on December 16, 2020, 11:57:41 AM
Yup. No worries.
Title: Re: Segment displays
Post by: Mach7 on December 18, 2020, 05:53:57 AM
Hello Andrew,

I have a question regarding the BCD thumb wheel switches.

I am finding that a couple of the digits on the Tref are a bit fussy as when I cycle through say +20 to +30...the value will sometimes change...and sometimes stay the same. I attribute this to nothing more than old or dirty internal contacts.

The TGT wheels work perfectly most likely due to the fact that they are never used in actual flight operations, (or at least we didn't use them when we had this Aircraft in our fleet).

I am looking at brand new replacement thumb wheel, and have found some, but have a question. These APEM switches are the exact dimensions, so they will fit perfectly in the hole, but I notice that there are more outputs/inputs on the PCB board then the ones that I have installed now.

The 1 - 2 - 4 - 8 - and C seem to be duplicated on the datasheet, so my assumption is that the switch is allowing a surplus connection at each output (?)...as they are still identified as BCD switches.

Also I could be reading this wrong....

Here is the datasheet, I am looking at page 2 at the bottom for the 141 and 400 models. (DPS8-141-AK2 is the 0 o 9 digits, and DPS8-400-AK2 is the plus and minus unit).

https://www.mouser.ca/datasheet/2/26/DPS8_PUSHWHEEL_11-18-1652739.pdf

I am assuming as long as I have the 1 - 2 - 4 - 8 - C connections, they should work fine (?)

I have attached a pic of the switch itself.

Jim
Title: Re: Segment displays
Post by: ame on December 18, 2020, 11:04:18 AM
Hello Jim,

When you say "the value will sometimes change...and sometimes stay the same" do you mean it changes a lot during the click, and then settles on the new value? Or doesn't actually change when the thumbwheel number changes?

Again, if you hook up the Arduino serial monitor you might get some hints from the diagnostic messages.

There are two possible explanations. If the number changes while the thumbwheel is changing it's because of 'contact bounce' or dirty contacts. Basically the thumbwheel has a pattern of contacts inside, and a rotating wheel that connects the common (C) line so that the 1-2-4-8 contact pattern matches the digit shown. During a change the output is indeterminate, and each contact will make or break almost randomly due to dirty contacts or contact bounce as the connecting points rattle past each other.

If the number does not change then it means that the connection at that point is dirty or worn so the new position can not be detected.

You could try some contact cleaner solvent. Or carefully disassemble, clean, and reassemble the switches.

New switches might help. To answer your question, the extra connections are for the complement of each bit. You can see a tiny bar over the top of the number. This means that the signal is inverted. You can see this in the truth table for Code 141. However, why not order Code 131?

Also, you could order PCB code AL, which will let you solder diodes in place.

Two more points for you to ponder.

First, you can 'hide' the random intermediate changes to the display when the wheels are clicked by the software technique of 'debouncing'. Basically, before you update the display you make sure that the input has stopped changing rapidly (or has remained stable for a while). Simple to do, but I didn't do it.

Secondly, if you swap the 'C' connections for each group of thumbwheels on the Arduino then Tref will act as TGT, and vice versa. You can determine if the newer TGT switches make the Tref display behave better, and if the problem with the older Tref switches is visible on the TGT display.
Title: Re: Segment displays
Post by: Mach7 on December 18, 2020, 12:02:52 PM
Hello Andrew,

I am 100 percent sure it is nothing more than a dirty contact at the second thumbwheel "3" position...so when you go from +20 to +30...the value will sometimes stay at 86.2 when you select +30 (the value should change to   but it stays at 86.2 then when you cycle through to +40 the value will then change to reflect the value at +40, (not sure of the exact numbers as I don't have a table in front of me).

As you stated; If the number does not change then it means that the connection at that point is dirty or worn so the new position can not be detected.

And I am positive this is the case...

If you play with the middle "3" digit..(cycle it up and down from 2 to 3 and 3 to 4, I can usually get the value to display the correct reading at +30...(almost like there is a bit of dirt inside the switch.

With these switches being over 30 years old, and the amount of action the tref switches have seen... I would think that these particular switches have reached or exceeded there cycle life.

I will try some contact cleaner...

With respect to the new switches, I contacted a number of distributers and the only ones that are available for immediate release are the 141's.

Having said that, if I was to order the 141's. then I should be OK if I only use the values without the tiny bar at the top...correct?

Also I am assuming that these switches have no diodes, so will have to solder an inline diode to each connection as well.

Jim
Title: Re: Segment displays
Post by: ame on December 18, 2020, 12:21:51 PM
Ok. No worries.

Yes, the 141 will work. Use the connection without the bar (incidentally, if you needed to use the inverted output it could be fixed in software :) ).

And yes, if there are no diodes then you must add them, as shown in the schematic.
Title: Re: Segment displays
Post by: Mach7 on December 18, 2020, 02:23:05 PM
Thanks Andrew!
Title: Re: Segment displays
Post by: Mach7 on January 04, 2021, 02:07:26 PM
Hello Andrew, hope you had a great Holiday and the best in the New Year...

Finally got my 3 digit 7 segment display!....but...i have run into a bit of a problem.

I taken one of the TM1647 drivers and removed the 4 digit display...then soldered wire for wire to the 3 digit display...with one output left open (from the driver). When i connected it all up, the 3 digit display illuminated very very dim....as if there was a short or something...but when I made my takeoff, mct...tgt.etc etc selection, the digits illuminated and worked perfectly.

When no selections are made...then it glows very dim as if there is a short somewhere.

I should point out that only the top and right side digits are glowing dim...its hard to tell..but i think the rest are extinguished.

So...I rechecked all the leads...and every output wire form the driver is going to the corresponding pin on the segment display...

any thoughtsÉ

Jim
Title: Re: Segment displays
Post by: ame on January 04, 2021, 03:39:44 PM
Hello Jim,

Glad the display finally arrived. I'm not sure quite what to suggest. Assuming the display is not damaged in any way then, as you know, it's just a bunch of LEDs in a housing. You could test each segment with a battery and resistor, but that would be tedious.

My suspicion would be solder bridges between some of the segment pins, or some other path from a power or ground to the segments.

Does the dimming pot work? You say that the operational settings are working. Do they dim and brighten properly?

When the display is 'blank' and erroneous segments are dimly lit does the dimming pot affect them?

When you display an operational value which does not contain the erroneous segments, do they remain lit, albeit dimly?

The first thing I'd look is for shorts (or almost shorts), bad joints, copper whiskers and other obvious problems.

Do you have other display boards? If you swap in an original 4-digit board (only four wires to move) does it work as it did before?

Do you have someone nearby (they can be non-technical) to whom you can explain what you have done? Usually after a few minutes of "and then this bit is for..." you will suddenly realise what the problem is. In fact, if there is no-one nearby you can explain it to the cat, or a rubber duck.

Good luck.
Title: Re: Segment displays
Post by: Mach7 on January 04, 2021, 04:52:00 PM
LOL...yes...have to find a cat to talk to or something.

Checked all the connections...and everything works fine when a selection is made...its just when nothing is selected there is a dim glow from some of the led segments....once a selection is made, that glow goes away and it works perfectly.

Ill try another TM1637 driver...maybe I damaged it removing the 4 digit led.
Title: Re: Segment displays
Post by: Mach7 on January 04, 2021, 07:45:25 PM
Fixed!...looks like a couple of bad connections at the driver output. All works well now...will send some pics and video`s shortly!!!
Title: Re: Segment displays
Post by: ame on January 04, 2021, 08:01:41 PM
Excellent!
Title: Re: Segment displays
Post by: Mach7 on January 05, 2021, 04:56:26 AM
Hello Andrew,

One additional problem, just running some tests with the thrust setting chart, and I found that the 'plus' and 'minus' values are inverted...for example the -50 N1 value is actually what the value should be at +50 etc etc.

If you run all the "+" temperatures from 5 to 50 they corresponds exactly to the "-" values, and if you run all the "-" values from 5 to 50, they correspond exactly to the "+" values.

No doubt I wired something up wrong....but I am assuming a programming change can solve this(?).

Thanks Andrew

Jim
Title: Re: Segment displays
Post by: ame on January 05, 2021, 07:53:36 AM
No problem. The simplest way is probably to edit around line 464:

Change

  if (!digitalRead(SW_D0)) {

to

  if (digitalRead(SW_D0)) {

Basically, remove the logical NOT operator (the exclamation mark).

I didn't know the relationship between the printed +/- symbol on the switch and the physical switch state. I guessed, which had a 50/50 chance of being right.

You can confirm that the sign of Tref is incorrect by using the serial monitor. When Tref is being used its value is printed. You can also therefore confirm that the software change above fixes it.

However, if after observing Tref you determine that Tref is actually being derived from the switches correctly you can look for the problem elsewhere.

So, in summary, use the serial monitor to observe Tref. If Tref is incorrectly negated, apply the simple change above. If Tref is correct then fix the calculation of N1.
Title: Re: Segment displays
Post by: Mach7 on January 05, 2021, 01:39:15 PM
Thanks Andrew...Ill try that later tonight...

so....found something out tonight that you most likely already know...

I had everything working perfectly last night, then this morning decided to tidy up the electronics as the Arduino and LED driver are just kindof hanging loose ontop of the CDU body.

I decided to make some soft pads out of some flexible material and proceeded to glue the NANO in place...followed by the TM1637 driver.

Once all put back together, the system did not work...the takeoff mode activated all by itself and I had dashes across the LED display....

I checked all the wires...everything was fine.

I decided to undue my last modification...and that was removing all the glue from the bottom of the NANO terminal holder...and voila...everything works perfectly again..

I was using WELD Bond glue...its a white glue that dries clear and is very strong....

My assumption is that there must have been some electrical conductivity whilst it was still wet (??)

Jim
Title: Re: Segment displays
Post by: ame on January 05, 2021, 02:36:13 PM
Ok, soooo, let me get this straight. It was working, then you did something and it stopped working. Then you undid what you did and it started working again?

Hmmmm...

:)
Title: Re: Segment displays
Post by: Mach7 on January 05, 2021, 03:19:20 PM
Yes....i suppose the moral of the story is...I never imagined glue could act as a conductor...
Title: Re: Segment displays
Post by: Mach7 on January 06, 2021, 07:43:46 AM
Removing the exclamation mark on line 464 worked perfectly!!! Now the N1 values correspond to the correct temperature!

thanks Andrew!

Jim
Title: Re: Segment displays
Post by: ame on January 06, 2021, 12:45:43 PM
No worries.

I can't remember what changes you wanted. Maybe there aren't any, now that you've got everything together. Or maybe you'll think of some once you start using it.

Anyway, I'm pleased it's working.
Title: Re: Segment displays
Post by: Mach7 on January 06, 2021, 03:37:34 PM
Hello Andrew, once I get it installed, I will probably be looking to fill in the 5 degree increment blanks.

Right now we have a change at every 5 degree mark...15..25..35..etc.

Most likely have the N1 show a change at every degree of temp change...maintaining the accuracy at the 10 degree temperature marks.

Jim
Title: Re: Segment displays
Post by: ame on January 06, 2021, 04:40:30 PM
Ok. No problem.

Just make sure you can access the USB socket on the Nano in situ, then you can hook up to a PC for diagnostics or reprogramming.

You can also pull the Nano off the carrier board and reprogram and reinstall it.

Either way, think ahead before you seal it up in an inaccessible location.
Title: Re: Segment displays
Post by: Mach7 on January 12, 2021, 10:02:52 AM
Yes for sure Andrew!

I actually installed a cannon plug at the back, so it is easy to remove from the panel.

I have finally made that video, (albeit forgot to demonstrate the MCT mode), and will be placing it on the other TMS thread shortly.
Title: Re: Segment displays
Post by: Mach7 on February 18, 2021, 06:05:44 AM
Hello Andrew, in the interest of sharing information I thought I would ask my question here rather than a PM.

So, with respect to the TMS CDU I have decided to do a duplicate build as I wanted to added a slightly bigger LED display, and I actually ordered additional (new) pushwheel switches under the MOM number you suggested...(DPS8-131-AK2'S for the 0 to 9 digits..and DPS8-400-AK2'S for the + and - input matrix.

It took a week for the 0 to 9 switches to come in, but just received the plus minus wheels months later, (apparently they are not a hot item for sale so nobody keeps them in stock).

I have included some pics of the -400 models, and I am  fine with the "C" common connection, but this particular switch has a A+ and A- connection right in the middle.

My question is which one of these is the "1" connection  which connects with the other "1s" o the other push wheel switches...as per your diagram?

Thanks Andrew

Jim
Title: Re: Segment displays
Post by: ame on February 18, 2021, 12:14:57 PM
Hi Jim,

The data sheet is your friend. I Googled the part number and hoped desperately that my previous advice was sound...

The model you have has true and "complementary" outputs, which means that the signals you want are available as true signals and inverted signals. The one you use depends on the rest of the system, and it gives you a lot more versatility.

The answer is- try it and see. In one position you will get the correct behaviour, in the other, it will be inverted. I'd start with A+.

You can solder the 'C' pin and just twist or bend the wire in place on the A+ connector. It should work well enough to evaluate, and if it's wrong you can move it easily.

Armed with the data sheet and my source code I could tell you precisely which connection to make, but I can't at this precise moment.
Title: Re: Segment displays
Post by: ame on February 18, 2021, 12:30:27 PM
And something reminded me that we had changed the source code because of an incorrect interpretation of the +/- wheel previously, so I just re-read a few messages back.

Be careful with your construction going forward. If you use my code from GitHub then the change has not been made. If you use your modified code then it differs (by one line). You have to remember which version you installed in each Arduino because it affects the wiring (and interpretation) of the switch signals. No big deal really, but you might scratch your head if the behaviour of the switch does not match the code if you don't remember that there are two versions now.
Title: Re: Segment displays
Post by: Mach7 on February 18, 2021, 02:54:07 PM
Thanks Andrew.

I will do by trial and error...i also noticed by looking carefully at the A+ it almost looks like there is a "-"  below it...not sure if that is intentional or just extra copper to solder on.
Title: Re: Segment displays
Post by: Mach7 on February 19, 2021, 12:46:05 PM
A+ was the correct choice Andrew.

Ill post some pictures of the new unit when I get it all soldered and glued together!

Jim
Title: Re: Segment displays
Post by: Mach7 on February 23, 2021, 01:45:56 PM
Here are some pictures of my TMS version 2. I constructed another unit with brand new push wheel switches and the wiring a bit more on the 'tidy' side.

Easy access to the Arduino for re-progamming as well.

Also, The entire unit now slides snuggly in place on the instrument panel, so there is no need to place fastening screws on the face of the CDU.

The original TMS had AML21 push on/off switches and it was difficult to feed the wires around the body of the switch to provide anode and cathode leads to the LED's.

These new switches are push on and off as well, however I have designed the pushbutton (3D print) to encompass all the bits needed to get power to the lamps within the buttons therefore there are no lead wires to worry about.

As you can see from the diagram, the 3d printed body of the switch contains the led, then, by virtue of the button design,  I have the anode lead connecting to the spring loaded contact within the switch to provide the anode input, and the cathode input is provided when the switch body is firmly pressed into place making contact with the upper portion  of the outer switch plunger.

I still have to install the switch covers that contain the labelling and chevron cutouts.
Title: Re: Segment displays
Post by: ame on February 23, 2021, 02:45:10 PM
Nice!