Skip to content

TimHanewich/PYPER

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PYPER - Python-Based 3D-Printed Electric Rover

pyper PYPER is a Python-based, 3D-Printed, Electric Rover.

I designed PYPER from scratch from the ground up - I used Blender for 3D-modeling of the chassis, steering mechanism, and drivetrain, printed the parts on my Creality Ender 3 3D Printer, designed the electrical circuitry, and wrote the code that coordinates its driving mechanics.

The project is fully open source under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license. The source code that runs on an onboard Raspberry Pi is available here and the 3D-printed parts (.stl files) can be found on Thingiverse here.

PYPER Specifications

  • Weight, fully assembled: 23g
  • Dimensions: 173x213x76 mm (WxLxH)
  • Gear Ratio: PYPER uses a 48:1 TT motor (please note that, while the title of this product on Amazon states it is a 1:48 ratio, it is actually a 48:1 (reduction) gear ratio) against a 4:5 3D-printed compound gear system I developed. This graphic helped me calculate this ratio:
    • Teeth on motor gear (gear attached to TT motor, receiving rotational input): 15
    • Teeth on mid-axle gear (intermediary between motor gear and final drive shaft): 24
    • Teeth on drive shaft gear: 12
    • Motor Gear to Mid-Axle Gear ratio (driven / driving) = 24/15 = 24:15
    • Mid-Axle Gear to Drive Shaft Gear ratio (driven / driving) = 12/24 = 12:24
    • Ratio of PYPER's 3D-printed combined gear system = 24/15 * 12/24 = 288/360 = 4/5 = 4:5
      • This can be interpretted as: for every 4 turns the motor gear makes (powered by the motor), the final drive shaft will rotate 5 times.
      • Thus, PYPER's gear system actually speeds up the TT motor (gains speed, loses torque) a little bit.
    • Altogether, combining the 48:1 ratio of the TT motor against the 4:5 ratio of PYPER's fixed 3D-printed gear system, PYPER has a 192:5 gear ratio.
      • This means that pairing PYPER's 3D-printed gear system to the TT motor speeds up the TT motor slightly, gaining speed, but losing torque (going from gear ratio of 48.0 to 38.4).

Why I Designed PYPER

I built PYPER to demonstrate the essential components required to build a basic RC car: a steering mechanism and a mid-mounted motor delivering power to the rear wheels through a multi-gear drivetrain. While many other models you can find online are very impressive, they tend to be overly complex and advanced, posing challenges for beginners to mechanical engineering to understand.

In contrast, PYPER is intentionally designed to be straightforward, accessible, and approachable for anybody. So, for the sake of learning, I describe PYPER and its systems (steering, drivetrain, code, etc.) below in detail.

I hope you can learn from PYPER and uses these ideas in your own projects.

How to Assemble PYPER

You can watch the video below to see PYPER being built from the 3D-printed parts below, from the ground up. Click the image below to watch! pyper vid

Parts List: What You Need to Build PYPER

PYPER is fully open source, everything you need to build one is available here. These are the parts used in PYPER, if you choose to build a PYPER yourself or repurpose these ideas in your own design:

Part Cost (USD)
~110g of PLA filament (20% infill used) $1.76
1 Raspberry Pi Pico W $6
1 SG90 Servo Motor $1.88
1 TT Motor $1.47
1 1S Lithium Polymer Battery $6.42
1 MT3608 DC-DC Boost Converter $0.90
8 MR115-2RS (5x11x4mm) Bearings $4.27
1 L293D DC Brushed Motor Driver $1.25
1 Small Breadboard $1.71
22 M2 and M3 Screws, Bolts, Washers (see below) < $2.00
Misc Wires < $1.00

Part costs to build PYPER: roughly $28.66.

PYPER's 3D-Printed Parts Explained

All of the 3D-printed parts needed to make PYPER are available on Thingiverse for free. Each part and its role is described below:

Image Part Function Role
img base.stl chassis The platform everything is built on top of
img wheel_front.stl chassis The two front wheels to the rover. PYPER's design requires two of these.
img wheel_rear.stl chassis The two rear wheels to the rover. PYPER's design requires two of these.
img hubcap_front.stl chassis Hubcap for the front wheels. PYPER's design requires two of these.
img hubcap_rear.stl chassis Hubcap for the rear wheels. PYPER's design requires two of these.
img steering_upright_right.stl steering Mounting the front right wheel to this allows the wheel to "pivot" to accommodate a steering angle, controlled by the servo
img steering_upright_left.stl steering Mounting the front left wheel to this allows the wheel to "pivot" to accommodate a steering angle, controlled by the servo
img tie_rod.stl steering Ties the two steering uprights together, mechanically linking them together with the servo, allowing the servo to manipulate the uprights
img tt_frame.stl drivetrain A frame that fits around the TT motor so it can be mounted to the chassis (base)
img motor_gear.stl drivetrain Fits snuggly around the TT motor's axle, transferring its torque into the drivetrain. PYPER's design requires two of these.
img mid_axle_gear.stl drivetrain Meshes against the motor_gear.stl, being driven by the motor gear. PYPER's design requires two of these.
img mid_axle.stl drivetrain Serves to hold two mid axle gears in place along their axis, allowing them to spin freely. I recommend printing this at 100% infill to make it stronger. I have had issues with it snapping at 20% infill.
img mid_axle_mount.stl drivetrain Holds the mid_axle.stl in place securely, allowing the mid axle gears to mesh with both the motor gears and drive axle gears. PYPER's design requires two of these.
img drive_axle_gear.stl drivetrain Meshes against the two mid_axle_gear.stl, transfering torque to the final drive, turning the rear wheels. PYPER's design requires two of these.
img drive_axle.stl drivetrain Final drive axle. Transfers torque from the two drive_axle_gear.stl to the rear wheels, moving the rover forward or backward
img bearing_mount.stl drivetrain Holds the drive_axle.stl in place, meshing with the two mid_axle_gear.stl, and allowing it to spin freely while also supporting the weight of the chassis. PYPER's design requires two of these.

