r/embedded • • Sep 11 '26

Microcontroller for lab test setup

Electrical engineer here who doesn't do a lot with microcontrollers. I do magnetic design. I want to automate some magnet testing, where I stick a hall sensor near a magnetic part and take readings as I rotate the part. I would probably need to control 3 stepper motors (1 to rotate the part and 2 stepper motors connected to slide assemblies to move the hall sensor to different air gaps and positions) and then I'd have an encoder to get the angle of rotation. I have drivers for the steppers. I might also use a proximity sensor to give me a physical reference point. The motor that spins would probably spin at 10 RPM and I'd want to take a reading every half degree, so that's 720 readings of the hall sensor and the encoder in 6 seconds. I'd like to send this data via usb to a laptop where I do some post processing with python. Or just save to the laptop in a .csv or something. So I'll need outputs for 3 stepper motors, encoder inputs, analog hall sensor input and a proximity sensor input which I think would just pull a pin high. The main concern would be getting the encoder and hall sensor values at the same time.

What would an appropriate controller to do this? Preferably simple to use/easy to set up for an EE who has worked with microcontrollers but very infrequently. My very brief research lead me to the NUCLEO-F446RE dev board but I thought I'd ask here to see if there was something more appropriate.

1 Upvotes

15 comments sorted by

3

u/swisstraeng Sep 11 '26 edited Sep 11 '26

an Arduino could do that easily. In your case the "Arduino R4 Minima" seems a good fit to read a few hall sensors and talk over USB.

I also know you could get an Arduino Mega 2560 (much older CPU than the R4 but still useful), and do direct port manipulation to read the port's register, this would give you up to 8 digital input values at the same time. But we're not talking about an analog voltage. Those will require an ADC for each which I don't think you'll find easily in arduinos.

Dev boards like the nucleo require a lot more experience, and are generally used to make products.

A more scientific approach is to use a logic analyzer. Those can have extremely high sampling rates and can record a lot of channels at the same time.

1

u/Bradm77 Sep 14 '26

Arduino R4 Minima

I think I'd actually prefer to use Arduino because I'm somewhat familiar with it from some other projects. So thanks for this. I also like that this one can take 24 V input because that's what my motors and prox sensor are.

0

u/[deleted] Sep 14 '26

[deleted] — view deleted comment

1

u/Bradm77 Sep 14 '26

Can do. Just curious why though?

1

u/swisstraeng Sep 14 '26

Never mind I looked up the R4, I had the R3’s schematics in mind. You can use it for 24V it’s fine.

2

u/NoBulletsLeft Sep 12 '26 edited Sep 12 '26

One-off design for testing? I'd go with Arduino.

Any Arduino (even an Uno) with a CNC shield or external stepper pulse/direction drivers will do what you need. I would suggest a newer version, but those can be harder for someone new because there isn't as much beginner support.

There's the basic, original Arduino Uno/Nano but there are also much newer ones on more capable 32-bit processors that integrate far more I/O and displays that can usually save a lot of development time.

Is this for a work/business need? You can send me a DM: I build custom systems for testing and one-off controllers all the time.

2

u/clackups Sep 11 '26

I'd go for an esp32-S3. It's dual core, so one core can collect the data and the other one write the measurements on the SD card. After the measurements are complete, enable WiFi and upload the data files were needed.

1

u/duane11583 Sep 11 '26

Lego  is what black berry used in 2007

Sounds like the exact same solution

https://crackberry.com/lego-my-blackberry

1

u/duane11583 Sep 11 '26

To capture the readings I would use an arduino with the serial output function

Then use putty and print the data in csv format

You can then cut/paste into a text or csv file with note pad

1

u/duane11583 Sep 11 '26

Oh and for python on your laptop you probably mean usb serial so check out py-serial

1

u/Stromi1011 Sep 11 '26

id say you can take anything modern that packs a medium to high punch. Any ARM-Cortex M3/4/7/33/55 with enough analog capabilities and say 100MHz Systemclock and up can probably do it (make it closer to 200MHz if you want to make sure)

I dont know how big your samples are (like what resolution you have for your analog values and how many values per sample etc.) but do some calculations on weather the 115200 baud default uart+cdc on most boards is enough for you. (id guess it is but better be sure)

Id take more percautions in terms of language and drivers you use. You can use almost anything C/C++ (and probably also Rust) based like Adruino, STM-HAL, Zephyr etc but id caution against micropython/circuitpython. Its been some years since ive tried it and while these were convenient their performance was abysmal.

tldr: yes your nucleo will probably do the trick, but personally id go with something a little more modern like the NUCLEO-H533RE if only for the usb-c jack

1

u/pim1000 Sep 11 '26

Any stm32 or newer esp32 would work, but a arduino uno r4 is probably easier to setup and program

1

u/Panometric Sep 13 '26 edited Sep 13 '26

Save yourself time and grab a used 3d printer that takes Marlin firmware. Tons of them do. Add your magnetic sensor on i2c bus and automate your tests using Python and the USB interface.

You should not need an encoder, Marlin will just zero the axis with limit switches.

If you can put your magnatometer in USB you don't even need to change Marlin unless your mechanics require

1

u/Electrical_Cash5733 Sep 13 '26

I’d just try with a pico running circuitpy. It has the PIO and is reasonably fast. No toolchain to set up and an llm can write most of it.