2WD robot
|
Physical build details
This compact 2WD robot uses a 3D printed 3-plate design that stacks:
- the Raspberry Pi Zero connected to the custom PCB, with a battery bank, all fixed to a middle plate that sits on top of;
- the bottom plate that holds the drive motors, the L298N motor controller and an ultrasonic sensor; and
- a top plate then has a 4x AA battery holder that powers the motors, a USB 'dongle' holder, a LCD display, four embedded slide switches and optionally a USB camera holder.
Power for the Raspberry Pi is provided by a rechargeable 5V battery bank that slides into two 3D printed circular clamps on the middle plate, but the power for the L298N/pair of geared drive motors is from a separate 4xAA battery holder screwed in place on the top plate. Use of rechargeable AA batteries for the motor powering, even though they only produce ~ 4.8V (4x ~1.2V) is still perfectly adequate.
All the 3D print designs, originated using FreeCAD, can be downloaded from the Prusa site here and the set of 'partial assembly' FreeCAD images below illustrate how the various components are fitted together. It should be noted that the Pi's single micro USB connector, via a male micro to female Type A cable, can be used either for a camera connection or for the 'dongle' used by a wireless controller - but not both unless some further port expansion method is used (see the software discussion further down the page).
PCB design
The custom PCB design, originated using KiCAD, can be downloaded from this GitHub repository and is illustrated in front and back views in the images shown below:
This PCB design, evolved over several iterations, simplifies the interconnect for a L298N motor controller and various sensors to the Raspberry Pi Zero.
Of particular note: is that, as this design originated back in 2019, some sensors at that time were only generally available with 5V output signals (i.e. they probably originated for use with Arduino microcontrollers) so the PCB also accommodates the use of a bi-directional logic level signal (LLS) converter module, a 2x 6-pin device that can convert 5V-to-3V3 signals (and vice versa). Selected sensor connectors are then routed within the PCB to the 5V ide of the converter before routing onwards to a particular GPIO pin from the 3V3 side of the device. It should be noted however that the particular type of converter used in the initial builds had particularly long GPIO pins so a small 3D printed spacer was designed to 'lift' the device a defined distance away from the PCB surface to avoid the pins from sticking out too far on the underside of the PCB.
The various connection options that are available in the PCB design are:
- a main 2x20 connector (fitted to the underside/back of the PCB) for direct connection of the overall pCB assembly to the Raspberry Pi GPIO pins;
- a 6-pin connector for the L298N motor controller;
- as discussed above, a 2x6-pin set of connections for the LLS converter module
- a 4-pin connector for an ultrasonic object detection sensor (5V output);
- a set of three 3-pin connectors for three separate line follower sensors - left/middle/right (3V3 output);
- a pair of 3-pin connectors for rotation speed sensors for each motor (5V output);
- four 3-pin connectors for slide switches; and
- a 5-pin connector to provide optional 5V or 3V3 powered I2C device connection, used for the LED display.
As the PCB design left some of the Pi's GPIO pins 'unused' these (7, 12, 15, 20 and 21) are also exposed as a separate 5-pin connector, along with a pair of 3-pin 5V/GND/3V3 connectors for any additional powering requirements.
Software options
The code that has been developed so far is available for download from this GitHub directory, and it uses a mixture of Python and compiled 'C' code.
Various individual component test scripts have been developed but the main operation code, typically automatically started @reboot using a cron, is 'logically' controlled by the set of four slide switches set into the top plate.
These four switches control the start/stop of different operational modes as follows:
- on - off: logical start, stop of an individual mode (does not switch the power!)
- A - B or C - D or E - F: are used in different combinations to set an individual mode as follows:
- ACE: autonomous forward drive with automatic avoidance of obstacles.
- ADF: simple demo-1 routine.
- ACF: simple demo-2 routine (not set up yet).
- BCF: single line follower sensor mode (not yet working).
- BDE: 3 line follower sensors mode (not yet working).
- BCE: wireless controller mode - if used in the build it means that the USB cannot be connected as well.
- ADE: web browser interface (not fully developed yet) with a camera streaming mode that cannot be used if wireless control is used for the build.
Wheeled robot projects:
Robotics projects:
All the currently available maker project information: