Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Automotive Senior Project Assistance: Motorcycle Control

  1. Nov 13, 2011 #1
    Hello All,

    A friend and I took on a senior project design that is certainly proving to be more difficult than anticipated.

    Here are the details:

    Design Challenge: Self Balancing Motorcycle

    Description: A picture of our prototype is attached. The motorcycle is remote controlled with a DC motor that drives the bike. A tilt sensor is used to determine the inclination and a stepper motor is used to steer the front wheel in order to torque the bike back to a vertical position. Also we are using an Arduino for microprocessing.

    My question lies in the set up. I am confused exactly how the sensor tells the motor to turn. I know some sort of pulse width modulation is necessary, which is where I grow weary.

    This is how I think the set up should go:

    The tilt sensor sends an error signal to the Arduino. The Arduino calculates a proper output through PID control (which we will create the code). The output is sent to the Stepper Motor Controller which converts the signal to PWM which is then sent to the motor. Then the motor turns.

    Any help would be greatly appreciated. I can provide more information as well.

    Thank you in advance!

    Attached Files:

  2. jcsd
  3. Nov 14, 2011 #2


    User Avatar
    Gold Member

    From the picture it seems like you have achieved your goal - it looks upright and balanced!! ha ha

    PWM for a stepper motor. Interesting.
    You sure it's is a stepper motor?
    Doesn't a stepper motor require different coils to be energized in a certain sequence for it to turn, and energizing the coils at a faster pace makes the motor turn faster?

    Or are you talking about a pulse width related to the error from the sensor, that is calculated in you PID, to determine for how long the stepper controller should energize the stepper motor, and at what speed and power level(torque)?

    You have done your control analysis which I do not want to get into as its complicated for a forum.
  4. Nov 15, 2011 #3
    Hey 256bits thanks for the reply!

    Yes you are right about the stepper motor being actuated by energizing coils. I now have a better understanding of how things are suppose to work, thank you!

    So here is now my new idea for the electronic set up of the balancing motorcycle:

    The tilt sensor will produce an error signal to the Arduino. The Arduino will contain a Stepper Motor Control code that will output a pulse generation to the motor driver (this is where I was confused before). Then the controller will send a correction signal to the motor which will rotate and torque the bike back to the proper position.

    Of course I am open to any criticism and suggestions.

    Current Goals
    • Connect sensor to voltmeter and get some readings
    • Connect sensor to Arduino and get them to talk to each other
    • Place sensor on known inclination angles to test linearity of sensor
    • Figure out Stepper Motor Control code from Arduino Library

    Will make updates as days go on.
  5. Nov 16, 2011 #4


    User Avatar
    Gold Member

    Painstaking trial and error, but that is the fun and exciting part, especially when it starts to work.
  6. Nov 18, 2011 #5
    17 November 2011

    So here is my first update.

    My goals today was to connect the tilt sensor to the Arduino and attempt to read some data. This became extremely frustrating and my attempts were unsucessful :(

    The tilt sensor outputs a digital data stream. However, the readings I was getting were complete jibberish. It was a random string of strange looking characters (maybe somebody knows what I am talking about). Turning the sensor in each direction didn't appear to get any distinct change in the reading so I unaware if the sensor and Arduino are even talking to each other.

    If anyone has experience with Arduinos any help would be greatly appreciated.

    The components I am using are:
    • ArduIMU V2 (sensor)
    • Arduino Uno

    I have found a program that will display the sensor's orientation (yaw, pitch, roll) and the values for their magnitude called ArduFlight. It works with the IMU without the Arduino so I can at least see if the sensor is working correctly.

    Other than that I need to find a way to convert the jibberish serial data into something useful (like numbers lol). I am sure there is a way and I will continue searching for an answer.

    Of course any assistance would also be nice. If anyone would like to see my attempted Arduino code I would be happy to show it.


  7. Jan 23, 2012 #6
    Being a motorcyclist I suggest drop the stepper motor and use 2 solenoids, both always active to cut out backlash but one may be more active than the other for control inputs. Does this sound like a pair of human arms, could throw in a bit of weight shift as it develops! Good luck
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook