BEAPER Nano: the Beginner Electronics and Programming Educational Robot for Arduino Nano ESP32
by johnrampelt in Circuits > Robots
773 Views, 4 Favorites, 0 Comments
BEAPER Nano: the Beginner Electronics and Programming Educational Robot for Arduino Nano ESP32
Background
If I asked you to imagine a beginner Arduino circuit, I'm fairly certain you would imagine some type of Arduino board connected to a breadboard. While breadboards are great for prototyping circuits or quickly testing new devices, I don't think they're a great solution for beginners wanting to learn how to program microcontrollers. They're also not great for building more permanent or reliable projects, including robots.
So, what could new learners use instead? How about a dedicated microcontroller circuit designed specifically to help beginners learn programming. What I have found is that using dedicated microcontroller circuits enables beginners to focus all of their efforts on developing their new programming skills, without the interruptions of simultaneously having to build, rebuild, and debug potentially unreliable breadboard circuits.
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 circuits designed to help my students learn to program microcontrollers more quickly and easily – after learning some electronic circuit fundamentals using breadboards. While many beginner circuits are by nature somewhat limited, I have tried to create beginner circuits using a modular design that allows the circuits to be assembled and used in multiple configurations.
These modular circuits don't need to have all of their components installed before new learners can start using them. Instead, learners can start programming after assembling a quicker-to-build, and lower cost subset of the full circuit. As they progress in their skills and abilities, learners can expand their circuit's feature set and capabilities by simply installing more groups of components.
Modular designs are great for classes and makerspaces too, since circuits can be assembled at a lower cost using only the parts required to achieve the learning goals, while their expandability allows the circuits to be customized for specific projects or to provide higher level opportunities for more advanced learners – all using the same common circuit, components, and lesson outlines!
Meet BEAPER Nano
When the Arduino Nano ESP32 was released and I saw that it combined a fast, powerful microcontroller, lots of memory, and built-in wireless capability in the tiny Nano form factor, I knew it would be a great microcontroller for many kinds of advanced circuit projects. When I found out that it could be programmed using both C/C++ and MicroPython, I knew it would also be an incredibly flexible and versatile microcontroller for use in education settings, too.
I soon set out to create a circuit both simple enough for beginners to use when starting to learn microcontroller programming, while simultaneously being versatile enough to support the more advanced capabilities of the Arduino Nano ESP32. To make initial circuit board assembly easy for novices, as well as to simplify the addition of more components as learners progressed, I chose to make the printed circuit board (PCB) a through-hole design. In addition to supporting typical beginner I/O devices, I also wanted it to be easy for beginners to make their circuit into a simple robot without having to buy or figure out how to connect external circuits and sensors. (More on that, later!) The result is BEAPER Nano, the Beginner Electronics And Programming Educational Robot for Arduino Nano ESP32.
BEAPER Nano Configurations
While you can choose to build your modular BEAPER Nano circuit any way you like, 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 Nano 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, line, and voltage sensors, as well as light, temperature, and position sensors for learning more advanced analog input and processing techniques. BEAPER Nano's components have been grouped into each of the 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 Arduino Nano ESP32
Robot starter configuration components
- battery and motor 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
- analog temperature sensor
- two rotary potentiometers
- two break-away optical floor and line sensor modules using LEDs and phototransistors
- voltage divider resistors used to sense the battery supply voltage
Expansion components
- four 3.3V analog/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 analog/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 Nano schematic for complete circuit details, as well as for reference and to see which components share I/O pins on the Arduino Nano ESP32.
Downloads
Supplies
Obtaining a BEAPER Nano PCB
Start by obtaining a bare printed circuit board (PCB). I've made the BEAPER Nano 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 Nano 1.0 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 Nano'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 Nano. Adding the Arduino Nano ESP32 header sockets and piezo beeper will be all that's needed for beginner 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 Nano, remember all of its electronic parts aren't typically 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 Nano parts list on the Digi-Key website.
BEAPER Bot – a simple, versatile robot
A circuit as flexible as BEAPER Nano 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 Nano, 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 Nano circuit snaps into, along with its gear motors, ball castor, and battery holder. Yes, snaps! All of the BEAPER Bot parts are designed snap together without 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 Nano PCB 180° before snapping it into its mount. The yellow robot featured in this tutorial is set up for rear-drive, and the blue 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 9, below.
Downloads
Installing the Education Starter Resistors and Pushbuttons
Do you have your BEAPER Nano 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 Nano, and the following steps include optional parts that may not be needed for your BEAPER Nano 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 Nano. To finish the education starter configuration, you will also need to install the user LEDs, piezo speaker, and the header socket strips for the Arduino Nano ESP32 – get the details on how to install the LEDs and piezo speaker in Step 3, and the Arduino 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 Nano 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 Arduino Nano ESP32 are installed and in the way.
Downloads
Installing the Robot Components
These components consist mostly of parts needed to make BEAPER Nano 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 analog/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
- 5.1kΩ 1%, 1/4W resistor
- 976Ω 1%, 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.
- Optional: install the voltage divider resistors if battery voltage sensing will be needed for your robot. Install and solder 5.1kΩ resistor R25, and 976Ω resistor R26.
- 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 Nano-based robot to detect the floor or a line. BEAPER Nano's on-board analog components are jumper-selectable. This allows either the ambient light sensor, temperature sensor, and two potentiometers (collectively named Enviro. for environmental sensors), or the robot floor sensor phototransistors and voltage divider resistors to be connected to the analog inputs of the Arduino Nano ESP32.
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
- MCP9700A temperature sensor
- 100nF capacitor
- 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.
- Optional: install the MCP9700A 3-pin temperature sensor U4 into the PCB, matching its shape to the silkscreen outline printed on the PCB. Install its 100nF decoupling capacitor, C5, and solder both components into place.
- 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 Nano 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 four, 3-pin sections from the 40-pin header strip to make 3-pin jumpers JP1-JP4. Insert the shorter, usually silver side of the header pins into the PCB and solder each of the pins into place. Tip: plug the 4-pin header socket on top of the four 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 analog/digital I/O headers of your BEAPER Nano 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 for the easiest way to mount an ultrasonic SONAR distance sensing module on 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 off 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 15-pin 2.54mm (0.1") header sockets
- 8-pin 2.54mm (0.1") header socket
- power switch
- two 10kΩ potentiometers
- Install and solder 15-pin header sockets J1 and J2 to hold the Arduino Nano ESP32.
- 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 solder with a no-clean flux).
Install ICs, Jumpers, and the Arduino Nano ESP32
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:
- four shorting jumper shunts
- 74HCT541 octal buffer IC
- SN754410NE quad half-H motor driver IC
- Arduino Nano ESP32 with headers
- Install jumper shunts onto the Enviro. pin positions of JP1-JP4 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.
- Align the header pins of the Arduino Nano ESP32 with headers J1 and J2, matching the triangular identification mark on the Arduino with the one on the BEAPER Nano PCB (the USB connector should be facing the piezo speaker), and carefully push it into place.
Important: ensure that both ICs are installed in their proper orientation, and that the BEAPER Nano PCB has been cleaned and thoroughly dried before proceeding to testing in the next step!
Test Your BEAPER Nano PCB
Are you ready to start learning programming, or eager to start making your robot? Let's test your BEAPER Nano PCB to ensure everything is working first. We'll start with the Arduino IDE software and a test program written in C/C++.
What you'll need:
- Arduino IDE 2.0 program for your operating system
- USB 2.0 Type-C cable to connect the Arduino Nano ESP32 to your computer
- BEAPER-Nano-Functionality-Test.ino C program (linked below)
- If you don't already have it, download and install the Arduino IDE for your operating system. The Arduino Nano ESP32 requires IDE 2.0 and higher versions to be used.
- Launch the Arduino IDE. First, check if your IDE has the support files for the Arduino Nano ESP32 installed. In the Boards Manager tab, search for 'nano ESP32 '. If the Arduino ESP32 Boards package is not shown as already having been installed, install it now.
- Download and open the BEAPER-Nano-Functionality-Test program (linked below) in the IDE.
- Connect the Arduino Nano ESP32 in your BEAPER Nano to your computer using the USB-C cable. From the board drop-down at the top of the IDE screen, select the Arduino Nano ESP32 connected to one of the USB ports of your computer.
- Click the Upload button (the right-facing arrow button) at the top of the IDE screen to compile the program and upload it to your BEAPER Nano. The program will start running as soon as the upload is finished (which may take a little while).
- Open the Serial Monitor by clicking on the icon that looks like a magnifier viewing a line of dots (at the top right of the IDE screen). Ensure the Serial Monitor tab (beside the Output tab, below the code editor) is selected, and the far right box is set to 115200 baud.
- A live print-out of the analog values being converted from the ambient light sensor, temperature sensor, and both potentiometers will appear in the Serial Monitor window at the bottom of the IDE screen. Cover or illuminate the ambient light sensor to watch its value change with the light level. Pinch the temperature sensor between your fingers and the temperature value should slowly increase. Turn each potentiometer shaft from one side to the other to change their values. A full sweep should produce values between 0 and 4095.
- 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. LED D4 should light and a tone should play continuously. SW4 is programmed to be a toggle button so you'll have to press it again to both turn off the LED and stop the tone.
- Press and release SW5 to cycle through the rainbow of colours from red, to yellow, green, aqua, blue, violet, and finally back to red on the Arduino Nano ESP32's built-in RGB LED.
If everything is working as it should be, you're ready to start learning programming or can continue to refine your programming skills using the features of the Arduino Nano ESP32 and the hardware on your BEAPER Nano!
If you're just starting to learn programming, take a look at the BEAPER Nano introductory programming activities on the mirobotech GitHub page. Or, maybe you'd like to try MicroPython programming? You can get started in the next step.
Downloads
Try MicroPython
If you're the type of person who thinks 'C' stands for challenging (instead of simply being the name of an old, yet still popular programming language), maybe you'll find MicroPython easier to use. MicroPython is a microcontroller-optimized version of the more modern and very popular Python programming language, with lots of powerful built-in functions, a simpler syntax than C, and a live REPL (short for read, evaluate, print, and loop) that acts kind of like the Arduino IDE's serial monitor, but with the ability to easily type in Python commands and set variables. Arduino makes it simple to get started programming the Arduino Nano ESP32 in MicroPython using the MicroPython installer and the new Arduino Lab for MicroPython IDE software.
What you'll need:
- Arduino MicroPython Installer program
- Arduino Lab for MicroPython IDE
- BEAPER-Nano-IO-Test.py program (linked below)
- Follow the step-by-step installation instructions in the Arduino MicroPython 101 course to install MicroPython onto your Arduino Nano ESP32. (Don't worry, it's easy to go back to C by following the instructions at the bottom of that same page if you're happier with curly braces and semi-colons than with spaces and colons!)
- Start Arduino Lab for MicroPython and open the BEAPER-Nano-IO-Test.py program.
- Connect the Arduino Nano ESP32 in your BEAPER Nano to your computer using a USB-C cable. Click the Connect button at the top of the Arduino Lab for MicroPython screen and select the USB device corresponding to your Arduino Nano ESP32.
- Click the Run button and the program should immediately start running. MicroPython is an interpreted language and the Arduino Nano ESP32 runs the MicroPython program directly, so there's no need to wait for the program to compile and upload as there is when using C!
While C programs typically use the standard Arduino Nano I/O pin names, MicroPython programs need to use the ESP32 microcontroller's actual I/O pin numbers instead. See the Arduino Nano ESP32 Cheat Sheet for details.
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 Nano will literally take your learning to the next level – and not just because it sits a level higher than the main BEAPER Nano 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.
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 Nano is disconnected from USB-C and its 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 Nano and gently insert the pins, making sure to align the LCD support and its machine screws with the LCD mounting holes in the BEAPER Nano PCB.
- Fasten the machine screws with nuts on the bottom side of the BEAPER Nano 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 be excited to test it out. Use the BEAPER-TFT-Analog-Bar-Graph C program shared on GitHub to visualize the Arduino Nano ESP32's analog inputs as bar graphs on the LCD display.
Downloads
Building a BEAPER Bot? 3D-print the BEAPER Bot Parts
BEAPER Nano was designed to be made 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 easiest. 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 mounting clips since these can easily be damaged. A variety of optional, extra servo holder designs are also included so you can mount 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 chassis 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 quickly and effortlessly 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 assemble your BEAPER Bot 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 blue, front-drive robot. The yellow robot pictured elsewhere in this tutorial is set up in a rear-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 to start with. You can always swap parts for different characteristics or for different robot 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 trying to push 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, 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 are, in what 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 become the back for this style of robot.
- Fish the battery holder wires to the back of your robot, so they can meet up with the motor wires, and then insert the battery holder into the open area 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 bottom 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 Optical Floor/line Sensor Modules
BEAPER Bot can mount one or both of BEAPER Nano's break-away optical sensor modules using its slide-in floor 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 Nano PCB, but for BEAPER Bot you'll need to break them away from the BEAPER Nano 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 Nano, they're also electrically connected to the on-board Arduino Nano ESP32 microcontroller's I/O pins. After breaking the sensor modules away from the main BEAPER Nano PCB, you'll have to re-connect them so that the circuit can power the LEDs and the Arduino Nano ESP32 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 Nano 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 downward-facing 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 that both components are 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, snap the right module's PCB into the second mount, slide the mount onto your BEAPER Bot, and solder the 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 Nano 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 Nano robot.
What you'll need:
- 4 AA batteries
- assembled BEAPER Nano PCB
- assembled BEAPER Bot robot and optical sensor modules
- small slot screwdriver
- Ensure the power switch on the BEAPER Nano PCB is in the off position and set the BEAPER Nano 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 Nano PCB over to allow access to the battery holder and install four AA batteries.
- Flip the BEAPER Nano 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 Nano. 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 as shown in the last two photos of the blue robot, above). 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.
Get Ready to Roll, and Some Extra Tips!
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 Nano (the ambient light sensor, temperature sensor, and both potentiometers) share Arduino Nano ESP32 analog input pins with the floor sensor phototransistors and the battery voltage divider circuit. If shorting jumper shunts were previously installed in the Enviro. position on the PCB to run the BEAPER-Nano-Functionality-Test programs in steps 6 or 7, 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, as well as the battery voltage divider (if its resistors were installed).
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-Nano-Functionality-Test program with both floor sensor modules connected and view the output in the serial monitor (for the C program) or the terminal (in MicroPython). 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 Nano 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 Arduino Nano ESP32. This means that while the power switch is in the off position any voltage applied to the Arduino through the USB connection can still power 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 Nano is powered off and has its USB-C cable is disconnected before inserting or removing the module.
Thanks!
Thank you for your interest in BEAPER Nano and BEAPER Bot! I hope you learned something new from this instructable, whether or not you choose to make BEAPER Nano or BEAPER Bot. Watch the mirobo.tech website for BEAPER Nano updates and new programming tutorials. I'd love to hear how you're using your BEAPER Nano, and I'd be happy to get your suggestions for improvements – you can contact me using the contact form on the website.