Which platform?

I see the following options for controlling robots with Python:

  1. Try to run Python within the Lego EV3 intelligent brick which is a Linux-based computer that is certainly capable of running Python.
  2. Run Python on the Raspberry Pi and connect the Pi up to Lego EV3 motors and sensors.
  3. Make a robot that uses Raspberry Pi but no Lego parts.
  4. Make a robot that uses neither the Pi nor any Lego parts.

Every one of these options has already been tried so let's see what has been done.

1. Try to run Python within the Lego EV3 intelligent brick which is a Linux-based computer that is certainly capable of running Python.

It's possible to run Python on the EV3 intelligent brick but it's for experts only. First you would need to install software called ev3dev onto a micro-SD card and then boot the brick with the SD card in place. The brick's firmware is not modified by the presence of the card, so when the card is removed the brick returns to its normal behaviour. Once the brick has been booted from the ev3dev card it is necessary to install software called python-ev3 and begin an SSH session. If you are truly an expert (I'm not) then you can find out more about ev3dev HERE and HERE. Read about Python-ev3 HERE. See also HERE. EV3dev promises to be the neatest way to use Python with Lego so I will see whether I can get it going - stay tuned.

2. Run Python on the Raspberry Pi and connect the Pi up to Lego EV3 motors and sensors.

The Raspberry Pi is the famous credit card sized computer that costs about £26 and which is described HERE. Platforms that allow Lego parts to be controlled by a Raspberry Pi include PiStorms and BrickPi.

PiStorms by Mindsensors.com seems interesting and affordable (from $110 without the Pi) but I only became aware of its existence in 2016 and I have not yet had time to research it much. My first impression is that it is probably much more powerful and better value for money than BrickPi.

BrickPi is designed to allow the Raspberry Pi to be connected up to Lego EV3 motors and sensors. The BrickPi plugs onto the Raspberry Pi as a 'shield' and is powered by a 9V battery or set of batteries. The BrickPi can be connected up to 4 NXT or EV3 motors and 5 NXT sensors (it's not clear whether EV3 sensors will work). A custom acrylic case has holes that allow the BrickPi to be physically connected easily to the Lego parts. An 'advanced' version the BrickPi is available that uses superior power management to double the life of the batteries. In addition to Python, the Raspberry Pi can also use Scratch or C to control the Lego pieces through the BrickPi. Great, but there is a problem... even though the stated aim of the BrickPi team is to make the BrickPi available for as little as $35 (€26) it currently sells (with the Advanced Power Option and case) for $80 (€60) from Dexter Industries or from ModMyPi.com. Once you add in the cost of a Raspberry Pi B+ board (the current model, £26 (€32) from Amazon.co.uk) this starts to like like an expensive option...

See also these videos and links:

Introducing BrickPi: LEGO bricks with a Raspberry Pi brain

3. Make a robot that uses Raspberry Pi but no Lego parts.

The famously affordable Raspberry Pi computer on a chip has a number of General Purpose Input/Output (GPIO) pins which can be used to control a robot, for example. However the Pi cannot drive motors directly because it cannot supply enough current or voltage. To get over this problem the Pi can be connected to a motor controller board which can switch on and off the required large currents. There are three kinds of motor that can be used: a DC motor is the kind used on most motorised toys, servo motors (like those in the Lego EV3 system) give more precise control and stepper motors are also very precise but work in a different way. Most robot kits (except for the EV3) use DC motors. Encoders can be used with DC motors to give feedback about the motor's movements to allow for improved precision.

Note that the Laika add-on board for the Pi should soon have available as an add-on module the Laika Pioneer which will supply up to 12 amps to motors - plenty of current for large motors. Check out also the Gertbot motor controller board and the many motor controller boards offered by Adafruit.

See also:

Raspberry Pi Robotics is a two part YouTube course. In the second part the Pi uses Python to control (through a L298N H-bridge motor controller) the very affordable (£15 + 2x £5 for the motors) Pimoroni/Pololu Zumo robot chassis.

However if you only use motors on your robot you have missed the point - using sensors is at least as important as using motors. The Laika board (about £35 or 40 Euros) has the potential to drive two motors but also has 2x analogue and 4x digital inputs (to connect sensors, switches and other input devices) and 7x digital outputs - to control LEDs, motors, sounders and other output devices. The GrovePi board allows the Pi to make use of more than 100 different kinds of Grove brand sensors that were designed for use with the Ardunio microcontroller board.

Raspberry Pi with Python for Robotics, a 13 part (?) series

Raspberry Pi - GPIO & Python These 9 YouTube videos give a good introduction to Python and using the Pi's General Purpose Input/Output (GPIO) pins but does not discuss motors or robots. You'll need to buy a Pi and an electronics kit (£12).

Building robots with Raspberry Pi and Python. This instructable shows how to make a relatively large, not so cheap robot.

There are many, many robot kits that work with the Raspberry Pi. This one is particularly nice because its camera allows you to see in real time on your computer or phone what your robot sees (this is called 'first person view' or FPV).

4. Make a robot that uses neither the Pi nor any Lego parts.

When you program a robot you want to use (and thus learn) a serious, powerful programming language. I consider the graphical Lego EV3 programming environment to be reasonably powerful but because it is graphical and has no use outside Lego it's not going to help your CV much. As previously stated, any robot that is controlled by Python programming IS going to teach you a powerful programming language with real value for your CV. To make a robot that uses no Lego parts and no Pi, a possible route would be to use the Arduino microcontroller board but the Arduino is very limited compared to EV3 or Python on the Pi so this is not ideal. There are many other systems that could allow for Python programming but to my mind there isn't one that stands out in terms of popularity.

Conclusion:

The first option will probably be the neatest once ev3dev is more mature and easier to install. The second option, BrickPi, is very good but a bit expensive since you might need to buy a Raspberry Pi computer and a BrickPi board. BrickPi lets you use the Lego sensors and using sensors is an essential part of serious robotics. Making robots that use only simple motors and touch sensors would be too limiting. I doubt that BrickPi could be used to build a big robot however, since it is designed to work with the Lego motors, so using Raspberry Pi with non-Lego motors might be the best approach for that.

Addendum:

A more modest way to get some practice with Python while doing Lego EV3 robotics would be to use Python (on a Raspberry Pi) to exchange bluetooth messages with the Lego EV3 robot. That is what is discussed on this page.

Other links:

Python on studentrobotics.org. Student Robotics is an annual UK competition that challenges teams of 16-18 year-olds to build fully autonomous robots.