(Solved)Problem powering my project!

Hello everyone, I have completed my drone project and I decided to build it from the beginning using an ATmega328 IC instead of arduino nano. I am using a 3s Lipo battery to provide power to everything, and with a voltage regulator I am getting 5V. Everything works fine(led, transmitter, mpu-6050 etc.) but the motors seems to not get power and I think that the problem is the voltage regulator. The battery should be connected directly to the Vin pin, but I had no clue which pin is in the Atmega328 IC so I used a voltage regulator to get 5V to power all the circuit. Please any advice is welcome, thank you all for your time.

I expect you shouldn’t be powering the motors via the regulator .
Need a circuit diagram

This is the schematic I used for my project but now i have simply replaced the uno with an ATmega328 IC.

P.S. By the way can you pls tell me how to upload a photo and appear to post and not to download it.

(Right click the picture link. Select Copy Link address. Select More:Modify
Type [ img ] paste the link [ /img] (without the spaces on both). Select Save)

  • Your schematic doesn't show any voltage regulator you are talking about
  • To show picture:
  • Attach an image file as you did.
  • Save your post
  • Copy an attached file link address
  • Edit your post and use saved link for inserting picture

Image upload guide

OP's schematic:

alesam:

  • Your schematic doesn't show any voltage regulator you are talking about

Ofc the schematic has not any voltage regulator as it uses an arduino uno that has a build in voltage regulator. As I said i replaced the arduino board with a simple ATmega328p chip, so I had to make a 5V voltage regulator to power it. Thanks for your help by the way!

If you pulled the 328P from a working Uno, then you will also need a 16 MHz crystal; two 22pF caps; three 0.1uF caps, one each for VCC, AVCC, and Aref - do not connect Aref to 5V, just a cap to Gnd; a 10K reset pullup resistor; and two 4.7K pullup resistors for SCL & SDA. Both SCL (clock) & SDA (data) must connect to the '6050 You may need other 6050 connections as well.

CrossRoads:
If you pulled the 328P from a working Uno, then you will also need a 16 MHz crystal; two 22pF caps; three 0.1uF caps, one each for VCC, AVCC, and Aref - do not connect Aref to 5V, just a cap to Gnd; a 10K reset pullup resistor; and two 4.7K pullup resistors for SCL & SDA. Both SCL (clock) & SDA (data) must connect to the '6050 You may need other 6050 connections as well.

Ok ok, that's some really interesting informations there. As I have no ftdi to program the Atmega I am programming it using an original arduino uno and then I am placing it to my board. To use the Ic I have followed this simply schematic:

Look into replacing the power-wasting 7805 regulator with a DC-DC buck converter going to your standalone-duino and the motor controllers get power straight from the battery.

My guess is that decoupling will be necessary.

You need the 0.1uF caps. Reset switch looks odd. Connect the resistor between the Reset pin & Vcc,wire the switch to connect the pin to Gnd when pressed.
Get rid of the Aref connection to 5V. Just a cap from Aref to Gnd.
And you need the SCL/SDA pullups.

CrossRoads:
wire the switch to connect the pin to Gnd when pressed.

For those who always have a screwdriver or like, "switch" is 2 close contacts like jumper pins that you short. Hey, if they don't have a screwdriver they probably shouldn't be messing with reset anyway!

CrossRoads:
You need the 0.1uF caps. Reset switch looks odd. Connect the resistor between the Reset pin & Vcc,wire the switch to connect the pin to Gnd when pressed.
Get rid of the Aref connection to 5V. Just a cap from Aref to Gnd.
And you need the SCL/SDA pullups.

Ok sir I will give it a try but can you please explain me or post me a link about why I have to add pull up resistors(and what value should i use) to SCL/SDA and why Aref pin shouldn't be connected to 5V but with a 0.1uF capacitor to Gnd.

Bare bones Arduino tutorial

Google "I2C pullups" to learn about how I2C works. One of many easily found tutorials:I2C - learn.sparkfun.com

why Aref pin shouldn't be connected to 5V but with a 0.1uF capacitor to Gnd.

See the processor data sheet.

Is the processor actuall running your code when on the PCB ?
Maybe a LED to show it’s alive...

Also a trap for beginners, the pin numbers on a PCB are not the same I/O designations as pins on the chip itself. Maybe worth checking pins.h

I just disconnected the Aref pin from Vcc and AVcc and connected it to Gnd via 0.1uf cap and the brushless motors still not working. Should i connect the Vcc directly to Lipo battery to power the motors or I will damage the Atmega?

Don't run motor power through the Arduino unless the motor is TINY and uses very little current..

Can someone please explain me how the Vin pin in arduino works and which pin of Atmega328 Ic is the Vin pin ?

GoForSmoke:
Don’t run motor power through the Arduino unless the motor is TINY and uses very little current…

Yes ofcourse my question was kind of bad. I think you should never power the Atmega328 Ic with more than 5V.

Volts is not current. Volts pushes current but it is the current of electric charges that powers things. Too much power for the thing will burn it up, even resistors have watt ratings while regulators and converters have amp (current) ratings for the most they can take.

To understand volts (electric pressure), amps ( electric current ) and ohms (electric resistance) you learn Ohms Law.

To learn more you study Kirchoff's Laws and then you can design simple circuits to connect to Arduino pins.

These are the simple DC electricity rules, be very happy you don't need to know AC electronics which is way trickier.

By the way, Ohms Law is a subject that smart middle-schoolers learn and Boy Scouts getting the Electricity Merit Badge, not exactly have to be in college (yet so many don't learn till then, so it goes) to grasp in less than a week and play well in time to follow.

The Vin pin is literally for putting volts in to the Arduino. It just goes in to the arduino to power it (7-12 volts, 6 is unstable). It is referred to as Vcc, or pin 7 on the Atmega.