Which Arduino or Microcontroller to Make a Robot?

New to Arduino looking for guidance before buying. I am a self taught c++ programmer, now i am looking to start building new things using micro controllers.

A friend is building the mechanical part of the robot it should move using 4 to 6 wheels and it should be able to move 2 mechanical arms to pick up or do other things. I want to put simple sensors just to test new things and learn. Later on maybe add a game controller to move and manipulate the robot via wifi. I want to learn to program in arduino ide too so dont mind my c++ background.

The questions is, which board i should use? One microcontroler is better to use or two different microcontrollers or two arduinos? Or maybe should i i use raspberry pi.

This is the first Arduino (compatible) board I bought...

https://www.pjrc.com/store/teensy_pins.html

It was a great choice.

However, given your goals there are far better choices. A Raspberry Pi, for example, provides a very easy path to WiFi networking for a mere $5.

the Arduino DUE is faster than the others and has plenty of input/outputs.

Pretty much any Arduino can do things like turning on/off motors, reading sensors, etc. The main difference is going to be the number of Input/Output pins.
For example, on an UNO, you can read 6 analog sensors, and you can control the speed of 6 motors (using PWM). If you want to use stepper motors, you’ll need 4 pins per motor, and if you want to control DC motors in two directions, you need at least two pins per motor. Add some LEDs, some sensors, WiFi … and you’ve used up all pins of the UNO pretty quickly.
You could use port expanders, multiplexers or shift registers to get more I/O pins, but it’s much easier to use the Arduino’s own pins (for writing code and for wiring).

The UNO has 14 digital pins (that can output either 0V or 5V, or read the binary state of the pin (either low or high)) of which 6 can be used as PWM. You have to keep in mind that pins 0 & 1 are used for programming and debugging, so these are pretty much useless for other things.
It also has 6 analog + digital pins. These can do the same things as normal digital pins, but they can read the analog voltage present on the pin as well.

If you need more I/O, you can choose between an Arduino Due, Arduino Mega or a Teensy 3.2.
They have much more I/O pins, more memory, and also other features like native USB support (Teensy + Due).
Teensy and Due are 32-bit microcontrollers (ARM, ARM/SAM) that run at 96 and 84 MHz respectively, whereas the Mega is 8-bit (AVR) and runs at only 16 MHz.
The Mega is a 5V board, the Teensy runs at 3.3V but has 5V tolerant inputs, and the Due is 3.3V only.
Teensy 3.2 has 34 I/O pins in total, of which 21 are analog pins, and 12 support PWM. 24 of these are easily accessible through the standard headers. The ten other pins require soldering wires to pads on the bottom.
Due has 72 I/O pins in total, of which 12 are analog pins and 12 support PWM.
Mega has 70 I/O pins in total, 16 of which are analog pins and 15 support PWM.

I like the Teensy 3.2 because it has more than enough I/O for most projects, but not as much as the Due or Mega. Its form factor is much more compact as well, and it fits on a breadboard. It’s a very capable processor, and much faster than a Mega or an UNO. It also has enough memory to drive small displays etc.

A Raspberry Pi is a completely different piece of technology, it’s an actual computer that runs an operating system. It has many times the processing power and memory of an Arduino, and the process of writing code for it is completely different.

Pieter

If you want WiFi access you may look into the ESP32 as well, the big brother of the popular ESP8266. It comes with 28 I/O pins, so not that many as the Mega or Due. Software support wise the ESP32 is not mature yet, but the specs are quite unbelievable for its price.

I would not recommend the ESP32 at all for a beginner. The Arduino core is not mature enough, and using the ESP-IDF requires extensive RTOS knowledge.
The ESP32 learning curve is many times steeper than Arduino's.

I'd start by getting an Arduino or Teensy board, and add WiFi later by adding an ESP8266 WiFi SoC as coprocessor.

Pieter

Thanks for all the great replies. After a research i did prior reading these replies i was thinking of the Due or the 2560.

@PieterP thanks for the quick overview, i knew the basics but your recommendations are great.

I did my small research lets say i am kinda looking for the best option for what i want to accomplish. So basically for what i want and I before start learning python or arduino codding... Which would be better? The raspberry pi or the arduino. If Arduiono... A 2560 would be enough? Why people use multiple arduinos? just for the pins?

randomgirl98:
Why people use multiple arduinos? just for the pins?

Many reasons. Sometimes to have more pins, but also more memory, more timers ...
If you have a large project, like a robot, it might make sense to have one Arduino handling all movement and sensing, and a second Arduino that controls the OLED display in the eyes and the speech module, for example, because combining the code for these two things would be cumbersome or because it would use to much resources for a single Arduino (large RAM frame buffers for the display, for example).

On the other hand, if you use one Arduino to drive the motors, and a second to read the sensors that determine how the robot moves, it makes a lot less sense. Sending data back and forth between the two Arduinos all the time is pretty cumbersome and will make writing clean code a lot harder.

In my last project (a self-driving wheelchair), we used an Arduino UNO for the main control: driving DC and stepper motors, light effects, reading line following sensors, reading light sensors, tachometers, IR remote input etc.
An ESP8266 was used as WiFi co-processor. It hosted a web interface to read data about the wheelchair, read the battery voltage, allowed control using an Android app, and displayed some information on an OLED display.

We wrote a simple binary protocol to communicate between the two processors over UART.

For driving the LEDs, we used shift registers on the SPI bus to get more outputs.

I've never actually used my RPi for Arduino-like stuff, so I can't help you with that. For controlling motors and reading sensors, a microcontroller is well-suited. If you need to perform complex operations or data analysis, a RPi might be desirable.

Pieter

The best Arduino for a beginner is an Uno because almost all the programs, libraries and add-ons will work with it.

If the Uno hasn't got enough I/O pins or enough serial ports then the Mega would be the next best IMHO.

If you are not already familiar with web programming and WiFi and if you just want to make a remote control for your robot I reckon that a pair of nRF24L01+ transceivers would be easier to implement. They are cheap and very effective.

It is also easy to use an ESP8266 to add WiFi functionality to an Arduino board. Using it that way does not require knowledge of programming an ESP8266.

...R
Simple nRF24L01+ Tutorial

Planning and Implementing a Program
Python - Arduino demo

Wow thanks @robin2 and @pieterp

So from what i read and your replies. I should get a mega. Is $10 and it will cover all my pins needs for the robot i mentioned. My doupt now considering i need a mega or maybe a due and i need wifi which board i should get or i need to adapt a wifi exter via usb?

Also, if someone used raspberry pi and arduino an opinion would be great.

The Due can be a real pain in the neck (trust me, I own one). I'd go with a Mega.

As for WiFi, try the ESP8266 module.

Thanks power breaker ill go with mega 2560 and check out the esp module. Thanks for all the help.

I recommend getting a WeMos D1 mini ESP8266 dev board. It has exactly the same chip as ESP-01 modules, but it has more memory, gives you access to all I/O pins, and has a USB interface for easy programming and debugging.

Pieter

In contrast to @PieterP I would suggest you get the simplest ESP8266 and just use it as an add-on WiFi module. It is possible to program ESP8266 devices with an Arduino but they would be a big challenge for a beginner.

I would also suggest that you start developing your program without any WiFi (or any other form of wireless communication) - just use the USB connection to your PC until you have everything else working.

...R

Robin2:
In contrast to @PieterP I would suggest you get the simplest ESP8266 and just use it as an add-on WiFi module. It is possible to program ESP8266 devices with an Arduino but they would be a big challenge for a beginner.

I would also suggest that you start developing your program without any WiFi (or any other form of wireless communication) - just use the USB connection to your PC until you have everything else working.

I agree that you should first write your code without any WiFi stuff.

However, there is no good argument for using an ESP-01 over a WeMos dev board (apart from the size maybe). I would argue that a dev board is much easier to use, especially for beginners. It has all supporting hardware on board, a decent voltage regulator, reset circuitry, decent decoupling … You need to add all that yourself when using an ESP-01, a dev board is just Plug ‘N’ Play.

An ESP-01 is really only useful as a Serial<->WiFi bridge, because it breaks out only 4 of the 11 I/O pins. A dev board can be used as a Serial<->WiFi bridge just as easily, and the principle is exactly the same, but it also allows you to program the ESP8266 if you want to.
And there are a lot of good reasons to do this: The ESP8266 has a lot of memory and processing power, so you can use it for heavy request parsing, running a display that requires a large frame buffer, etc. It also simplifies the Arduino program, because it won’t have to worry about anything WiFi or TCP/IP related.

I’d be interested to know why you think “the simplest ESP8266” would be easier to use?

Personally, I find normal, readable Arduino code (e.g. WiFi.begin("ssid", "password");) much more beginner-friendly than cryptic AT-commands (Serial.println("AT+CWJAP=\"ssid\",\"password\"");). And we’re not even talking about having to parse the output of each AT command to check if it was successful …

Pieter

Just be aware that many libraries won't work on an ESP for mostly silly reasons like that the F() macro won't work (or that was my experience anyway). It is also a PITA to operate an ESP via AT commands. But the same could be said of any peripheral that you attempt to use without any support library. I did find one, but I can't vouch for its quality yet.

Agreed.
There are indeed some libraries that don’t support the ESP8266, but it’s gotten a lot better recently. Most “common” devices are supported (OLED displays, digital sensors, rotary encoders, those kinds of things … ) and many Arduino libraries by companies like Adafruit have added ESP8266 support as well.

But you’re not likely to need any specialized libraries if you’re just using the ESP as a WiFi co-processor.

Writing basic Arduino code, like driving LEDs, reading buttons, switching relays, motors, reading I²C or OneWire sensors is exactly the same as on an Arduino UNO. And if you have an ESP8266 dev board, you can just plug it in and hit upload.

In general, I think that programming the ESP directly is preferred, although there are some scenario’s where AT commands are better suited for the job.
My point here is that it’s better to get a board that can do both.
The price difference is negligible (I paid $3.30 for a WeMos D1 mini clone, and $2.50 for an ESP-01) and as far as I can see, there are no other factors that make the ESP-01 a better choice for this particular project.

Pieter

Well, I investigated the AT command option. All but one of the resources I found stopped dead in the tracks, after the point where an access point is found and connected to. Then they change the subject or go silent. There was nothing to help with actually using UTP or TCP. Often, a discussion of those came after a sneaky switch to ESP native mode. So I did actually find a sketch that almost(!) did the SNTP function that I wanted. That was after spending an entire day trying to find the correct AT firmware to reflash after giving up once in frustration and burning sketches direct to the ESP. That was because the new firmware doesn't support the 4M flash on my device. So I had to treasure hunt offsite because Espressif doesn't provide it anymore. Stuff like that turns me off. I massaged the hacky sketch into something that works, but it is blocking code. Not good for the kind of stuff I need to do with my other peripherals.

I am hacing trouble understanding what the esp is. I need wifi for the remote controller and connection with the robot at a distance

The EPS8266 is a very capable microprocessor with built-in WiFi, often used as WiFi interface for an Arduino (which in a way is sad as then you use the most capable of the two for the least work). The WiFi part can be used as access point and client, and it has a web server built in as well. The ESP does suffer from a serious lack of proper documentation (and even that may be an understatement).

As said most Arduino libraries work out of the box - I have not yet run into problems here, and am using the F() macro extensively myself, especially for all those html strings I use for building up pages.

Main limitation of the ESP vs Arduino is in number of available pins (11 digital + 1 analog), and precision timing. On the other hand the ESP comes with 1 MB of Flash and runs at 80 MHz.

if you need WiFi and don't need all those pins, it's the perfect choice for microprocessor.