DIY Raspberry Pi Pico Robot Controller Board for L0Cost Robots Built on Matrix or Strip Board

by tekyinblack in Circuits > Robots

222 Views, 2 Favorites, 0 Comments

DIY Raspberry Pi Pico Robot Controller Board for L0Cost Robots Built on Matrix or Strip Board

IMG_9974.JPEG

There are lots of commercially available circuit boards which accommodate a Raspberry Pi Pico development board and provide interfaces for building robots, but for the L0Cost Robot project the cost of these automatically put them out of reach.

The design was born out of competing in the PiWars 2024 competition and recognising the need for a custom design which did just what was needed. Separately described is a an add-on I2C control and display card.

This is a simple design which an enthusiast can build easily and cheaply using readily available matrix or stripboard.

Features are:

Power Switch

Very useful but I'm always amazed when commercial boards don't include one.

On board power regulator

The board can accept up to 10.8 volts, a limitation of the DRV8833 motor controllers but ok for six nicads or a pair of serial lithium batteries. If the board is being powered by a 5V supply then the regulator can be replaced by a linking blank.. Provision has been made on the board to allow a pin jumper to be used to supply either 5V or 3.3V to the lower power rail which supplies one of the I2C interfaces and the sensor connectors.

Power LED

It's big and in the middle of the board to make it obvious without being intrusive.

Start/Stop button

This makes operating the robot a lot easier than having to plug a USB in to run a program or switch on and hope! Alternatively, this button can be rewired as a reset switch.

Piezo sounder

While this could be used for giving the robot some musical accompaniment, it's primarily included to give audible feedback for a robot operator who has difficulty seeing a visual indicator, and that could be anyone in bright sunlight!

2 x DRV8833 dual H-bridges to control 4 DC motors individually

For many robots, two DC motors will be sufficient, but with more complex designs, such as using mecanum wheels, four are required. This is also the case if the robot uses a pair of stepper motors for propulsion. If only two DC motors are needed, then the second DRV8833 module isn't required, saving costs. This also frees up 4 GPIO ports which can be accessed via the sockets.

I2C interface for MPU-6050 accelerometer/gyroscope

The board has been laid out to accommodate an MPU-6050 module but also any I2C connection could be afforded. The MPU-6050 is included as an advanced robot function such that the attitude of the robot can be determined, aiding autonomous operation. The power supply to this module can be either 5V or 3.3V depending on the power jumper position.

Interface for HR-SR04 ultrasonic sensors

A specific socket interface has been included for the very useful HR-SR04 ultrasonic sensors which provide robust, if basic, distance and object sensing. The socket has dropper resistors wired to it to enable the module to be run at 5V but not exceed the 3.3V pin limit on the Pico.

Interface for additional I2C bus or WS2812B LEDs

A second I2C interface is provided on the board with a fixed 5V supply and dropper resistors fitted to reduce the voltage to the 3.3V GPIO pin limit. Instead of using I2C, this socket can instead be used for general GPIO breakout or to connect a WS2812b LED string.

Pin breakouts with power rail for servos

The pinouts on the board have been arranged to allow easy direct connection of low powered servos to the board (such as the SG90). Higher powered servos will need independent power supplies.

3V or 5V power rail

As mentioned earlier, a jumper allows power from the Pico's internal 3.3V regulator to be used in place of the boards 5V supply where required.

Pin breakout with power rail for serial comms and all spare GPIOs

The UART pins on the Pico have not been dedicated to any onboard feature to allow simple serial communications from the board with the L0Cost robot controller or any other processing module so that the board can be used either as a main robot controller or as an offload processor, running the basic robot control features.

For use with Raspberry Pi Pico or Pico W

The board can be used with either the Pico or Pico W so the robot can have Wi-Fi communications features added easily with a change of board.

The size of the board could have been reduced slightly but it has been chosen to fit with the chassis dimensions of the L0Cost Robot series of DIY robots. It doesn't have mounting holes but if the board is cut with larger dimensions then these can be accommodated. Pictures below show the change of board size when it is cut down.

