Mind Control Car!!!
This is a startup project for beginners. This is a really easy project that requires fewer parts.
Components and supplies
1
Arduino UNO
1
Wire, Flexivolt-E
1
4xAA battery holder
1
SparkFun Full-Bridge Motor Driver Breakout - L298N
4
DC Motor, 12 V
1
USB-A to B Cable
40
Male/Female Jumper Wires
1
HC-05 Bluetooth Module
Tools and machines
1
Soldering iron (generic)
1
Solder Wire, Lead Free
1
Solder Flux, Soldering
1
Multitool, Screwdriver
1
Tape, Electrical
Apps and platforms
1
Arduino Web Editor
1
Arduino IDE
Project description
Code
Mind_controlled_G-sensor_car.ino
arduino
1/* 2 3 This source code of graphical user interface 4 has been generated automatically by RemoteXY editor. 5 To compile this code using RemoteXY library 2.3.3 or later version 6 download by link http://remotexy.com/en/library/ 7 To connect using RemoteXY mobile app by link http://remotexy.com/en/downloadr/ 8 - for ANDROID 4.1.1 or later version; 9 - for iOS 1.2.1 or later version; 10 This source code is free software; you can redistribute it and/or 11 modify it under the terms of the GNU Lesser General Public 12 License as published by the Free Software Foundation; either 13 version 2.1 of the License, or (at your option) any later version. 14*/ 15 16////////////////////////////////////////////// 17// RemoteXY include library // 18////////////////////////////////////////////// 19 20// RemoteXY select connection mode and include library 21#define REMOTEXY_MODE__SOFTSERIAL 22#include <SoftwareSerial.h> 23 24#include <RemoteXY.h> 25 26// RemoteXY connection settings 27#define REMOTEXY_SERIAL_RX 2 28#define REMOTEXY_SERIAL_TX 3 29#define REMOTEXY_SERIAL_SPEED 9600 30 31 32// RemoteXY configurate 33#pragma pack(push, 1) 34uint8_t RemoteXY_CONF[] = 35 { 255,3,0,0,0,67,0,8,13,4, 36 5,48,60,14,30,30,0,2,26,31, 37 2,0,9,6,22,11,0,2,26,31, 38 31,79,78,0,79,70,70,0,131,1, 39 7,23,23,8,1,2,31,73,110,100, 40 105,97,110,0,131,0,14,31,33,8, 41 2,2,31,76,105,102,101,104,97,99, 42 107,101,114,0 }; 43 44// this structure defines all the variables of your control interface 45struct { 46 47 // input variable 48 int8_t joystick_1_x; // =-100..100 x-coordinate joystick position 49 int8_t joystick_1_y; // =-100..100 y-coordinate joystick position 50 uint8_t switch_1; // =1 if switch ON and =0 if OFF 51 52 // other variable 53 uint8_t connect_flag; // =1 if wire connected, else =0 54 55} RemoteXY; 56#pragma pack(pop) 57 58///////////////////////////////////////////// 59// END RemoteXY include // 60///////////////////////////////////////////// 61 62#define PIN_SWITCH_1 13 63 64//define right motor control pins 65#define right_motor_A 8 66#define right_motor_B 9 67#define right_motor_speed 11 //enable pin 68 69//define left motor control pins 70#define left_motor_A 6 71#define left_motor_B 7 72#define left_motor_speed 10 //enable pin 73 74//define two arrays with a list of pins for each motor 75uint8_t RightMotor[3] = {right_motor_A, right_motor_B, right_motor_speed}; 76uint8_t LeftMotor[3] = {left_motor_A, left_motor_B, left_motor_speed}; 77 78//speed control of motors 79void Wheel (uint8_t * motor, int v) // v = motor speed, motor = pointer to an array of pins 80{ 81 if (v > 100) v=100; 82 if (v < -100) v=-100; 83 if (v > 0){ 84 85 digitalWrite (motor [0], HIGH); 86 digitalWrite (motor [1], LOW); 87 analogWrite (motor [2], v * 2.55); 88 } 89 else if ( v<0 ){ 90 91 digitalWrite (motor [0], LOW); 92 digitalWrite (motor [1], HIGH); 93 analogWrite (motor [2], (-v) * 2.55); 94 } 95 else{ 96 digitalWrite (motor [0], LOW); 97 digitalWrite (motor [1], LOW); 98 analogWrite (motor [2], 0); 99 } 100} 101 102 103void setup() 104{ 105 RemoteXY_Init (); 106 107 pinMode (PIN_SWITCH_1, OUTPUT); 108 109 //initialization pins 110 pinMode (right_motor_A, OUTPUT); 111 pinMode (right_motor_B, OUTPUT); 112 pinMode (left_motor_A, OUTPUT); 113 pinMode (left_motor_B, OUTPUT); 114 115} 116 117void loop() 118{ 119 RemoteXY_Handler (); 120 121 digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1==0)?LOW:HIGH); 122 123 //manage the right motor 124 Wheel (RightMotor, RemoteXY.joystick_1_y - RemoteXY.joystick_1_x); 125 Wheel (LeftMotor, RemoteXY.joystick_1_y + RemoteXY.joystick_1_x); 126 127 128} 129
Mind_controlled_G-sensor_car.ino
arduino
1/* 2 3 This source code of graphical user interface 4 has 5 been generated automatically by RemoteXY editor. 6 To compile this code using 7 RemoteXY library 2.3.3 or later version 8 download by link http://remotexy.com/en/library/ 9 10 To connect using RemoteXY mobile app by link http://remotexy.com/en/downloadr/ 11 12 - for ANDROID 4.1.1 or later version; 13 - for 14 iOS 1.2.1 or later version; 15 This source code is free software; you can redistribute 16 it and/or 17 modify it under the terms of the GNU Lesser General Public 18 License 19 as published by the Free Software Foundation; either 20 version 2.1 of the License, 21 or (at your option) any later version. 22*/ 23 24////////////////////////////////////////////// 25// 26 RemoteXY include library // 27////////////////////////////////////////////// 28 29// 30 RemoteXY select connection mode and include library 31#define REMOTEXY_MODE__SOFTSERIAL 32#include 33 <SoftwareSerial.h> 34 35#include <RemoteXY.h> 36 37// RemoteXY connection settings 38 39#define REMOTEXY_SERIAL_RX 2 40#define REMOTEXY_SERIAL_TX 3 41#define REMOTEXY_SERIAL_SPEED 42 9600 43 44 45// RemoteXY configurate 46#pragma pack(push, 1) 47uint8_t RemoteXY_CONF[] 48 = 49 { 255,3,0,0,0,67,0,8,13,4, 50 5,48,60,14,30,30,0,2,26,31, 51 2,0,9,6,22,11,0,2,26,31, 52 53 31,79,78,0,79,70,70,0,131,1, 54 7,23,23,8,1,2,31,73,110,100, 55 105,97,110,0,131,0,14,31,33,8, 56 57 2,2,31,76,105,102,101,104,97,99, 58 107,101,114,0 }; 59 60// this structure 61 defines all the variables of your control interface 62struct { 63 64 // input 65 variable 66 int8_t joystick_1_x; // =-100..100 x-coordinate joystick position 67 68 int8_t joystick_1_y; // =-100..100 y-coordinate joystick position 69 uint8_t 70 switch_1; // =1 if switch ON and =0 if OFF 71 72 // other variable 73 uint8_t 74 connect_flag; // =1 if wire connected, else =0 75 76} RemoteXY; 77#pragma pack(pop) 78 79///////////////////////////////////////////// 80// 81 END RemoteXY include // 82///////////////////////////////////////////// 83 84#define 85 PIN_SWITCH_1 13 86 87//define right motor control pins 88#define right_motor_A 89 8 90#define right_motor_B 9 91#define right_motor_speed 11 //enable pin 92 93//define 94 left motor control pins 95#define left_motor_A 6 96#define left_motor_B 7 97#define 98 left_motor_speed 10 //enable pin 99 100//define two arrays with a list of pins 101 for each motor 102uint8_t RightMotor[3] = {right_motor_A, right_motor_B, right_motor_speed}; 103uint8_t 104 LeftMotor[3] = {left_motor_A, left_motor_B, left_motor_speed}; 105 106//speed control 107 of motors 108void Wheel (uint8_t * motor, int v) // v = motor speed, motor = pointer 109 to an array of pins 110{ 111 if (v > 100) v=100; 112 if (v < -100) v=-100; 113 114 if (v > 0){ 115 116 digitalWrite (motor [0], HIGH); 117 digitalWrite (motor 118 [1], LOW); 119 analogWrite (motor [2], v * 2.55); 120 } 121 else if ( v<0 ){ 122 123 124 digitalWrite (motor [0], LOW); 125 digitalWrite (motor [1], HIGH); 126 analogWrite 127 (motor [2], (-v) * 2.55); 128 } 129 else{ 130 digitalWrite (motor [0], LOW); 131 132 digitalWrite (motor [1], LOW); 133 analogWrite (motor [2], 0); 134 } 135} 136 137 138void 139 setup() 140{ 141 RemoteXY_Init (); 142 143 pinMode (PIN_SWITCH_1, OUTPUT); 144 145 146 //initialization pins 147 pinMode (right_motor_A, OUTPUT); 148 pinMode 149 (right_motor_B, OUTPUT); 150 pinMode (left_motor_A, OUTPUT); 151 pinMode (left_motor_B, 152 OUTPUT); 153 154} 155 156void loop() 157{ 158 RemoteXY_Handler (); 159 160 161 digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1==0)?LOW:HIGH); 162 163 //manage 164 the right motor 165 Wheel (RightMotor, RemoteXY.joystick_1_y - RemoteXY.joystick_1_x); 166 167 Wheel (LeftMotor, RemoteXY.joystick_1_y + RemoteXY.joystick_1_x); 168 169 170} 171
Downloadable files
Circuit Diagram
Circuit Diagram

Comments
Only logged in users can leave comments