Wiring up an Arduino Nano ATMega328 (CH340G) clone

Hi;

Can anyone help point me in the direction of a tutorial on connecting up the following parts:

ATMega328 (CH340G) Clone bought here 

To an L298N Motor Driver here 

To control the DC Motors on this chassis

I'll also be adding an Ultrasonic Detector mounted on a Servo.

Iv'e found various builds but most use servos, like this one?

Thanks

 

 

I am curious about a few things.

The chassis you link to mentions encoders, but, all I see are the encoder wheels and nothing that actually does any sensing. Do they ship with sensors or do you have to add your own? Do you really need encoders at this time? I ask this because as far as I can tell you can save yourself money on the kits if you buy them piecemeal you could save yourself.

Motors  http://tinyurl.com/mx5pr52 2.19 * 2 = 4.38
battery holder http://tinyurl.com/kdxbnlu 0.99 This is a 6 cell pack add dummy cells as needed

I would buy a sheet or two of foam core from the dollar store and a few packs of ping pong balls. Cut the bases from the sheets, use ping pong balls as “casters” and you have saved yourself cash as a result. Not to mention the kids learn they don’t have to go out and buy everything purpose built for a hobby robot.

Adding encoders at a later date is a simple exercise given that the motors are dual headed. Just add an encoder wheel of some form to the back side and go from there.

Also, the motors in that kit are like the ones I linked to, and, they are rated at about .12A. They won’t stall anywhere near 2A let alone .8A that something like the L9110 is capable of. It takes 2.5 to 12V, ground, and 4 inputs. I am still trying to get a straight answer about how many have to be PWM. Bajdi has suggested all the inputs must be PWM. I am not sure how that works. Another site I found seems to think there is a braking action available. The truth table I have seen does not support their thinking.

The reason there is so much push against the L298 and its ilk is that they drop so much power. On the order of 1 to 2V that would otherwise be sent to the motors. The testing that Bajdi did suggests closer to .5V drop from 5 to 4.5V for the L9110 board. With a 6 cell pack you can make a single dummy cell (dowel rod with a wire running end to end) and get 6v with maybe .5V drop seen at your motors using rechargeables. With a 4 cell pack of alkalines and an L298 your motors will probably see 4 to 4.5V.

L9110 driver http://tinyurl.com/mhkxo4v 1.09

To answer your question. Remove the Enable jumpers connect a PWM line to the correct side** of the jumped pair for the A and B connections. You will also need 4 more lines to connect to the 4 inputs for the motors to control direction. I don’t really like to go that route, but, I don’t see any reason to complicate this for you any more than it already is. Then you just write a program to PWM from somewhere around 50 to 255 (50 is about as low as you can go because, friction/drag), and pick your direction HIGH + LOW or LOW + HIGH on a single pair of inputs. Your connected motor will turn at your “chosen” speed. “chosen” because, all motors are different and what exactly is 128? :slight_smile:

**correct side is the side that actually goes to the chip. The incorrect side is likely tied to the logic input level.

birdmun;Sorry only just seen

birdmun;

Sorry only just seen this post, could have saved some cash, isn’t there a benefit though of using the L298 as it also supplies +5v regulated for the Nano?

I connected it up using this Instructables.