One of the advantages of this board is that it can be programmed with a variety of languages, varying from C with the standard Raspberry Pi Pico SDK, to using the Arduino IDE, Python with CircuitPython and Micropython, and even BASIC using the Micromite architecture.

Supplies

IMG_9939.JPEG

Matrix board - the picture shows the sort used. A standard size makes two controller boards. The picture shows a cut board and an uncut board with a mark out for the cut. If mounting holes are required then cut the board larger to accommodate these.

PCB pins and sockets - I buy the 40-pin variety and then cut down to size

Push button on/off switch

Push button momentary (this is the same as the on/off switch with the latch removed)

LED and 330R resistor, chose your own colour LED

Solid core hookup wire - much easier to make short connections

Buck convertor regulator, the ones used are based on an MP2307 chip

2 x DRV8833 Two are not essential, if your robot only has two DC motors, one will do.

1 x MPU-6050 This is not essential but provision is made for when it's used

1 x piezo sounder

Terminal blocks if required for motor and power connections, but pins will do for small robots

Board Layout Design

Pico Controller layout V8b.png

This is the board layout design. It was created in Microsoft Excel to get the grid and general layout and then the wires were draw on with Microsoft Paint.

This is the first version and just building it has demonstrated some of the improvements necessary, but I'll use it for a while before designing the second version

Cut the Board to Size

IMG_9940.JPEG

The board used is designed for use with ICs and I buy packs of rejects, some of the faults can be seen in the pictures but if you're happy to drill the extra holes and cut round the faults then they work fine. As mentioned earlier, no provision for mounting holes has been made so if they are required then the board should be cut with larger dimensions to accommodate the hole layout required.

I use a small saw to cut the board but have recently started using a small drill with miniature cutting wheel to do it.

Fit the Pin Sockets

IMG_9948.JPEG
IMG_9943.JPEG
IMG_9945.JPEG
IMG_9946.JPEG

The pin sockets were assembled on the board in the correct places as per the diagram, and then held in place by strips of pins holding them together in the correct spacing and alignment. Once sure they are correct, a few solder tags were used to fix them in place and check positions before soldering all the rest.

Once the sockets were all fixed, the power terminals and power switch were fitted.

Inspect your soldering and check the board for solder bridges between tracks and correct. It's much easier to do when they occur than finding them later. Also check for missed joints and dry joints which will give errors.

Fit the Terminal Pins

IMG_9955.JPEG
IMG_9949.JPEG
IMG_9951.JPEG

Colour coded terminal pins have been used to make it easier to determine the use of each pin but isn't essential.

To ensure the pins are upright and to make them easier to fit, they were inserted into an unused piece of pcb socket strip at the correct spacing. These strips could then be inserted into the pcb either singly or in multiples before soldering.

Inspect your soldering again. There are a lot of joints so it's easy to miss one or get a poor connection.

Test Fitting

IMG_9956.JPG

After the initial soldering is completed, the modules have been inserted to test the layout still works and to make any corrections easier. It's also a good time to check if any glaring mistakes have been made before investing time in the next stages.

Add the Direct Wire Links

IMG_9964.JPEG

Most of the connections on the board are made with bare stripped wire to make it easy to measure and insert connections. These are coloured black in the diagram. Work methodically from one edge to the other fitting all wire joints in turn. Cross off a joint on the diagram as it's soldered in to keep track. Trim the excess wire on the connections as they are made to give easier access to the board as more joints are made.

In the picture, wires have been inserted as per the diagram, together with the dropper resistors (the pico is 3.3V), motor terminal connections and push button.

This is a good time to inspect the board and compare it to the diagram to ensure all connections have been made and are in the correct place.

As always, inspect your soldering for missed or dry joints.

Finishing Details

IMG_9971.JPEG
IMG_9973.JPEG

Some of the connections aren't direct and are made using covered wire shaped to fit. They are coloured blue in the diagram. These are measured and fitted now, along with the power LED and piezo sounder.

The sounder is positioned under the Pico to save space. It's not included as a robot feature but to provide an audible indicator of the robot status where a visual display may be difficult or impossible for the operator to see. The negative lead of the sounder connects to the ground track on pin 8 of the Pico and the positive connection is to GPIO28.

