How does the MIDI Scooter work?

I saw this video on youtube

On the developer’s blog the scooter’s operation is described as:

A brief summary of what exactly is going on here:

  1. Laptop program parses a MIDI file and I choose three tracks that look interesting.
  2. XBee radio streams MIDI data wirelessly to the motor controller.
  3. Motor controller uses the frequency of the MIDI note as the PWM frequency.
  4. Each phase corresponds to one MIDI track. Three phases can play three tracks simultaneously.

For kicks, here’s the code for both ends of the system.

Because the PWM frequency is independent of the motor speed, this all happens more-or-less in the background while the regular motor control algorithm runs in the foreground. Meaning, I can ride the scooter around at low speeds without noticing any difference in performance. At high speeds, when the note frequencies get close to the commutation frequencies, bad things would happen.

I still don’t get it how it actually works with the motor signal. If he’s converting the tone frequency into a pwm signal he’s changing the resulting energy that he gives to the motor so the speed is also changing in contradiction to his statement the PWM frequency is independent of the motor speed. If he’s modulating a pwm signal onto another the resulting energy also changes. I also don’t know where the sound is actually coming from. Is there a speaker or is he using the motor as a kind of speaker? oO

Any ideas of what’s going on there?

I’m not that much into mechanicals so a block diagram would have been nice.

2 Comments

  1. Kenn Sebesta

    The voltage applied to a motor is the *average* voltage. The average voltage is only a function of the off time vs. the on time. The frequency of these pulses itself has no bearing whatsoever on the average voltage. The average voltage is what determines the average speed.

    All the guy is doing is changing the frequency at which he generates the averaged, PWM signal. The PWM’s duty cycle rests constant, so the average voltage stays constant.

  2. Yep, that pretty much sums it up. The average voltage, which is related to motor speed, is proportional to the duty cycle. But it is independent of the switching frequency. 50% on at 15.6kHz produces half speed silently. 50% on at 1,000Hz produces half speed noisily.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>