Visual Depictions of PYPERS Components

steering system drivetrain: motor mount drivetrain: Mid Axle drivetrain: Final Drive These visualizations can be found in this PowerPoint deck.

Post-Printing

  • You will need to insert a MR115-2RS (5x11x4mm) bearing into the following parts after printing. Each part is designed to accept the bearing with little friction, but you may need to use a mallet/hammer to bang the bearing in.
    • mid_axle_gear.stl
    • bearing_mount.stl
    • wheel_front.stl
  • After printing the gears, you may need to slightly sand down some of the teeth of each gear so they mesh well against one another.

Screwing the 3D-Printed Parts Together

Metric screws are used in PYPER's design due to their wide availability, precision, and compatibility. The holes cut into the 3D-printed parts will fit are all intended for metric screws.

These are how many of each metric screw specification you'll need:

Size (width*length) Count
M3*30mm 4
M3*12mm 2
M3*8mm 4
M2*12mm 4
M2*8mm 6
M2*6mm 2

These are the specific needs for these screws in PYPER's design:

  • 2 M3*30mm for steering uprights
  • 2 M3*12mm for steering uprights
  • 2 M3*8mm for screwing front wheels in
  • 4 M2*12mm for screwing in final drive bearing mounts
  • 4 M2*8mm for screwing in mid axle mount
  • 2 M3*30mm for screwing TT motor into TT frame
  • 2 M3*8mm for screwing TT frame into base
  • 2 M2*6mm for screwing in rear wheels
  • 2 M2*8mm for screwing in SG90 servo to frame

Wiring up the Electronics

PYPER uses:

  • A 1S (1 cell) Lithium Polymer battery (but this can be swapped with any battery < 5V that can provide enough current to power these electronics, which is minimal)
  • A MT3608 DC-DC converter to step up the 3.2-4.2 nominal volts of the 1 cell battery to a stable 5V
  • An L293D brushed DC motor driver for controlling the application of electricity to the motor via the Raspberry Pi's GPIO pins
  • A 1:48 gear ratio TT motor to turn the rear wheels, moving it forward or backward
  • An SG90 servo to actuate a steering angle
  • A Raspberry Pi Pico W to serve as "the brain", driving PYPER around according to requests

The components should be wired together as depicted in this wiring diagram below: wiring

The draw.io wiring diagram can be found here, if you'd prefer to pull up a higher-resolution version.

Driving PYPER: Software

PYPER is drivable via an onboard Raspberry Pi Pico W which runs a web server on your local network and receives movement commands via HTTP requests. PYPER's software is written in MicroPython and is available in the src folder here.

Before deploying this code to your own Raspberry Pi Pico W, you will need to configure a few variables in the settings.py module:

  • wifi_ssid: The SSID (username) of your wifi network. The Raspberry Pi Pico will use this to connect to your wifi network and receive movement instructions via HTTP requests.
  • wifi_password: The password to your wifi network. The Raspberry Pi Pico will use this to connect to your wifi network and receive movement instructions via HTTP requests.
  • gp_steering: Set this to the GPIO pin (GP number, not pin number) that you are using to control the servo via the servo's signal wire. If you used the same GP pin that I used in my code, this does not need to be changed.
  • gp_safety: Set this to the GPIO pin (GP number, not pin umber) that you have connected to the top-left pin of the L293D motor driver; this serves as the "safety" input (for the L293D to give any power to the motor, this must be set to a high state). If you used the same GP pin that I used in my code, this does not need to be changed.
  • gp_i1: Set this to the GPIO pin (GP number, not pin number) that you are using to control one of the motor inputs (see wiring diagram). If you used the same GP pin that I used in my code, this does not need to be changed.
  • gp_i2: Set this to the GPIO pin (GP number, not pin number) that you are using to control the other motor input (see wiring diagram). If you used the same GP pin that I used in my code, this does not need to be changed.

With the contents of the src folder loaded onto a Raspberry Pi Pico W (programs like Thonny or rshell can be used for this), once the Raspberry Pi Pico W is powered up, it will immediately begin to execute the code in the main.py module. Once the onboard LED of the Raspberry Pi Pico W goes solid, this indicates it is ready to operate!

Drive Mode

PYPER has two operation modes: HTTP mode and UDP mode. You can change which mode PYPER is in by changing the operation_mode variable in the settings.py module. 0 = HTTP mode, 1 = UDP mode.

Both operation modes are described in separate documention:

Clips from Development

I routinely took small clips during PYPER's development, demonstrating each part of the design. I'm listing them here for learning purposes, in case you want to study a specific piece:

To include in project on Thingiverse:

  • hardware
    • Total grams of filament used
    • Car weight
    • Car top speed @ 6v?
    • Cost estimate w/ parts and filament
    • All individual parts and full assembled STL
      • And how many of each part you will need to print to make the full thing
    • Video putting it together?
    • Dimensions
    • Pictures of fully assembled
    • Video of it working
    • Explanation of each part. i.e. compare front + rear hub cap differences
    • Why I made this: basic fundamentals of driving
    • The type of steering system it uses
    • Wiring diagram is supplied as draw.io (and add picture to readme)
  • software
    • how the code works
    • rover control method (HTTP requests)