Model train people are on this forum

… I just know it. Someone wants to see this.


Very interesting even to a non train person but what am I missing that makes a pi needed as opposed to an Arduino?

I thought the same thing, though if you wanted to make a user interface a pi makes it way easier even than an esp…


I am guessing price per I/O and ease of programming. You can also remote access the RPi for adjustments and other things, and it can usually multi-thread where the Arduino can’t. This makes it much easier to monitor and react to multiple inputs than the interrupts required for Arduino.


Eh you could do this without interrupts pretty easily.

But yeah the RPi is way more capable than arduino obviously.

Then you are much better at Arduino than I! I have trouble getting more than one input monitored at the same time.

Well that’s just it, these inputs aren’t instantaneous, so you don’t have to monitor them at the same time. You could just cycle through and poll the states of several Hall effect sensors many times per second, which is going to be enough to catch a train passing by.


Even an arduino uno can poll at 400hz, which unless your train is FAST, is likely not a limit. But yes, clearly a multicore ARM can blow the doors speed wise off a 16mhz micro controller. The only difference is the RPI can be in the middle of polling, and the machine chooses that moment to activate update checking or filesystem cleanup, now on a RPI4 it’s so fast who cares, but the arduino is deterministic (i.e. every time through the loop is identical) which is why a microcontroller is better in many ways than a general purpose computer. If you need faster deterministic control, go to a faster “arduino” (such as an Adafruit feather M4, which is powered by an ARM as well and is super fast, and can do hardware floating point math if you need that)

Since that is almost 10x faster (and not exactly expensive). Also remember on the arduino-type SBCs you are running compiled C++ so basically machine language, while many people use python on the RPI which is interpreted and slow as hell. I mean sure you can write Java or C++ on the RPI as well, but programming the GPIO in C++ on a PI is way more complicated. and if you use any floating point calculation the difference is night and day between the Arduino Uno and the Feather M4 (probably close to 100x in my testing)


Yeah that’s why I suggested the ESP family too, they’re very inexpensive and are orders of magnitude faster than arduino at floating point math (not that that’s relevant here since it’s a hall effect sensor and a train, cmonn).

Here’s a geeky deep dive:

Oh and ESPs are bluetooth and wifi enabled too, fun!

1 Like

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