Motorized Skateboard Operated by Hand Gestures

I was just sitting in our Robotics Lab doing nothing. And then I had this idea to make an automatic Skateboard,operated only by hand gestures. How much more awesome it can be?
Well then i started gathering the parts. We had some very high torque BLDC motors just sitting there. They had 75KG/CM of torque each making it 150KG/cm for me. Me being only 90 KG it was enough for me.

Then there was this accelerometer a faulty one, with only X axis Working and Y axis burnt down. I tried making it work without reading its datasheet and by mistake made it hot and its Y axis output went non functional.So i had this 3 axis accelerometer with only X and Z axis working.

Also had a uC board with atmega16 on it. Few long wires a Limit switch and a bunch of connectors.

Thanks to my Mechanical Engineer friends they modified an old chasis for me with the help of a Caster wheel into a very good looking (Ahem!) Skateboard.
So i mounted my Motors, powered the drivers, Charged my Accelerometer.
But sadly i realised as the Y axis was burnt i won’t be able to turn it properly. But then there was a little chance of a solution. The Z axis was sure giving the change in outputs on both tilts. But the output was same. Well i fixed it by a Limit switch And a little bit of extra coding. I added both left and right turns in it. (Well i have to do Gesture + Limit switch for left turn but its still enough awesome )
so I just powered it up with my 5S LiPo and whoa it worked. My childhood dream was right there. A hand gesture operated Skateboard.
I have still kept a kill switch as at certain times it goes out of control and i surely don’t want to get killed.
I Still have to reduce all those wires and make it RF.


Whats Next?
-have to fix it with a Proper Accelerometer.
-Make it wireless
-Improve Stability.
-Add proper deceleration while Stopping
​
Here is the code:
​
#include
#include
#include"LCD.h"
void fwd()
{
PORTD |= (1<<PD3);
PORTD &= ~(1<<PD2);
while(OCR1A<=28)
{
OCR1A++;
OCR1B++;
_delay_ms(30);
}
}
void rev()
{
PORTD &= ~(1<<PD3);
PORTD |= (1<<PD2);
while(OCR1A<=18)
{
OCR1A++;
OCR1B++;
_delay_ms(30);
}
}
void right()
{
PORTD |= (1<<PD3);
PORTD &= ~(1<<PD2);
while(OCR1A<=20)
{
OCR1A++;
OCR1B=0;
_delay_ms(25);
}
}
void left()
{
PORTD |= (1<<PD3);
PORTD &= ~(1<<PD2);
while(OCR1B=2)
{
OCR1A--;
OCR1B--;
}
OCR1A=0;
OCR1B=0;
}
void main()
{
int x=0,y=0,z=0;
DDRA=0x00;
//PORTB=0xFF;
ADCSRA=0b10001001;
ADMUX=0b00100000;
PORTA |= (1<<PA3);
DDRA |= (1<<PA4);
PORTA &=~(1<<PA4);
lcd_init();
DDRD=0xFF;
PORTD |= (1<<PD6);
PORTD &= ~(1<<PD7);
TCCR1A=0xA0;
TCCR1B=0x11;
ICR1=50;
//right();
while(1)
{
ADCSRA |= (1<<ADSC);
while(!(ADCSRA & (1<<ADIF)))
{
;
}
x=ADCH;
//lcd_gotoxy1(0);
//lcd_showvalue(x);
ADMUX++;
ADCSRA |= (1<<ADSC);
while(!(ADCSRA & (1<<ADIF)))
{
;
}
y=ADCH;
//lcd_gotoxy1(6);
//lcd_showvalue(y);
ADMUX++;
ADCSRA |= (1<<ADSC);
while(!(ADCSRA & (1<<ADIF)))
{
;
}
z=ADCH;
//lcd_gotoxy1(12);
//lcd_showvalue(z);
ADMUX--;
ADMUX--;
if(x100)
{
lcd_gotoxy1(0);
lcd_string("REV");
rev();
}
else if(z<100)
{
if(!(PINA & (1<<PA3)))
{
lcd_gotoxy1(0);
lcd_string("LFT");
left();
}
else if(PINA & (1<<PA3))
{
lcd_gotoxy1(0);
lcd_string("RGT");
right();
}
}
else
{
lcd_gotoxy1(0);
lcd_string("STP");
stop();
_delay_ms(1000);
}
/*
/*else if(!(PORTA & (1<<PA3)))
{
lcd_gotoxy1(0);
lcd_string("STP");
}
else
{
lcd_gotoxy1(0);
lcd_string("NWS");
}
*/
}
}