Skip to content

Latest commit

 

History

History
395 lines (304 loc) · 11.8 KB

File metadata and controls

395 lines (304 loc) · 11.8 KB

ESP32 Robot Car - Testing Guide

Pre-Testing Checklist

Before you begin testing, ensure all connections are properly made according to CONNECTIONS.md.

Hardware Checklist

  • All components are securely mounted on the chassis
  • All wire connections are secure and properly insulated
  • 12V battery pack is fully charged
  • ESP32 is powered via USB or 5V supply
  • All GND connections are common (shared ground)
  • Motors are properly connected to BTS7960 drivers
  • No loose wires or short circuits
  • HC-06 Bluetooth module LED is blinking (indicating it's powered and ready)

Software Checklist

  • Arduino IDE is installed with ESP32 board support
  • Code is uploaded to ESP32 successfully
  • Serial monitor shows "ESP32 Robot Car Starting..." message
  • Bluetooth device name "ESP32_RobotCar" is visible

Step-by-Step Testing Procedure

Step 1: Power On and Initial Check

  1. Power on the ESP32 via USB cable

    • Wait for the blue LED on ESP32 to indicate it's running
    • Open Serial Monitor (115200 baud) to see initialization messages
  2. Verify Serial Output

    • You should see: "ESP32 Robot Car Starting..."
    • Then: "Bluetooth device is ready to pair!"
    • Then: "Device name: ESP32_RobotCar"
    • Finally: "Setup complete! Waiting for Bluetooth commands..."
  3. Power on the 12V battery pack

    • Connect to B+ and B- terminals on both BTS7960 modules
    • Verify no sparks or unusual sounds
    • Check that motors don't move (they should be stopped)

Step 2: Bluetooth Pairing

  1. Enable Bluetooth on your smartphone/tablet

    • Go to Bluetooth settings
    • Make sure Bluetooth is turned on
  2. Scan for devices

    • Look for "ESP32_RobotCar" in the available devices list
    • If not visible, wait 10-20 seconds and scan again
    • Ensure HC-06 module LED is blinking
  3. Pair with the device

    • Tap on "ESP32_RobotCar"
    • Default pairing code is usually "1234" or "0000" (check HC-06 documentation)
    • If pairing fails, try both codes
  4. Verify connection

    • Once paired, the device should show as "Connected"
    • HC-06 LED should change from blinking to solid or slow blink

Step 3: Install Bluetooth RC Controller App

Recommended apps for Android:

  • Arduino Bluetooth Controller (by Mightyohm)
  • Bluetooth RC Controller (by SimpleSoft)
  • Bluetooth Terminal (for manual command testing)

For iOS:

  • LightBlue (for testing)
  • BLE Scanner (if using BLE)

Step 4: Configure App Button Mapping

Configure your Bluetooth RC app with the following button mappings:

Button/Control Command Function
Up Arrow / Forward F Move Forward
Down Arrow / Back B Move Backward
Left Arrow L Turn Left
Right Arrow R Turn Right
Up-Left Diagonal G Forward Left
Up-Right Diagonal 1 Forward Right
Down-Left Diagonal H Back Left
Down-Right Diagonal J Back Right
Center / Stop S Stop
Speed Slider 0% 0 Speed 0%
Speed Slider 10% (Note: '1' conflict) See note below
Speed Slider 20% 2 Speed 20%
Speed Slider 30% 3 Speed 30%
Speed Slider 40% 4 Speed 40%
Speed Slider 50% 5 Speed 50%
Speed Slider 60% 6 Speed 60%
Speed Slider 70% 7 Speed 70%
Speed Slider 80% 8 Speed 80%
Speed Slider 90% 9 Speed 90%
Speed Slider 100% q Speed 100%
Emergency Stop D Stop All

Note on Speed 10%: There's a conflict - '1' is used for both "Forward Right" movement and "Speed 10%". In the current implementation, '1' triggers Forward Right movement. To set speed to 10%, you can:

  • Use speed 0% (command '0') and then gradually increase
  • Modify the app to send a different character for speed 10%
  • Use the default speed (50%) which works well for most applications

Step 5: Basic Movement Testing

Important: Start with the car elevated (wheels off the ground) to prevent accidents.

  1. Test Stop Command

    • Send 'S' command
    • Verify all motors stop
    • Check Serial Monitor for "Motors Stopped" message
  2. Test Forward Movement

    • Send 'F' command
    • Verify both left and right motors rotate forward
    • Check Serial Monitor for "Moving Forward" message
    • Send 'S' to stop
  3. Test Backward Movement

    • Send 'B' command
    • Verify both motors rotate backward
    • Send 'S' to stop
  4. Test Left Turn

    • Send 'L' command
    • Verify right motors forward, left motors backward
    • Send 'S' to stop
  5. Test Right Turn

    • Send 'R' command
    • Verify left motors forward, right motors backward
    • Send 'S' to stop

Step 6: Diagonal Movement Testing

  1. Test Forward Left (G)

    • Send 'G' command
    • Verify right motors at full speed, left motors at reduced speed
    • Send 'S' to stop
  2. Test Forward Right (1)

    • Send '1' command
    • Verify left motors at full speed, right motors at reduced speed
    • Send 'S' to stop
  3. Test Back Left (H)

    • Send 'H' command
    • Verify right motors backward full, left motors backward reduced
    • Send 'S' to stop
  4. Test Back Right (J)

    • Send 'J' command
    • Verify left motors backward full, right motors backward reduced
    • Send 'S' to stop

Step 7: Speed Control Testing

  1. Set Speed to 0%

    • Send '0' command
    • Verify speed is set to 0%
    • Try moving forward - motors should not move
  2. Set Speed to 50%

    • Send '5' command
    • Verify Serial Monitor shows "Speed set to: 50%"
    • Send 'F' to move forward at 50% speed
    • Observe motor speed is moderate
  3. Set Speed to 100%

    • Send 'q' command
    • Verify Serial Monitor shows "Speed set to: 100%"
    • Send 'F' to move forward at full speed
    • Observe motors are at maximum speed
  4. Test Speed Changes During Movement

    • Start moving forward ('F')
    • Change speed to 30% ('3')
    • Verify motors slow down while still moving forward
    • Change speed to 80% ('8')
    • Verify motors speed up

Step 8: Emergency Stop Testing

  1. Test Emergency Stop (D)
    • Start any movement (e.g., 'F')
    • Send 'D' command
    • Verify all motors stop immediately
    • Verify Serial Monitor shows "Emergency Stop - All motors stopped"
    • Verify speed is reset to default (50%)

Step 9: Ground Testing

Now test with the car on the ground:

  1. Place car on smooth, open surface

    • Ensure there's enough space to move
    • Remove any obstacles
  2. Start with low speed

    • Set speed to 20% ('2')
    • Test forward movement ('F')
    • Verify car moves forward smoothly
    • Stop ('S')
  3. Test all directions

    • Forward, backward, left, right
    • Diagonal movements
    • Verify car responds correctly to all commands
  4. Test speed variations

    • Gradually increase speed from 20% to 100%
    • Verify smooth acceleration
    • Test at different speeds
  5. Test turning radius

    • Test left and right turns
    • Verify car can turn in place
    • Test diagonal movements for smooth cornering

Troubleshooting Guide

Problem: Motors Not Moving

Possible Causes:

  1. 12V battery not connected or discharged

    • Check battery voltage with multimeter (should be ~12V)
    • Verify B+ and B- connections on BTS7960 modules
    • Ensure battery is charged
  2. Enable pins not activated

    • Check that L_EN and R_EN pins are receiving HIGH signal
    • Verify GPIO connections to enable pins
    • Check Serial Monitor for movement commands being received
  3. Motor connections incorrect

    • Verify motors are connected to M+ and M- terminals
    • Check that motors are connected in parallel correctly
    • Test motors directly with battery to verify they work
  4. PWM signals not working

    • Verify PWM pins are connected correctly
    • Check Serial Monitor for PWM channel setup messages
    • Test with multimeter if PWM signals are present

Solution:

  • Double-check all connections per CONNECTIONS.md
  • Verify power supplies are working
  • Test each component individually

Problem: Motors Running in Wrong Direction

Possible Causes:

  1. Motor wires reversed on BTS7960
  2. Code logic reversed

Solution:

  • Swap M+ and M- connections on the affected motor driver
  • Or modify the code to reverse the direction in the movement functions

Problem: Bluetooth Not Connecting

Possible Causes:

  1. HC-06 not powered

    • Check VCC is connected to 3.3V (not 5V)
    • Verify GND connection
    • Check if LED is blinking
  2. Wrong baud rate

    • HC-06 default is 9600 baud
    • Verify code uses 9600 baud rate
    • Some HC-06 modules may need different baud rate
  3. Pairing code incorrect

    • Try "1234"
    • Try "0000"
    • Try "1111" or "1234"
  4. Device not in range

    • Ensure device is within 10 meters
    • Remove obstacles between devices

Solution:

  • Check HC-06 connections
  • Verify Serial Monitor shows Bluetooth initialization
  • Try unpairing and pairing again
  • Check HC-06 module documentation for default settings

Problem: Car Moves Too Fast/Slow

Solution:

  • Adjust speed using speed commands (0-9, q)
  • Modify default speed in code (change currentSpeed initial value)
  • Adjust PWM frequency if needed (currently 1000 Hz)

Problem: Diagonal Movements Not Smooth

Possible Causes:

  • Speed difference between sides too large
  • Motors not balanced

Solution:

  • Adjust speed ratio in forwardLeft(), forwardRight(), backLeft(), backRight() functions
  • Currently set to 50% reduction - try 30% or 40% for smoother movement

Problem: ESP32 Resets or Crashes

Possible Causes:

  1. Insufficient power

    • ESP32 needs stable 5V supply
    • USB cable may not provide enough current
    • Use quality USB cable and power adapter
  2. Short circuit

    • Check for loose wires touching
    • Verify no connections are reversed
  3. Overheating

    • Ensure proper ventilation
    • Check if motors are drawing too much current

Solution:

  • Use quality power supply for ESP32
  • Check all connections for shorts
  • Monitor Serial output for error messages

Problem: Commands Not Being Received

Possible Causes:

  1. Bluetooth not connected
  2. Wrong app or app not configured correctly
  3. Commands being sent as strings instead of single characters

Solution:

  • Verify Bluetooth connection status
  • Check Serial Monitor for "Received command: X" messages
  • Ensure app sends single ASCII characters, not strings
  • Test with Bluetooth Terminal app to send commands manually

Recommended Testing Sequence

  1. ✅ Power on and verify initialization
  2. ✅ Pair Bluetooth device
  3. ✅ Test stop command (S)
  4. ✅ Test forward (F) - wheels off ground
  5. ✅ Test backward (B) - wheels off ground
  6. ✅ Test left turn (L) - wheels off ground
  7. ✅ Test right turn (R) - wheels off ground
  8. ✅ Test speed control (0, 5, q)
  9. ✅ Test diagonal movements (G, 1, H, J)
  10. ✅ Test emergency stop (D)
  11. ✅ Ground test at low speed (20%)
  12. ✅ Ground test all movements
  13. ✅ Ground test at various speeds
  14. ✅ Final performance test

Safety Reminders

⚠️ Always test with wheels off ground first ⚠️ Start with low speeds ⚠️ Keep hands away from moving parts ⚠️ Ensure adequate space for testing ⚠️ Have emergency stop ready (D command) ⚠️ Disconnect power before making any wiring changes ⚠️ Monitor battery voltage - don't over-discharge


Performance Optimization

After initial testing, you may want to adjust:

  1. Default Speed: Modify currentSpeed initial value in code
  2. PWM Frequency: Adjust PWM_FREQUENCY if motors are noisy
  3. Diagonal Speed Ratio: Adjust speed reduction in diagonal movement functions
  4. Response Time: Adjust delay in main loop if needed

Next Steps

Once testing is complete:

  • Fine-tune speed settings for your application
  • Adjust movement patterns if needed
  • Add any custom features or modifications
  • Document any changes made for future reference