AM/ Arduino & encoder help!

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Message
Author
User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: AM/ Arduino & encoder help!

#31 Post by jph »

Keith Baxter wrote: Sat Apr 02, 2022 10:50 am
Hi,
Just for info I downloaded the 172 panel and the encoder does not work. Same encoder, same pin configuration in my instrument code works like a charm. :P
And by the way @Corjan when changing the encoder from one dial to another, AM hangs, grays out then CTD
Keith
Ok, then you ARE saying that the fault is in the panel / instruments
If that is your diagnosis then @Ralph or @Corjan can hopefully check their code as you are saying it is an issue.

Very confusing.
Joe. CISSP, MSc.

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: AM/ Arduino & encoder help!

#32 Post by Ralph »

If you can make a short description or video on how you can make it fail then that would be great.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: AM/ Arduino & encoder help!

#33 Post by jph »

@Keith Baxter
Update.............. No problems found.

Went to main PC with XP on and ran the panel with the sim running (X-Plane)
Observations (using UNO D2 D3 PCB Encoder with pull ups.)
Encoders work perfectly. No issues at all as far as movement and direction and action of instruments is concerned.

A few minor observations - the Altimeter uses the naming convention where the Arduino is numbered 0-15 as opposed to alphabetical as per the others otherwise no issues found.

Note - the instrument 'knobs' do not rotate (as one would expect) as with hardware use this part would normally be hidden. The action of the instruments if fine though. 100%

Joe
Joe. CISSP, MSc.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: AM/ Arduino & encoder help!

#34 Post by jph »

Ralph wrote: Sat Apr 02, 2022 3:01 pm If you can make a short description or video on how you can make it fail then that would be great.
As you can see by my above post Ralph. All works fine (I was using an uno 'cos It was the first thing I pulled out of the junk box.)
No CTD changing encoder assignment and for sh!ts and giggles even ran 3 instruments simultaneously from same encoder. Very entertaining to watch.

I would suggest he adds pull-ups and tries again. ?

Joe
Joe. CISSP, MSc.

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: AM/ Arduino & encoder help!

#35 Post by Keith Baxter »

Ralph wrote: Sat Apr 02, 2022 3:01 pm If you can make a short description or video on how you can make it fail then that would be great.
Ralph,

Yes sure I will. I always do. I will need to consistently be able to reproduce. But that will not be any time soon i am afraid, I do not have issues with my code and encoders or the way I work.
I have said what needed to be said. Peeps must believe me or get lost. I do not care.

Sometimes I just wish to be out in the fields with cows and tulips. No noise
Ahhh someone is trying to wet on my battery. just one key stroke and lights off. :D



Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: AM/ Arduino & encoder help!

#36 Post by jph »

Keith,
The
I would suggest he adds pull-ups and tries again. ?
was meant for the OP - NOT for you. :? (although it is definitely best practice - especially with encoders remote from the Arduino as it gives a cleaner pulse)
As said, the panel works perfectly here and repeatability is 100%.
Joe
Joe. CISSP, MSc.

xtech007
Posts: 8
Joined: Thu Mar 31, 2022 3:02 pm

Re: AM/ Arduino & encoder help!

#37 Post by xtech007 »

Gentlemens!!
So sorry for the delay.
Got most of the morning and afternoon (here were I’m @) trying and testing all the suggestions by all who had contributed .

Here is what I tried:

1st. Changed pins on the Mega.
Same issue. Sometimes both directions works and sometimes it doesn’t.

2nd. Added external 10k resistors to inputs.
Worked on some gauges not all. But when Re-started AM the one direction dial issue came back.

3rd. Replaced the Arduino Mega board!!
Used a new one ordered from Amazon.
Ahh… same issue.

4th. Just for the kicks, loaded a sketch to the mega setting all the input pins as INPUT_PULLUP the.
Tested each encoder & buttons and worked great.
So, then re-flash the Mega using the flash Tab on AM.
Removed all external resistor just to test!
Added the panel, assigned pins to the gauges, started Xplane11 , started the flight and guess what..
FREAKING THING WORKS!!!!!!

Tested all gauges , buttons and encoders and all works flawlessly.

Pissed off, tried the original board did the same and Darn thing worked too!!

Guys, don’t know what to say!!

Thank you for your support and encouraging to keep going with different options. Also is great to see different point of views. That’s what moves great forums like this one.

xtech007
Posts: 8
Joined: Thu Mar 31, 2022 3:02 pm

Re: AM/ Arduino & encoder help!

#38 Post by xtech007 »

I did not had to modify any script, sketch or code.
It was all done through AM.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: AM/ Arduino & encoder help!

#39 Post by jph »

Nice one, glad you got it working. Consider the fun you had doing it though. ;)
Joe
Joe. CISSP, MSc.

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: AM/ Arduino & encoder help!

#40 Post by Keith Baxter »

Ralph,

I spent a hour or so trying to consistently reproduce the issues to try and get to the bottom of this. I am unable to. But the issue is sometimes present in the panel.

I did run a few panel instruments in <creat/edit> and never had a issue. Only SOMETIMES in the panel.

Not sure what to say, but definitely, sometimes there is an issue.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply