What Microcontroller should i use  - Page 1
Forum section: electronics / beginners

author: ElectroNex
author_rank: Newbie
timestamp: February 18, 2023, 10:16:19 am
content: hi im building a project which is quite simple and needs to be able to run 4 stepper motors 2 servos and a screeni would love to build a pcb for my project for obvious reasons so im looking for micro controller ic i could use

author: BadeBhaiya
author_rank: Regular Contributor
timestamp: February 18, 2023, 10:49:17 am
content: Try to list out the hardware features you need from the microcontroller. How many GPIOs do you need? Do you need hardware SPI/I2C busses or can you bit-bang them?For example if you need 4 stepper motors you would lets say need 4 GPIOs per motor, which comes to 4x4=16, 2 servo motors would need 2 additional GPIO lines with PWM capabilities. A screen would run off of an SPI bus and would need 4-5 GPIO lines. You may also need a few hardware timers to control stepper motors and stuff. Also try to estimate how much flash and RAM you can get away with.In your case for example, the least amount of GPIO pins you can have is 16+2+5 = 23 GPIOs. You would also need hardware timers, SPI transreceiver, and PWM.This is just a very simple example and you can of course do with less or more resources. Maybe you can share the 4 control lines for all stepper motors and just have 4 additional enable lines? 23 GPIOs -> 15 GPIOs. Maybe you don't need hardware PWM and can do it in softwareAnother important thing is clock speed. Do some very rough calculations on how long a particular action takes. Can you manage the system on a 1MHz clock? 8MHz? 64MHz? 300MHz?Lastly, a few very general tipsPrefer whatever you're comfortable with. If its an atmega328a with Arduino, go ahead!Try to avoid through hole parts (take up too much space, not enough pins)If you're building a prototype or first revision, go with a slightly over-specced microcontroller than what you actually think you need. You can always use a less expensive part in the second revision.

author: pcprogrammer
author_rank: Super Contributor
timestamp: February 18, 2023, 12:18:06 pm
content: Why not experiment first with some store bought modules.There are stepper motor boards for arduino compatible controllers that offer all the needed functionality. There are so many projects about this to be found on the internet.For examplehttps://howtomechatronics.com/tutorials/arduino/how-to-control-stepper-motor-with-a4988-driver-and-arduino/If you need more processing power then an AVR based arduino, you can try a bluepill, or raspberry pico.Controlling a servo is very simple. For this you can also find so many projects on the internet.This way you can construct and test your system first and then draw a schematic based on it and design a PCB based on the schematic.

author: BlackICE
author_rank: Regular Contributor
timestamp: February 18, 2023, 12:23:38 pm
content: I'm old school and hate to solder SMDs so prefer through hole. I use small pre-made boards using 328p or ESP32s and solder them to perf boards. With the current pricing ESP32s boards cost less or about the same as 328p board. So unless you want low power consumption why not use an ESP32. ESP32 supports FreeRTOS which is great if you are fluent in RTOS programming.

author: Ian.M
author_rank: Super Contributor
timestamp: February 18, 2023, 01:16:29 pm
content: Four steppers, two servos and a screen sounds like a good fit for an off-the-shelf 3D printer controller board, reprogrammed with your own firmware.

author: Infraviolet
author_rank: Super Contributor
timestamp: February 18, 2023, 06:25:12 pm
content: Right now, for part availabiliy reasons, I'd strongly consider the Raspberry Pi Pico.

author: brucehoult
author_rank: Super Contributor
timestamp: February 18, 2023, 10:14:36 pm
content: Quote from: Ian.M on February 18, 2023, 01:16:29 pmTen years ago those usually used an ATMega2560, which has lots of I/Os and despite being only 8 bit and 16 MHz and 8 KB RAM seemed to get the job done just fine. I haven't looked at them recently, but I'd guess they probably use something Arm now.