loading
This is my 'FIRST' post so am sorry if i missed something or made a mistake, please bear with me.

This is kind of a side project my friend and I made based on Arduino micro-controller and MSP-430 micro-controller. And I would like to share the steps we took to come up with this accelerometer car.

Hope you like it =)

Step 1: The Remote

For this you will need:

1. RF Tx and Rx
2. Accelerometer Module
3. Arduino uno 
4. Jumper cables 
5. Ardunio usb cable

I'm using an Encoder board along with the RF Tx i.e the HT-12E board.

Connect the Accelerometer Module Pin
X------Analog Pin ------ A1
Y------Analog Pin ------ A2
All Gnds and Vcc should be short separately.


We wont be needing the z-axis as am trying to use the module to replicate the actions of a real driving style.
So if ,
I bend the board Forward the car moves Forward.
I tilt it Left/ Right the car moves Left/Right.
I bend the board Backwards the car Stops.

So on those lines we have to first get the readings of the module for various triggering points so that we can move the car accordingly when a trigger point has been hit.

First run just the module on the Arduino and note the readings of the various tilt positions.
(acc test code in the download file)

Make sure u place all the components on some sorta board so that your actions can be interpreted easily.

For me i got the trigger values for,
Forward----- x= xxx   y>= 400 
Stop---------- x= xxx   y<= 300
Left----------- x<= 300  y= xxx
Right--------- x>= 380  y= xxx

'xxx' means dont' care because those values doesn't trigger in the directions we are looking for.


Once you got all these info,
Go on and connect the Accelerometer Module and the RF Tx to the Arduino to the pins given below

Accelerometer Modlue 
x--------- A1
y--------- A2

RF tx board
b0------- 7
b1------- 6
b2------- 5
b3------- 4

All Gnds and Vcc should be short separately.

Place all the components on the same board.
You plug in the Arduino to the computer and dump the code on the Arduino.
(Acc-Rf-Tx  code in the download file)

There you go, now you have the Remote READY.

NEXT STEP!!!!!

Step 2: The Car

For this u will need:

1. RF Tx and Rx
2. H-Bridge 
3. MSP-430
4. Jumper cables
5. 4 AA Battery holder x 1
6. AA Battery x 4
7. MSP-430 usb cable
8. Car along with DC motors and wheels

I'm using a Decoder board along with the RF Rx i.e the HT-12D board.
I'm using Energia IDE for the MSP-430.

First assemble the car with the wheels and dc motors i.e if you don't already have a car lying around.

Then you will have to do the following connections.

RF Rx

b0 -------- 7
b1 -------- 8
b2 -------- 13
b3 -------- 14

H-Bridge

The two wires of each dc motor is given to the output of each input on the board 
and the input of the board is given to

taking A is for the right motor
inp A1 ------ 10
inp A2 ------ 9

taking B is for the left motor
inp B1 ------ 11
inp B2 ------ 12

The battery in connected to the h-bridge.
The enable pins of motor A and B are short to any Vcc pin.

P.S
The Gnd pins of all the boards involved are shorted separately and the Vcc pins of all the boards involved are shorted separately. 

Once you are done with the setup, connect the MSP-430 to the computer and dump the code on to it.
(Acc-RF-Rx code in the download file)

Make sure all the components are properly connected and attached on to the chassis of the car and nothing is falling off.

You now have the car ready.

NOW TEST IT!!!! 

Step 3: Thank You

Thank You for your patience and time for going through this instuctable.
Hope you liked it.

If you have any doubts or questions, mail them to me at,

pineapple.exprs@gmail.com


Here's the video of the working model =)

Ohh!!! I Almost forgot, here are the code files.

Acc-test

Acc-Rf-Rx

Acc-Rf-Tx

