Need to power small dc motor car for specific distance and stop

BTW, you're going to need small powerful magnets. Like these http://www.amazon.com/Grade-Super-Strong-Neodymium-Magnets/dp/B001ANVAHI/ref=pd_cp_hi_1

They need to be axial. You would glue one with South toward the sensor and three with North toward the sensor.

Using four will balance the wheel and turn OFF the Hall Effect Detector, which is latching.

Willie the postman???

Keep me up updated...

OK we got the sensor and most of the circuit connected. We even think we understand what's going on. But here are our questions so far:

  1. The code says D13 should have a LED to indicate ready but it is not shown in either diagram. We assume that the other end should be grounded but we are not sure of where to put it on the breadboard.
  2. Our sensor has 3 leads the one in the diagram only has 2. According to the datasheet we think D12 should go to the output. The middle leg should go to ground and the input should should connect to 3V. Right? But again we are unsure of how to place it on the board.
  3. Our go button is a spring loaded NO. Is that correct or does it need to operate in a closed position?

Right, Willie the Postman... From the yard sale scene where Joy steals the ball from the game and Willie pops out his glass eye as a replacement.
My other favorite is Billie... “He can still be your brother, he just has to be an outside brother”
Thanks again for the help

  1. The D13 pin has the on-board LED on the UNO. It is the one nearest d13. There is nothing for you to connect.

  2. The diagram was using a reed switch for simplicity. As you face the HED, the left-most pin is number 1, the middle pin is pin 2, and the right-most pin is pin 3.

pin 1 goes to +5V
pin 2 goes to GND
pin 3 goes to pin d12

I'll cook up another set of breadboard and schematic diagrams tonight.

You should probably test the HED individually just to see how it works.

I am attaching a breadboard and schematic for the test circuit. You should see the LED come ON when the South pole of a magnet comes near the sensor, and the LED should turn OFF when a North pole comes near the sensor. You can see how the sensor reacts to the magnet and you can also see how close your magnet needs to be to turn the sensor ON/OFF.

In the diagrams, I used a 4.8V battery pack, but you can just use jumpers from the Arduino 5V and GND.

Test_HED_bb.jpg

Here's the final drawings. Everything is there.

motor18hed_bb.jpg

motor18hed_schem.jpg

You're our hero.
We'll work on it today and post some pics

MaJiG:
Here's the final drawings. Everything is there.

The Uno product page list the current avaliblity of the 3.3v pin as only:

DC Current for 3.3V Pin 50 mA

I thought earlier in the thread the motor was estimated to require more then that?

Lefty

That transistor is going to get hot. You may want to add a resistor at the emitter to ground. I don't know off hand of an actual value to use, so you may just want to use a 1K POT and adjust it.

Added: You may want to make it a darington pair, instead of a single transistor.

retrolefty, nice catch. Attaching mods. Karma bump.

HazardsMind, the motor is ON less than five seconds.

motor18hed2_bb.jpg

motor18hed2_schem.jpg

Almost there... We think!!
But, We can't get the motor to stop.
The test circuit worked just as explained.
Now with the circuit set up as described, when the arduino is powered up the D13 LED flashes a couple of times and then lights up. (it does this whether the magnet is aligned near the HED or not when power is turned on)
Then when the go button is pressed the motor starts but continues to run regardless of the number of times the magnet is passed over the HED.
We're sure it is connected correctly but the one component we are not sure of is the transistor. The numbers on it are 2N3904-338 it's the only one we have right now.
We tried reversing the HES and the transistor to see if polarity was a problem but no luck.
We changed the number of rotations to 3 in the code just to make the tests quicker but other than that we have made no changes to the code.
But we're at a loss as to what to try next.
Thanks

I hadn't noticed the power mod before the last post.
We are testing the setup with a 9V battery power source to the Arduino.
And all power sources connected as shown.
The transistor has not been hot at all. Could a bad transistor cause the problem we are seeing?

GrisGris:
I hadn't noticed the power mod before the last post.
We are testing the setup with a 9V battery power source to the Arduino.
And all power sources connected as shown.
The transistor has not been hot at all. Could a bad transistor cause the problem we are seeing?

If your code is solid, the only other real possibilties would be a shorted transistor, broken HED, or the HED is not hooked up properly or needs some other type of hook up like a pullup resistor. Also, with hall effect sensors, it will only respond to a single pole. Make sure that your pole of the magnet is correct for the sensor.

I would separate that part and test it to make sure the arduino is actually seeing the HED trigger.

Retroplayer:
I would separate that part and test it to make sure the arduino is actually seeing the HED trigger.

We did the HED test that MaJ sent and it works so we eliminated that as a problem.
I think I'll run down to Radio Shack now and get another transistor in case that's it.
How would I isolate the HED to test it with the Arduino?

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.

void setup(){
pinMode(12,INPUT_PULLUP);
pinMode(13,OUTPUT);
}

void loop(){

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

}

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

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

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

IMGP2194.JPG

IMGP2195.JPG

IMGP2201.JPG