Raspberry Pi with CAN Bus HAT + HAPCAN

Post Reply
Alexandre
Posts: 6
Joined: 28 Sep 2018, 13:44

Raspberry Pi with CAN Bus HAT + HAPCAN

Post by Alexandre »

Hello,
I am considering using a raspberry pi with a CAN Bus hat on the same CAN Bus as HAPCAN.
Most of the hats available use either SN65HVD23x or SN65HVD26x. Both are 3.3V CAN Bus Transceivers, but they are compatible with 5V CAN Buses.
The idea is to power the raspberry pi with a 5V power supply, and to connect its ground to the HAPCAN power supply ground (so that CAN has the same ground reference).
Do you see any problem with this integration?
Thank you.
Jacek
Posts: 560
Joined: 17 Feb 2007, 18:00

Re: Raspberry Pi with CAN Bus HAT + HAPCAN

Post by Jacek »

Alexandre wrote: 21 Oct 2021, 14:09 Do you see any problem with this integration?
No, not at all. Please give us more details when you have it done.
Regards
Jacek
Alexandre
Posts: 6
Joined: 28 Sep 2018, 13:44

Re: Raspberry Pi with CAN Bus HAT + HAPCAN

Post by Alexandre »

Hello,
I have successfully integrated the Raspberry Pi with a CAN hat to the HAPCAN network.

In summary, I have developed C code to make it work as a HAPCAN Ethernet Interface and also as a "MQTT to HAPCAN" gateway.

It means that when I run a HAPCAN Programmer on my PC, it can connect to the Raspberry Pi and program the modules. Also, I can add Items to OpenHAB so it can control the HAPCAN modules and read their status using MQTT.

Mind you, the Software is written in C code for a headless Raspberry Pi (no monitor, no keyboards, no mouse). So, there is nothing fancy implemented, and no user interface. At the moment the translation between MQTT and HAPCAN is very basic.

For the HW setup, I have used two power supplies: a 24V supply for the HAPCAN modules, and a 5V supply for the Raspberry Pi. The grounds (outputs) are connected together.
For the CAN Bus HAT, I have tried two options, and both work:
https://www.waveshare.com/rs485-can-hat.htm
https://www.elektor.com/pican-2-duo-can ... rry-pi-2-3
For the integration, I have used the Raspberry Pi 3. Its ethernet port is connected to my network. For connecting the HAPCAN Bus cable to the Raspberry Pi, I only used the CANH and CANL wires.

My goal is to upload all I have to github in the next weeks, together with a step-by-step guide for setting up the Raspberry Pi.

After my tests, I really believe that the development of a “HAPCAN Hat” for the Raspberry Pi should be at least considered. It would enhance the capabilities of the Ethernet Interface without increasing the power consumption too much. Please, tell me what you think.

Thank you.
Jacek
Posts: 560
Joined: 17 Feb 2007, 18:00

Re: Raspberry Pi with CAN Bus HAT + HAPCAN

Post by Jacek »

That’s great news. I can’t wait to see the code and other documents about it on github. We’ve just had a chat about MQTT at the other topic, but looks that your project would solve it. Thanks a lot.
Regards
Jacek
Alexandre
Posts: 6
Joined: 28 Sep 2018, 13:44

Re: Raspberry Pi with CAN Bus HAT + HAPCAN

Post by Alexandre »

Hi,
The Raspberry Pi project I am working now has a first version available on the link below:
https://github.com/alcp1/HMSG

I have made some short videos to give a general idea of some of its features (sorry - no audio):
https://www.youtube.com/watch?v=V89GETZ ... 0k&index=1
https://www.youtube.com/watch?v=wgRGvjC ... 0k&index=2
https://www.youtube.com/watch?v=VfVhRW2 ... 0k&index=3
https://www.youtube.com/watch?v=yHDpkd5 ... 0k&index=4

If you need any further information, please, let me know.
Jacek
Posts: 560
Joined: 17 Feb 2007, 18:00

Re: Raspberry Pi with CAN Bus HAT + HAPCAN

Post by Jacek »

Alexandre,
it looks great. I haven't tested yet, but definitely will do. MCP2515 is a quite old controller. Microchip suggests to use the MCP2518FD for new designs, so probably I will use the new one. Thanks for that.
Regards
Jacek
Post Reply