So I recently tried to make a hand gesture controlled robot but ran into some programming error. Here are the specs:
#For the transmitter module, I used the following:
*Arduino Nano 3.0 as the Microcontroller development platform
*Grove 3 axis digital accelerometer 16g for sensing hand gesture
*RF transmitter 433 Mhz (Transmitter: JMR-TX1)
*Power source: 7.2V rechargeable battery unit to power up the Arduino Nano
#For the robot, I used the following:
*Pololu Chassis
*Two DC geared motors, compatible wheels
*L293D Dual DC motor controller module
*Arduino Nano 3.0
*RF receiver 433 Mhz (Receiver: RXB6)
*Power source: 7.2V rechargeable battery unit to power up the Arduino Nano
I hooked up all the parts carefully. I uploaded the code entitled "Transimitter_code" to the transmitter. I uploaded a code called "Receiver_test" and used serial monitor to see if the robot's arduino received data from the transmitter, the data I wanted to receive was the x and y coordinates measured by the accelerometer. Fortunately, the Arduino was receiving data wirelessly and displaying it in the serial monitor, which means my basic concept was ok. You can see the code attached to this thread. P.s. You will need three libraries: Wire.h, VirtualWire.h and ADXL345.h to run the codes. You can google them up and get them for free.
Now, I tried to use the received data to control the motion of the bot, that is: run the motors in specific direction. However, this time, the code seems to have some problem.
When I tilt my hand forward (the transmitter module is worn on my hand), this means the robot must go forward. However, only the right wheel of the robot rotates forward and the loop continues forever, i.e. even if my change my hand position, the robot doesn't stop and doesn't move in a different direction.
Oddly, if I tilt my hand backward, the robot seems to work partially. Like if I increase the tilting of my hand, the robot's right wheel moves accordingly. however, the left wheel again, in this case, doesn't rotate.
If I rotate my hand left or right, nothing happens.
I have checked both the motors using other codes and both motors seem to work fine. They even rotate simultaneously if I code them to rotate together. Hence, it is not a hardware issue.
I have uploaded the bot's code. I firmly believe, it's a problem with the code. Please check it out and provide a solution.
Thanks in advance.
Receiver_test.ino (1.77 KB)
Transmitter_code.ino (3.3 KB)
Bot_code.ino (2.68 KB)