Pages: 1 2 [3]   Go Down
Author Topic: Need to power small dc motor car for specific distance and stop  (Read 3912 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
God Member
*****
Karma: 27
Posts: 829
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
void setup(){
pinMode(12,INPUT_PULLUP);
pinMode(13,OUTPUT);
}

void loop(){

 if(digitalRead(12) == 0){
     digitalWrite(13,HIGH);
     delay(500);
     digitalWrite(13,LOW);
 }

}
Logged

Lost Wages
Offline Offline
Full Member
***
Karma: 11
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ITWORKS
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.
Thanks
Logged

Lost Wages
Offline Offline
Full Member
***
Karma: 11
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Lost Wages
Offline Offline
Full Member
***
Karma: 11
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Pics of the kids working on the car


* IMGP2194.JPG (48.56 KB, 320x181 - viewed 20 times.)

* IMGP2195.JPG (51.07 KB, 320x181 - viewed 18 times.)

* IMGP2201.JPG (45.17 KB, 320x181 - viewed 16 times.)
Logged

Pages: 1 2 [3]   Go Up
Jump to: