I finelly got to the point where I can wire up my project. I am using an Arduino UNO to a L298N. My 12V power supply is connected to the L298N input power, and my motor to the output side.
// connect motor controller pins to Arduino digital pins
// motor one
int enA = 10;
int in1 = 9;
int in2 = 8;
void setup()
{
// set all the motor control pins to outputs
pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
}
void demoOne()
{
// this function will run the motors in both directions at a fixed speed
// turn on motor A
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
// set speed to 200 out of possible range 0~255
analogWrite(enA, 255);
// now turn off motors
//digitalWrite(in1, LOW);
//digitalWrite(in2, LOW);
Please post a picture of your circuit and a picture of your schematic (no Fritzing mess). How much current does the motor draw? Do you have a part number?
Did you measure the voltage across the motor or the collector-emitter voltage?
Are there other parts that could drop the voltage? Long wires, bad connectors, bad solder joints, thin PCB traces, current sensing resistors, polyfuses ... Is your power supply limiting the current/reducing the voltage?
I’m not at home right now. I’ll take some pictures and post them. Nothing else in the circuit. Just the Arduino and the L298 and of course the motor. I measured voltage across the inputs for the 12 volt power supple then on the motor. 12 at input 6 at motor.
I have been using several motors. All have same symptoms. I’ll measure amps when I get to shop
Ok, well, I thought my Fluke Multi-Meter could measure current, but I was wrong. I have no way of measuring AMPs sorry. I also can't do a schematic very well. Best I could do is hand drawn so I'll work on that tomorrow. But here is a photo of the board and connections as I currently have them. Made a few changes on pins, so the connections don't match the code I posted earlier.
wvmarle:
That is quite consistent with the numbers given by PieterP in #1.
So this shows you why you should always check the data sheet of your components, so you know what to expect.
I would have if I had a spec sheet for the L298N. Unfortunately all I have is the component with no paperwork. Looked on-line
But I did find a "tutorial" and it mentioned that the Arduino and the power supply need a common ground. I didn't have that. I connected all the grounds together and now I am only getting a 1.5V drop. I can live with that.
ov10fac:
I would have if I had a spec sheet for the L298N..... Looked on-line
Here's one link, and pic is the part about the drop from page 3. Always loses 1.8V, and may be over 3V at 1A, almost 5V at 2A. Good reason not to use a 298 for low voltages where that drop is proportionally more significant.
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Also check on how to post pictures in your posts.
OPs picture.
Quite right. That is one of the problems with being dyslexic, left / right confusion.
Still the OP has not found the way to edit a post and correct things has he?
Thanks to everyone. Tom you were right, the common ground was the problem. As for voltage, I plan on running a 24 volt motor with this controller. I will need the ability to change speed using a pot and button, be able to reverse direction again using a button. I now have the bugs worked out and have it running on a bread board. I have more coding to do and I have to figure out the LCD (another thread) but at least the motor, the pot and the buttens are all running ok now.
As for reading the rules, sorry, you caught me. But on my own behalf, I have been participating in forums since they were called bulletin boards and you accessed them with a dial-up line at 300 baud. All the rules have basically been the same. So I scanned these rules and completely missed the section on posting code. My bad there. As for the pictures, I did read the thread you pointed to. Had the photos uploaded to the site as attachment, but when I tried to actually insert them I received an error message so I haven't gone back to see what the issue might be. That having been said, that procedure is a very complex way of getting pictures into at post. Most forums that I participate in have a simple button that inserts the image at the cursor.
So, again many thanks for the information and now I see the code symbol (actually its an html tag, but hey) and will use it in the future if necessary.
wilfredmedlin: Here's one link, and pic is the part about the drop from page 3. Always loses 1.8V, and may be over 3V at 1A, almost 5V at 2A. Good reason not to use a 298 for low voltages where that drop is proportionally more significant.
Saw that, but could not find anyplace on the sheet where they defined V(cesat). So I didn't know that was the total voltage drop across the chip. Add to that the fact that I was using a board that incorporated the L298 but also other components I pretty much disregarded that spec sheet.
So I guess my next question is, if not the L298 then what? What seems to be the consensus when it comes to DC motor control in the 24 Volt range?
ov10fac:
So I guess my next question is, if not the L298 then what? What seems to be the consensus when it comes to DC motor control in the 24 Volt range?
Have a look here. These more modern chips are far more efficient and don't need the huge heat-sink typically seen on a 298.
wilfredmedlin:
Have a look here. These more modern chips are far more efficient and don't need the huge heat-sink typically seen on a 298.
Many thanks, exactly what I have been looking for. There are several single motor boards that appear to do exactly what I want. Soo, since iI was unable to read amps with my multi-meter, what would be the recommended device to read amps in these low current circuits? What is the consensus of opinion on a good "reasonably" priced current reader?
Saw that, but could not find anyplace on the sheet where they defined V(cesat).
Well you won’t because that is a basic parameter of bipolar transistors, it is short for the Voltage between the Collector and Emitter when the transistor is in SATuration. That means is turned on as hard or as completely as it can go. So it is a bit like complaining they don’t say what a volt is.
I have not seen a multimeter that can’t measure current, even the $5.00 from a thrift shop can measure current.