Skip to content

WilliamDemirci/Arduino-4WD-Mecanum-controlled-by-Android-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino 4WD Mecanum controlled by Android app

Arduino 4WD Mecanum controlled by an Android app using an Arduino Mega 2560, a L293D motor shield and a HC-05 Bluetooth Module.

Application

The APK of the application can be downloaded here APK.
Get it on Google Play

How to use the application?

  1. Switch on the Arduino and the HC-05 Bluetooth module.

  2. On your smartphone, scan the available Bluetooth devices and associate with the HC-05 Bluetooth module with the default password "1234".

  1. Install and start the application. Link of the APK

  2. Select the HC-05 Bluetooth module.

  1. Have fun!

The application contains:

  • A joystrick and two buttons to control the robot
  • A seekbar to control speed
  • A switch in the top left to switch to night mode
  • A button to disconnect from the robot

Arduino

Bluetooth wiring

Don't forget to cross RX and TX!

Motor shield wiring (L293D)

How is the robot controlled?

Frame format

The frames are in the following form: sxxyyy
- "s" for "start" allows us to know when a frame starts
- "xx" is the value of the movement performed by the user. For example, if the joystick is pushed forward to go straight, the movement will be "03".
- "yyy" is the value of the speed chosen by the user. For example, if the speed is at maximum, the value will be "255".

For this example, the final result is as follows: s03255

To summarize: 1 header letter + two movement digits + three speed digits

How to use the application on another robot?

  1. Retrieve the data received by Bluetooth and separate them if necessary


    receivedData = Serial1.readStringUntil('s'); // split received data into frames delimited by a 's'
    move = receivedData.substring(0,2).toInt(); // split two first digits to get movement value
    speed = receivedData.substring(2,5).toInt(); // split three last digits to get speed value

  2. Perform the processing according to the data received.


    For example:
    moveRobot(move, speed);

Author

WilliamDemirci

License

MIT License. See the LICENSE file for details.

Other

Feel free to contact me if I can optimize the code or if there is an errorr. I'm a newbie. Thank you!