Servo movement resets ATMEGA328

Are you going to use rechargable AAs or alkaline ?

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.

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.

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 ?

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?

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 :slight_smile:

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.

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.

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

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...

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);
}

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.

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.

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.

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.

By 'show what you got', do you mean to show the current draw?
For a fast pulse use a sense resistor and an oscilloscope( analog ).
Dwight

I think you replied to the wrong post. There is nothing in this thread about pulses.

It was an earlier post. I believe he wanted to measure the current
of the servo in action. That is usually faster than a DMM response time.
Sorry, I'm so far out of sequence.
Dwight

Your response time is nothing short of horrendous.. :smiley:

Hi everybody, yes CrossRoads, I was thinking about remove the 7805 of the ATMega328 and connect directly to a few AA batteries.

Also use a rechargable power supply for servo, but it must be behind a 7805, and feed both rechargables ways (ATMega circuit and servo circuit) with an AC/DC adaptor.

So I think that is posible feed all with and without rechargables batteries. Because without rechargables batteries it can be powered by the AC/DC adaptor.

If you have any suggestion from your experience about to make a rechargable circuit, please let me know.

Now, while Im improving circuit details with you Im developing the Android App to manage the sketch with the phone. I was using BluTerm to communicate with the AtMega on the breadboard and everything work properly, but I need a more specific software solution.

Thanks a lot to help me in the project.

Best regards.