» Electronics » Arduino »Android Arduino Bluetooth Car

Android Arduino Bluetooth Car


This robot controlled by bluetooth smartphone. The accelerometer of the smartphone measures the angle of the phone to the left / right, up / down, uses this data to calculate the speed of directional engines, the data is transmitted via Bluetooth to Arduino
What you need to build a robot.

Arduino uno, HC-06 Bluetooth Module, two 300 RPM 12v gear motors, H-bridge L298N Dual H Bridge Motor Controller
12 to 1.3 A lead acid battery. Each engine consumes 0.4A, plus the consumption of driver logic. Arduino wires, ordinary 9v batteries and a connector for connecting the battery to the Arduino. Electrical wires for connecting electric motor drivers. Usb cable. Phone with Android version 4 and higher. 4 swivel 50mm rubber wheels from Screwfix or Toolstation; Two Lynxmotion HUB-02 universal hubs.



The case is assembled from plastic 22 cm long and 17 cm wide. Two motors must be connected to the shaft and secured with a threaded pin.

Front wheels
The rubber is removed from the rollers and two holes are drilled in them in accordance with the holes on the hubs. The hubs are fixed on the axes passing through the housing with threaded pins. After that, the rollers are fixed on the hubs, and rubber is put on them.


Rear wheels



The rear wheels are simply unscrewed from the hinge and secured through holes drilled in the housing.

Electrical Connections.

code for arduino [926 b] (downloads: 404)

There will be problems loading the program code in Arduino. This is due to the fact that the Bluetooth module, its RX \ TX contacts, are connected to the Arduino pins 1 and 2, which are also used to transfer data via USB. It is necessary to change the contacts 1 and 2 to 11 and 12 in the connected library, which will be used for data transfer.



The motor driver does not need a separate power supply for the logic. 12V is enough to power the driver logic and the motor itself. The minus of the battery should be connected with both the Arduino and the motor driver. ECA / 5V and ENB / 5V motor driver contacts can be jumpered. It must be removed before connecting to the Arduino. Nothing should be connected to the two 5V pins.

Android code.

The attached file must be unpacked and imported into Android Studio, pack it in apk and install on the phone.

code for android [5.28 Mb] (downloads: 477)

Key files:
Paired Devices Activity:
deviceList.java
activity_device_list.xml
LED and Motion Control Activity:
ledControl.java
activity_led_control.xml
Manifest:
AndroidManifest.xml
Paired Devices Activity shows available Bluetooth devices. As soon as the devices are connected, control is transferred to the LED and Motion Control Activity.
The on / off buttons send an “on” or “off” message to the Arduino, turning the built-in LED on or off. The phone’s accelerometer, which transmits x / y values ​​from the sensor, each time these values ​​change, controls the movement. Based on this, Arduino calculates the speed and direction of rotation of the motors in the range from 0 to 255. It transmits these Arduino values ​​in the form of 'L-255:' or 'R100', etc. Based on this, the Arduino sends the rotation speed commands of the left engine to ENA, the right one to ENB and changes the direction of rotation by changing the polarity to IN1, IN2 for left, N3 and N4 for right engines.
0
0
0

Add a comment

    • smilesmilesxaxaokdontknowyahoonea
      bossscratchfoolyesyes-yesaggressivesecret
      sorrydancedance2dance3pardonhelpdrinks
      stopfriendsgoodgoodgoodwhistleswoontongue
      smokeclappingcraydeclarederisivedon-t_mentiondownload
      heatirefullaugh1mdameetingmoskingnegative
      not_ipopcornpunishreadscarescaressearch
      tauntthank_youthisto_clueumnikacuteagree
      badbeeeblack_eyeblum3blushboastboredom
      censoredpleasantrysecret2threatenvictoryyusun_bespectacled
      shokrespektlolprevedwelcomekrutoyya_za
      ya_dobryihelperne_huliganne_othodifludbanclose

We advise you to read:

Hand it for the smartphone ...