Nume proiect

Introducere

The project consists in building and programming a RC Car that will be controlled over Bluetooth Protocol. A mobile app will be used as a remote.

Descriere generală

Hardware Design

Components:

1 x Arduino UNO
1 x HC-05 Bluetooth Module
1 x Car chassis
4 x Wheels
4 x Gear Motor 5v
1 x L293D motor driver module
1 x Battery holder
2/4 x Accumulators/Batteries
N/A Jumpers

Software Design

The car is equipped with an Adafruit Motor Shield, which allows control of multiple motors simultaneously.

The code begins by including the necessary libraries. AFMotor is the library for controlling motors using the Adafruit Motor Shield, and SoftwareSerial is used for communication with the Bluetooth module.

Four motor objects are created using the AF_DCMotor class from the AFMotor library. These objects represent the individual motors connected to the motor shield. The parameters passed to the constructor specify the motor number and the frequency at which it operates.

In the setup() function, the serial communication with the Bluetooth module is initiated by calling bluetoothSerial.begin(9600). The baud rate is set to 9600, which should match the baud rate configured for the Bluetooth module.

The loop() function continuously checks if there is data available to be read from the Bluetooth module using bluetoothSerial.available(). If data is available, it is read using bluetoothSerial.read() and stored in the command variable.

After reading the command, the Stop() function is called to ensure that all motors are stopped before executing the new command.

Based on the received command, the code enters a switch statement to determine the action to be performed. If the command is 'F', the forward() function is called, which sets the motors to rotate forward. Similarly, for 'B', 'L', and 'R' commands, the back(), left(), and right() functions are called, respectively.

The forward() function sets the speed of all the motors to 255, which is the maximum velocity. Then, it calls the run() function for each motor with the FORWARD parameter, causing them to rotate in the clockwise direction.

Similarly, the back(), left(), and right() functions set the motors to rotate in the opposite directions, based on the desired movement.

This code allows an Arduino-controlled car to receive commands via a Bluetooth module and perform movements such as forward, backward, left, and right by controlling the motors connected to the Adafruit Motor Shield.

Rezultate Obţinute

Concluzii

Download

Jurnal

Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului.

Bibliografie/Resurse

Listă cu documente, datasheet-uri, resurse Internet folosite, eventual grupate pe Resurse Software şi Resurse Hardware.

Export to PDF

pm/prj2023/avaduva/rc_car.txt · Last modified: 2023/05/28 23:41 by radu.mitcan
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0