Go Down

Topic: Servo movement resets ATMEGA328  (Read 4080 times) previous topic - next topic

Ginza

Hi raschemmel, I will do the testing joining 2 battery boxes to get 6AA batteries like you said and then I will upload the testing comments.

I will continue using the 7805 IC by now.

Thanks.

raschemmel

Are you going to use rechargable AAs or alkaline ?
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Ginza

Rechargable batteries, because the price is very similar and then I will think about recharge the batteries with the same ATMega circuit.

Im testing the circuit with a power supply adaptor (12v 1A), yesterday the 7805 generates some heat, so I will put a sink to it.

Now Im developing the Android App to manage the ATMega by Bluetooth.

So while Im testing the sketch and the circuit Im developing the Android App to gain time. I must finish the App now in September to test the Skecth, Circuit and Android App all in October 24/7.

Best regards, GInza.


raschemmel

This is the kind of heatsink you need for a 7805 running on 12V input. Notice the difference between that heatsink and this one.  The surface area is greater and the metal thickness of the mounting surface is thicker.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Ginza

Hi raschemmel, thanks for your suggestion. Yesterday I have unsoldered one from an old PC power supply and put on the 7805.

Im without money now, but when I'll have the circuit finished and stable, I will get one like you recommend me.

Im testing now the best power supply option for my project. I have seen that with basic power the Bluetooth communication is poor and when is turned on an output from the phone, the ATMega can be reseted.

I think that I must use a basic power supply for the ATMega328, so the system processing is always ok and running and other to power the outputs.

What do you think about it ?




raschemmel

Quote
I think that I must use a basic power supply for the ATMega328, so the system processing is always ok and running and other to power the outputs.

What do you think about it ?
 
I've been working in electronics for 30 years and the term "basic power supply" could mean anything so it doesn't tell me anything.  A voltage regulator like the LM7805 is always preferred for a uP  over any unregulated power source such as batteries. The ideal input voltage for an LM7805 is between 7V and 9V, (7.5 V to 8V is the best range but these are not standard regulator values) not 12V so it doesn't need to dissipate the extra voltage. Do you have any capacitors on your  5V bus?
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Ginza

Hi raschemmel, reading my last question to you, I think that you are doing double work, answering me and trying to understand my poor english :)


Yes, I have a capacitor of 100uF at the 7805 output.


Yesterday I have connected the 9V/250mah only for the ATMega328 and the RTC Module and 4AA batteries/1800mAh only for the bluetooth. Because I need that the system at the ATMega works always, but the bluetooth is only to set and get system settings.

I thought that by this way I can preserve more battery time to the ATMega328, the results were:

--> The ATMega could run 10 hours with the 9v battery
--> The Bluetooth device HC-05 could run one hour.

I had to put differents power supplies, because the BlueTooth device was killing the power for the ATMega when they share the same power supply.

Im thinking that I could use an AC/DC adaptor of 9V or 7V to feed the ATMega behind the 7805 and leave the option to put a 9V battery backup, so the system works with AC/DC and if it is neccesary to move the device or there is a problem with the energy, it can continue working with the 9V battery.

Same to the other power supply to feed the BlueTooth, an AC/DC adaptor and optional 4AA batteries if it fails.

Also Im thinking that I can put a sliding switch or a simple switch, to turn on and off the BlueTooth so it will be turned on only when it is neccesary to configure the system.

I will try to upload 2 pictures of yesterday.


raschemmel

You realize that if your software is written correctly, you can control a relay that switches between the ac/dc adaptor and the battery. With more than one relay you can have multiple battery banks, monitor the voltage of the battery in use and switch to a different battery when it starts to get low. Theoretically the only limit to how many battery banks you can have is the number of digital I/O and the six analog inputs can be used as digital I/O as well. (you would have do a little research . I don't know how to do that.) You can get an 8-relay module with 5V relays.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

CrossRoads

Quote
monitor the voltage of the battery in use and switch to a different battery when it starts to get low
That might get tricky as the voltage will get pulled down some under heavy loads (servos moving) and rise again under light load.  I suppose one could check it only when no servos were being commanded to move, or, check only when servos were moving, and if it didn't stay at a high enough level then call it end of life and switch.

The analog pins can be assigned as digital outputs easily:
byte pin14 = 14; // A0
:
byte pin19 = 19; // A5
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Ginza

Hi CrossRoads, yesterday I didnt connected the servo.

I think I must use different power supplies, so with one power supply only for the atmega I will can continue running the sketch.

Yesterday night I have connected the 9v battery/250mAh only for the ATmega and the RTC and today morning the 9v battery down to 5v, so the 7805 wont continue working and the sketch stop working.

Im continue searching the best option to feed the circuit...

raschemmel

Quote
You realize that if your software is written correctly 
I didn't say it would be simple. Crossroad's observations/suggestions are good advice. Any software designed to monitor battery voltage should include some kind of "IF" statement code to exclude any measurements "while" any power consuming devices are running (motors, servos , etc.) This can be accomplished using boolean flags :

 if ((motor_A ==false) && (servo_A == false))
    {
      bat1 = analogRead(A0);
      }
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Ginza

Hi raschemmel, I will take note about this that you comment me. Yes I was thinking about measure the battery status and send the data by bluetooth to the phone.

But, look at this, I was testing with the 9v/250mAh battery (powering ATmega328 and RTC module only), the battery has a 7805 to regulate the 5v, with this schema my sketch can run until the battery will be in 6v or 7v.

When the battery is discharged to 5v or 6v the 7805 cant continue working because it needs minimum 7v to work, but the power that is in the battery (5v/6v) is perfect to continue running the skecth.

I think that I need in my final circuit connect directly to a AC/DC power supply with the option that I can get a secondary power supply with rechargable batteries. So when I can power the circuit with AC/DC I dont use the batteries and when the AC/DC power is not available I use the rechargable option. Also I should recharge the batteries with the circuit when it is connected to AC/DC.

Also I think that I need 2 power supplies, one fot the ATMega328 and RTC and other for BlueTooth module, servo, etc.

What do you think about this ?

Yesterday I was trying to upload 2 pictures of the project, but appears a message that dont let me upload pictures. I downgrade the quality of pictures, put them into a zip file, but was impossible upload the pictures, I dont know why.

Best regards.

raschemmel

#42
Sep 15, 2015, 04:31 pm Last Edit: Sep 15, 2015, 04:32 pm by raschemmel
Quote
Yesterday I was trying to upload 2 pictures of the project, but appears a message that dont let me upload pictures. I downgrade the quality of pictures, put them into a zip file, but was impossible upload the pictures, I dont know why.
The error is caused by the photo file exceeds maximum file size. Open the photo file with Windows Paint. In the upper left corner of Paint is a button called "Resize" Click this button and type in "40" where you see the "100" and hit ENTER. Click on the floppy disk symbol at the top left of Paint to SAVE the resized photo. The file should now be 40% of the original size. It is not necessary to use Winzip and it actually doesn't help anyway with picture files. The resized file should now be small enough to upload without errors.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Ginza

I have tried to upload the picture one more time, the forum message says 'security check...'  I work with Debian Linux, perhaps this may be the problem, I dont know, dont worry.

Now im developing the Andriod app to communicate by bluetooth with the circuit.

Please, tell me what do you think about the power supply in my last post.

CrossRoads, if you can read my last post, please comment it. Thanks.
 

CrossRoads

Yes, two power supplies, one for 5V and one tor the servo & other power hungry stuff would be good.
Could even use 3xAA battery for 5V directly and skip the 7805.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up