Going to develop a DIY CAN bus system for monitoring/controlling systems in a camper/RV

I think i found a use for the several MCP2515 CAN modules i have from eBay, as the subject line says.
i can have a central monitoring and control arduino (likely a Mega2560, my favorite Arduino :wink: ), with a 7" Nextion i have had for a while.
then build some Arduino CAN sensor modules for things like tank levels, various temperatures (like for winter camping), room temperature (to control the furnace), battery volt level, and some other status info. like a sensor to detect when AC power is connected, or power fails. could be as simple as a relay on each leg of the incoming 240Vac (120 -L1 + 120 -L2, 50A RV power cord).
i can also control some items like the furnace (act as a thermostat, using a relay), battery charger (if volts drops to X volts, then solar isn't taking care of the load... and disconnect after the volts reaches Y level).

i found a useful library and CAN reference from: Arduino CAN Tutorial - Interfacing MCP2515 CAN BUS Module with Arduino

i will likely base my system on that library, and build from there. Seeed Studio makes a CAN dev board with an ATmega32u3 MCU (https://www.digikey.com/en/products/detail/seeed-technology-co-ltd/102991321/11201147) that i can use for the remote nodes, unless custom nodes are needed.

but the intent here is to develop a system where the master control unit supplies power for all the sensors, via the use of CAT5e cables for CAN + power (5V). one pair for CAN, and 3 pairs for sensor power, though this may be abandoned if i end up with a lot of nodes. not much current on 3 pairs of 22AWG...
still may use CAT5e cable for the twisted pair, somehow. maybe just higher power nodes will have their own power source, derived from the RV 12V power, with DC-to-DC step-down converters, and heavy power filtering. but the intent is to reduce the number of signal wires around the camper.
say each tank level sensor set (digital) has 5 wires (4 levels + common), or only 2 wires if i dare go analog with a resistor ladder setup (not crazy about the idea). but multiply the wires by 3 tanks, and that is too many wires to run back to a single arduino monitor. so, CAN would involve running a network of a twisted pair wire, and a power wire for high-power nodes. hence my plan to use CAN, and some arduinos.

just posting to see what others thought about my idea. keep in mind, my 5th wheel camper is currently gutted for renovation, so running some CAN bus wiring will be easier, as well as hiding some Arduinos.
most of the custom nodes will be derived from a bare-bones ATmega328PU, and will likely be on copper-pad perf-board as they will each be unique enough to not have the same exact circuit, and i don't think a shield system will work for me. mostly because in transit, things will loosen over time, and a custom circuit can be potted in resin for better vibration resistance, and once a node works, it won't need to be changed in design, and can be potted.

~Travis

Fun and interesting project.
40 years ago I built a house and had thoughts about a special channel system, beside to the mains channels, just for a communication. The costs for the house gave no room for that idea...

CAN bus or I2C.... You've got CAN circuitry. Go for it but check up cable lengths, pullups etc.

As You say, all connections must sustain the vibrations from the road. Breadboards are banned. Use soldered connections, or screw blocks. However, the rubber wheels and suspension will take care of a lot.
Once I built a one board (100 * 160 mm) computer for the car. It survived for 10 years!
Good luck!

1 Like

Consider a centralized server, a Raspberry Pi, and the outlaying MCU, wireless, communicating with the RPi.

in regard to cable lengths, i found this via google: https://www.axiomatic.com/whatiscan.pdf

Are there distance limitations?
Can bus is a synchronous network, where all receiving modules synchronize to the data coming from a transmitting module. The electrical characteristics of the CAN bus cable restrict the cable length according to the selected bit rate. You can use cabling up to 250 meters with the baud rate of 250 kbit/s.

The maximum bus length with a bit rate of 10 kbit/s is 1 km, and the shortest with 1 Mbit/s is 40 meters.

i will be using 125Kbps, and with the min length @ 40 Meters (for 1Mpbs), i should be safe. my 5th wheel camper has a total circumference of 20 Meters.

~Travis

i thought about using a Rpi as a central server, but in cold weather, i prefer MCUs over MPUs for this simple reason. less components to fail in cold weather... though as i am writing this, i realize i have not tested my Nextion screen in bitter cold weather (Note to self... :wink: )

based on that thought, i could have an override for the furnace control, or a backup thermostat to warm the camper up, then switch over. or i could just leave the furnace out of it, and just monitor temperature.

I am able to set my HAVAC from my phone, through a RPi, to a ESP32 sitting in place of the thermostat.

About that cold weather stuff and components and blah blah blah. Do you drive a car? Consider that a 2020 Subaru has 63+ microprocessors and all the components to go along with those microprocessors. Now ask yourself how many times do Subaru's fail because its cold?

it is not wise to generalize one component works, so they all will. :wink:
last winter, at -42degF, here in Maine USA, the touchscreen in my truck would not work until the truck warmed up. that is the experience i derive my basis on.

it isn't about just the Raspberry Pi. if my touchscreen does not work, nothing does, because i can't control it through the touchscreen.

in the above instance, my truck worked fine, but i could not use the touchscreen at all. so if the touchscreen in my project is the main control point, it all shuts down, effectively, in the cold.

LCD type displays get slow when they get cold. Equipment used in large freezers had to have a little heater attached. If You manage powering things Your main controller could turn on heating for the screen when needed and warm it up.

1 Like

interesting thought... could even be just a cheap little "12v defroster blower" thing blowing on the back of the touchscreen...
could be simply this: if the unit powers on and the room temp is less than X degF, kick on the heater. when the room temp rises to Y degF, shut off the heater, but also, if the heater runs for N minutes, something is wrong, shut off and wait for reset (just in case).

Hi,
I now it can get bloody cold for months in some countries, but what are you fitting out here?
An RV or a mobile Refrigerator Container.

Build a simple canbus and freeze it.

Tom... :smiley: :+1: :coffee: :australia:

Hi Tom,
the problem is not the CAN bus freezing. my Nextion touchscreen that will control everything has a minimum operating temp of -20C. so if i need to fire my system up in -40C temps, or less, then the touchscreen will not operate to allow me to turn on the furnace.

i have done winter camping in the past, so this is rather likely to happen as a scenario. the trick with camping in this cold, do not fill or use the indoor plumbing :wink:

I suggest a power resistor emitting a few Watt. Use cardboard and make a little cabinette for the display. Automatic heater control when system is powered up.
No need to keep the system running when the camper is not used.
Check the components for minimum storage and opersting temperature.

1 Like