Go Down

Topic: Need to power small dc motor car for specific distance and stop (Read 13727 times) previous topic - next topic


The following code should cause the on board LED to blink when it senses the magnet.It assumes that you are using the schematic that Majig posted.

Code: [Select]

void setup(){

void loop(){

if(digitalRead(12) == 0){



I can't really address this until tomorrow, but my first thought is that the latching HED isn't being turned OFF.  Make sure that your magnet wheel has the one South pole magnet and the three North pole magnets.  The HED is a latching type so when it detects the South pole it will turn ON and stay ON until it detects a North pole. Thus, if it doesn't see a North, the motor will never turn Off.  Be sure that you have the magnets with the proper polarity on your sensor wheel.

Once you are sure of the magnets, using my original code, when first run it waits to see the wheel align with the South magnet. Turn the sensor wheel until the LED turns ON, then turn the sensor wheel until a North magnet is aligned with the HED and the LED should turn OFF.  I suspect that the problem is with the North magnets.

More tomorrow...


It was the pole sequence that we were doing wrong
and maybe the transistor,,, we replaced that too
The motor runs on the go switch then 3 passes of alternating N & S poles switches it off.
Tomorrow we'll try to put it on the car
The last test with the actual car motor looked like it may need more current because it felt pretty week compared to the little test motor. But the  9V arduino power source is getting low so maybe a fresh battery will help.


Too cool! Congratulations.

I thought the motor was a 3V motor.  If so, 9V is probably too much even for a short run.

My last diagram was predicated on the car having a two-AA battery pack for the motor.

Tell me about the motor:  what voltage and current?

Tell me about the battery pack:  what batteries and configuration?

I'd love to see pix or video...


Yes it is a 3v motor powered by 2 AAA batts. We were just touching the 3v output from the Arduino and ground to the solder joints on the board without cutting the leads so it is probably getting pulled away too.
Do you have any advice on how to extend the HED legs so it will reach out over the wheel? We were thinking of some sort of arm (paperclip) with patch wires soldered to the legs of the HED.


I would re-read some of the latest posts, use the car's native AAA batteries to power the motor.  Look at the last schematic I posted.  The Arduino's 3.3V is only rated @ 50mA and, if the motor draws more, you run the risk of frying your Arduino.

As far as extending the HED, I would solder some extension wires as you suggested, but I would think about a non-magnetic material for the support. A piece of plastic (like a cut down plastic knife) or a Popsicle stick.

Did you ever check how much current the motor draws? Just use the 3V AAA batteries with the motor in series with an ammeter.


Pics of the kids working on the car

Go Up