Best practices and general advice

Hi all,
I am new to Ardunio, but not to programming and am working on a home project for which I would appreciate views and advice from established users. Let me start by saying that this is not a commercial project, I have no plans to distribute it or sell it in anyway, shape or form. I have the concept of what I want to achieve, and how I want it to work so am about to start on the circuitry design and ardunio programming.

To give some background, I am looking to create a design using the Ardunio system, that is in essence a standalone board incorporating an Ardunio Nano. The board will have various sensors as inputs and be networked to other identical boards to share data. In terms of output from EACH board, there will be various LEDs, an I2C connection to power a bespoke text only display using four 7x5 character modules, and digital outputs to other boards and/or servo controls, and the ability to control a DC motor. So quite a bit going on and some aspects (such as the text display may yet get moved to a separate self-contained PCB).

Once I have got the board and software working, I'll then create another two identical boards, using the same ardunio and components to test the networking communication and how each board reacts to data from the others. Once that is right, my plan is to use the ardunio circuit plans and my own circuity from the test boards to create a bespoke PCB that I can have made to create all the boards for the final project, of which there may be 50-60 needed.

I appreciate that is a fairly non-descriptive, high-level background, but where I am seeking the input is on the best way to do things with Ardunio, for example:

a) the boards will need to store some data as a result of the power being lost. Is it best to use EEPROM (which could be updated numerous times in an operating session) or to incorporate some form of SD card reader/writer? The latter would add to the cost and potentially slow the data transfer of course. Presumably there could be a capacitor in the circuit so if the board detects a loss of power, the variable contents get written to EEPROM at that point only, while it is being powered from the capacitor/backup battery, before shut down?

b) with the above number of boards, is it viable to have them on a common power source, or because of interference or any other electrical aspect is it best to limit the number of boards being powered from the same source? I appreciate the overall power requirement of the board would need to be established to accurately answer that question, but my question is in theory at this point.

c) there is likely to be a need to update the ardunio software on each board once the project is up and running - either to provide additional features or bug fixes. From a best practice point of view, is this likely to involve having to plug into a USB socket on each board, or is there a permitted way to put ardunio into an 'update' mode and 'broadcast' the new over the existing network that would link the boards together?

d) for space requirements, the four character displays will be situated on a information panel, hence my thought for taking these off onto a separate and dedicated PCB. Is there a better way (ardunio, RPi, PIC) of purely controlling the display?

e) I was originally looking at using PIC chips and designing the circuitry to purely what was needed for this project, but was pursuaded that prototyping and final design could be easier/quicker with Ardunio. Can anyone with experiencing of using the Ardunio circuit design in a final PCB project offer any insights, aspects to watch or avoid?

Any thoughts, good sources to read, advice would be welcomed. Thanks in advance.

Rich

I use a scheme where I use a Raspberry Pi as an interface to 13 ESP32's scattered about my property like the back yard, in the crawlspace and in the attic. The RPi runs Eclipse MQTT Broker, free. Also the RPi is using a Python program to interface the ESP32's data to my web site.

My RPi has a UPS that I built, so it stays up and running.

Each ESP32 board is provided with its own power source.

After the board is up and running, I just leave it alone. Also ESP32's and other boards have the ability to OTA on updates. Over The Air.

I have several boxes that are just displays located through the property. I use various OLED and e-ink displays as well as the data is available on my web site.

The RPi does TensorFLow processing from images taken by some of the ESP32's.

1 Like

What is a "bespoke"?

You have done a very thorough design of a solution, what is the question?
I mean, tell us what you want to do, not how you are going to do it. You could very likely be developing a complex solution that has already been done.

Open your mind and let the suggestions flow.

I have several sensors and displays all over my house including five that display my blood glucose level. (It doubles as a clock). I also have some HASP wall plates that control different lights and display the time and temperature as well.

"Custom" design.

I get the impression that he proposes to incorporate the raw ATmega chips into the PCB, as well as all sorts of other things.

I tend to think it is still more practical to use Pro Minis as "daughterboard" modules since they are already efficiently designed and (Chinese clones) inexpensive. Unless connection to a PC is required as a normal part of operation, a USB interface is inappropriate; you simply make a provision for serial (or possibly ICSP) connection for program updates.

1 Like

Evening guys,
@SteveMann Apologies, I was trying to present everything in a simplified way without getting into specifics so that people did not get confused, lose interest, or the thread ended up going off on a tangent! Its nothing secret however, so more than happy to fill in the details!

In a nutshell, this whole project (if successful) would be an elaborate control system for a model railway. Yes there are many systems about, and there are a number of ardunio based systems available - but nothing that does things the way I want it to work or this form of approach, nor to the level of complexity. Hence, my term bespoke - it is a system that would be designed specifically for the scenario I have, and nothing that is intended to be adapted for anyone else. To go into the full detail could take up many words and probably leave people none the wiser - but in essence it is about controlling and tracking movement of model trains, with a system that can adapt to different types of trains, showing their position and identifying their current and next movement without having a physical PC in the system. Each of the final PCB boards would be in control of one area and by talking to adjacent boards have the ability to make informed decisions about the activity being undertaken. Not really AI, more a set of rules giving a choice of outcomes. 85% of all of this is undertaken purely by software, but the other 15% is hardware (ie various sensors, feedback information, motor control output, servo control output to physical items).

It is, without doubt, way over the top for a model railway, far more advanced than would ever be needed. But having worked on the real railway in the past it would provide a level of realism that I want to achieve, and there is a personal goal here - I know I can deal with all the software aspects, the challenge to myself is to make the hardware side work!

@Paul_B Your initial thought is correct in terms of using the ATmega chips in the final design, in essence using Ardunio boards as a prototyping tool. I'll look at your thought of the Pro Minis as a 'daughterboard' module tho. I am certainly interested in anything that makes things simpler. Thank you also for the serial/ICSP comment re OTT updates, ill look further at that.

I have used ProMini's everywhere as sensor interfaces.

I'm of the belief that the ESP32 + Raspberry Pi is a proper solution for most remote nodes. The ESP32 offers many advantages, OTA being one and a corporate-backed Arduino core with very well documented API. Also, this board has been around long enough to shake-out many issues. By default, FreeRTOS is integrated automatically.

I prefer to use NodeRED instead of MQTT on the Raspberry Pi. It too is free/opensource.
https://www.stm32duino.com/viewtopic.php?t=959

The serial faux-JSON is remarkable simple and can be sent easily. One GPS node here sends RMC processed datagrams over UDP for clocks about the house.

1 Like

I would recommend looking at the Wemos D1 Mini and use ESPLocal to communicate between the boards.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.