Welcome to Cockpitbuilders.com. Please login or sign up.

May 06, 2024, 03:10:16 PM

Login with username, password and session length

PROUDLY ENDORSING


Fly Elise-ng
425 Guests, 0 Users
Members
Stats
  • Total Posts: 59,641
  • Total Topics: 7,853
  • Online today: 554
  • Online ever: 831
  • (May 03, 2024, 12:39:25 PM)
Users Online
Users: 0
Guests: 425
Total: 425

COUNTDOWN TO WF2022


WORLDFLIGHT TEAM USA

Will Depart in...

Recent

Welcome

CTS288 I am going crazy

Started by kurt-olsson, April 19, 2016, 11:05:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kurt-olsson

Ok, everything except the CTS288 rotary encoders in my MCP work 100% stable.

I have 5 encoders. Sometimes when i start encoder 1,2,3 is stable and 4,5 is starting to make jerky movement.
Next time i boot up the teensy it can be another Encoder that works fine and some completely other gives jerky movement.

Lots of time if i put my finger on the backside of the ones that is fault it starts to work correct again.

Thanks to the Rotary encoders i have to tear up my MCP for the third time. Its anoying becuase all the other switches work fine.

The worst thing is that i cant count on the encoders 100%, sometimes they work and sometimes not. Not repeatable fault all the time, just occurs now and then.

This is my code for the Encoders:

int8_t encodervalue_speed = Encoder_Speed.read();
 
   if (encodervalue_speed != encodervalue_speed_prev) {
     delay(15);
     
      if (encodervalue_speed < encodervalue_speed_prev) {
        MCP_Speed = MCP_Speed + 1;
      Serial.print("SPEED 1 UP\n");
      }
      else  {
        MCP_Speed = MCP_Speed - 1;
         Serial.print("SPEED 1  DOWN\n");
      }
      encodervalue_speed_prev = encodervalue_speed;
      return;
    }


It works like a charm, it must be something with my wiring.

Does it mater that my Teensy is inside a Metal box? (the casing of the MCP?)

Does anyone of you have sucessfuly 100% stable results with the CTS288?

And if you do, what resistors do you have? do you use any? or are you using the INPUT_PULLUP resistors only?

This is a big problem, because i am stuck with this problem and can´t "tick off" my MCP and move on to the next item. =(

I want to be able to know 100% that the encoders are always working.


Should i use connectors instead of solder direct onto the CTS288?

If you look at my MCP, does anybody see some "BIG NO NO" in this setup?


I am thinking of using just one Teensy just for the Encoders, so i know there is nothing else making them unstable...

Is there something wrong with my wires? are they too thin and cant shield the current in them?

kurt-olsson

#1
removed.

KyleH

#2
I have not used a Teensy, but do design PIC microcontroller circuits and firmware, so I'll attempt to help with some suggestions.

Quote from: kurt-olsson on April 19, 2016, 11:05:50 AM
Ok, everything except the CTS288 rotary encoders in my MCP work 100% stable.

I have 5 encoders. Sometimes when i start encoder 1,2,3 is stable and 4,5 is starting to make jerky movement.
Next time i boot up the teensy it can be another Encoder that works fine and some completely other gives jerky movement.
What are the symptoms exactly? Is it jumping around when your moving the knob or without touching it.
Quote
Lots of time if i put my finger on the backside of the ones that is fault it starts to work correct again.
This could indicate a noise problem.

Quote
...
This is my code for the Encoders:

int8_t encodervalue_speed = Encoder_Speed.read();
 
   if (encodervalue_speed != encodervalue_speed_prev) {
     delay(15);
     
      if (encodervalue_speed < encodervalue_speed_prev) {
        MCP_Speed = MCP_Speed + 1;
      Serial.print("SPEED 1 UP\n");
      }
      else  {
        MCP_Speed = MCP_Speed - 1;
         Serial.print("SPEED 1  DOWN\n");
      }
      encodervalue_speed_prev = encodervalue_speed;
      return;
    }


It works like a charm, it must be something with my wiring.

Not necessarily. You said it seems to change the affected encoder on each boot of the teensy. This could be some sort of race condition or something.

How are you reading the encoders in the teensy? If you are polling for 5 of them you may have timing issues where it's not picking up the change in the second pin due to the poling.
The better method is to use an interrupt. Have the interrupt triggered on detecting a change on one of the pins, then determine which one, and check the associated pin to determine direction of rotation. That way when your spinning the heading knob, it's not in the middle of polling the altitude knob.

Quote
Does it mater that my Teensy is inside a Metal box? (the casing of the MCP?)
No...that's a good thing

Quote
Does anyone of you have sucessfuly 100% stable results with the CTS288?
Can't comment on that part in particular, but have other rotary encoders running stable using interrupt method

Quote
And if you do, what resistors do you have? do you use any? or are you using the INPUT_PULLUP resistors only?

I do not use the internal pull-up's for these. I have 2.2k pull up resistors for my encoders, as that is what the datasheet recommended.
Quote

Should i use connectors instead of solder direct onto the CTS288?
Solder is usually a more reliable connection if done correctly

Quote
If you look at my MCP, does anybody see some "BIG NO NO" in this setup?
...
Is there something wrong with my wires? are they too thin and cant shield the current in them?

To be honest yes there are issues. If it looks like a rat's nest there is the potential for noise issues.

The best method would be to have everything connected to a PCB without wires, keeping trace runs short to reduce noise.
Since this isn't really practical for most home builders, there are some things you could do to help eliminate noise.
Biggest one is that your wires for each encoder/switch/display, should be twisted together.

So if you encoder has 3 wires, the 3 should be twisted together. You can either buy cable like this or make it yourself.
The easiest way to do this is to take 3 (or however many the component needs) different coloured wires and cut them all to the same length. Make it long something like 2 meters. Gather the one end of the 3 wires, put them in the chuck of a drill, and tighten the chuck. Have someone else hold the other end or tape them to a table. Hold the wires tight with the drill, and turn it on while holding pressure on the wires, and run it till you have a nice tight twist to them.
Then cut the cable to the length you need.


Edit: Looks like you posted while I was typing. I'll post some code later if you haven't got it sorted.
Kyle

Chief Pilot
Worldflight Team USA
http://www.worldflightusa.com

RayS

I concur with Kyle. You might have a noise issue with the wiring.

One thing I've had success with is using 1 meg pullup resistors on the input channels for the encoders. It'll allow you to get away a questionable wiring layout with marginal noise issues.

Also, if you have other components powered by a supply that isn't sharing the same ground as the USB connector, you might have a floating ground issue, which can manifest itself in many crazy, unpredictable ways.
Ray Sotkiewicz

kurt-olsson

Thank you sooo much for your answers. It is back to basics again for me.

These are "semi-high-end" encoders, i don´t think they are the problem.

It is NOT software problem. Right now i get this behavior:

1, Nothing happens when i turn the encoder
2, i put my finger on all the connectors it starts to work flawlessly.


Like you said, it looks really crappy even with the adafruit board.

I need that twist-wire-tool and also some terminals connectors.

I will read through your posts again, right now i am in a hurry.

once again, thanks for answers. This is really frustrating since this is the last part of my MCP left...

kurt-olsson

#5
Ok, My next move will be to make sure to use the Interrupts pin and attachInterrupts code.

I will add Capacitors of 0.1uf to each pin of the Encoder

Capacitor 1 = PinA to PinGround of the encoder
Capacitor 2 = PinB to PinGround of the encoder

I use the Internal Pullupresistors of the Teensy, i dont think i need them as hardware in my circuit... (not sure though)

I will also do the twisting of the cables.


The symptons is often, if i am running just the Serial Print Manager and check my values its working fine, but when firing up X-Plane it starts to twitch.
So i suspect the interrupt at first, but also noise becuase ALWAYS when an encoder stops working, if i put my finger on the plats it starts again and then it is FLAWLESS.


RasyS and Kyle, thanks for your time to answer my questions.

kurt-olsson

Ok, it is something with the Ground on this Rotary Encoder!

I can replicate this ALL the time!

1, Its working fine!
2, i just touch and move the ground cable
3, Stops working completely
4, restart everything, nothing happens.
5, put my finger on the ground pin, it starts to work again flawlessly.

Should i add a resistor on the ground pin?

fordgt40

Have you tried moving the cable with something insulated eg a pencil. If the problem recurs then it is a poor solder joint

kurt-olsson

#8
Haha Getting closer!

Now i connect the groundpin direct through my Terminal to the OTHER groundpin of the Teensy, now i can move the cable and it always start again!!!

What is the different with that ground pin? Or is it that my soldering or the breadbord is not ok, when i used my terminal it works MUCH Better. I would say, right now it works 99% i have some twitch if i move the cable a bit while running the Teensy and USB cable.


So what i did

Download the latest Encoder Lib from Paul.
Using Interrupts Optimization ( if i understand correct the code will use interrupt without having to attach)
Removed ALL the Serial.print from my code, and i used ALOT for debugging.

I don´t think that mather though, the main improvement came from using terminal connection instead of my soldering

Hm... do i have the wrong solder material???
Maybe i am soldering completely wrong and get "cold-soldering" issues?



kurt-olsson

#9
It is bad soldering...

Both on the groundpin from the rotary encoder and the groundpin in the teensy...

I don´t understand why my soldering is so bad...

Or either is the encoder broken on the ground channel or something. It is definently the ground that is causing the problems.

When i touching the ground with my finger i must give it contact and therefore it starts to work.

KyleH

Are you using lead-free solder? It is much more difficult to work with. You soldering skills have to be pretty good to begin with to use it successfully.

As far as touching it goes, have you tried moving it with a plastic pen or pencil? Using your finger will add capacitance, which could be helping with noise. Verify with something else first to confirm it is a poor connection.
Kyle

Chief Pilot
Worldflight Team USA
http://www.worldflightusa.com

kurt-olsson

#11
Thanks Kyle.

Yes, it is ledfrer solder. I will change this in the future

Analyzing more i think i found a problem. I use waaaay tooo much solder led.
I thought the more the better, but having big lumps is making the connection bad.

If i use a voltmeter on my big lumps ofter there is no contact. But after removing the led with a tool i get supergood contact on the pins.

I will use flat terminal connectors in the future.

I thought about adding a capacitor, but the thing is that the encoder is really impressive when having contact.

I attached an image to show the solder-meds

fordgt40

#12
Peter

I use 5 core 0.7mm dia tin/lead solder ration 60/40 with a 50 watt variable temperature controlled soldering station. From your picture I see that there is little form of  mechanical joint ie have the wires been bent back thru the holes in the pins. As you suggest there is much too much solder and the heat has been applied for too long, in fact you run the real risk of component damage thru too much heat being applied to the internal circuitry of the switches/encoders.

Definitely change to solder as above, a good joint should be bright not dull.

Good luck

David

Edited to expand about mechanical joint

kurt-olsson

Yepp! I underestimated the difficulty of soldering.

ALSO! The cts288 is NOT ok to bend the pins on! Once i bend them back i get full contact! That was the problem! (Maybe solder also)

Pheeeew i am just glad i got the repeated problem with my voltmeter. Now i will connect with flat terminal and make sure they work 100% before mounting them back!

KyleH

Lead-free solder will not look bright when soldered correctly. It's one of the difficulties in working with it.
Are you in Europe? If so, is it difficult to find Leaded solder there?
And just to be sure, you're using solder for electronics right, not plumbing solder?
Kyle

Chief Pilot
Worldflight Team USA
http://www.worldflightusa.com

fordgt40

Quote from: kurt-olsson on April 21, 2016, 11:59:43 AM

ALSO! The cts288 is NOT ok to bend the pins on! Once i bend them back i get full contact! That was the problem! (Maybe solder also)

Peter

You misunderstand. I have not suggested bending the pins. I recommend that you pass the hookup wire through the hole in the pins and then bend it back on itself and crimp with pliers before soldering. If there is no hole on the component pin then bend the wire around the pin  If you do not do this then you will find it more difficult to get a good joint.

David

kurt-olsson

Quote from: fordgt40 on April 21, 2016, 01:09:15 PM
Quote from: kurt-olsson on April 21, 2016, 11:59:43 AM

ALSO! The cts288 is NOT ok to bend the pins on! Once i bend them back i get full contact! That was the problem! (Maybe solder also)

Peter

You misunderstand. I have not suggested bending the pins. I recommend that you pass the hookup wire through the hole in the pins and then bend it back on itself and crimp with pliers before soldering. If there is no hole on the component pin then bend the wire around the pin  If you do not do this then you will find it more difficult to get a good joint.

David


No man, i bent them long time ago, my bad english, sorry.

Well... All this has made me lots of knowledge richer. Both in soldering, mechanics and my other thread also backlighting.

The result is now...

Start from scratch! :)

