Arduino code/hardware for can-fix buttons/encoders?

Discussion forum for the CAN-FIX protocol. This is a CANBus based communications protocol specifically suited for experimental aviation.

Moderators: John Nicol, birkelbach

Post Reply
ulbuilder
Posts: 15
Joined: 27 Nov 2023, 10:26

Arduino code/hardware for can-fix buttons/encoders?

Post by ulbuilder »

I'm looking to setup some physical buttons and encoders.

Can anyone point me where I might find some example code/circuits to accomplish this?
birkelbach
Posts: 187
Joined: 04 Sep 2012, 14:42

Re: Arduino code/hardware for can-fix buttons/encoders?

Post by birkelbach »

Here is the beginnings of a project that I started years ago that tries to implement CAN-FiX on an Arduino

https://github.com/makerplane/CAN-FIX-ArduinoLib

It may not be 100% up to date with the latest version of the protocol and I'm sure that it's not feature complete. It should be a good place to start. Feel to post fixes/additions to the GitHub repo.

As far as buttons/encoders I don't think anyone has done that specifically yet. It's on my list but not nearly close enough to the top to have gotten done. :D
Phil Birkelbach
Waller, Texas
RV-7 727WB
www.myrv7.com
ulbuilder
Posts: 15
Joined: 27 Nov 2023, 10:26

Re: Arduino code/hardware for can-fix buttons/encoders?

Post by ulbuilder »

I got a few of these Raspberry RP2040 micro-controllers with built in CAN-bus:
https://www.adafruit.com/product/5724

Wrote some crude circuit python to handle a couple of encoders and their push buttons. The board can support up to four encoders and five switches. With an add-on board to add more GPIO ports it could easily handle more.
https://github.com/e100/mp-canfix-devic ... er/code.py
The code is not complete, needs libraries and such too, a file from the python-canfix library too. I'll get more details added to the repo so anyone can quickly get this up and running too!

It can send messages as an owner or as a node specific message but is not 100% compliant to the CAN-FIX spec.

I've added to my FIX-Gateway changes some new features. You can flag individual inputs in the canfix plugin to also read node specific inputs. Needed if you want to update the same fixid from more than one encoder. Imagine a pilot and co-pilot BARO encoder for example.

For encoders I made the totaling of the step counts optional. I cannot think of any situation where having the total of all step changes is helpful.

I've added an encoder function to the FIX compute plugin. It takes the encoder fixid as input, multiplies it by a user defined multiplier and adds the result to the output. Requires the totaling be disabled in the encoder input.
Post Reply