กลับไปหน้ารวมไฟล์
4wd-rover-with-sonar-mega-rf24-l298nw-self-drive-mode-45850b-en.md

It has a sense of humor, or it's just not "smart enough"

Smart Rover

This rover is controlled with Radio transceivers.

The RF24 has a frequency of 2.4 GHz, which can interfere with a wireless mouse, Wifi, or other sources, so I have done my best to provide code and instructions on how to improve or optimize the best signal for maximum distance.

For example, the the code we set the PA level to HIGH or higher, and I included the channel, custom pipe numbers and the defining the data rate is essential for a reliable connection. The code is as raw as I could get it for beginners.

The RF24 with the antenna reaches up to 100m, I soldered a 10uF capacitor between VCC and GND on it, or you can buy the RF24 adaptors if desired.

DO NOT WIRE THE VCC PIN TO 5V, YOU WILL BLOW IT.

If you buy the adaptor, you can wire to 5V.

The 10uF capacitor works well with 3V input, and should provide a clear signal.

RF24 Adaptor, allows for 5 V input

RF24L01 - You can leave the IRQ pin disconnected

SPI pins for the RF24

These are the pins that I used for the rover. You can see each one defined in the code.

Arduino Mega pins, all are digital except ENA and ENB are PWM pins (speed control)

I purchased a smart car which included a frame for the servo. The code was difficult to decipher, so I broke it down for beginners.

Ultrasonic Servo Wiring

The L298N motor drivers have a maximum input voltage of 47V.

This project uses 6V gear motors, with two 3.7V 18650 batteries for each driver.

The L298N batteries can handle a maximum input voltage of 47 V.

Meaning if you build this rover, you can buy your own motors, wheels, and ramp up the voltage as desired. Making this project easy to upscale.

Close up of L298N pinout, notice I have grounded the L298N's to the Mega as well.

The controller sends and receives data provided in the code.

Enjoy building your own now.

Controller Wiring

I am still updating the page for this project.

But the code will do everything you need it to with at least one button and one joystick.

Remote control Radar, which also can be attached to a rover, or any vehicle.

nRF24L01, L298N, Arduino Mega, Arduino Nano, HC-SR04 Ultrasonic Sensor, Remote control. Which can also be found on my other tutorial if you want to make your own remote control.

EXPANDED TECHNICAL DETAILS

System Architecture & Communication

This rover utilizes a dual-node RF24 (nRF24L01+) communication link. The remote controller sends X and Y axis data (or button commands), which the Arduino Mega on the rover decodes to calculate motor speeds.

  • NRF24L01+ Optimization: Operates at 2.4GHz with Enhanced ShockBurst™ technology. The Mega handles the protocol, ensuring multi-byte packets are received with CRC checks.
  • L298N Motor Driver: Interfaces between the high-current DC motors and the Mega. It uses PWM signals to control speed and digital pins to control direction (H-Bridge logic).

Self-Drive Logic (Autonomous Mode)

When switched to Self-Drive mode, the HC-SR04 Ultrasonic Sensor acts as a primary radar.

  1. Scanning: The sensor pulses and measures the time-of-flight.
  2. Decision Matrix: If an obstacle is detected within a threshold (e.g., 20cm), the rover halts, reverses slightly, scans left and right to find the clearest path, and then proceeds.
  3. Mega Performance: Using the Arduino Mega allows for a large number of I/O pins, facilitating the inclusion of multiple sensors and telemetry feedback simultaneously.

ข้อมูล Frontmatter ดั้งเดิม

title: "4WD Rover with Sonar, Mega, RF24, L298N(W/ SELF DRIVE MODE)"
description: "Using an RF24 to send and receive data to control a 4WD rover with radar. With Automation Code is easy even for beginners!"
author: "Gallax"
category: ""
tags:
  - "arduino mega"
  - "rover"
  - "ultrasonic sensor"
  - "radar"
  - "l298n"
  - "nrf24l01"
  - "button"
  - "4wd"
  - "hc-sr04"
  - "remote control"
  - "rf24"
views: 4111
likes: 0
price: 3450
difficulty: "Intermediate"
components:
  - "1x Resistor 1k ohm"
  - "2x Dual H-Bridge motor drivers L298"
  - "1x Tactile Switch, Top Actuated"
  - "2x Analog joystick (Generic)"
  - "1x 9V battery (generic)"
  - "3x Battery Holder, 18650 x 2"
  - "1x Jumper wires (generic)"
  - "4x DC Motor, 12 V"
  - "1x Multitool, Screwdriver"
  - "1x Ultrasonic Sensor - HC-SR04 (Generic)"
  - "1x Arduino Mega 2560"
  - "1x Arduino Nano R3"
  - "6x Battery, 3.7 V"
  - "2x nRF24 Module (Generic)"
tools: []
apps:
  - "1x Processing"
  - "1x Arduino IDE"
downloadableFiles: []
documentationLinks: []
passwordHash: "9a6f6ae518bc7b282e492deaa5df19a4af7ae709d9ad74fc73c948f1035482e3"
encryptedPayload: "U2FsdGVkX1/ipdICvfwWt1lthBeDPszFmUEgXzNV03yt5+rTdlVGW3eurHQXW0OGr+3KEOBi/9RWKLf9x2d84r3S+Wz+Pj0amH17giFzA+m1eGyx1R+ei/4WXObUjiSL"
seoDescription: "Build a 4WD Rover with RF24, Mega, and Radar. Features SELF DRIVE MODE and beginner-friendly Automation Code."
videoLinks:
  - "https://www.youtube.com/embed/It5hKAz_BGQ"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/4wd-rover-with-sonar-mega-rf24-l298nw-self-drive-mode-45850b_cover.jpg"
lang: "en"