I took the whole mcp apart. I need one more backplate for backlight. And i made some big designerrors in my first version hehe.

Final version will have unbent cts288 that hopefully will work as a charm with terminal flat connectors. :)

fordgt40

Welcome to the club, we have all been there to one degree or another!! You are making the right decision.

David

RayS

Ray Sotkiewicz

kurt-olsson

Quote from: RayS on April 21, 2016, 07:20:06 PM
(Psst!  "Wire-Wrap!")

:-D
8)

Amen! Will look for that tool this weekend!

RayS

I wish I had saved pictures of my first AP project. What a mess! It was a 777 MCP, complete with a genuine 777 panel, which to this day I regret selling.

It was beautiful, but only 'worked' after the 5th or 6th wiring iteration. Once I settled on a wire-wrap configuration, all the problems went away. Problems like wires inadvertently breaking off due to cold solder joints, a rats nest of wires that induced noise into an already sensitive interface, and the inability to troubleshoot the mess when things went wrong.

Head Kyle's advice on twisting the rotary encoder channel wires together. You won't regret it!
Ray Sotkiewicz

kurt-olsson

Quote from: RayS on April 21, 2016, 10:10:19 PM
I wish I had saved pictures of my first AP project. What a mess! It was a 777 MCP, complete with a genuine 777 panel, which to this day I regret selling.

It was beautiful, but only 'worked' after the 5th or 6th wiring iteration. Once I settled on a wire-wrap configuration, all the problems went away. Problems like wires inadvertently breaking off due to cold solder joints, a rats nest of wires that induced noise into an already sensitive interface, and the inability to troubleshoot the mess when things went wrong.

Head Kyle's advice on twisting the rotary encoder channel wires together. You won't regret it!

OEM panels are sweet!
Thanks allt for your help RayS. I am glad i tore it apeart, with my current knowledge i hope to get a good result. I did the twisting of the cables yesterday and it made such improvement. I will test the flat terminal connector aswell on the new encoders. Its better if nothing works than -"it works kind of"

I am also glad i didnt proceed with drilling in the panels but instead headed for another backplate. Thanks to forum input.


Ridgenj

I have many OEM panels. to convert. I.opened the fire detection panel and I can't cut all this nicely wired  artwork.
I have 22 awg aircraft wires and 26 Awg regularly wires.
Do I use the cannon plugs or rewired all,  to be or not to be.
Cheers
Luis

Sent from my SM-T700 using Tapatalk


Like the Website ?
Support Cockpitbuilders.com and Click Below to Donate