LeisureCAN

The open source CAN-Bus network for leisure vehicles

User Tools

Site Tools


make_your_own

How to make your own LeisureCAN devices

Making a LeisureCAN Unit

You need the following components:

  • Arduino Nano or compatible device
  • MCP2515 CAN Bus Module TJA1050 Receiver SPI Module
  • step down buck regulator to 5V or a stable 5V source

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 PortArduino Nano Port
INTD2
SCKD13
SID11
SOD12
CSD10
GNDGround
VCC+5V

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 ;-)

Making a LeisureCAN Gauge

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.

make_your_own.txt · Last modified: 2021/01/20 20:56 by christian