NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Sensors, Actuators, and Robotics » Robot Car

April 06, 2011
by Robotnik
Robotnik's Avatar

I have been trying to build a robot car out of an old rc car, and I have been having trouble controlling the electric engines. The problem I am having is, I can't get enough current. I am using some irf640n n-channel MOSFETs to control them and I am using a 4 - AA battery(1.5v each) supply for a voltage source. The data sheet says that at 6 volts the current should be close to 10A but it is only .8A, and barely enough current to move the toy car. So if anyone knows what I am missing, please help.

April 07, 2011
by bretm
bretm's Avatar

Four regular alkaline AA batteries aren't going to be able to supply 10A of current for any significant amount of time, even assuming that the circuit is correct. Consider NiMH or lithium batteries.

If the old RC car originally ran on alkaline AA's, then it's probably a problem with a circuit, not the batteries, and you don't actually need 10A.

April 07, 2011
by Robotnik
Robotnik's Avatar

The old car did use 4 regular AA batteries, their max continuous current is about 4.5A. At this point i am just trying to get enough current through the MOSFET, so i am keeping the circuit as simple as possible. So here is how my circuit is setup: (very simple)

  • 6 volts at the gate of the MOSFET
  • ground at the source of the MOSFET
  • then drain to 6 volts

So what i am confused about is, how come the current is so low? .8A is barely even enough to get the car to move. Am I reading the data sheet correctly? Because it says on page 1 that the max continuous drain current is 18A and the graph on page 3 says at 6 volts the current should be 10 amps. I know my battery only is capable of 4.5 amps but should the MOSFET cause the current to decrease this much? And also, the MOSFET gets relatively hot even with just .8A, is this something to be concerned about?

April 07, 2011
by Ralphxyz
Ralphxyz's Avatar

Hot "generally" means miss wiring!! Which is also implied by your low amperage reading.

Yup, start over strip everything and re-wire.

Ralph

April 07, 2011
by missle3944
missle3944's Avatar

I have the same exact problem too. I try to contrll a 6v motor but it draws to much current thus resulting in a hot mosfet. On the chart it does say the cirent needed for 6volt motor and the 6 volts juat doesnt meet the current.

April 08, 2011
by BobaMosfet
BobaMosfet's Avatar

I think the op missed the small 'h' on the battery rating- as in 10Ah, not 10A.

BM

April 08, 2011
by Robotnik
Robotnik's Avatar

Thanks for the help guys. I honestly have no idea what i am doing wrong, i am very new to circuitry. Here is a picture of my circuit. I am testing the drain current by connecting the two wires with a multimeter. My Circuit

also here is a link to the data sheet i am using.

April 09, 2011
by bretm
bretm's Avatar

You said the max continuous current of the batteries is 4.5A, but I'm unclear whether that's in the original RC car, or with the multimeter directly connected to the batteries. If it's directly connected to the batteries that won't tell you much because the batteries won't operate well in a short-circuit condition.

Measure the current in the original RC car and that will tell you what load resistor to use during your tests.

Do you have a 6VDC power adapter (wall wort) that you can try instead of the batteries? That will let you distinguish between a battery problem and a circuit/transistor problem.

The picture doesn't show the entire power rails of the breadboard. I assume there is nothing else connect to it on the left side?

April 09, 2011
by Robotnik
Robotnik's Avatar

Okay, this seems to be more complicated than I originally thought, so i am going to explain my project in a little more detail. Basically i am modifying an old rc car to be a robot instead of an rc. The car has two electric motors(one for steering, one for forward and reverse), a 4 AA battery power supply, and a chip that I presume is for receiving signals and then controlling the motors. So what I was intending on doing is replacing the rc car's original chip with the nerdkit, so I could program it. Unfortunately, I have hit a bit of a 'roadblock' because I can't get enough current through my MOSFETs.

@ bretm

Yes, the 4.5A was with the multimeter connected directly to the battery, I didn't realize batteries don't operate correctly like that. Also, I can't measure the current in the original rc car because I already removed the chip. I tried to reattach it, but it didn't seem to work, I may have damaged it somehow. And no there is nothing else on the power rails.

April 09, 2011
by JKITSON
JKITSON's Avatar

Hi From the pic. it appears you have:

The GATE to the + (Positive) The SOURCE to the - (Negative) The Drain open (no connection)

This shorts the full battery thru the FET & it will get warm..

To test you need the motor to + and the GATE..

Jim

April 10, 2011
by bretm
bretm's Avatar

It's a mosfet, so no current flows throw the gate, so no short until he connects the multimeter.

April 10, 2011
by bretm
bretm's Avatar

All right, i think i see the problem. This is an n-channel mosfet. See http://www.cadvision.com/blanchas/hexfet/nch-sw.htm where it explains the problem. You need a p-channel or an h-bridge I guess. Power switching is not my area of expertese.

April 10, 2011
by Robotnik
Robotnik's Avatar

Ah, that does make sense.

I am having an interesting thought than:

I don't fully understand how MOSFETs work, but would this cause them to switch on and off really fast?

Because if the source is 0 volts and the gate is 6 volts, the source and drain are connected.

