Multiple controllers or all in one?

Good day,

I am building a project where i need the following things:

  • Display
  • W5500 Ethernet module
  • MC522 RFID module
  • SD Card reader
  • RTC

Use case:
A person scans his RFID tag to the device, the display shows a message, the device than creates an XML file on the SD card and for example every minute the device updates values from the SD card to an online server.

I use an SD card to store XML files because at some places where this device will be placed, internet is not that stable and the device has to work 24/7.

This is how i am building this now:
Atmega 1284P:
Controls the LCD Display and receives the data from an Atmega 328P

Atmega 328P
Connected through the internet to update data to the server

How to go on
Is it better to use another Atmega 328P to connect it to the MC522-RFID module and connect this to the other micro controllers (via RX/TX) or is it better to use the other Atmega 328P?

I am not sure if it is better to use multiple micro controllers for every task, or to make 1 program that does it all.
The device needs to run as smooth as possible.

I am sorry if this is not really understandable, if you have any doubts please ask

The details are scant, but I would favour of using one board for all of the tasks and remove the problems of communication between several of them

Okay, thank you, the only think i am not sure about is, what if for example a file is being written to the SD card and at that moment a person puts his RFID tag in front of the RFID scanner, the tag won't be scanned at that moment right?

As you say "connect to the Internet" I'm thinking ESP8266 or ESP32, as it has WiFi built in. One controller to do everything.

ESP32 may be your best bet. You can drop the SD card reader (it has a lot of storage built in), the Ethernet adapter (use WiFi) and the RTC (it's go that as well, and anyway you would get the time off the Internet).

I can't and don't want to use wifi, it has to be connected via a cable. I also don't want to use an ESP8266 or ESP32 since i want to make a PCB myself

Also, i can get the internet time now, i also want the time to be correct if internet connection is lost

bluebirdsoftware:
I can’t and don’t want to use wifi, it has to be connected via a cable.

Then you’ll have to use an ethernet adapter of sorts indeed.

I also don’t want to use an ESP8266 or ESP32 since i want to make a PCB myself

So how is that stopping you?

The ESP12 modules are highly PCB friendly. They’re perfectly happy to go in the reflow oven, while hand soldering is also an easy option. The ESP32 modules are no doubt likewise. The programming is dead easy as well, just use a standard USB/TTL adapter. You can even throw an FTDI header on your board if you like, I normally use a 3-pin header (Tx, Rx, GND) which I connect to regular USB/TTL adapter. Possibly even easier than the ATMega controllers which need a 6-pin ISP header for programming and special ISP programmer. Just remember to set it to 3.3V.

Also, i can get the internet time now, i also want the time to be correct if internet connection is lost

That’s what the built-in RTC of the ESP32 is good for…

You mean to solder on a whole developer board or just the ESP32 module?
I have never heard of this or used this. I can't find that much information of the specs of the bare module and i think every development board has it's own specs?

Maybe it is a better solution

Just the module. Just like you can get the ATmega microcontrollers barebones, you can get the ESP modules barebones. You can even get the ESP8266 chip by itself, but that's not really useful.

I've done just that a lot with ESP12 and ESP07S modules, the latter for projects that called for an external antenna. Of course you can completely disable the whole WiFi part if you don't need it.

Specs of the processor are not much different than that of the development boards. Things like pinout are easily found online; the processor parameters (pin current limits, interrupts, etc) are all the same across boards as those depend on the processor itself.

Okay thank you, you said i don't need an SD card but i only read at some sites it has 4mb of flash, i am not sure if that is enough. And will everything i need work? (TFT display, MFRC522, W5500 etc.)?

I think i will try the ESP32 controller. It has much more to offer (240Mhz dual core instead of 16Mhz single core) and maybe i can use the wifi / bluetooth as an additional feature.

The only thing i don't know (except for the things like tft display etc), is if this controller (LilyGO TTGO T7 Mini32 ESP32-WROVER - LILYGO-H303) works the same as this (https://www.digikey.nl/product-detail/nl/espressif-systems/ESP32-WROOM-32/1904-1010-1-ND/8544305).

For developing i would like to have a breadboard compatible module but after that i want it PCB mounted. Does the breadboard module changes things on the module or is it just the breadboard compatibility?

Also, do i have to look for special things in the ESP32 or are all the same? (i already see WROOM and WROVER versions, which one should i use?)

Thank you!

bluebirdsoftware:
I can't and don't want to use WiFi, it has to be connected via a cable.

There are very strong reasons not to use WiFi, specifically security and reliability.

That said, I suspect it is improbable that either is critical in your application. The big problem is that Ethernet is so comparatively cumbersome, particularly in terms of hardware (Interface + cables + ports on your switch) while the compact ESP chips modules have an embedded stack to make your code so much easier.

bluebirdsoftware:
Okay, thank you, the only think i am not sure about is, what if for example a file is being written to the SD card and at that moment a person puts his RFID tag in front of the RFID scanner, the tag won't be scanned at that moment right?

Why not? That's exactly what you have a purpose-built RFID module to do! :roll_eyes:

4 MB Flash leaves you normally 3 MB for SPIFFS.

That’s a LOT of space. How much do you really need per RFID card? Let’s be generous: 50 bytes? That allows you to store info on 60,000 cards. If that’s not enough you really should be looking at off the shelf solutions, as your company is obviously big enough to warrant that.

A write to SD card doesn’t take that long, either. A person will have to swipe their card really fast if that could be an issue. And indeed, it’s anyway the RFID reader that’s doing the reading itself, then communicates this to your device. That process takes easily a couple hundred milliseconds, while the SD card out SPIFFS writing takes just a few ms, reading being much faster.

Do mind that as both SPIFFS and SD are based on flash memory you’re limited to 1000-2000 writes per cell before that cell breaks down. So do your writing sparingly. In one ESP8266 project of mine I’ve resorted to using an external EEPROM instead of the built-in Flash, as the project is doing to many writes, and it’d reach the limit within a few months. That EEPROM is guaranteed to last for 1 mln writes, so that’s a few decades to reach the guaranteed number and several more decades before it’d really fail. That’s long enough :slight_smile:

Do mind that as both SPIFFS and SD are based on flash memory you're limited to 1000-2000 writes per cell before that cell breaks down.

Is this correct ?

SPIFFS uses flash memory but surely 1000-2000 writes is wrong and how does writing to an SD card use flash memory ?

The SD card itself is flash memory.

It seems I got those numbers wrong, 10-100k limits I find on a quick Google search, still it's a lot less than EEPROM, in addition flash uses larger sectors. All in all much faster to wear out.

Paul__B:
There are very strong reasons not to use WiFi, specifically security and reliability.

That said, I suspect it is improbable that either is critical in your application. The big problem is that Ethernet is so comparatively cumbersome, particularly in terms of hardware (Interface + cables + ports on your switch) while the compact ESP chips modules have an embedded stack to make your code so much easier.
Why not? That's exactly what you have a purpose-built RFID module to do! :roll_eyes:

Well, it is not that i don't want to use WIFI but the device i am building is going to be sold to our customers. They receive the device and it has to work out of the box. Not all my customers have WIFI everywhere (in parks, garages etc) so ethernet has to be available. It would be great if WIFI could be an option but i am not sure how i would make the install easy for the customers to connect the device to their WIFI (The device gets a screen but no other input).

What i meant with the RFID tag being skipped, the Atmega 328P is single core so all code loops infinite, what if writing to an sd card (for example) takes 5 seconds, during these 5 seconds, no code is being executed to read the RFID tag (the ESP32 is dual core i see, so i could use multithreading for this purpose i guess).

wvmarle:
4 MB Flash leaves you normally 3 MB for SPIFFS.

That's a LOT of space. How much do you really need per RFID card? Let's be generous: 50 bytes? That allows you to store info on 60,000 cards. If that's not enough you really should be looking at off the shelf solutions, as your company is obviously big enough to warrant that.

A write to SD card doesn't take that long, either. A person will have to swipe their card really fast if that could be an issue. And indeed, it's anyway the RFID reader that's doing the reading itself, then communicates this to your device. That process takes easily a couple hundred milliseconds, while the SD card out SPIFFS writing takes just a few ms, reading being much faster.

Do mind that as both SPIFFS and SD are based on flash memory you're limited to 1000-2000 writes per cell before that cell breaks down. So do your writing sparingly. In one ESP8266 project of mine I've resorted to using an external EEPROM instead of the built-in Flash, as the project is doing to many writes, and it'd reach the limit within a few months. That EEPROM is guaranteed to last for 1 mln writes, so that's a few decades to reach the guaranteed number and several more decades before it'd really fail. That's long enough :slight_smile:

I don't know yet how big the files will be but some customers have 500+ employees and maybe in the future i get bigger customers who have 1000+ or maybe more employees, i don't want there to be a limit on the files so if an SD card is more safe for that, i would like to have that extra bit of insurance.

If there is a better solution i am happy to hear about that.
Since i want the device to work as well without internet, i need to store all user data on the device including a small profile picture (60 x 60 pixels ore something). I think because of the pictures (if that will work), it needs more than 3MB storage

In this time and day there is more chance to have WiFi than ethernet in most places. You will also have to consider setting up the network connection itself, and finding the host you need to to communicate with on the network.

If you're writing so much data upon an RFID read that it takes 5 seconds you're doing something terribly wrong.

In many cases yes, people use WiFi, our customer have holiday parks etc and a lot of times in some places there is no WiFi. The device only needs internet to connect to our server. A lot of companies have their WiFi protected and have guest networks for their customers.

Connecting it through ethernet works (as it already does now). Maybe some customers use WiFi but not all of them can or want to provide me their settings. I am not sure how to make a user friendly way to connect to their WiFi without having a touchscreen or keybourd / mouse.

I don't know how much time it will take to write the XML file (for example), maybe miliseconds, i haven't tried this yet

bluebirdsoftware:
I am not sure how to make a user friendly way to connect to their WiFi without having a touchscreen or keybourd / mouse.

WiFiManager?
Then the customers can do it themselves, with a smartphone.
Leo..

I tend to agree that the availability of Ethernet is nowadays the more improbable.

It is certainly true that you can probably just use DHCP to get out onto the internet from a simple Ethernet connection (but getting in is not so easy) while there is the additional step on WiFi to configure for the AP. :roll_eyes:

Wawa:
WiFiManager?
Then the customers can do it themselves, with a smartphone.
Leo..

How would that work? I have never heard of it

Paul__B:
I tend to agree that the availability of Ethernet is nowadays the more improbable.

It is certainly true that you can probably just use DHCP to get out onto the internet from a simple Ethernet connection (but getting in is not so easy) while there is the additional step on WiFi to configure for the AP. :roll_eyes:

I had the w5500 module working on an Atmega328p. It would be possible on the Esp32 too right?