1
$\begingroup$

Is it possible to drive the whole mobile differential drive robot with single arduino? Sonar sensor, servo motor, two encoders, two motors, imu, etc. I mean would it give a reasonable performance or very slow or impossible? If we use two arduinos would it be much better?

For example, two motor+encoder, imu, one servo motor for sonar sensor and one sonar sensor, + bluetooth communication with pc. The task is for example building map of the room, and kinematic control for tracking some trajectory. I mean it should do PID control for motors, kinematic control for robot, sensor fusion for imu+encoders, communicate with PC (this is to do some computationally intensive tasks such as trajectory planning or to store maybe the complete map in pc etc.).

$\endgroup$
  • $\begingroup$ I think you maybe need to share more information about your expectations. "imu, etc" is very open-ended. What is the purpose of this robot, what task does it need to fulfill. How do you define reasonable performance? How do you define very slow? $\endgroup$ – Morten Nissov Feb 5 at 12:18
  • $\begingroup$ In my mind at least, a mobile differential drive robot can vary from 2 wheels, a castor, and basic sensors (encoders/IR) up to LIDARs and vision. The former is likely very possible with an arduino whereas the latter is probably impossible. $\endgroup$ – Morten Nissov Feb 5 at 12:20
  • $\begingroup$ Thank you for comments, I added some more info. $\endgroup$ – Pasha Feb 5 at 19:18
2
$\begingroup$

It depends what Arduino you are going to use. I don't think that you can use Arduino Nano/Micro for this because you will not have enough I/O and memory. You can use Arduino Mega (maybe UNO) but you will have to utilize hardware interrupts for all the communication and measurement stuff.

I have done a similar robot a few years ago utilizing interrupts only on Arduino MEGA 2560 runnig at 500 Hz (the computation for all PID regulators, IMU complementary filter and low pass filters for signals was made every 2ms). Using interrupts you can drive up to 10x servo motors using just one timer, measure analog values by ADC, communicate using I2C/SPI/UART at almost no cost because all the work will be done by dedicated hardware and not by the CPU. This is why it is called a micro-controller and not a micro-processor. You will utilize the CPU just to process the results from the interrupts and compute values for PID regulators, filters, etc. The sad thing is that a lot of libraries are not using interrupt because it's easier that way and therefore waste a lot of computation work just waiting for the result.

Nowadays, I would use a little bit more powerfull Arduino or another board that can run some kind of RTOS e.g. FreeRTOS. For this project is the Arduino Mega 2560 the absolute minimal requirement.

So the answer is simple: Yes, you can use Arduino but the less powerfull board you utilize the more sophisticated solution you will have to make.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Does using arduino itself for speed control degrade the performance? Should we use separate speed controller for each motor rather? Also for sonar sensor. $\endgroup$ – Pasha Feb 6 at 10:08
  • $\begingroup$ The speed is controlled using PWM, what is another peripheral of micro-controller. Changing the speed of a motor is just writing a value into particular register. So there is no performance issue. The only performance drawback is that you need to compute the value for PWM. $\endgroup$ – Lubo Feb 6 at 17:00
  • $\begingroup$ Sonar sensor can be connected via I2C. All you need to do is to read it using interrupts so you won't waste performance just waiting for response from sensor. $\endgroup$ – Lubo Feb 6 at 17:09
0
$\begingroup$

I am doing this project right now but it will be more appropriate to use two Arduinos for the number of different sensors you are mentioned.

| improve this answer | |
$\endgroup$
-2
$\begingroup$

You can try a board named teensy. It is programmed in the arduino IDE but it got much higher performance.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks for your answer, but we are looking for comprehensive answers that provide some explanation and context. Very short answers cannot do this, so please edit your answer to explain why it is right, ideally with citations or personal experience. Answers that don't include explanations may be removed. $\endgroup$ – Mark Booth Feb 5 at 10:46
  • $\begingroup$ @jsotola Mark Booth isn't the op, but rather a moderator. And he's right, I'm a big fan of the teensy, but your answer doesn't really answer the question. $\endgroup$ – NomadMaker Feb 6 at 0:02
  • $\begingroup$ @NomadMaker, it is not my answer ... perhaps the answer is inadequate, but the actual questions that have been posed can be answered with a simple yes or no $\endgroup$ – jsotola Feb 6 at 0:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.