This connects the source to the 6 volts at the drain, which would cause the source and drain to be disconnected.

If the source and drain are disconnected than the source would be zero volts again, which would connect the source and drain again, starting the process all over again.

April 11, 2011
by Robotnik
Robotnik's Avatar

Okay, I got it working. What I did was use 8 AA batteries to create about 12 volts, and connected the 12 volts to the gate of the MOSFET. Then I used the voltage regulator to cut the voltage in half and connected that to the drain. Then I connected 0 volts to the source. So that way when the source and drain are connected the voltage at the source is only about 5 volts and the gate is 12 volts, so the drain and source stay connected. I also ordered some p-channel MOSFETs because I need the voltage regulator for the micro-controller.

Thanks for your help guys, I will post back when i am finished, or if I get stuck again.

April 20, 2011
by Robotnik
Robotnik's Avatar

I have finally received my p-channel MOSFETs. They work fine, but there is one problem, the MCU cannot turn on the MOSFETs. I can do it manually using the ground and turn them on and the 5 volt rail to turn them off just fine. I also can turn the MOSFETs off with the MCU outputting 5 volts. When I connect the pin that is supposed to output 0 volts to the gate it does not cause the drain and source to connect. So, does anyone know what I am doing wrong?

April 24, 2011
by BobaMosfet
BobaMosfet's Avatar

What FETs did you get? You don't output zero volts, you simply ground the gate. So, in other words, use a pin to hold the gate high, with a pull-down resistor on the gate. Then when you turn the pin off, the gate will ground and it should work.

BM

April 25, 2011
by Robotnik
Robotnik's Avatar

Oh okay, I didn't realize that the MCU doesn't output zero volts. It works now, thanks.

April 26, 2011
by bretm
bretm's Avatar

I don't get it. Why can't you pull it to ground by setting the pin to output low?

April 26, 2011
by BobaMosfet
BobaMosfet's Avatar

bretm-

Page 72 of the ATMEGA168 Datasheet will answer all your questions.

BM

April 26, 2011
by Ralphxyz
Ralphxyz's Avatar

BobaMosfet a answer like that that really does not help. I have a least three different versions of the ATmega 168 Datasheet.

All of them have a different page 72.

Is this what you are refering to?

13. I/O-Ports 
13.1 Overview

Ralph

April 26, 2011
by bretm
bretm's Avatar

It's just one question, and that section doesn't answer it. In fact, it points out that the pins have symmetric drive capability, able to souce and sink current. So if it can turn on an n-mosfet with high output, why couldn't it turn on a p-mosfet with a low output?

April 27, 2011
by Ralphxyz
Ralphxyz's Avatar

Apparently, I am going to have to see if I have or get some p-channel MOSFETs just to answer the question if just turning the pin low on a mcu would turn on the p-channel MOSFET.

From Robotnik description and BM's replies that certainly is insinuated.

I think bretm's question is a good one and should be documented like in a FAQ.

Ralph

April 27, 2011
by Robotnik
Robotnik's Avatar

Okay, sorry for the confusion everyone... I just tried grounding the gate with the mcu pin a couple seconds ago, and it worked. I think I forgot to set the pin to output before. I guess you don't really need to set the pins to output, however, because if you have a pull-down resistor it works the same way.

My past self is always foolish, if only I had a way of communicating with him...

April 27, 2011
by BobaMosfet
BobaMosfet's Avatar

Sorry, for the short response, am sick right now. bret found the section on I/O Pins. Symmetric drive is right, but pulling a pin low requires a clear path to ground in the circuit which the pin is part of.

BM

April 27, 2011
by Noter
Noter's Avatar

Ok, I think I get it - if you want to drive your p-channel mosfet using the pull-up resistor on an input port then you will need another resistor to GND so when the pull-up is disabled the gate will be pulled to ground.

But if you set your port for output then you don't need an extra resistor to GND as the port is capable of driving a p-channel mosfet by pulling the gate to GND.

Is this it, do I really understand what is going on here?

April 27, 2011
by Rick_S
Rick_S's Avatar

Way to keep promoting the FAQ Ralph LOL Thumbs Up

May 09, 2011
by Robotnik
Robotnik's Avatar

Okay, I finally got this working. I can program the car to move forward, backward, turn left, and turn right. Now I just need sensors. I saw a analog sonar senor at radio shack, but it was $30.00. Does anyone know of a cheaper solution?

May 09, 2011
by Ralphxyz
Ralphxyz's Avatar

Robotnik, the IR distance sensors I have been playing with, (Sharp 2D120X) from Hobby Electronics. The sensor I got appears to be discontinued but they have some other one.

I was going to use these distance sensors as obstacle detection. The Sharp GP2Y0A02YK IR Sensor - 59" / Analog goes from 8" to 59".

I just use the Nerdkit tempsensor ADC code to read the ADC value you could break it down to actual distance, they are very sensitive.

There are some sonar sensors unmounted for $5.00 or so.

Ralph

Post a Reply

Please log in to post a reply.

Did you know that two resistors plus a transistor can be used to make a better voltage supply? Learn more...