I am building (or at least trying to) build a 2-wheeled balancing robot. The robot's hardware is in place - I am trying to make it balancing using only an accelerometer.

Motors and wheels are exactly the same as the Mini Balancing Robot in the magazine. Driver is also L293D controlled by the CCP module in PWM mode. Motors are running at 5V from 7805 regulator (to provide a roughly constant response).
Microcontroller is PIC16F876A running at 20MHz. The robot is only about 25~30cm tall too. Accelerometer is the ADXL335 but I'm only using one axis. I'm incorporating a PID controller and Moving Average Filters for the ADC data, but i guess something is wrong somewhere in the loop... Programming in PICC.

At the moment... It is not balancing... I've been trying for quite a while to make it balance bot to no avail... I'm not sure what is wrong...

Could somebody please answer some of these:
1. Where do u reckon is the best place to mount the accelerometer? Its currently placed somewhere in the middle of the robot's body (height).
2. Which axis do i have to use for balancing? Only one is enough?
3. Are my motors underpowered? They are the MO-SPG-10-30K.
4. Which is the best axis to use? I'm using the one perpendicular to the robot (parallel to the ground).
5. Should I use 5V for the accelerometer, and if so, does it output 5V or still 0~3.3V? If 3.3V, should I use 3.3V reference for my microcontroller?
I've attached a picture of the robot. If you see anything else that might be wrong with my robot, please let me know. Please reply asap if you can.
Thank You Very Much.
