Hello,
Whilst I have dabbled with microcontrollers in the past, I am quite new to ESP so wanted to seek advise as to whether what I want to do is achievable before I embark on a potential waste of time...
I have the need to join multiple ESP microcontrollers on a bus system stretching probably total of 50m. There will be one ESP which will act as the master which periodically polls the other 20 ESP nodes all connected along the 50m bus.
I thought that the only reliable bus that would be suitable would be something like CAN bus. You can get CAN bus transceivers which connect to the ESP via SPI or I2c. CAN bus spec seems to indicate this is within the specification in distance terms and this is a supported and well known protocol.
The part I'm not sure about is updating the firmware. Since this is a remote system I need to be able to connect to the ESP boards and download updates and I won't be able to do this over wifi which I would like to disable so am wondering whether this is possible to do this via the CAN bus.
I'm assuming this would require a custom boot loader as I'd need a copy of the new downloaded program to be checked to ensure it is correctly downloaded before using it I cannot afford for transmission errors and the loss of some nodes in case of corruption...
Has this been done before? I'd hate to re-invent the wheel if it is already available? If this is not possible, would there be any better alternatives out there?
Thanks
Is what I want to achievable?
-
- Posts: 9730
- Joined: Thu Nov 26, 2015 4:08 am
Re: Is what I want to achievable?
CAN would work, I think. Another option is to use an UART for RS485 communications. For uploading new firmware, you can probably adapt the existing OTA update method, that is, there are two or three firmware partitions and updating is done from the existing firmware rather than the bootloader.
Re: Is what I want to achievable?
Have you looked into ESP-NOW?
With little code modification to OTA you could have your master push out the update to all units paired to it.
With little code modification to OTA you could have your master push out the update to all units paired to it.
Re: Is what I want to achievable?
Thanks for your input guys.
I had looked at RS485 in the early days but mistakenly got the max distance wrong as now I've looked at it again, I can see it has more than enough.
I need to look in to this a bit more but at this stage I don't think there is much difference between RS485 and CAN bus in that they both require additional transceivers boards connected to either SPI or I2c.
As for ESP-Now, I hadn't looked into this. I think from the common consensus that a modification to OTA is what is likely needed.
I had looked at RS485 in the early days but mistakenly got the max distance wrong as now I've looked at it again, I can see it has more than enough.
I need to look in to this a bit more but at this stage I don't think there is much difference between RS485 and CAN bus in that they both require additional transceivers boards connected to either SPI or I2c.
As for ESP-Now, I hadn't looked into this. I think from the common consensus that a modification to OTA is what is likely needed.
Re: Is what I want to achievable?
You can also use the ESP32 with a MAC PHY and use Ethernet. Depending on your specifications, it might be a better / more modern option.
Re: Is what I want to achievable?
Yes, ethernet based ESP32 looks interesting too.
The only slight drawback is the ability to daisy chain. As I will have around 20 nodes, I really would need to daisy chain from one node to another in order to avoid taking 20 cables from a large switch.
I'll look around and see if there is a three port switch available which I can put at each node in essence creating a tap - one port from previous node, one port to the node and the other to the next node.
Not sure whether there are any easier ways, but certainly worth a look.
The only slight drawback is the ability to daisy chain. As I will have around 20 nodes, I really would need to daisy chain from one node to another in order to avoid taking 20 cables from a large switch.
I'll look around and see if there is a three port switch available which I can put at each node in essence creating a tap - one port from previous node, one port to the node and the other to the next node.
Not sure whether there are any easier ways, but certainly worth a look.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 146 guests