Skip to content

Commit

Permalink
Merge branch 'newbie-guide' of github.com:ut-ras/RobotathonESP32 into…
Browse files Browse the repository at this point in the history
… newbie-guide
  • Loading branch information
tguyenn committed Oct 22, 2024
2 parents c88de52 + 0221942 commit 1385109
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 35 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_assets/images/motor_with_external_power.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,18 @@ Warning: Be careful to not short (connect) a power pin directly to a ground pin.
{: .callout-toby}

## Powering the ESP32
You can power your ESP32 by 2 methods: battery pack or USB connection.
You can power your ESP32 by 2 methods: battery pack or laptop USB connection.

{: .highlight}
Note: Do NOT power your ESP32 through its 5V pin with the battery pack while simultaneously connecting it to your computer! This may irreversibly damage your devices (only do one power connection at a time).
{: .callout-toby}

<!-- Using the external battery pack is detailed in the [Actuators page](https://ut-ras.github.io/RobotathonESP32/sensors-and-actuators/actuators) because we will be using the motor driver's 5V output to power the ESP32. -->
### USB Connection Power
The USB connection to your computer is necessary for uploading and debugging your code through the serial monitor. It would be easiest to keep using the USB connection until later in the competition when testing the entire system.

### External Power Source

First we will go over using an external power source for the ESP32. For this competition, you will be able to control your robot with a wireless game controller to navigate around the field (sensor challenges should be completed autonomously). It would be impractical to power your ESP32 through USB-laptop connection on the field, so you will need a battery pack. We need to reduce the voltage of the battery pack (9V) down to a level the ESP32 can safely use (5V) through the buck converter.

Below are the steps to interface the buck converter to your microcontroller:

1.) Connect the red wire from the battery pack to the IN+ on the buck converter and the black wire from the battery pack to the IN- on the buck converter (convention dictates that red = hot wire and black = ground)

<img src="{{ '/_assets/images/buck_converter_part1.png' | prepend: site.baseurl }}" alt="buck_converter_part1.png">

2.) Grab a multimeter, put it into voltage reading mode, and attach the leads to OUT+ and OUT-. Adjust the small yellow screw on the buck converter until the multimeter reads a voltage of 5V.

<img src="{{ '/_assets/images/buck_converter_multimeter.png' | prepend: site.baseurl }}" alt="buck_converter_multimeter.png">

3.) Remove the multimeter leads and attach a red wire from the buck converter's OUT+ terminal to the ESP32's 5V pin. Attach a black wire from the buck converter's OUT- terminal to the ESP32's GND pin.

<img src="{{ '/_assets/images/buck_converter_power.png' | prepend: site.baseurl }}" alt="buck_converter_power.png">

### USB Connection

The USB connection to your computer is necessary for uploading and debugging your code through the serial monitor. It would be easiest to keep using the USB connection until later in the competition when testing the full system.

If you want to power your ESP32 while using a USB connection, **securely** place one of the battery leads to an unused row in your breadboard (like picture below).

<img src="{{ '/_assets/images/buck_converter_disable.png' | prepend: site.baseurl }}" alt="buck_converter_disable.png">

You should now be able use your USB connection safely!
Using the external battery pack is detailed in the [Actuators page](https://ut-ras.github.io/RobotathonESP32/sensors-and-actuators/actuators) because we will be using the motor driver's 5V output to power the ESP32.

If you want to know more about any features, feel free to ask a mentor or Google for more information :)

Expand Down
22 changes: 14 additions & 8 deletions docs/_sections/_guide-primaries/sensors-and-actuators/actuators.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ nav_order: 4

The word "actuators" is just a fancy word for "devices that create motion," which can include anything ranging from hydraulic pistons to motors. In our case, electric motors will be the key to your robot's motion! In this competition, you will be dealing with servo motors.

<!-- below text is now irrelevant because we are moving away from DC motors lol -->
<!--

# DC Motors
<img src="{{ '/_assets/images/dc_motor.jpg' | prepend: site.baseurl }}" alt="dc_motor.jpg" width="200" height="300">

Expand All @@ -30,20 +29,27 @@ A motor controller, such as the L298N, acts as an intermediary between the micro
The following information is an adapted version of [this guide.](https://lastminuteengineers.com/l298n-dc-stepper-driver-arduino-tutorial/)

# How to Use Motor and Motor Controller?

# Battery Pack Power
First we will go over using an external power source for the ESP32. For this competition, you will be able to control your robot with a wireless game controller to navigate around the field (sensor challenges should be completed autonomously). It would be impractical to power your ESP32 through USB on the field, so you will use a battery pack. We need to reduce the voltage of the battery pack down to a level the ESP32 can safely use through the motor controller's 5V voltage regulator.

Here is a diagram of how your circuit should look when using the battery pack (voltage regulator jumper needs to be in place to enable the motor controller's 5V output to the ESP32):
Here is a diagram of how your circuit should look when using the battery pack:

<img src="{{ '/_assets/images/external_ESP32_power.png' | prepend: site.baseurl }}" alt="external_ESP32_power.png">
<img src="{{ '/_assets/images/motor_controller_jumper.png' | prepend: site.baseurl }}" alt="motor_controller_jumper.png" width=400 height=400>
* Notice how the blue lines are shared between all components so that they have a common ground

However, if you want to be able to use your motors and plug your ESP32 into your laptop to use the serial monitor for debugging, then you'll have to change the wiring (or else you will fry your equipment!):

<img src="{{ '/_assets/images/motor_controller_with_usb.png' | prepend: site.baseurl }}" alt="motor_controller_with_usb.png">
* Note how the line from the motor controller's 5V line is now gone!

If you want to power your ESP32 and motors while using a USB connection, simply remove one battery from the battery pack (creates open circuit) and take out the voltage regulator jumper on the motor controller (will make 5V terminal receive input). You should now be able use your USB connection safely!
You should now be able use your USB connection safely!

{: .highlight}
Do NOT power your ESP32 through its 5V pin with the battery pack while simultaneously connecting it to your computer through USB! This may irreversibly damage your devices (only do one at a time).
{: .callout-toby}

To control a DC motor using the ESP32, a motor controller, and AA battery pack, you can connect them together as shown below:
To control a DC motor using the ESP32, a motor controller, and battery pack (**WITH USB CONNECTION**), you can connect them together as shown below:

<img src="{{ '/_assets/images/motor_with_external_power.png' | prepend: site.baseurl }}" alt="motor_with_external_power.png">

Expand Down Expand Up @@ -95,7 +101,7 @@ void loop() {
delay(1000); // Stop for 1 second
}
```
Again, more detailed information about the L298N motor controllers can be [found here!](https://lastminuteengineers.com/l298n-dc-stepper-driver-arduino-tutorial/) -->
Again, more detailed information about the L298N motor controllers can be [found here!](https://lastminuteengineers.com/l298n-dc-stepper-driver-arduino-tutorial/)

# Servo Motors

Expand Down Expand Up @@ -140,4 +146,4 @@ void loop() {
}
```

Simply input a different value in the ```write()``` function to change how the servo behaves! See [this official Arduino guide for more info](https://www.arduino.cc/reference/en/libraries/servo/write/)
Simply input a different value in the ```write()``` function to change how the servo behaves!

0 comments on commit 1385109

Please sign in to comment.