You need the following components:
In the photo on the right, you can see all these components wired together, so have a close look at the photo if you have wiring problems.
Wire the CAN module as follows:
|CAN Module Port||Arduino Nano Port|
You will need two of those to test if you can actually send and receive data on the CAN bus. As the material costs are fairly minimal, that shouldn't be a problem.
Connect the two CAN bus cards L to L and H to H, and bridge the internal 120 Ohm termination resistor on both CAN boards, simulating a bus cable that's terminated on both ends.
Download the source code from this site, and load it onto both arduino nanos.
Uncomment the source code to set a device name, id, and subscriptions etc.
Now fiddle with the input ports to simulate switches being switched, and watch the output ports change according to the subscriptions you have set up.
Best connect relays to the output ports so that you can actually switch something other than LEDs (which are fine just for testing).
If you have struggled with a problem for at least a day, feel free to ask for help
Gauges are very easy to make. Just take any existing gauge, strip out the interior, and fit a stepper motor, e.g. a MG90S, or whatever fits in there. Take the three wires of the stepper motor and hook them up to a gauge output of a unit, configure it, and you're ready to roll! For the unit configuration, configure one of the PWM ports as a measuring gauge output, and configure the “servoOutputs” storage for the correcponding port with a minimum and maximum value that the gauge shows, and the angle the needle goes through from minimum to maximum. That's it!
Keep in mind that the angle position “0” is the clockwise maximum, and the maximum angle is the anticlockwise maximum (or the clockwise minimum). So the needle of the stepper motor is fixed to the axle of the stepper motor in maximum position, which is angle 0.
Now wire the 5V plus and minus cables to the units + and - outputs, and the command wire for the stepper motor to your gauge output port of the unit. Add a subscription to the gauge port to wherever the measurement comes from, and the gauge will display after startup of the unit.
If you have a servo motor that turns clockwise on a positive value, set the direction value to “0” in the servoOutputs eeprom storage. If it's turning anti-clockwise like this one, put it to 1.