Raspberry Pi, Arduino and Robotics
Raspberry Pi, Arduino and Robotics
Author
Discussion

Northernboy

Original Poster:

12,642 posts

287 months

Thursday 11th November 2021
quotequote all
I decided to start learning Python, then decided I should do it on a Raspberry Pi, then decided that I should do something interesting rather than lighting up an LED, so have asked my wife to get me the Pi and a robot chassis for Christmas.

Having done that, I now need to do what I should have done first, and worked out what these things are, and what I need to make them work…

The plan / hope is to try (and fail, but that doesn’t really matter) to have a robot that will wander round, map the house, maybe pick things up and put them in a box, go and see the children in bed when it gets light, and just use this as a way to learn a new language and some new skills.

The thing is, I’m starting from nowhere, so could do with some resources. I got impatient and ordered another robot chassis, with an arduino-based controller board. I’ve no idea at all if it will run the same code as my Pi.

I don’t know what connectors I use, if I need to be soldering things, or whether the Pi Zero I bought can also control a robot.

Does anyone know where to start?

An example of how little I know; there are two arduino robot controllers on the site I was browsing, does anyone know how I could have worked out the difference between what these two do?

https://thepihut.com/products/romeo-ble-arduino-ro...

https://thepihut.com/products/romeo-ble-mini-small...

jesusbuiltmycar

5,135 posts

284 months

Friday 12th November 2021
quotequote all
Sounds like a very ambitious project...

I have recently started playing with the Arduino as a way to teach my 12 year old son about electronics - mainly as a way to get him away from playing computer games.

The Pi & Arduino will not run the same code, they are very different devices. The Pi is a full blown microprocessor which runs a Linux OS - i.e. it is a fully usable computer, whereas the Arduino is an 8bit microcontroller which is great for circuit prototyping. See: https://www.electronicshub.org/raspberry-pi-vs-ard...

If you are looking at learning to program Python a Pi is the way to go.

If you are looking at learning some electronics then choose the Arduinois fantastic for developing small electronics projects and comes with a number of libraries making it very easy to interact with sensors and control servos (ideal for simple Robotics) - if this sort of thing existed in the early 90s when I did electronics at uni I might have pursued a different career path!

If you decide to start playing with Arduino's there are a lot of YouTube tutorials and other web resources. It will also be worth getting a number of breadboards, a meter jumper wires etc for you circuits. You should also avoid any of the cheaper Arduinos (e.g. the Nano/Pico) as they can be difficult to 'upload' programs to directly as they often use cheaper components which do not work out of the box (e.g. CH340 usb controller in place of an FTDI chip).






Northernboy

Original Poster:

12,642 posts

287 months

Friday 12th November 2021
quotequote all
jesusbuiltmycar said:
Sounds like a very ambitious project...

I have recently started playing with the Arduino as a way to teach my 12 year old son about electronics - mainly as a way to get him away from playing computer games.

The Pi & Arduino will not run the same code, they are very different devices. The Pi is a full blown microprocessor which runs a Linux OS - i.e. it is a fully usable computer, whereas the Arduino is an 8bit microcontroller which is great for circuit prototyping. See: https://www.electronicshub.org/raspberry-pi-vs-ard...

If you are looking at learning to program Python a Pi is the way to go.

If you are looking at learning some electronics then choose the Arduinois fantastic for developing small electronics projects and comes with a number of libraries making it very easy to interact with sensors and control servos (ideal for simple Robotics) - if this sort of thing existed in the early 90s when I did electronics at uni I might have pursued a different career path!

If you decide to start playing with Arduino's there are a lot of YouTube tutorials and other web resources. It will also be worth getting a number of breadboards, a meter jumper wires etc for you circuits. You should also avoid any of the cheaper Arduinos (e.g. the Nano/Pico) as they can be difficult to 'upload' programs to directly as they often use cheaper components which do not work out of the box (e.g. CH340 usb controller in place of an FTDI chip).
Thanks, it’s the programming side that interests me more; I did quite a lot of electronics at university, so hopefully have a decent level of knowledge there.

And yes, the projects are definitely ambitious; there will be a lot of steps along the way which will hopefully be enjoyable too.

I’ve bought a Pi Zero, so will want to see what I can get that to do too.

Even further down the line I’d like to see what I can equip a cheap RC plane to do; if I can get it to circle or fly a route under its own control.

Edited to add, the last electronic project I worked on was the CMS detector at CERN, so although I’ve been away for a while, I’m hopefully capable, with the right effort, of coming up with something interesting.

Edited by Northernboy on Friday 12th November 11:48

eharding

14,648 posts

314 months

Friday 12th November 2021
quotequote all
You might take a look at Micro Python / Circuit Python - traditionally the sort of microcontrollers supported by the Arduino platform were CPU and memory limited, and the the sort of C/C++ approach used in Arduino was the best compromise between usability and performance, but in recent years there have been more and more powerful microcontrollers - often using ARM cores - which allow the used of higher level languages whilst remaining 'close' to the hardware, Micro Python / CIrcuit Python being examples (the latter being a fork of the former)

A Raspberry Pi is more amenable than a full-blown PC to interacting with hardware modules via simple digital pins, analogue/digital conversion or bus interfaces such as I2C or SPI, and you can do so in Python, but you still have an operating system running which can in some circumstances be a drawback, and some effort is required to make a Pi robust to abrupt power removal, whereas a microcontroller will be more focused on interaction with the hardware (particularly if timing is important) and generally more resilient to simply being turned off.

The Raspberry Pi foundation recently released the Pico, a very (£3.60) affordable ARM-based microcontroller which is compatible with Micro/Circuit Python, although there are a plethora of other boards available which may have additional specific hardware included on-board, but at the cost I'd say definitely getting hold of a Pico as well - depending on your application, it might be appropriate to have a full-blown Pi running you high-level logic, and coupling it with a Pico to do the low-level hardware interaction.

I know the classic 'use a pin to light an LED' project doesn't sound that exciting in itself, but it's worth doing it as an introductory exercise - in my experience, you'll soon be wanting to interact with sensor or controller modules, and these will generally be accessible via the I2C or SPI busses - conceptually each device on the bus (connected to a number of GPIO pins on the controller) has an individual address, and each type of device will have a number of registers which can be read or written to - environments such as Arduino or Micro/Circuit Python which make interacting with these busses (and various other flavours) fairly straightforward, with the caveat that you're now dealing with the vagaries of things like pull-up resistors on the bus or noise on the power lines, so there's a good chance that at some stage you'll be debugging the hardware as much as the software, and you find yourself hooking an oscilloscope up and observing that things aren't as entirely digital as you'd like, but that's part of the challenge.

The autonomous robot projects you have in mind are indeed ambitious (and there are any number of companies trying the same thing with varying degrees of success) but there's no harm trying!


rfisher

5,064 posts

313 months

Friday 12th November 2021
quotequote all
Lots of hackers have (literally) picked the brains of robot mowers (Bosch and Worx specifically, probably a few others out there as well by now).

Might be a good place to start looking for established Python scripts.

Northernboy

Original Poster:

12,642 posts

287 months

Friday 12th November 2021
quotequote all
Thanks to both of you.

I’m (hopefully) getting a couple of Picos too, so will see what I can do with those.