BEAPER Pico: the Beginner Electronics and Programming Educational Robot for Raspberry Pi Pico
by johnrampelt in Circuits > Robots
1055 Views, 12 Favorites, 0 Comments
BEAPER Pico: the Beginner Electronics and Programming Educational Robot for Raspberry Pi Pico
Background
I have been teaching high school electronics and computer technology courses for over thirty years, and in that time I've created a number of different beginner circuits to help my students learn about electronics and microcontroller programming. I try to design these beginner circuits using a modular approach that allows them to be assembled and used in different configurations.
Modular circuits don't need to have all of their components installed for beginners to start learning programming fundamentals using them. Instead, learners can start programming after assembling a quicker-to-build, and lower cost subset of the full circuit. Learners can expand their circuit's feature set and capabilities by simply installing additional groups of components later, which lets their circuits grow with them as they improve their software skills and interfacing abilities.
Modular designs are especially great for classrooms and makerspaces, since the circuits can be assembled at a lower cost using only the parts required to achieve the learning goals. At the same time, their expandability allows the circuits to be customized for specific projects, or to provide higher level opportunities for more advanced learners. The big plus for instructors is that an entire class can make projects using the same common circuits, components, and lessons, while being able to differentiate instruction for learners at all levels!
Meet BEAPER Pico
This past August I presented my BEAPER Nano project at a conference for computer studies teachers. It's a modular beginner microcontroller board made for the newer Arduino Nano ESP32, and each of the teachers attending my session made their BEAPRR Nano into a BEAPER Bot robot. The session was well received and some of the teachers asked about the possibility of creating a similar robot for the Raspberry Pi Pico family of microcontroller boards, since these microcontroller circuits are available at a lower cost than the Arduino Nano ESP32.
The Raspberry Pi Pico form factor is slightly larger than the Arduino Nano ESP2, but I thought it should be possible for me to squeeze a Raspberry Pi Pico into the same physical circuit form factor to take advantage of the already created BEAPER Bot robot chassis I had originally designed for the BEAPER Nano. The result is this prototype BEAPER Pico, the Beginner Electronics And Programming Educational Robot for Raspberry Pi Pico. The Raspberry Pi Pico is a tighter fit on the PCB, and its larger size results in too little free space around the USB cable, so I'm not totally happy with this design yet. But, these are challenges I can try to resolve in the next revision!
Just like BEAPER Nano, I wanted BEAPER Pico to be simple enough to be used as a beginner learning circuit board for microcontroller programming, while simultaneously being versatile enough to support the more advanced capabilities of the the Raspberry Pi Pico. To make initial circuit board assembly easy for novices, as well as to simplify the addition of more components as learners progressed, the printed circuit board (PCB) has been created as a through-hole design. And, since the BEAPER Pico PCB is the exact same size as BEAPER Nano, it will be just as easy for beginners to make it into a robot using the 3D-printable BEAPER Bot parts.
BEAPER Pico Configurations
BEAPER Pico can be built in multiple ways, but there are three common configurations that I think make the most sense: an education starter configuration containing only the components needed for beginners to start learning introductory microcontroller programming, a robot starter configuration enabling BEAPER Pico to run from batteries, drive motors, and be made into simple robots, and an analog I/O configuration providing a variety of analog input devices for making robot floor and line sensors, as well as light and position sensors for learning more advanced analog input and processing techniques. BEAPER Pico's components have been grouped into these three configurations, below, along with expansion components that overlap between configurations, or are more specialized and provide even greater learning opportunities. Let's get to know the components that make up each configuration.
Education starter configuration components
- four pushbuttons
- four LEDs
- piezo speaker
- header sockets for the Raspberry Pi Pico
Robot starter configuration components
- screw terminal strip and power switch
- 5V low drop-out voltage regulator circuit
- 3.3V to 5V level shifter IC
- H-bridge motor driver IC
Analog I/O configuration components
- ambient light sensor
- two rotary potentiometers
- two break-away optical floor and line sensor modules using LEDs and phototransistors
Expansion components
- four 3.3V digital I/O headers that can be bridged with a socket to hold an ultrasonic SONAR distance sensor module
- four 5V output-only headers (shared with the 3.3V digital headers) to drive servos or other 5V devices
- QWIIC connector to connect 3.3V I2C peripherals
- SPI breakout connector designed to mount a full colour, 1.54" graphical TFT LCD display panel
Download the BEAPER Pico schematic for complete circuit details.
Downloads
Supplies
Obtaining a BEAPER Pico PCB
Start by obtaining a bare printed circuit board (PCB). I've made the BEAPER Pico PCBs and electronic component kits available to order individually on the mirobo.tech website. Purchasing from the website helps me to keep producing learning materials and circuits for education.
PCBs are also available from the BEAPER Pico shared project page on PCBWay (this provides the least expensive option for schools and maker spaces to order them in larger quantities and at the lowest cost). You'll need to create an account first and new members can use this PCBWay referral link for a $5 USD credit.
BEAPER Pico's Electronic Components
Schools and maker spaces likely already have the resistors, pushbuttons, and LEDs needed for learners to begin assembling the education starter configuration of BEAPER Pico. Adding the Raspberry Pi Pico header sockets and piezo beeper will be all that's needed for beginners to start learning programming before deciding on the other parts that will be required to complete the circuit for their particular application.
When assembling BEAPER Pico, remember that all of its electronic parts won't usually be needed. Study the schematic diagram to determine which components you need for your project, and either use the parts list file linked at the end of this section to source the required electronic parts, or select parts from this shared BEAPER Pico parts list on the Digi-Key website.
BEAPER Bot – a simple, versatile robot
A circuit as flexible as BEAPER Pico can do a lot on its own, but the R in BEAPER means it was also designed to make it easy for beginners to make it into a robot. The simplest, quickest, and lowest cost method I've used to make robots with students in my classes is to cut the robot chassis out of a piece of scrap wood or MDF and screw the circuit board, gear motors, sensors, and battery holder onto it. This could certainly work just fine for BEAPER Pico, too, but the required tools, hardware, mechanical expertise, and time (for the inevitable trial and error) to build a robot chassis may not be readily available in a programming- or computer-focused course.
For those with access to a 3D printer, there's a much quicker, and more well integrated option – a simple BEAPER Bot robot chassis that the BEAPER Pico circuit snaps into, along with its gear motors, and battery holder. Yes, snaps! All of the BEAPER Bot parts are designed snap together without any needing any small, easily-misplaced screws, bolts, or nuts.
BEAPER Bot can be built in a rear-drive configuration (better for line following robots), or a front-drive configuration simply by rotating the BEAPER Pico PCB 180° before snapping it into its mount. The red robot featured in this tutorial is set up for rear-drive, and the white robot is built in a front-drive configuration.
Optical sensors, servos, and other components can be added to BEAPER Bot by 3D-printing and sliding their mounts into dove-tail grooves around the outside of the robot chassis. You can grab all of the 3D design files in assembly Step 8, below.
Downloads
Installing the Education Starter Resistors and Pushbuttons
Do you have your BEAPER Pico PCB and starter electronic parts? Let's begin by soldering the lowest profile parts into the PCB first – this makes it easiest to assemble the PCB. All of the electronic parts listed in this step are required for every configuration of BEAPER Pico. The following steps include the optional parts that may not be needed for your BEAPER Pico configuration.
What you'll need:
- 100Ω, 1/4W resistor
- four 270Ω, 1/4W resistors
- five 1kΩ, 1/4W resistors
- five 6mm pushbuttons
- Bend all resistor leads before inserting them into the PCB for soldering (this component lead bender makes it easy – .STL file linked below). Tip: if you're new to soldering, you can learn everything you'll need to know in this awesome Soldering is Easy comic!
- Install and solder the reset circuit pushbutton SW1, and 100Ω resistor R1.
- Install and solder 1kΩ switch series resistors R3-R6, and piezo load resistor R15.
- Install and solder 270Ω LED series resistors R7-R10.
- Install and solder the user pushbuttons SW2-SW5.
The resistors and pushbuttons installed in this step are the only ones needed to begin learning programming using the education starter configuration of BEAPER Pico. To finish the education starter configuration, you will also need to install the user LEDs, piezo speaker, and the header socket strips for the Raspberry Pi Pico – get the details on how to install the LEDs and piezo speaker in Step 3, and the header sockets in Step 4.
If you want to start using the education starter configuration to learn programming now, but you think you might expand your BEAPER Pico circuit with additional components in the future, it will be easiest to install the necessary resistors and smaller components before installing some of the larger components and finishing the PCB. This is especially true for the JST-SH/QWIIC connector used for I2C expansion, as it is much easier to install now than after the tall header sockets for the Raspberry Pi Pico are installed and in the way.
Downloads
Installing the Robot Components
These components consist mostly of parts needed to make BEAPER Pico into a robot, including the 5V regulator circuit, optical floor sensor resistors, and IC sockets for the 3.3V to 5V logic level shifter needed and H-bridge motor driver. In addition, series resistors used for the 3.3V digital I/O expansion headers and 5V servo/output headers can be installed in this step.
What you'll need:
- 16-pin DIP IC socket for the H-bridge IC
- 20-pin DIP IC socket for the level shifter IC
- ten 100Ω, 1/4W resistors
- three 4.7kΩ, 1/4W resistors
- 1kΩ, 1/4W resistor
- 10kΩ, 1/4W resistor
- three 100nF capacitors
- three 47µF 25V electrolytic capacitors
- low drop-out 5V regulator
- #4-40 x 3/8" bolt and nut (or M3 x 10mm bolt and nut)
- Install and solder 1kΩ power supply LED series resistor R2.
- Install and solder the 10kΩ logic pull-up resistor for the H-bridge motor driver, R19.
- Install and solder 100Ω header resistors R11-R14.
- Optional: install and solder 100Ω series resistors R27-R30 if the H5-H8 5V output headers will be used.
- Install and solder 100Ω floor sensor LED series resistors R20 and R21.
- Install and solder 4.7kΩ floor sensor phototransistor pull-up resistors R22-R24.
- Install and solder 20-pin DIP socket U2 and 100nF capacitor C6 for the logic level shifter IC. Make sure to match the notch molded into one end of the socket to the painted notch on the PCB silkscreen.
- Install and solder 16-pin DIP socket U3 and 100nF capacitor C4 for the H-bridge motor driver IC if you are planning on building the BEAPER Bot or using similar low current motors. The IC socket makes it easier to replace the motor driver if it ever fails, but the motor driver IC can be soldered directly into the PCB instead for better heat sinking using the PCB's ground plane when using higher current motors.
- Bend the leads of the 5V regulator and insert them into the PCB. Fasten the regulator using a bolt and nut. Tip: inserting the regulator mounting bolt from the bottom of the PCB prevents longer bolts from interfering with PCB mounting and, as an added bonus, the protruding bolt can make a convenient location to clip on an oscilloscope ground lead for later testing and debugging!
- Install and solder 100nF regulator input decoupling capacitor C1.
- Install and solder 47µf electrolytic filter capacitors C2, C3, and C7. Important: electrolytic capacitors are polarized and must be installed with their marked, negative lead inserted into the round pad located within the filled semi-circle of the capacitor silkscreen outlines on the PCB. The longer, positive lead will match the square pad marked with a small '+' sign just outside of the capacitor silkscreen symbol.
Installing the Analog and I/O Components
Built-in analog components make it easy for you to simulate analog sensors in your programs, or allow a BEAPER Pico-based robot to detect the floor or a line. BEAPER Pico's on-board analog components are jumper-selectable. This allows either the ambient light sensor and two potentiometers (collectively named Enviro. for environmental sensors), or the robot floor sensor phototransistors to be connected to the analog inputs of the Raspberry Pi Pico.
The QWIIC connector allows BEAPER Pico to connect to external I2C devices using commonly available QWIIC or STEMMA cables. It's the only surface-mount part on BEAPER Pico and requires extra care during soldering, but can be successfully soldered manually using a fine, conical point soldering iron.
What you'll need:
- TEPT4400 ambient light sensor
- three 4.7kΩ, 1/4W resistors
- five 3mm diameter LEDs
- 12.2mm diameter piezo speaker
- 4-pin JST-SH connector
- 6 circuit, 5.08mm (0.2") lead spacing screw terminal strip
- 40-pin 2.54mm (0.1") header strip (to be separated into 3-pin and 4-pin headers)
- 4-pin 2.54mm (0.1") header socket
- Optional: install and solder the QWIIC (JST-SH) connector and 4.7kΩ pull-up resistors R16 and R17 if I2C peripherals will be used. Either use a needle-tip or flat tip soldering iron and liquid flux (to help prevent solder bridging between the closely-spaced JST connector signal pins) or, alternatively, a hot air solder station. Carefully solder both the four rear JST-SH connector signal pins and its two front mounting tabs.
- Optional: Install the TEPT4400 ambient light sensor Q4 with its long (emitter) lead inserted into the square PCB pad closest to R18 and solder it into place. Install and solder 4.7kΩ pull-up resistor R18.
- Install and solder 3mm LEDs D1-D5. Important: for consistency with the other components having different lead lengths (the ambient light sensor, phototransistors, and electrolytic capacitors), the component pads for BEAPER Pico have been designed so that the long lead of most LEDs must be inserted into the square pad, and the short lead into the round pad. This is opposite to conventional practice for LEDs, but makes it easier for a group of beginners in a classroom or maker space to successfully assemble their circuits since the long leads of each of the components with different lead lengths always goes into the square pad. Schematic symbols added to the silkscreen show the proper orientation of each optical part if you're unsure.
- Install and solder piezo speaker LS1 into the PCB. The piezo specified in the parts list is not polarized, but if a polarized piezo is used instead, insert the positive lead into the square PCB pad closest to the LS1 label.
- Carefully snap apart three, 3-pin sections from the 40-pin header strip to make 3-pin jumpers JP1-JP3. Insert the shorter, usually silver side of the header pins into the PCB, and solder each of the pins into place. Tip: you can plug the 4-pin header socket on top of the three jumpers to keep them all in alignment as well as to make it easier to hold them in place while soldering.
- Important: decide how the H1-H4 digital I/O headers of your BEAPER Pico will be used. There are two primary options: 1) install header pins to make it easier to connect up to four external 3-pin devices, or, 2) bridge H1-H4 with the 4-pin header socket to make it easiest to mount an ultrasonic SONAR distance sensing module for a robot. Note that the signal pins of H1 and H4, as well as power and ground connections will still be accessible if a SONAR module header is installed, as the SONAR module only uses the signal pins H2 and H3. Install and solder either 3-pin headers, or the 4-pin header strip into H1-H4.
- Optional: snap apart and install four, 3-pin header strips for digital outputs H5-H8 if these will be used.
- Insert and solder the 6-pin screw terminal strip. Important: ensure the openings of the screw terminal strip are facing the outside edge of the PCB, and not toward the IC sockets.
Installing the Final PCB Components
It's time for final PCB assembly, where the remaining tall and awkward parts will be installed.
What you'll need:
- two 20-pin 2.54mm (0.1") header sockets
- 8-pin 2.54mm (0.1") header socket
- power switch
- two 10kΩ potentiometers
- Install and solder 20-pin header sockets J1 and J2 to hold the Raspberry Pi Pico microcontroller.
- Optional: install and solder an 8-pin header socket if the LCD will be used.
- Optional: install and solder the power switch if the regulator has been installed.
- Optional: install and solder the 10kΩ potentiometers if your project needs user-controlled analog inputs. Solder both the potentiometer leads as well as their metal mounting tabs.
Carefully inspect all of your solder connections, fix any solder voids or short circuits, and then clean your PCB with the recommended flux remover for your solder (unless you used a no-clean flux).
Install ICs, Jumpers, and the Raspberry Pi Pico
It's always exciting to get to the final assembly step, isn't it? Obviously, you'll only need the jumper shunts if the JP1-JP4 jumper headers have been installed and, likewise, the ICs only if the IC sockets have been installed.
What you'll need:
- three shorting jumper shunts
- 74HCT541 octal buffer IC
- SN754410NE quad half-H motor driver IC
- Raspberry Pi Pico, Pico W, or Pico 2 microcontroller and a 40-pin 2.54mm (0.1") header strip broken into 2 20-pin headers, or
- Raspberry Pi Pico H or Pico WH microcontroller with pre-soldered headers
- Install jumper shunts onto the Enviro. pin positions of JP1-JP3 for testing.
- Carefully straighten the pins of the octal buffer IC, align its notch or pin 1 identification mark with the notch of the 20-pin DIP socket, and push it into place.
- Carefully straighten the pins of the motor driver, align its notch or pin 1 identification mark with the notch of the 16-pin DIP socket, and push it into place.
- If you have a Raspberry Pi Pico with pre-soldered headers, align the header pins of the Rasbperry Pi Pico with headers J1 and J2, matching pin 1 of the Raspberry Pi Pico with the triangular identification mark on the BEAPER Pico PCB (the USB connector should be facing the analog sensor select jumpers), and carefully push it into place.
- If your Raspberry Pi Pico came without pre-soldered headers, the easiest way to install them is by inserting the long pins of each of the headers into the J1 and J2 header sockets, placing the Raspberry Pi Pico on top, and then soldering each pin.
Important: ensure that both ICs are installed in their proper orientation, and that the BEAPER Pico PCB has been cleaned and thoroughly dried before proceeding to testing in the next step!
Test Your BEAPER Pico PCB
Are you ready to start learning programming? Or, eager to start making your robot? Let's test your BEAPER Pico PCB to ensure everything is working first. We'll use the Thonny IDE software and a test program written in MicroPython.
What you'll need:
- Thonny Python IDE program for your operating system
- MicroPython .UF2 firmware file for Raspberry Pi Pico or Pico W or Raspberry Pi Pico 2
- USB 2.0 micro B cable to connect the Raspberry Pi Pico to your computer
- BEAPER-Pico-IO-Test.py program (linked below)
- If you don't already have it, download and install the Thonny Python IDE for your operating system.
- Download the newest MicroPython UF2 firmware file for your specific Raspberry Pi Pico microcontroller from one of the websites listed above. Follow the instructions on the website to install the MicroPython firmware onto your Raspberry Pi Pico microcontroller.
- Connect your Rasbperry Pi Pico to your computer and Launch the Thonny IDE. If Thonny doesn't immediately connect to your Rasbperry Pi Pico, click on the three small lines in the bottom-right corner of the window and choose MicroPython (Raspberry Pi Pico). If it's not listed, try choosing Configure Interpreter from the Run menu, and select the port connecting to your Raspberry Pi Pico.
- Download and open the BEAPER-Pico-IO-Test program (linked below) in the IDE.
- Click the Run button (the green circuit with the right-facing triangular button) at the top of the IDE screen to start running the program in the Raspberry Pi Pico. The program will start running immediately and will show a live print-out of the analog values being converted from the ambient light sensor, both potentiometers, and the Raspberry Pi Pico's on-board temperature sensor in the shell below the code program code window.
- Cover or illuminate the ambient light sensor to watch its value change with the light level. Turn each potentiometer shaft from one side to the other to change their values. A full sweep should produce values from close to 0 to close to the maximum possible value of 65535. Put your finger on the Raspberry Pi Pico's microcontroller, and you should see the raw temperature value slowly decrease.
- Press and release SW2 to flash the four user LEDs in sequence.
- Press and hold SW3 to light LED D3 and play two tones. SW3 is programmed to be a momentary button so LED D3 should stay lit until you release SW3.
- Press and release SW4. SW4 is programmed to be a toggle button so LED D4 should turn on until SW4 is pressed again to turn it off.
- Press and release SW5 to brighten and dim LED D5 using PWM.
If everything is working as it should be, you're ready to start learning programming (or continue to refine your programming skills) using the features of the Raspberry Pi Pico and the hardware on the BEAPER Pico circuit!
If you're just starting to learn programming, look for programming examples and activities for Raspberry Pi Pico on the internet. I'll be posting some introductory Python learning activities on the mirobotech GitHub page soon.
Downloads
Add the Optional Graphical LCD Display
You'll learn so much just by making programs that use pushbuttons, LEDs, analog sensors, the piezo speaker, and motors, but adding a graphical LCD display onto your BEAPER Pico will literally take your learning to the next level – and not just because it sits a level higher than the main BEAPER Pico PCB! You can use it to display variables and user interface elements (UIs) for your projects, and even program simple games to play on it such as the block breaker game shown above.
What you'll need:
- 1.54" 240 x 240 pixel LCD display panel
- 2 M2 x 16mm nylon machine screws and nuts
- 3D-printable BEAPER Nano LCD support (link to Tinkercad design – download the .STL file below)
- Ensure your BEAPER Pico is disconnected from the computer and its battery power supply before you begin.
- Insert the two M2 machine screws through the LCD PCB on the opposite side of the inline header connector.
- Insert the machine screws into the holes in the 3D-printed LCD support such that the support cross-beams are touching the bottom of the LCD PCB.
- Align the LCD header pins with the 8-pin LCD/SPI header socket on BEAPER Pico and gently insert the pins, making sure to align the LCD support and its machine screws with the LCD mounting holes in the BEAPER Pico PCB.
- Fasten the machine screws with nuts on the bottom side of the BEAPER Pico PCB and gently tighten the screws. Then comes the best part – peeling back the protective cover film!
Once the LCD is mounted, I'm sure you'll want to test it out. I'll upload an example program to GitHub soon to let you do just that.
Downloads
Building a BEAPER Bot? 3D Print the BEAPER Bot Parts
BEAPER Pico was designed to be easy to make into a robot, and that's what the next few steps will help you do. There's more than one way to make a make a simple robot, and the BEAPER Bot robot chassis was designed to be one of the simplest. That's because all of its parts have been designed to snap, slide, or clip together without any screws! And, you're free to modify any of them.
Since fine tolerances are involved it's important to use one of your 3D printer's better quality print settings and an appropriate print speed to ensure your parts fit together well. I used 0.16mm layer height and the High Quality setting on a Bambu Lab printer for my example, and the chassis took about 5.5 hours to print using regular PLA.
Not all of the parts linked below are required. Some are spares, such as the motor mount clips since these can easily be damaged. A variety of optional, extra servo holder designs are also included so you can mount the relatively common SG90 type servos in different locations and orientations.
What you'll need to 3D print:
- BEAPER Bot Robot Chassis (the .STL file includes one chassis and four motor clips)
- BEAPER Bot Optical Floor Sensor Mounts (two mounts needed making floor or line sensor modules)
The chassis can be printed without supports if your 3D printer does a reasonably good job with overhangs and bridges, but you might see some unevenness in the top arch of the wheel wells. Enabling supports on the print bed only will ensure the wheel wells print nicely. Important: if you enable supports, set them to only originate on the print bed and not on the printed parts.
What you'll want to 3D print:
- BEAPER Bot Motor Mount Tool (makes it quick and easy to install the motor mount clips)
I know, who wants to wait for one extra part after all of the chassis parts are printed and ready to be assembled, right? Trust me, the motor mount tool is especially helpful for installing the motor clips, and you'll definitely want one (or more) if you're building a bunch of BEAPER Bots as projects in a classroom or maker space.
Optional parts you don't need to print:
- BEAPER Bot Motor Mount Clips (two spare clips in case you damage the four included clips)
- BEAPER Nano LCD Support (used for mounting the optional LCD display)
- BEAPER Bot Servo Holders (two 3-tab mounts to hold servos vertically)
- BEAPER Bot Servo Holder - right (one 2-tab mount to hold a servo on the right side of the chassis)
- BEAPER Bot Servo Holder - left (one 2-tab mount to hold a servo on the left side of the chassis)
- BEAPER Bot Servo Holder - horizontal (two mounts to hold servos horizontally)
Re-mix and create your own parts
All of the BEAPER Bot parts were designed and shared in TinkerCad to make it easy for anyone, and specifically for teachers and students limited to using Chromebooks in schools, to have the ability to modify them. BEAPER Bot features dove-tail slots around its perimeter that enable you can create and easily mount accessories onto your robot – use the Dove-tail Plates design, below, as a starting point for your designs.
Here are the links for all of the BEAPER BOT parts on the TinkerCad website:
- BEAPER Bot Robot Chassis
- BEAPER Bot Optical Floor Sensor Mounts
- BEAPER Bot Motor Mount Tool
- BEAPER Bot Motor Mount Clips
- BEAPER Nano LCD Support
- BEAPER Bot Servo Holders
- BEAPER Bot Servo Holder - right
- BEAPER Bot Servo Holder - left
- BEAPER Bot Servo Holder - horizontal
- BEAPER Bot Dove-tail Plates
I can't wait to see what kinds of interesting accessories builders will come up with and add onto their BEAPER Bots!
Downloads
Assemble the BEAPER Bot Robot Chassis
Before you get started you'll need to think about what you want your robot to do. Will it be a line-follower? A Sumo bot? A mapper or explorer? Does it need to be fast, or be energy efficient? Knowing what you want your robot to do will allow you to determine if should be assembled in a front-drive or rear-drive configuration, and what kind of batteries and gear motors to use. The example photos in this step show the construction of a red, rear-drive robot. The white robot pictured in the other parts of this tutorial was set up in a front-drive configuration.
Whichever way you decide is the front, we'll assume that you'll power your robot using 4AA batteries and typical 6V motors that are fast enough, but still energy efficient, at least to start. You can always swap parts for different characteristics and applications later.
What you'll need:
- 3D-printed BEAPER Bot robot chassis
- two 3D-printed motor mounting clips (4 are included with the chassis)
- 3D-printed motor mount tool (optional, but makes installing the motor mounting clips much easier)
- two N20 gear motors (6V 150RPM, or 6V 200 RPM work well to start)
- two 34mm diameter plastic wheels
- 1 roller ball castor
- 4 10-12cm (4-5") lengths of thin (22-24ga.) stranded hook-up wire for motors
- 4 AA battery holder (long 2x4 style) with leads
- Strip 2mm of insulation from one end of each of the four motor wires and tin the stripped ends with solder. Solder the wires to the motor terminals. I used a red wire to connect the positive motor terminal (marked with a + sign), and a black wire for the unmarked negative terminal.
- Strip 8mm of insulation from the loose end of each motor wire, and tin all stripped ends.
- Align one motor inside the molded motor cradle in the bottom of the chassis and press it down to ensure it's sitting flat on the bottom plastic. Install a motor mounting clip over top of the motor with its large flange closest to the motor wiring (away from the motor shaft - see the photos for guidance), and push on the flange to slide the mounting clip towards the motor shaft.
- If you printed a motor mount tool, now is the time to put it to use. Flip the robot chassis over and insert the tool with the flat side of its forks against the motor clip flange, and the angled side of the forks against the chassis. Then push the tool into the chassis until it stops. If you don't have a motor mount tool, a small, flat-bladed screwdriver inserted into the slots in the bottom of the chassis will help you push on the motor clip, and makes it easier to slide the clip over the motor gear box than just pushing on the clip's flange your fingers. Ensure the small locking tab in the middle of the motor clip extends over the end of the motor's gear box (see the photo showing the installed motor and overhanging mounting clip from the bottom side of the chassis).
- Repeat step 4 to mount the second motor.
- Insert the roller ball castor, ball side down, into the small square opening on the bottom side of the chassis opposite the motors. The flanges of the roller ball castor will be held in place by four small locking tabs molded into the chassis. Use your finger to push the roller ball castor into the chassis while gently pressing on one pair of tabs to allow the first side to be captured under the clips, and then repeat on the second side to fully clip the roller ball castor into place. If you damage the clips, the roller ball castor can be screwed into the chassis with two short and small screws.
- Align the flat side of the D-shaped opening in the wheels with the flat side of the motor shaft, and push the wheels onto the motor shafts – the protruding bump in the hub of each wheel must face the motor.
- Okay, now it's decision time. If your robot is going to be rear wheel drive (best for line following), the motor wires can stay where they in the areas that will become the back of the robot. But, if your robot is going to be set up to have its drive wheels at the front, you'll need to fish the motor wires through the holes in the chassis and pull them out by the roller ball, which will now be the back for this style of robot.
- Fish the battery holder wires to the back of your robot where they should meet up with the motor wires, and then insert the battery holder into the open location between the motor and the roller ball cavities. It's a tight squeeze to get the battery holder past the PCB supports in the battery well, and you'll have to insert one end of the battery holder into one side of the chassis and hold it just below the PCB support (don't push it all the way down into the chassis as the side support will be in the way) while angling the other side of the battery holder in. If the battery holder wires are kept out of the way, the battery holder will just clear the opposite PCB support.
Assemble the Optional Floor/Line Sensor Modules
BEAPER Bot can mount one or both of BEAPER Pico's break-away optical sensor modules using slide-in sensor mounts. The right sensor module (labelled R) can be used by itself to make a line-following sensor that is able to sense a black electrical tape line applied to a white painted board or to a light-coloured floor. Or, the right and left (labelled L) sensor modules can be used together to make separate floor sensors for both the right and left front corners of the robot to prevent it from rolling off a tabletop, or falling down a flight of stairs. The two modules could also be used to follow a wider line, or to detect T-intersections or crossing points on narrower lines just by repositioning them.
Each floor sensor module uses an infrared (IR) LED to illuminate a spot on the floor, and either one or two IR phototransistors to sense the light reflected from the floor. For some simple robot designs the sensor modules could remain attached to the BEAPER Pico PCB, but for BEAPER Bot you'll need to break them away from the BEAPER Pico PCB in order to insert them into BEAPER Bot's special dove-tail sensor mounts. The relocatable mounts allow you to easily switch your robot between line sensing and floor sensing modes.
While the sensor modules remain attached to BEAPER Pico, they're also electrically connected to the on-board Raspberry Pi Pico. After breaking the sensor modules away from the main BEAPER Pico PCB, you'll have to re-connect them so that the circuit can power the LEDs and the Raspberry Pi Pico can read the phototransistor values. While wires can be soldered directly between each optical sensor module and the main PCB, I find that adding pin headers to the PCBs and using short socket extension cables to connect them provides more flexibility while reducing the possibility of wire connections breaking from repeated bending.
What you'll need:
- two 3D-printed optical floor sensor mounts
- two IR LEDs
- two (or three) IR phototransistors
- two 3-pin 2.54mm (0.1") headers
- two 4-pin 2.54mm (0.1") headers
- 3-pin 0.1" header socket extension cable, 10-15cm in length
- 4-pin 0.1" header socket extension cable, 10-15cm in length
- Grip and twist each optical sensor module to break it away from the BEAPER Pico PCB. Snap off the small rectangular joiner, and trim any sharp, protruding edges of the PCB substrate as well as any torn and exposed copper traces using a sharp cutter. Warning: don't file or sand PCB material without adequate breathing protection.
- If you haven't done so already, install and solder pin headers H10 and H12 onto each optical sensor module, as well as headers H9 and H11 on the main PCB.
- The IR LEDs and phototransistors must be properly aligned and set at the correct height above the floor for maximum sensitivity, and the sensor module mounts are designed to assist you in doing do both! Starting with the left sensor module, insert a phototransistor into the bottom of the PCB with its long lead into the square pad beside the label Q1. Similarly, insert an LED into the bottom with its long lead going into the square pad closest to the bottom D6 label. Do not solder the LED and phototransistor into the module yet!
- While carefully holding the LED and phototransistor in the left sensor module PCB, align the PCB with the 3D-printed floor sensor mount and insert the LED and phototransistor into the mount. Press the left sensor module PCB into the mount until the clips lock it into place. Do not solder the LED and phototransistor yet!
- Examine the bottom of the floor sensor mount. With the bottom side facing up, notice that both the LED and phototransistor will likely have retracted into the mount. We don't want this as it will prevent them from working properly! Turn mount so the sensor circuit board is facing up, and the LED and phototransistor should protrude slightly below the bottom of the mount – by about 1mm. This is the correct height for their proper installation, but setting them on the table for soldering will push them back into the mount. The easiest solution to this problem is to attach the sensor module to your BEAPER Bot before soldering in the optical parts. Slide the mount's dovetail tabs into any of the slots in the BEAPER Bot chassis, ensure each component is protruding slightly from the bottom of the mount, and solder each component lead.
- Next, repeat the process for the right sensor module. If your robot just needs to sense the floor, only LED D7 and phototransistor Q3 are required. If you're making a line-following robot, install both Q2 and Q3 along with LED D7 (and you won't need the left sensor module, but it was good practice and you might find a use for it later – they can also become wall or proximity sensors). Insert the long leads of all of the components into the square pads closest to their respective part labels, clip the right module's PCB into the second mount, slide the mount onto your BEAPER Bot, and solder these component leads.
- Make sure you clean the flux residue from the optical sensor modules after soldering (unless you're using solder with a no-clean flux) as subtle changes in the conductivity of some types of flux over time will affect your sensor readings.
- Connect the socket extension cables to the sensor module PCBs. Beside each header you'll find either a circle or triangle reference mark that you can use to confirm the colour order of the extension cables when you plug them into the headers on the BEAPER Pico PCB.
Final Assembly
This is it! You've reached the final step of the BEAPER Bot assembly process, and hopefully the beginning of lots of learning for you with your new BEAPER Pico robot.
What you'll need:
- 4 AA batteries
- assembled BEAPER Pico PCB
- assembled BEAPER Bot robot and optical sensor modules
- small slot screwdriver
- Ensure the power switch on the BEAPER Pico PCB is in the off position and set the BEAPER Pico on top of the BEAPER Bot with the screw terminal strip at the back of the robot. Do not snap it in yet!
- Insert the red (positive) battery lead into the left-most screw terminal, marked with a large +sign on the silkscreen near C3 (the tiny + sign is for C3), and turn the screw to fasten the wire. We'll call this terminal 1.
- Insert the black (negative) battery lead into the second terminal, terminal 2, marked with a large – sign on the silkscreen, and fasten it into place.
- Insert the wires from the left motor into the middle two terminals, terminals 3 and 4. I attach the positive motor lead (the one marked with a + sign on the motor) into terminal 3, and the negative lead into terminal 4. This is just for consistency, so that all of my programs work the same way in every robot, without me having to change the code, or swap the motor wires, if the motor runs in reverse. (It's a great idea to have all of the students in a class or maker session do the same, making it easy to share program code.)
- Insert the wires from the right motor into the last two terminals, terminals 5 and 6. As with the left motor, I connect the positive lead into terminal 5 first, and then the negative lead into terminal 6.
- Flip the BEAPER Pico PCB over to allow access to the battery holder and install four AA batteries.
- Flip the BEAPER Pico PCB back over so it's sitting on top of BEAPER Bot, and align the protruding BEAPER Bot mounting pins with the matching mounting holes in BEAPER Pico. Only the two mounting pins closest to the battery holder in the wider part of the chassis will be used – the other two mounting pins on the front (back?) edge of the robot used when the circuit board overhangs the sensor modules in front-drive mode (this allows the sensors to be connected with headers and sockets instead of extension cables). When the PCB and the mounting pins are aligned, gently push down to snap one side the PCB into place, followed by the other side.
Some Extra Tips Before You Get Rolling
There are a few things you'll need to do before you get your BEAPER Bot rolling, including re-setting the shorting jumpers, and positioning and testing the floor or line sensors.
Set the Jumpers
The analog sensors on-board BEAPER Pico (the ambient light sensor and potentiometers) share Raspberry Pi Pico analog input pins with the floor sensor phototransistors. If shorting jumper shunts were previously installed in the Enviro. position on the PCB to run the BEAPER-Pico-IO-Test program in step 6, you will need to move them to the Robot position to enable the analog floor sensors to be read instead. You can then re-run the test program to verify the operation of your line and floor sensors.
Position the line and floor sensors
Are you making a line-following robot? Will the line be made using electrical tape, or a similarly narrow material? If so, you only need the right sensor module and can remove the left sensor module entirely. Mount the right sensor module in the middle slots at the front of the robot (as shown in the photos with both the yellow and blue robots) and have your program try to keep both phototransistors Q2 and Q3 on the line.
Will your robot be following a wide line, or a narrow line with T-intersections or crossings? Mount both the left and right sensor modules so that phototransistors Q1 and Q3 are on located on opposite sides of the line, just to either side of the line. Write your program to try to keep both phototransistors off the line as the robot moves.
Does your robot need to detect the presence or absence of a floor, or the line around the outside of a Sumo ring? Mount both the left and right sensor modules on opposite corners of the robot and write your program to interpret darkness as the absence of the floor or, for a sumo ring, to detect the white outer ring.
Test and calibrate the floor sensors
Run the BEAPER-Pico-IO-Test program with both floor sensor modules connected and view the output in the Thonny shell. When the robot is sitting on a reflective surface the values should be low. Lifting the robot up off of the surface should reduce the amount of reflected light, raising the voltage due to the phototransistors' increased resistance in their pull-up circuits, and increasing the output value being displayed. You'll want to record the typical ranges of values that your robot sees for light and dark and use those to create an effective line or floor sensing program.
Replacing the batteries
Good quality alkaline AA batteries should run the robot for many hours with the standard 150 or 200 RPM motors. When it's time to replace the batteries, carefully pry one edge of the BEAPER Bot away from the BEAPER Pico PCB and slightly lift the PCB on the same side. When that side of the PCB comes out of the robot chassis, try to lift the PCB straight up to dislodge the opposite instead of pivoting the PCB on an angle in order to avoid damaging the fragile 3D-printed PCB alignment pins. Rechargeable batteries can be used instead of disposable batteries, though you will need to take them out to charge them.
Power is on while programming!
The power switch disconnects the battery from the entire circuit, but does not disconnect any circuitry from the Raspberry Pi Pico. This means that while the power switch is in the off position any voltage applied to the Raspberry Pi Pico through the USB connection will be able to run the motors. You should ensure that your robot doesn't accidentally roll away when a program you're working on turns on the LEDs, since the LEDs and motors share the same I/O pins. You'll also want to be be careful to limit the current drawn from a computer's USB port. If you're doing software testing or you have installed higher current motors, it's a good idea to disconnect the motor wires from the screw terminal strip while developing your program, and reconnect the motor wires only to run the robot.
Add a SONAR module
An HC-SR04P (the 'P' denotes modules capable of 3.3V operation) ultrasonic SONAR distance sensor module can be plugged directly into a header socket bridging the H1-H4 I/O connections without using any mounting hardware. These inexpensive SONAR modules can provide reasonably good detection of solid objects from approximately 3cm to 2m in front of the robot. To prevent accidental damage to the SONAR module, ensure the BEAPER Pico is powered off and has its USB cable is disconnected before inserting or removing the module.
Thanks!
Thank you for your interest in BEAPER Pico and BEAPER Bot! I hope you learned something new from this instructable, whether or not you choose to make BEAPER Pico or BEAPER Bot. Watch the mirobo.tech website for BEAPER Pico updates and new programming tutorials. I'd love to hear how you're using your BEAPER Pico, and I'd be happy to get your suggestions for improvements – you can contact me using the contact form on the website.