Jump to content

Keypads and Arduino


Raisuli

Recommended Posts

Learned something new last night after a few hours of troubleshooting.  Keypads (switch matrix) in Arduino/Teensy don't like long cables, and for the purpose a meter is a long cable. 

For v2.5 of my pit I'm using 16 port I2C chips to go from 7 controllers to 3, which involves a controller on every other panel (or so), and ran into keypad problems.  A little troubleshooting, followed by a little DuckDuckGo, pointed out the problem.  Now I'm abandoning keypads and using those momentary switches as digital inputs.  Turns out I2C, encoders, analog, and digital don't mind the long wires as much.  Analog might care a little; I've had to calibrate my axis in joy.cpl to make them all work right.

Still looking to see if there's another option; if not a backplane may need rebuilt to add another I2C to the next set of panels, but we'll see how many pins I have left. 

Not sure anyone else is as crazy as me, but thought this was interesting.

Link to comment
Share on other sites

The whole point of microcontrollers is distributed processing. 

You're SUPPOSED to put more of them in, closer to their I/O location.

Not only does it reduce the I/O pin count, it also reduces the complexity of the code in each device.

Link to comment
Share on other sites

13 hours ago, No1sonuk said:

The whole point of microcontrollers is distributed processing. 

You're SUPPOSED to put more of them in, closer to their I/O location.

Not only does it reduce the I/O pin count, it also reduces the complexity of the code in each device.

Yeah, well.  I used to think a meter was pretty close!  Seven controllers was too many to manage when configuring controls.  DCS is hands down the best, but there is another sim and that control setup isn't as nice.

Given the working code is mostly loops most of it is copied from one sketch to another with no edits...only the encoders and specialty buttons (master caution and eject) need any kind of attention, and that's only because the variable names change.  Okay, the setup stuff needs attention...maybe I should just number encoders and put them in a loop, too...I'll do that for the last set and have it ready to go for the next iteration.

And I have pins left over.  I'd have more pins left over if I wanted to add I2C chips.  Those make life really, really easy.  I start out with 58 digital and 27 analog.  23 analog shares space with digital, but with 8 axis in DirectX I only lose 4 digital pins to analog.  2 more of those digital pins are lost to SCL and SDA, so net 52 digital are still available after I hook up 8 axis and I2C.

The sketches runs around 100 loops/sec just because that seems like a nice number.  The delay is set to keep that rate, and now that I think about it the delay should be dynamically set on the fly.  Hrm...

First set of panels done, tested, and installed in the pit!  (I refuse to include the clip from Willow).  128 buttons, 8 axis, 1 controller.  Button 1 is Master Caution, button 128 is 'Fuel Select ->RESVR'.

Second set of panels needs some re-work; a new backplane and I have to change a remote keypad into digital switching.  Once it's done 126 buttons and 8 axis, 1 controller.  Should only take a couple days.

Then on to the third set, of which only one panel needs work.  110 buttons, 8 axis, 1 controller.

When I tackle DCSBios Ithat Arduino Mega I've had forever comes out of it's box.   That's for later.  Once I'm done with v2.5 there are other projects that have priority over DCSBios.  Like flying.  The wife's monitor stands.  Vacation.  More flying.  Might finally build that mantle for the fireplace if I come up with a design I like.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...