If your car starts going in a different direction other than the prompted direction, then alter the codes and check the motor pins.
like it guys !!
THANK YOU !! :)
<p>ASWAMY, msp430 is not convenient to me, so i wanna use something another such as arduino. woulb be thier any changes in their source code</p>
<p>can u give me ur mail id robobot3112 </p><p>?</p>
<p>transmitter code is working fine but the reciever code is wrong as remote is transmitting 1,2,3,4,5 etc and reciever is recieving data from serial monitor</p><p>like f,b,r,l,s</p>
<p>robobot3112 thanx for ur help but the code u have written is wrong u mixed up two codes </p><p>dont mind but u copied the code from controlling robot using rfs</p>
<p>got my problem abhay reply to it asap</p>
<p>tx code</p><p><br>// TRANSMITTER CODE<br><br>//NOTE :- THIS TRANSMITTER CODE IS USED WHEN YOU WANT TO CONTROL THE ROBOT VIA THE BREADBOARD REMOTE<br>#include &lt;VirtualWire.h&gt;<br><br>//Assigning controller buttons to Digital Pins<br>const int groundpin = 18; // analog input pin 4 -- ground<br>const int powerpin = 19; // analog input pin 5 -- voltage<br>const int xpin = A3; // x-axis of the accelerometer<br>const int ypin = A2; // y-axis<br>const int zpin = A1; // z-axis (only on 3-axis models)<br><br><br><br>void setup()<br>{<br> Serial.begin(9600); // Debugging only<br> pinMode(groundpin, OUTPUT);<br> pinMode(powerpin, OUTPUT);<br> digitalWrite(groundpin, LOW); <br> digitalWrite(powerpin, HIGH);<br> Serial.println(&quot;setup&quot;);<br> // Initialise the IO and ISR<br> vw_setup(2000); // Bits per sec<br> vw_set_tx_pin(3); //Transmitter Data Pin to Digital Pin 3<br> <br> <br> for(int i = 0; i&lt;6 ; i++)<br> {<br><br><br> }<br> <br>}//close setup<br><br>void loop()<br>{<br> int xs= analogRead (xpin);<br> int ys = analogRead (ypin);<br> <br> char *msg2;<br> <br> if(ys &gt;= 400); //if the forward values are received<br> {<br> char *msg2 = &quot;1&quot;; //send 1 to the receiver<br> digitalWrite(13, true); // Flash a light to show transmitting<br> vw_send((uint8_t *)msg2, strlen(msg2)); //send the byte to the receiver<br> vw_wait_tx(); // Wait until the whole message is gone<br> digitalWrite(13, false);<br> }<br> <br> if(ys &lt;= 300)//if the back button is pressed<br> {<br> char *msg2 = &quot;5&quot;; ///send 5 to the receiver<br> digitalWrite(13, true); // Flash a light to show transmitting<br> vw_send((uint8_t *)msg2, strlen(msg2)); //send the byte to the receiver<br> vw_wait_tx(); // Wait until the whole message is gone<br> digitalWrite(13, false);<br> }<br> <br> if(xs &gt;= 380);<br> {<br> char *msg2 = &quot;3&quot;; //send 3 to the receiver<br> digitalWrite(13, true); // Flash a light to show transmitting<br> vw_send((uint8_t *)msg2, strlen(msg2)); //send the byte to the receiver<br> vw_wait_tx(); // Wait until the whole message is gone<br> digitalWrite(13, false);<br> }<br> <br> if(xs &gt;= 300);//if the right button is pressed<br> {<br> char *msg2 = &quot;4&quot;; //send 4 to the receiver<br> digitalWrite(13, true); // Flash a light to show transmitting<br> vw_send((uint8_t *)msg2, strlen(msg2));//send the message to the receiver<br> vw_wait_tx(); // Wait until the whole message is gone<br> digitalWrite(13, false);<br> }<br> <br> <br>}//close loop<br> <br> // End Of Code </p><p>rx code</p><p><br> #include &lt;VirtualWire.h&gt;<br><br>//declaring pin Nos of FIRST L293D<br>int en1 = 5;<br> int en2 = 6;<br> int in1 = 7;<br> int in2 = 8;<br> int in3 = 9;<br> int in4 = 10;<br> //declaring pin nos of SECOND L293D<br> int en1o2 = 3;<br> int en2o2 = 11;<br> int in1o2 = 4;<br> int in2o2 = 12;<br> int in3o2 = 14;<br> int in4o2 = 15;<br> int motorPin[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15};//array for storing pin nos<br><br>void setup()<br>{<br> Serial.begin(9600); // Debugging only<br> Serial.println(&quot;setup&quot;);<br> // Initialise the IO and ISR<br> vw_setup(2000); // Bits per sec<br> vw_set_rx_pin(2);//Receiver at Digital Pin 2<br> vw_rx_start();// Start the receiver PLL running<br><br> <br> for (int i = 0; i &lt; 12; i++) <br> {<br> pinMode(motorPin[i], OUTPUT);<br> }//close for loop<br><br><br>}//close setup<br><br>void loop()<br>{<br> <br> <br> <br> uint8_t buf[VW_MAX_MESSAGE_LEN];<br> uint8_t buflen = VW_MAX_MESSAGE_LEN;<br><br> if (vw_get_message(buf, &amp;buflen)) // Non-blocking<br> {<br> int i;<br><br> digitalWrite(13, true); // Flash a light to show received good message<br> // Message with a good checksum received, dump it.<br> <br> for (i = 0; i &lt; buflen; i++)<br> {<br> Serial.print(buf[i]);<br> if(buf[i] == 'f')<br> {<br> forward();//go forward when f is pressed<br> }<br> if(buf[i] == 's')<br> {<br> stopMotor();//stop/brake when s is pressed<br> }<br> if(buf[i] == 'l')<br> {<br> left();//go left when l is presed<br> }<br> if(buf[i] == 'r')<br> {<br> right();//go right when r is pressed<br> }<br> <br> }//close for loop<br> <br> digitalWrite(13, false);<br><br> }//close main if<br>}//close loop<br>//you can print the data entered when debugging by adding Serial.println<br><br>////////////////////////////////////////////////////////////////////////////////////////<br><br>//set of functions<br>void forward()<br>{<br> digitalWrite(en1,HIGH);<br> digitalWrite(en2,HIGH);<br> digitalWrite(en1o2,HIGH);<br> digitalWrite(en2o2,HIGH);<br> digitalWrite(in1,HIGH);<br> digitalWrite(in1o2,HIGH);<br> digitalWrite(in2,LOW);<br> digitalWrite(in2o2,LOW);<br> digitalWrite(in3,LOW);<br> digitalWrite(in3o2,LOW);<br> digitalWrite(in4,HIGH);<br> digitalWrite(in4o2,HIGH);<br> }<br> <br> <br><br>void left()<br>{<br> digitalWrite(en1,HIGH);<br> digitalWrite(en2,HIGH);<br> digitalWrite(en1o2,HIGH);<br> digitalWrite(en2o2,HIGH);<br> digitalWrite(in1,LOW);<br> digitalWrite(in1o2,LOW);<br> digitalWrite(in2,LOW);<br> digitalWrite(in2o2,LOW);<br> digitalWrite(in3,LOW);<br> digitalWrite(in3o2,LOW);<br> digitalWrite(in4,HIGH);<br> digitalWrite(in4o2,HIGH);<br> <br>}<br><br>void right()<br>{<br> digitalWrite(en1,HIGH);<br> digitalWrite(en2,HIGH);<br> digitalWrite(en1o2,HIGH);<br> digitalWrite(en2o2,HIGH);<br> digitalWrite(in1,HIGH);<br> digitalWrite(in1o2,HIGH);<br> digitalWrite(in2,LOW);<br> digitalWrite(in2o2,LOW);<br> digitalWrite(in3,LOW);<br> digitalWrite(in3o2,LOW);<br> digitalWrite(in4,LOW);<br> digitalWrite(in4o2,LOW);<br> <br>}<br><br>void stopMotor()<br>{<br> digitalWrite(en1,HIGH);<br> digitalWrite(en2,HIGH);<br> digitalWrite(en1o2,HIGH);<br> digitalWrite(en2o2,HIGH);<br> digitalWrite(in1,LOW);<br> digitalWrite(in1o2,LOW);<br> digitalWrite(in2,LOW);<br> digitalWrite(in2o2,LOW);<br> digitalWrite(in3,LOW);<br> digitalWrite(in3o2,LOW);<br> digitalWrite(in4,LOW);<br> digitalWrite(in4o2,LOW);<br>}<br> //End Of Code</p>
<p>abhay listen my arduinos are working fine but i am using only rf modules not the rf boards so please give me an code for that:) :)</p>
<p>hey can you tell me wat exactly is the role of msp4 in this project?</p>
<p>listen my communication is not occuring what should i do.</p>
can you please elaborate on ur problem ?
<p>can u suggest me another microcontroller i can use...i don't want to use msp430...what should i use if i don't want to use it....</p>
hey, you can use an aduino uno it self.
<p>listen my communication is not occuring what should i do.</p>
<p>can u suggest me another microcontroller i can use...i don't want to use msp430...what should i use if i don't want to use it....</p>
<p>can u suggest me another microcontroller i can use...i don't want to use msp430...what should i use if i don't want to use it....</p>
<p>can u suggest me another microcontroller i can use...i don't want to use msp430...what should i use if i don't want to use it....</p>
When i uploaded the program and switched on the car it started rotating automatically
<p>according to the program the car will be moving forward and only change direction once a high or low command is received from the decoder. When you moved or turned the controller, did you notice any movement, If not some connection would have been made that is wrong</p>
When i uploaded the program and switched on the car it started rotating automatically
When i uploaded the program and switched on the car it started rotating automatically
brother i have used a arduino uno in robot and want the changes in the code. I am beginner so i dont know how to correct the code. thank you
you cab use the same code for arduino uno as well.
thanks
sorry typo can*
very interesting one...very informative too...
This is a fascinating idea - can we see a video of it working? <br>
http://www.youtube.com/watch?v=USg8kzSwF3o <br> <br>U can also click on the word 'video' in the last step =) <br> <br>Thank You!
Oh, I didn't spot that! <br> <br>Did you know that you can embed YouTube videos into your instructables? <br>
Sorry about that ! <br> <br>Will try to do that next time.
How much did it cost
Well around 4.5K (INR)
Approximately $75/&pound;45

About This Instructable

10,065views

47favorites

License:

More by aswamy:Accelerometer Car 
Add instructable to: