Main Site Documentation

Easiest way to programatically turn on/off a tiny motor


I’m trying to find the easiest/cheapest method of simply turning on/off one of those tiny vibrating motors like what is in a cell phone programatically. I’m a .NET guy, so if FEZ is the way to go, I’ll accept that answer. FEZ just seems kinda overkill for something so simple and I don’t know enough about hardware stuff to know better.

Any thoughts/advice you can give will be helpful.



Well, you might want to use this product

It’s a lilypad with a vibration motor attached. From the description it sais:

So you could use a transistor in combination with any micro controller to turn it on and off (transistor connected to +5v, base connected to microcontroller)

If this is not what you are looking for, please let me know :wink:


You did not say what criteria is used to determine when to turn on the vibration motor. The stimuli is important in selecting an embedded controller.

The least expensive way to turn the motor on and off is a switch. :smiley:

Coming soon will be the FEZ Panda. This will be a very low cost FEZ ( ~$25).

FYI. For a .NET person, working with a FEZ is a real fun experience. Checkout the beginners ebook in the download section.


Thanks for the great input so far!

Just to clarify, I just want to write a simple .NET application that can turn on/off a USB connected vibrating motor.

FEZ Panda sounds like a great fit, as does the LilyPad that was suggested. Will update this thread if/when I move forward with the project.


A USB connected vibrating motor? Please explain…


Sorry if my terminology doesn’t make sense to those of you who actually know what you’re talking about. :slight_smile:

I pulled a vibrating motor out of a cell phone. I just want to be able to turn this motor on via a .NET application that is running on my computer. I’m fairly certain the easiest method of connecting this motor to my computer is via USB, but I’m also fairly certain I can’t just soldier the motor directly to the USB cable and achieve what I want. :slight_smile:


Actually connecting the motor to a USB interface is one of more difficult ways.

To make the motor vibrate you need to apply a DC voltage.

It is hard for me to explain alternatives to someone with limited electronics experience. :slight_smile:

The FEZs are very flexible and offer several ways of connections.

As mention before, an easy way is to connect a digital port on a FEZ to transistor and the transistor to the motor. The current required by the motor is too high to connect directly to the FEZ.

There is a single relay componet sold by GHI which could be used to apply the voltage to the motor. With this component you would not need to worry about the electronics, althought depending upon which FEZ you use you might have to do a little soldering.

The PC to FEZ communications could be done in several ways. The beginner ebook gives examples on several alternatives.

With a Cobra FEZ and the relay component, I could be controlling the motor from a PC within an hour.

I think most of the people here are more software than hardware, but we have a great group and we help each other work our way through the unknown.

I suggest you read the ebook. It will give you lots of ideas on how to achieve your goal. As you read the book, you can post questions on the forum for specific areas you have questions.


Perfect question, Alex.

I have some vibrating motor here too
And now i know how to connect it to the FEZ myself :smiley:


Is the vibration motor a DC brushless type?

If not and you aren’t connecting the motor to something like an H-Bridge to control motor direction, and are just using a transistor to turn the motor on and off, don’t forget to put a diode in reverse-bias between the motor’s terminals.

Like relays, motors (especially cheap brushed motors) are inductive loads and generate nice pulses of reverse biased current when the internal magnetic field collapses which, without a diode can pretty quickly cause the transistor to fail. The diode between the terminals acts as a lowest resistance path for this current and saves the rest of your circuit from the pulse.


Why would you connect a vibration motor to USB? ???
Pick a transistor, some resistors and you are done.

Check out Heffo’s scheme. :wink:


“Why would you connect a vibration motor to USB?”

Because I want the motor to turn on (vibrate) whenever VisualStudio finishes building. You know how you can go into your system sound settings and configure the OS to beep whenever VisualStudio finishes building, hits a breakpoint, etc…? I’ve written a VS plugin that will allow me to tap into those events and hopefully make motor vibrate in different patterns depending upon what event is fired.


So what you want to do is connect a motor to FEZ and then FEZ connects to the PC using USB and then use VS to control FEZ in which will control the motor. Correct?


So if you have a successful compile you get a pleasing vibration, but if you have a syntax error you get an annoying vibration?


“Because I want the motor to turn on (vibrate) whenever VisualStudio finishes building. You know how you can go into your system sound settings and configure the OS to beep whenever VisualStudio finishes building, hits a breakpoint, etc…?”

That is actually a pretty neat idea, especially for hearing impaired people. Since you can’t hear the sound schemes, you CAN feel the vibration.

If you use my circuit diagram for wiring up the motor and you connect the ‘Motor_On’ signal up to a PWM line on the FEZ you could use a low frequency pulse to adjust the speed of the motor, which in turn adjusts the feel of the vibration from a low rumbling to a high buzz

Personally, I would have probably used a small Atmel or PIC micro with USB and a CDC driver to control the motor, but the learning curve for a beginner on that is pretty steep and you need programmers and so on. For plain ease-of-use for someone unfamiliar with microcontrollers, motor drivers and so on, the FEZ is brilliant.


If your making this, why not hook it up at a lower level so that it works for all Windows applications and not just Visual Studio?


That’s kewl Alex. I guarantee that once you get get a motor to turn you’ll want to do more. Eventually you’re going to want to turn on a light, spin multiple motors, send an SMS etc. I recommend that you get a Fez Domino + The motor shield to get yourself started. You’ll be able to find a driver to turn the motor on and off at different speeds as well as example code of how to communicate via USB CDC. Post a video once you’ve gotten it to work.