Problem powering a toy car engine with Arduino Mega 2560

Hello,
I bought a simple toy car and took the motherboard off of it.
I am trying to control it through a computer with an Arduino Mega 2560 Mega Board.
When I connect the engine to the +5V or 3.3V and the GND on my board it works OK but when i set an output pin to HIGH with the "DigitalWrite" function it doesn't seem to power up the engine.
I tried this with a number of pins and nothing is working.
I don't have very much electronics knowledge.
It seems like these pins just aren't powerful enough to power the engine.
Would be happy to get some help.
Thank you in advance.
Ron

Ronkihack,

You need to do a bit more than just hook up an Arduino to a motor to make it work. Fortunately, not a lot more.

First off, you need to know what voltage the motor runs on. How is the toy car powered? Does it have onboard batteries, or run off a connection, like a RC car on a track? In either event, take out your handy dandy voltmeter and check the voltage on the power source.

Knowing that, the next step is to determine the current drawn by the motor. Break the circuit and reconnect it with an ammeter, using the ammeter to make the connection across the break. Turn the car on and see how much current it is drawing, both when free running and under load. (Unless your voltmeter is really basic, it should also function as an ammeter, but you might have to put the input probe into a different socket.)

The Arduino pins can supply about 40 mA (milliAmps, or 1/1000 of an amp) at either 5 or 3.3 volts, depending on your board. I think the mega is 5 V, but I don't have one. You can verify that with your voltmeter too. If your motor wants more current than that, or more voltage, you need an external circuit to control the motor. There are many varieties, too many to describe in one post. Best bet is to get the specs on your motor and report them here, and then I, or better yet, someone like crossroads, can suggest what you need to do. Most likely a transistor and two resistors will put you in good shape, but my experience with motors is very limited. (I do intend to play around with them once my current disposable electric toothbrush wears out, and I can take out the little motor inside it.)

Regards,
Martin

Thank You Martin.
Is it possible that the 5V pin can supply more current than the digital pins?
Because when I connect it to the 5V pin in the board it works fine.

Edit: Just measure the current while hooked up to the 5V and 3.3V pins on the Arduino. It shows 0.2mA and 0.17mA respectively.
I have already took apart the car so I can't see what current it should get but it works fine in this current.
When connected the engine to pin 13, tested at 0.08mA. Is something wrong with my board?

Yes the 5V pin will supply much more current than a digital pin. Your toy car motor will draw far more current than an arduino digital pin will supply. I don't know how you are measuring current but the figures are a long way from what a typical motor will draw. I have a tiny vibrator motor from a mobile phone ( physically smaller the the nail on your pinky ) it draws more current than an arduino pin can supply (around 60 mA). A toy car motor will use at least several hundred mA and possibly more than that. Typically you'll use a transistor to drive a small motor from an arduino pin

OP - read this thread; it may help you understand your car (you didn't mention the car or the board): http://arduino.cc/forum/index.php/topic,86883.0.html

Thank You very much, You have been very helpful