Arduino-robot using the G-sensor on your smartphone

Manage the Arduino-robot using the G-sensor on your smartphone


In this article you will learn how to use this service RemoteXY very easy to set up a remote control robot platform or two motors car. The robot we will manage with the control element "joystick" that can work with G-sensor of your smartphone. At the end you will find the video and can see what we've got.

1387




We have assembled a very simple two-wheeled platform that would show you how to build a remote control system. The platform consists of the following components (we do not claim the workmanship, the platform is assembled to demonstrate the capabilities of the resource RemoteXY):
  • Сhassis - we excised from its sheet material;
  • The front wheel - wheel turns 360 degrees;
  • Gear motors 2 pcs.;
  • Wheel, with the axis suitable for geared motors 2 pcs. Wheels we bought together with geared motor;
  • Battery compartment with a switch on the 4th AA type batteries;
  • Arduino, we used all the same clone Seeeduino;
  • Bluetooth HC-06 module;
  • Motor driver chip L298N;
Electrical wiring and all modules machines represented in the following figure.

Management program

Use editor of this resource and construct the following interface control:
Set in the middle of the screen "joystick". In the properties of the joystick to select additional control "Enable G sensor". Select the switch position G-Sensor "bottom-left". The same settings can change the color to red. In the future, we will be a joystick to control the movement of the machine.
Set "Switch." Put it to the left of the joystick. You can also change its color. Switch, we will drive the LED on the Arduino board at pin 13.
If you did everything right, you should have roughly the management interface:

In the project settings, select the target platform, for which we get the source code: "Arduino (SoftwareSerial), library version". Push the button "Get the code" and download the source code on your computer. By link download library RemoteXY and install it in the Arduino IDE.
Open the downloaded sketch in the IDE Arduino. Perfect sketch compiles without errors. However, it certainly is no code to manage our machine. Our task is to corrected this code. For correct, we will use the downloaded example.
Pay attention to the definition of the structure RemoteXY in the sketch of project. The structure contains fields that fully comply with the established controls on the user interface. We see the variables joystick_1_x and joystick_1_y, reflecting the x and y coordinates of joystick, as well as variable switch_1, reflecting the switch.



Commentaires

Posts les plus consultés de ce blog

Suiveur De Ligne avec Arduino