Author Topic: What Microcontroller should i use  (Read 900 times)

0 Members and 1 Guest are viewing this topic.

Offline ElectroNexTopic starter

  • Newbie
  • Posts: 2
  • Country: us
What Microcontroller should i use
« on: February 18, 2023, 10:16:19 am »
hi im building a project which is quite simple and needs to be able to run 4 stepper motors 2 servos and a screen
i would love to build a pcb for my project for obvious reasons so im looking for micro controller ic i could use



[/size]
[/color][/font]
 

Offline BadeBhaiya

  • Contributor
  • Posts: 49
  • Country: in
Re: What Microcontroller should i use
« Reply #1 on: February 18, 2023, 10:49:17 am »
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 software

Another 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 tips
  • Prefer 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.
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4388
  • Country: nl
Re: What Microcontroller should i use
« Reply #2 on: February 18, 2023, 12:18:06 pm »
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 example https://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.

Offline BlackICE

  • Regular Contributor
  • *
  • Posts: 225
  • Country: us
Re: What Microcontroller should i use
« Reply #3 on: February 18, 2023, 12:23:38 pm »
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.
« Last Edit: February 18, 2023, 01:21:05 pm by BlackICE »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13130
Re: What Microcontroller should i use
« Reply #4 on: February 18, 2023, 01:16:29 pm »
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.
 

Offline Infraviolet

  • Super Contributor
  • ***
  • Posts: 1161
  • Country: gb
Re: What Microcontroller should i use
« Reply #5 on: February 18, 2023, 06:25:12 pm »
Right now, for part availabiliy reasons, I'd strongly consider the Raspberry Pi Pico.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4531
  • Country: nz
Re: What Microcontroller should i use
« Reply #6 on: February 18, 2023, 10:14:36 pm »
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.

Ten 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf