Go Down

Topic: Which Arduino or Microcontroller to Make a Robot?  (Read 1 time) previous topic - next topic

randomgirl98

Aug 27, 2017, 04:41 pm Last Edit: Aug 27, 2017, 05:27 pm by randomgirl98
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.

Coding Badly


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.


LandonW

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

 

PieterP

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

wvmarle

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.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

PieterP

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

randomgirl98

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?

PieterP

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

Robin2

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


Two or three hours spent thinking and reading documentation solves most programming problems.

randomgirl98

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.

Power_Broker

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.
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

randomgirl98

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

PieterP

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

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.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

PieterP

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

Go Up