Answer the question
In order to leave comments, you need to log in
How to create a network of microcontrollers on the CAN bus?
I am working on a smart home project, I have only just started to get acquainted with microcontrollers, so sometimes there are plugs.
The components of my smart home need to communicate over the network. 1-Wire is too unreliable and slow, Ethernet has a minus the need for a switch, and it’s stupid to hang an Ethernet port on each executive.
I came to the conclusion that you need to use the CAN bus, and the speed is sufficient and the maximum length of the connection is acceptable.
The task is to create a basic element that can receive / send data from the CAN bus, and then process this data according to the firmware.
There is information on the Internet about a bunch of mcp2551 + mcp2515 + avr controller, but when I did not find specific schemes and working examples.
Can someone tell me which way to dig? I would be very grateful if someone shares their experience with CAN
Answer the question
In order to leave comments, you need to log in
The HARDWARE didn't say how much information will be circulating on the network. IMHO, hanging CAN on each device is no less stupid than Ethernet, tk. hardware CAN is still exotic for small-footed MKs, but it is probably possible to make software CAN, but this is not much for the faint of heart. There is also an SPI-th MCP2515. The problem can be solved simply and reliably enough by means of RS485, the protocol is MODBUS, which has proven itself well in the industry, there are a lot of examples on the network for different implementations. For him, MK is enough USART, and almost every modern MK has it, even in 8-pin ones (as well as SPI) and add an appropriate transceiver, something like AD485. IMHO, which MK to take - it doesn't matter at all, as long as its resources correspond to a specific task, and what development / debugging tools the performer has.
AVR is the last century. I advise you to look towards STM32. By the way, if you need to save a lot, then instead of STM32 you can pick up a cheaper STM8, they also have a kind of CAN (though not full-fledged).
Plus, you will also need a level converter, but this stuff is on ibei / ali in bulk.
To communicate with a computer, you will either have to buy an expensive PCI CAN controller (by the way, it’s a big problem with them: usually a developer uploads modules for very ancient kernels, so if you don’t know how to write / edit kernel modules, it’s better to discard this idea right away), or make your own USB <-> CAN adapter based on the same STM32. Another option: make a master controller with ethernet, on which the web muzzle will spin. We stick it into a wifi router and from any device with wifi we can see the state of the system.
1-Wire is too unreliable and slow
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question