What are the correct CAN bus settings for a MCP2515?

Good afternoon all,

Short introduction
I live in The Netherlands and have a small VelBus at home. Currently 4 glaspanels and 4 shutter modules. More modules will be added soon. Just before we started the complete renovation of our house, we discovered the VelBus edge lit glass panels at the BatiBouw fair. Both fell in love with the switches and once the renovation started, I installed approx 100 m of cabling for the purpose of domotics.

The VelBus is connected to OpenHab, which in turn also uses Zigbee (Ikea lamps, aqara motion detectors), Wifi (Sonoff modules) and 433 MHz KlikAanKlikUit. Kind of a mixed system but it works great.

The plan for the upcomming years is to converted more to VelBus, as it is very realiable and does not need a Raspberry to work. The RPI does do the automation, but in case of failure / crash, the boss (yes, my wife) wants to be able to control the lights. So that if where the KlikAanKlikUit has a +1. It can be controlled with a dedicated remote at all times. VelBus has the same advantage, but it kind of expensive (in fact very expensive, so 1 module at a time). That is why there is a slow convertion planned.

As I do like to learn how things work, I now set my self some goals of understanding the Velbus. As it is CAN based and the protocol is more or less published, step 1 is to be able to understand what is happing. I played with the VelBusLink software.

Also installed the python VelBus module and even was able to fake a module using python. More on that later :slight_smile:

BTW: I use the VelServ on my RPI.

CAN logger
I grabbed an arduino & MCP2515 chip, and got that working very fast. but have difficulties finding the optimal settings for the MPC2515.

When I trigger the output of module “3”, my Adruino logs following:
(already calculated the CAN ID back to velbus ID (/2 & 0xff)

03 02 01 12
03 07 DA 01 FE 00 00 01 AB

In the first row, everyting OKE
In the sencond row, the data is shifted 1 bit (not byte) when I compare with VelBusLink output (and datasheet).
So after the “7” (number of bytes), everything is shifted 1 bit.

Should be according VelBusLink:

03 07 ED 00 FF 00 00 00 D5

The 16k6 baudrate is not standard, and I had to guess the CNF1, CNF2, CNF3 values using an online calculator. But there are many variations of these 3 values that give the same baudrate but have different means for other settings.

Does anyone have a reliable set of configuration values for the MCP2515 (at 8 MHZ)???


I don’t understand why you want to bother with the CAN messages?
Just use a TCP/IP velserver with a USB or Serial connection to the bus.
That same TCP/IP velserver can be used for VelbusLink.

If you use openHAB, do you use the openHAB native binding?
You can also use my scripts to integrated Velbus with OpenHAB.
These scripts will read everything on the bus and you can send any command you want:

And regarding the protocol files, this can also be handy:


1 Like


Already saw your name on several threads :slight_smile:
The answer is simple: build hardware!

I already identified 5 places in the hallway, stairs and 2nd floor where a motion detector connected to VelBus would be the perfect (long term stable) solution. It’s just damn expensive (and a nice challenge to get it done. I am an engineer after all)

openHAB works like a charm. Have the “Cedric” bindings, mqtt, python scripts. But in the end it is a computer and if it crashes or something happens to me, we are in the dark. As pointed out by the other parts of this household.

Rule #1: make it wife-proof
Rule #2: make the basics (lights, shutters) work when the software is dead.

So, I need more VelBus hardware to get make a system which provides at least the basic functions of controlling lights when the RPI is dead (or me, worst case). So much more hardware. So the idea to “hack-around” a little.

And learning CAN, STM32, etc on the way.

Any help is appreciated. If it turns out to difficult, I will make up another plan and hard wire some essentials.

Greetings Matthijs

Ohh, I was assuming it was straight CAN bus, but now see some things I do not understand. Like lost bits. So slightly confused.

It works!!

Today learned how to use CAN on my STM32. That was NOT simple, but in the end it works. When I now press a button on the STM32, the VelBus switch in the room is operated and the lights are switched.

So this is a good basis to make some PIR motion sensors.

It’s pitty it is not possible to post any pictures. :frowning:
And magically the Arduino + MCP2515 now also work. So looks like some other failure. Maybe hardware or cables?

Anyway, off to make some modules now.

Greetings Matthijs

I also use ‘only’ Velbus for basic functionality.
And OpenHAB for extra stuff like automation and integration.

I played around with https://www.mysensors.org/ and nRF24L01 for wireless transmission.
I have a test board that transmits temperature and humidity to OpenHAB for 2 years now without any issue.