L298n motor driver how to connect to arduino
![l298n motor driver how to connect to arduino l298n motor driver how to connect to arduino](https://hackster.imgix.net/uploads/attachments/1310765/l298n-module-pinout_euSGWCPov7.jpg)
![l298n motor driver how to connect to arduino l298n motor driver how to connect to arduino](https://sc04.alicdn.com/kf/HTB11Y_LazvuK1Rjy0Faq6x2aVXa8.jpg)
When you wire a motor to ‘Motor1’ output terminals you’re connecting it to Output1 and Output2 (probably… the labelling is a little silly). Unsurprisingly, Input1 controls Output1, Input2 controls Output2, and so on. Make sure you don’t use the jumpers as they’ll try to override your PWM control outputs. The 2 jumpers (JP1 and JP2) are designed to connect the Enable pins to Vss, which means that the Output pins are always on, saving you from having to use 2 of your digital output pins to control them… but if you want to run PWM then that’s not very convenient. If you were to turn EnableA off while a motor connected to Output1+Output2 was running, the motor would act as if it was removed from the circuit, and it would just spin to a stop when it ran out of momentum. All this means is that when, for example, the input to EnableA is set to low, Output1+Output2 are disabled. EnableA and EnableB are active-high enables for Output1+Output2 and Output3+Output4 respectively.
#L298N MOTOR DRIVER HOW TO CONNECT TO ARDUINO FULL#
Without it, a microcontroller would need to send the full Vs (+9V in your case) to the input pins in order to activate the motors. Vss is the connection for the logic components of the L298 - it enables TTL (+5V and 0V) level components (like your microcontroller) to interface happily with the L298. Obviously you’ve already got Vs and GND figured out, but I’ll just mention that the L7805 (VDD output) also feeds into the Vss pin on the L298. The datasheet for this part should help you with any questions specific to this particular IC (there are others in the L298 range with similar but not identical specs).įrom here on out I’ll use the datasheet terminology, so with reference to your 8-pin header, the input side connections are. If you check out the photo further down the page (which shows the board from a different angle), you can see that the driver IC is specifically an L298N from STMicro. I could probably figure this all out with the data sheet and meter, but even though this was cheap, I'd still rather not risk screwing that up and blowing up the L298 or the arduino if I get something wrong, so I'm hoping someone here might have an idea of how this should work. I've tried contacting the seller about the mislabelled pins, and asked if they had any guidance on how to wire it to an arduino, but I haven't heard anything back-guess that's why they're cheap. I am planning on using pins 10 and 11 on the arduino for PWM control (EN2 and EN1), but I'm not sure what to do with the L1, L2, 元, L4 pins from the header (also known as M11, M12, M21, M22). With VCC and GND connected to a 9V power source, VDD is puts out 5V, thanks to the onboard 7805, so I am plannning on using VDD/GND to power the arduino- That's about the only part that works right now =-) On the other side of the board The terminal blocks are marked a bit better. I'm pretty sure the L1, L2, 元, L4 match up with M11, M12, M21, M22 they mention, and that EN2 and EN1 are PWM2, and PWM1. The markings on the board (for the 8 Pin Header) are actually a bit differrent than the above statement claims. Simple 8 pin interface PWM Mode (GND,VCC,M11,M12,M21,M22,PWM2,PWM1) (Jumpers JP1 & JP2 placed) Here's an enlarged image of the board (from their site) To save everyone the trouble, here's the information they provide on the site. The only information on setting the board up is on the page above- no additional information was included with the board. My goal is to set the driver board up for PWM control of 2 DC motors. The problem is, apparently, I seem to be too inept to figure out how to actually connect the motor driver to the arduino! Now I'm working on a bot that requires a more than the 1A that the L293 based stuff I've been using, so I found this cheap motor driver, based on the L298, that seems like it should work perfectly for me.
![l298n motor driver how to connect to arduino l298n motor driver how to connect to arduino](https://cdn.shopify.com/s/files/1/0482/4648/9255/products/Slide1_17c68027-0617-4954-b5d5-53bd9bffb405_600x600.jpg)
I built some motor shields and got those programmed, and working successfully with some cheap hobby motors, I've also successfully managed to get some servo's running without a problem as well. To start myself off, I picked up a handful of arduino clones, mostly seeeduinos. I am quite new to the world of robotics, but have years of experience with basic passive components (caps, resistors, etc) so I thought this would be a fun way to start learning more.