Beginner trying to use a ATMega328

Hello everyone, I am very new to Arduino but have completed most the projects in my beginners book and have a good understanding of engineering and building things as I make fighting robots in my free time. I would like to try to build my own electronic speed controller to control 2 large 800 watt, 18v motors using spectrum radio gear. I thought I could buy an ATMega328 Microcontroller with Uno Bootloader from Technobots and program it on my arduino then take it out and put it in a homemade circuit for the esc. I will use 8 large relays to reverse the motors and 2 banks of MOSFETs to control the speed of each motor but those will both be attached externally to the circuit board. All I need the circuit to do it read 2 channels from my receiver, convert this to a PWM signal to control the mosfets and use 8 of the other channels to turn on and off some smaller mosfets which will turn on and off the large H bridge of relays. I am confident doing the programing but I don't know what hardware is needed. Other than the Microcontroller and the MOSFETs what components will the circuit board need to run (bear in mind I don't need to program it) and what do I have to connect to each pin. I have tried reading about this on the forum but struggle to understand most of the stuff you guys are talking about! Sorry! Let me know if this is even possible! Thanks for your help and sorry if this post is in the wrong place! Max

Max…:
Other than the Microcontroller and the MOSFETs what components will the circuit board need to run (bear in mind I don’t need to program it) and what do I have to connect to each pin.

You can find lots of designs of ESC's on rcgroups:

Here you can see some of them: http://www.rcgroups.com/forums/showthread.php?t=140454

More inspiration: http://forum.arduino.cc/index.php?topic=165816.0

For some reason Atmega8/328 seems to be a very popular mcu for ESC's, also the ones you buy. An example schematic http://www.rcgroups.com/forums/showthread.php?t=1679621

Hi,
Thanks for the help I have now started designing my circuit. Does anyone know what kind of current a 12v automotive relay will draw (rated for 40A)? Also what current can the copper tracks on circuit board handle at 18v?

Max.....: Hi, Thanks for the help I have now started designing my circuit. Does anyone know what kind of current a 12v automotive relay will draw (rated for 40A)? Also what current can the copper tracks on circuit board handle at 18v?

Most likely in the 100ma ballpark, but every relay coil resistance can be different so only with a datasheet or at least a product description for the specific relay can one be certain of what the coil current draw is. As far as PCB trace current capacity that depends on the width (and somewhat the length) of the trace and the thickness of the copper trace. I'm sure there are some PCB experts around here that can give you guidelines on that.

Lefty

Hi,
I have designed a PCB which I think should work- hopefully you can make sense of it (attached)
The 8 mosfets connect to 8 18v relays to form an H bridge to control the direction of each motor. The other 6 mosfets form 2 banks to control the speed of each motor using pwm. There will be external circuitry to connect the relays to the pcb, the motors to the mosfet banks and the circuitry to form the H-Bridge as this all needs to be high current. I also need to move the components around so it fits on a smaller pcb.
Please let me know if this looks like it will work or if I have made some rookie error
thanks,
Max

Am I right in thinking I will need a MOSFET driver to control the power mosfets in the bank of FETs as they require 10v when the ATMega only runs on 5v? Could I use Logic level MOSFETs run directly from the ATMega pins to control the 40A automotive relays? Would the ATMega be able to handle the amps to control all 8 Logic level FETs each from one of the digital pins? Sorry for all the questions but I am very new to MOSFETs but have just read a large article on them. Thanks for any help. Max

I don't mean to sound whiny but is there a reason I am getting few replies? If my circuit is so useless it's not worth helping please just tell me and I will try to go and speak to our electronics technician. I could just do with a point in the right direction to know what to look into. I just realised I didn't mention this is to control a large DC brushed motor, to change the speed and direction of 2 motors- if I've gone about this the wrong way then let me know.

Quick tip for the PCB, you can get rid of that wire link by routing that track under switch S1.

Is there a reason why the PCB is so large?, there`s quite a bit of unused space there.

Lakes:
Quick tip for the PCB, you can get rid of that wire link by routing that track under switch S1.

Is there a reason why the PCB is so large?, there`s quite a bit of unused space there.

Thanks for the tip, the I haven’t got round to trying to shrink the board down yet, I don’t think the board is finished yet so thought I’d wait until it was done before trying to compress it.

You need decoupling capacitors, thicker power and ground traces and mounting holes at the corners.

JoeO: You need decoupling capacitors, thicker power and ground traces and mounting holes at the corners.

Do you mean decoupling capacitors for the power supply to the microchip or for the power to each of the mosfets or both? What thickness trace would you suggest to go to the mosfets, I've already used "thick" for the ground trace.

Usually a 10uF and .1uF on the on the power supply.

A few questions Are you etching this PCB yourself? You stated that you will program the chip first then move it to the PCB. I would highly suggest you put a socket on the PCB so you can remove the Atmega chip to reupload sketches incase you want to change something.

I will either etch this myself at school or get it etched by Fritzing. That's a good point with the socket for the chip. I don't quite understand what you mean by "Usually a 10uF and .1uF on the on the power supply", do you mean have 2 decoupling capacitors on the same power supply?

Max.....: I don't quite understand what you mean by "Usually a 10uF and .1uF on the on the power supply", do you mean have 2 decoupling capacitors on the same power supply?

Yes, the 10uF is a polarized electrolytic type capacitor. And the 0.1uF is common ceramic capacitor. No reduce noise in the supply going to the Atmega chip. The should be placed as close as possible to the '328. One side going to the positive and one to the GND. On the electrolytic cap, it has a positive and a negative side. You can find these caps at a local supply store or someplace like Ebay. They are cheap enough to buy in bulk because they are used in almost every circuit.

http://en.wikipedia.org/wiki/Decoupling_capacitor

Thanks.
Another question, could I run 4 of these MOSFETs off a single ATMega pin without a mosfet driver chip?

I think I’m right in saying it can be run off 5v to the gate but I’m not sure if the combined current needed would be too much? They would be used with pwm to control the speed of the motor.

Hi, How would you guys connect the wires from the 800w motors to the bank of 4 MOSFETs? I am struggling to think of a way that will handle the current? Thanks, Max