Is what I want to achievable?

cosmarchy
Posts: 3
Joined: Sat Mar 25, 2023 6:47 pm

Is what I want to achievable?

Postby cosmarchy » Sat Mar 25, 2023 7:08 pm

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

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: Is what I want to achievable?

Postby ESP_Sprite » Sun Mar 26, 2023 2:01 am

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.

username
Posts: 477
Joined: Thu May 03, 2018 1:18 pm

Re: Is what I want to achievable?

Postby username » Sun Mar 26, 2023 3:40 pm

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.

cosmarchy
Posts: 3
Joined: Sat Mar 25, 2023 6:47 pm

Re: Is what I want to achievable?

Postby cosmarchy » Sun Mar 26, 2023 10:09 pm

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.

vanBassum
Posts: 68
Joined: Sun Jan 17, 2021 11:59 am

Re: Is what I want to achievable?

Postby vanBassum » Tue Mar 28, 2023 1:45 pm

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.

cosmarchy
Posts: 3
Joined: Sat Mar 25, 2023 6:47 pm

Re: Is what I want to achievable?

Postby cosmarchy » Tue Mar 28, 2023 7:48 pm

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.

Who is online

Users browsing this forum: Google [Bot] and 108 guests