There is one cut in the board required across the positive line of the voltage regulator, marked in black on the diagram. Ensure this is cut before continuing.

Testing

Don't insert any modules into the board until you're happy with your testing.

If you've been checking your work as you go along then there shouldn't be many problems, but as there are hundreds of soldered joints then it's likely there be at least one fault somewhere in construction.

Using a resistance meter or multimeter on the resistance range. Some switches will short the power rails together when in the off position so ensure that the switch is ON when testing as it may give erroneous results.

  1. Check the resistance between the incoming ground connection and the rest of the board. it should be a good connection to all ground points and no connection to any others.
  2. There are three power rails, check that the input power only connects to the motor drivers and power regulator. That the 5V from the power regulator connects only to the middle two rails, but to all of the points. Check that the bottom power rail is not connected to anything except all of its points and the I2C connector.
  3. With the power off, insert a pico and connect it to a programming computer via the USB socket, the power LED should light. With a voltmeter or a multimeter on a 5V or greater range, say 20V, test that the voltage on the 5V rail is correct. Connect programming software to the pico and ensure that it's accessible. If this is the first time it's been used then it may need to have firmware loaded first for some IDE's
  4. Testing of all the features will need software loading, see a later step.


Voltage Jumpers

IMG_9977.JPEG
IMG_9978.JPEG

The bottom power rail does not have a permanently wired connection and is instead intended to take it's power via a jumper from one of the Pico pins, either the 3.3V pin or the 5V pin. Only one jumper should be used at a time to connect a yellow pin to a red pin.

For 3.3V, connect pin 36

For 5V, connect pin 39

See the pictures above for each.

Modules and Setup

IMG_9972.JPEG

The basic board uses three modules, the power regulator, the DRV8833 motor drivers and the MPU-6050 IMU.

The power regulator has four pins and while they aren't on an exact 1/10" or 2.54mm pitch, will fit standard sockets ok. See the picture for how they've been soldered. It was found that inserting four pins into a socket of the correct pitch, fitting the regulator over the pins and soldering was the best way to ensure a good fit. Before using they must be adjusted for 5V output, do this without being connected to any module.

If the board is to be powered by the Pico USB connection, or from a regulated 5V supply, then the regulator is not required and a bypass insert used, shown in the pictures as a piece of stripboard fitted with four pins.

The DRV8833 modules are fitted with two rows of six pins with components uppermost. Again inserting the pins into existing sockets before soldering aids alignment.

The MPU-2050 can have the pins soldered in two ways, depending upon requirements. As shown in the pictures, the module is mounted flat to the board and orientation of the board must be taken into account when using this module to understand the movement directions in software. The board has markings to indicate the x, y and z directions it will report and these will need to be translated into the actual robot orientation.. The solder pins can be changed to 90 degree pins where the module will be stood up from the board which may facilitate additional I2C connections and a different orientation in software.

Software

As mentioned at the beginning, the Pico, and this board, can accept a range programming environments.

Adafruit provides example code in Circuitpython for the modules used on the board and many others which can be connected.

Raspberry Pi provide a C++ SDK for programming the Pico and support Micropython. Code for the board can be referenced via a Micropython library service, such as this one.

The Arduino IDE supports all the features of the board in it's version of C++, load one of the RP2040 boards to use the environment.

The Pico can also be programmed in BASIC using the Micromite environment. This is self-contained and only needs terminal access to the Pico. Support for some features is built-in but others will have to be coded.

Initially code I write for it will appear on github here.

Next Steps

IMG_9975.JPEG
IMG_9980.JPEG

This board was made as a response to the needs of a robot controller for the PiWars 2024 competition but is meant to be as practical a circuit as possible, while being low cost and DIY of course. Features can be missed off, and additional ideas incorporated if required so it has has advantages over commercial offerings.

It is intended to be usable in the L0Cost Robot project to expand the capabilities of the basic ESP32-CAM controller.

An additional I2C connected control panel is being designed to provide detailed status and control abilities to the card and subsequent robots constructed using it.

I'm aware this board has some shortcomings and will be updating it in the future as I'll be making several.