Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
helloworld5
PostPosted: May 16, 2012 - 06:54 PM
Wannabe


Joined: Jun 23, 2011
Posts: 65


Hello everyone,

I am currently trying to make a backup battery for this design (see attachment) which uses the ATmega8. The circuit is not done so please ignore any wiring that seems odd. I programmed the ATmega8 so that it lights up the LEDs in a certain pattern and the circuit in the attachment seemed to work when I tested it out on a breadboard (took off the main 5V source) but I am just wondering if this is a bad design to use the 5V battery as a backup power source (and if it is, please give me some suggestions). The reason why I need a backup battery is because I will be adding a real time clock on the ATmega8 and I would hate to reconfigure to the right time over and over again.


Thank you.
 
 View user's profile Send private message  
Reply with quote Back to top
Jepael
PostPosted: May 16, 2012 - 07:34 PM
Raving lunatic


Joined: May 24, 2004
Posts: 5994
Location: Tampere, Finland

Well a real solution would be to put a separate real time clock chip that has battery backup pin.

I don't know what your 5V backup battery source really is. But you combine main +5V through diode to AVR VCC, and battery through 100R to AVR VCC. A diode will have a voltage drop, about 0.7V depending on current consumption. To me that looks like the battery is used as the power source when AVR consumes little current, less than 5mA. When AVR consumes more current, more than 10mA, the 100R won't allow that much current and the diode starts to conduct current from main supply.

That, and your AVR does not have all the power supply and ground pins conneted, so it may be fried already.
 
 View user's profile Send private message  
Reply with quote Back to top
helloworld5
PostPosted: May 16, 2012 - 08:04 PM
Wannabe


Joined: Jun 23, 2011
Posts: 65


I guess I can get a tiny series and use UART but I was hoping I could create a circuit so I only use one microcontroller.

As for the backup battery, it will be the small round ones.

I don't quite understand what you mean by the ground pins are not connected. The only ground not connected from the diagram is pin 14 which I haven't finished.

I will check, when I get home, how much current is flowing from the battery when both main and battery source are connected.
 
 View user's profile Send private message  
Reply with quote Back to top
Jepael
PostPosted: May 16, 2012 - 08:48 PM
Raving lunatic


Joined: May 24, 2004
Posts: 5994
Location: Tampere, Finland

helloworld5 wrote:
I guess I can get a tiny series and use UART but I was hoping I could create a circuit so I only use one microcontroller.


I did not mean another microcontroller, I meant a separate dedicated real time clock chip. Those have I2C or SPI bus.

helloworld5 wrote:

As for the backup battery, it will be the small round ones.


There still is no such thing as a 5 volt battery. What kind of batteries and how many?

helloworld5 wrote:

I don't quite understand what you mean by the ground pins are not connected. The only ground not connected from the diagram is pin 14 which I haven't finished.


The AGND and AVCC pins are not connected and it won't work correctly because not all ground and supply pins are properly connected. If you have already built a circuit like in your schematic, the AVR may already be damaged since it did not have all supply pins properly connected.

helloworld5 wrote:

I will check, when I get home, how much current is flowing from the battery when both main and battery source are connected.


OK. You might also need some kind of system to sense if main 5V supply is on or off, so you can go into some kind of battery backup mode where LEDs are kept off and the AVR sleeps a lot, instead of consuming batteries while blazing at full 16 MHz, blinking a lot of LEDs.
 
 View user's profile Send private message  
Reply with quote Back to top
larryvc
PostPosted: May 16, 2012 - 09:44 PM
Raving lunatic


Joined: Dec 06, 2007
Posts: 2512
Location: Redmond, WA USA

Here you go:

http://datasheets.maxim-ic.com/en/ds/DS3231.pdf

_________________
Larry

Those afraid to embrace the future will quickly fade into the past. - larryvc
 
 View user's profile Send private message  
Reply with quote Back to top
helloworld5
PostPosted: May 17, 2012 - 06:15 AM
Wannabe


Joined: Jun 23, 2011
Posts: 65


Wow, never seen one of those but that's pretty cool Very Happy

Anyways, I checked the currents and the main source provides 24 mA and 30 mA (there are 4 LEDs at the moment and when 3 LEDs are used, it uses 24 mA and 30 mA is used when 4 LEDs are on) and the battery source is always at 4.5 mA.

As for the battery, I guess I will be using 2 of the 3 V round batteries.

As for sensing if the main source is on, I was going to hook up a MOSFET to the main source which will be connected to an input pin of the ATmega8 so if it's off, the LEDs will all shut off.


EDIT: Okay, I just realized what you were talking about for AVCC and AGND. I never knew these pins were so important because I never used in any of my projects and never ran into problems with it. What exactly is the disadvantage if you don't use them? And, I'm guessing you just directly connect the AVCC and AGND without any components connected to them. Also, my microcontroller is still programmable and works fine from what I'm seeing.
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: May 17, 2012 - 07:44 AM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18520
Location: Lund, Sweden

AVCC is often (always?) the supply for the port where the ADC channels are. Even if the port pins are working as digital I/O pins. More in the data sheet of your controller.

Short advice: Always connect AVCC and AGND, even if the ADC is not used.

(If the ADC is used, and accuracy of the conversions is important, then follow the advice on filtering AVCC etc in the data sheet. If you are sure that you will never use the actual ADC then just connect AVCC to VCC and AGND to GND.)
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Jepael
PostPosted: May 17, 2012 - 07:53 AM
Raving lunatic


Joined: May 24, 2004
Posts: 5994
Location: Tampere, Finland

helloworld5 wrote:

As for the battery, I guess I will be using 2 of the 3 V round batteries.


That's 6.0 volts. With fresh batteries, even more. The AVR has absolute maximum rating of 6.0V which it does not have to survive. It is specified to work properly up to 5.5V. So between the range of 5.5V to 6.0V, it does not break, but it does not have to work properly.

helloworld5 wrote:

EDIT: Okay, I just realized what you were talking about for AVCC and AGND. I never knew these pins were so important because I never used in any of my projects and never ran into problems with it. What exactly is the disadvantage if you don't use them? And, I'm guessing you just directly connect the AVCC and AGND without any components connected to them. Also, my microcontroller is still programmable and works fine from what I'm seeing.


Disadvantage? It is a miracle it even works at all. And all power pin pairs should have a bypass capacitor connected to them, but on a small hobby system one 100nF per chip might be enough. You don't have any capacitors over any AVR power pins at all!

What might have saved you is that on Mega8, there is a rumour that there is an internal bug and actually AVCC is connected to VCC. Still, it is unwise not to follow datasheet suggestions how to connect pins.

Different power pins may power different internal blocks. On many AVR models the AVCC pin is used to power the IO port where the analog IO pins are (your LEDs), among other things. Leaving AVCC unconnected would result into that port and its IO pins not working at all, and it might even break if too much currents flow through internal silicon structures.

Same thing as overclocking. Not specified to work, but it might.
 
 View user's profile Send private message  
Reply with quote Back to top
helloworld5
PostPosted: May 17, 2012 - 08:32 AM
Wannabe


Joined: Jun 23, 2011
Posts: 65


Jepael wrote:


Disadvantage? It is a miracle it even works at all.




LOL, omg I'm sorry but this just made me laugh haha.

But on a more serious note, I will go over the ATmega8 data sheet because I haven't read any of it other than ADC and PWM registers. I'm still quite new to microcontrollers and I didn't have any time to tinker with them due to finishing my second year in electrical engineering. Feels like I know nothing about electronics even after finishing my second year, lmao.

Also, I will be trying to learn how to use the RTC IC mentioned above instead of using the two round batteries.


Thank you everyone.
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: May 17, 2012 - 08:48 AM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18520
Location: Lund, Sweden

Somewhere in my vaults I have a sketch of how to set up a battery backup for an AVR from an ancient discussion here at 'freaks. IIRC it involves two zener-diodes and some other stuff. I'll try to dig it out.

Quote:
Feels like I know nothing about electronics even after finishing my second year, lmao.

I've been programming for some 30+ years. Sometimes it feels like I don't know anything about it. Wink
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Jepael
PostPosted: May 17, 2012 - 09:21 AM
Raving lunatic


Joined: May 24, 2004
Posts: 5994
Location: Tampere, Finland

helloworld5 wrote:
Feels like I know nothing about electronics even after finishing my second year, lmao.

Thank you everyone.


Heh, my second year in electronics was about ten years ago, and I still feel like I know nothing. Well maybe something about something though Smile

Thank you and best of luck for your projects. From the questions you asked, you seem to be genuinely interested and therefore learn quickly Smile
 
 View user's profile Send private message  
Reply with quote Back to top
Kartman
PostPosted: May 17, 2012 - 02:23 PM
Raving lunatic


Joined: Dec 30, 2004
Posts: 8728
Location: Melbourne,Australia

3v round batteries - that's hardly a precise description! Are we talking about button cells like a CR3025 or similar? Or a cylindrical cell like a 16450 ? with engineering, you want to be precise and read the datasheet.

Your circuit would've been charging the battery when powered externally. Primary lithium cells don't like this.
 
 View user's profile Send private message  
Reply with quote Back to top
larryvc
PostPosted: May 17, 2012 - 05:24 PM
Raving lunatic


Joined: Dec 06, 2007
Posts: 2512
Location: Redmond, WA USA

JohanEkdahl wrote:
I've been programming for some 30+ years. Sometimes it feels like I don't know anything about it. Wink

Sometimes it sounds like it too. Laughing Wink

_________________
Larry

Those afraid to embrace the future will quickly fade into the past. - larryvc
 
 View user's profile Send private message  
Reply with quote Back to top
nleahcim
PostPosted: May 17, 2012 - 05:35 PM
Raving lunatic


Joined: Feb 19, 2003
Posts: 2233
Location: Seattle, WA

On a recent design I had a 5V LDO and a 3V battery as my power sources. I dioded the two supplies together (anode 1 connected to 5V, anode 2 connected to 3V, both cathodes tied to my AVR's supply voltage. During normal operation the device was powered through the diode by 5V. But when the 5V dies the battery kicks in.

I don't see any good reason to pay extra for a Maxim RTC for most applications - doing it onboard the microcontroller is pretty easy.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
clawson
PostPosted: May 17, 2012 - 05:44 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62220
Location: (using avr-gcc in) Finchingfield, Essex, England

I gotta ask. If you are making an AVR design that may need to run from battery why on earth would you use a mega8 and not a mega88PA?

(the P in that stands for PicoPower)

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: May 17, 2012 - 06:39 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18520
Location: Lund, Sweden

Quote:
Sometimes it sounds like it too.

Right. I'll be looking out for your next slip, and then it is going to come down hard on you.. Wink

-----

Re the circuit I just plowed though the external disk with all the photos, and found it. Dual supply circuit, battery backup when main supply goes out. With sense on when that happens (on PORTD2 in this case), so that you can take all low-power consumptions you can/need. Sorry, no part numbers for the zeners and transistor.

[EDIT: Uploaded correct picture, with the 1K resistor between transistor and GND... Now, about that shaded pull-up, I really don't know for sure, but probably as an alternative to an internal pull-up.)


Last edited by JohanEkdahl on May 17, 2012 - 06:48 PM; edited 2 times in total
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
larryvc
PostPosted: May 17, 2012 - 06:41 PM
Raving lunatic


Joined: Dec 06, 2007
Posts: 2512
Location: Redmond, WA USA

JohanEkdahl wrote:
Quote:
Sometimes it sounds like it too.

Right. I'll be looking out for your next slip, and then it is going to come down hard on you.. Wink

-----

Re the

That's OK, I can take it too. Very Happy

_________________
Larry

Those afraid to embrace the future will quickly fade into the past. - larryvc
 
 View user's profile Send private message  
Reply with quote Back to top
theusch
PostPosted: May 17, 2012 - 08:14 PM
10k+ Postman


Joined: Feb 19, 2001
Posts: 25881
Location: Wisconsin USA

Quote:

I guess I can get a tiny series and use UART but I was hoping I could create a circuit so I only use one microcontroller.

??? OK, I'll bite--what does that statement have to do with anything said before that?

If power draw is important, why did you start with an older-generation AVR model that is going to be much less power efficient than a replacement e.g. ATmega88PA?
 
 View user's profile Send private message  
Reply with quote Back to top
helloworld5
PostPosted: May 17, 2012 - 08:36 PM
Wannabe


Joined: Jun 23, 2011
Posts: 65


clawson wrote:
I gotta ask. If you are making an AVR design that may need to run from battery why on earth would you use a mega8 and not a mega88PA?

(the P in that stands for PicoPower)


I never really used any other series other than the ATmega8 so I am quite unfamiliar with the other series' characteristics but I'll give it a go once I learn everything about ATmega8.


Kartman wrote:
3v round batteries - that's hardly a precise description! Are we talking about button cells like a CR3025 or similar? Or a cylindrical cell like a 16450 ? with engineering, you want to be precise and read the datasheet.


Sorry for not indicating well but yes, I was going to use the button cell.


nleahcim wrote:
On a recent design I had a 5V LDO and a 3V battery as my power sources. I dioded the two supplies together (anode 1 connected to 5V, anode 2 connected to 3V, both cathodes tied to my AVR's supply voltage. During normal operation the device was powered through the diode by 5V. But when the 5V dies the battery kicks in.

I don't see any good reason to pay extra for a Maxim RTC for most applications - doing it onboard the microcontroller is pretty easy.


That is an interesting design, I'll definitely try this out. But, it seems pretty much like what I was doing before except using a lower voltage battery.


JohanEkdahl wrote:
Re the circuit I just plowed though the external disk with all the photos, and found it. Dual supply circuit, battery backup when main supply goes out. With sense on when that happens (on PORTD2 in this case), so that you can take all low-power consumptions you can/need. Sorry, no part numbers for the zeners and transistor.

[EDIT: Uploaded correct picture, with the 1K resistor between transistor and GND... Now, about that shaded pull-up, I really don't know for sure, but probably as an alternative to an internal pull-up.)


I'll try this out too when I get my hands on some zeners and learn more about them.


theusch wrote:
Quote:

I guess I can get a tiny series and use UART but I was hoping I could create a circuit so I only use one microcontroller.

??? OK, I'll bite--what does that statement have to do with anything said before that?

If power draw is important, why did you start with an older-generation AVR model that is going to be much less power efficient than a replacement e.g. ATmega88PA?


Oh, that was because I was going to have one dedicated ATtiny that had RTC constantly running after the ATmega8 turned off until the other people showed me the RTC IC.

Again, I had no idea about other series' characteristics because I only worked with Atmega8. I knew about tiny series only because my friend showed me how to use UART on it but other than that, I am a total noob with microcontrollers.
 
 View user's profile Send private message  
Reply with quote Back to top
larryvc
PostPosted: May 17, 2012 - 08:44 PM
Raving lunatic


Joined: Dec 06, 2007
Posts: 2512
Location: Redmond, WA USA

helloworld5 wrote:
...but other than that, I am a total noob with microcontrollers.

Welcome to the hobby!!! Smile

_________________
Larry

Those afraid to embrace the future will quickly fade into the past. - larryvc
 
 View user's profile Send private message  
Reply with quote Back to top
theusch
PostPosted: May 17, 2012 - 09:00 PM
10k+ Postman


Joined: Feb 19, 2001
Posts: 25881
Location: Wisconsin USA

Quote:

Oh, that was because I was going to have one dedicated ATtiny that had RTC constantly running after the ATmega8 turned off until the other people showed me the RTC IC.

Note that most AVRs can support a type of RTC, with a watch crystal on timer-oscillator pins. No need for the extra "Tiny".

Using an RTC chip is a bit more straightforward. Depending on your experience level, it may get you more quickly to a successful outcome. However, if you continue with backup power as e.g. shown earlier and work with AVR sleep modes, and turn off the power-suckers when main power is lost--you will end up having touched on many aspects of microcontroller-application creation.
 
 View user's profile Send private message  
Reply with quote Back to top
nleahcim
PostPosted: May 18, 2012 - 01:04 AM
Raving lunatic


Joined: Feb 19, 2003
Posts: 2233
Location: Seattle, WA

helloworld5 wrote:

nleahcim wrote:
On a recent design I had a 5V LDO and a 3V battery as my power sources. I dioded the two supplies together (anode 1 connected to 5V, anode 2 connected to 3V, both cathodes tied to my AVR's supply voltage. During normal operation the device was powered through the diode by 5V. But when the 5V dies the battery kicks in.

I don't see any good reason to pay extra for a Maxim RTC for most applications - doing it onboard the microcontroller is pretty easy.


That is an interesting design, I'll definitely try this out. But, it seems pretty much like what I was doing before except using a lower voltage battery.

No - you're using a resistor for some reason that I cannot explain. My suggestion is to use a diode so that your power supply does not back feed your battery. This is making the assumption that your battery's voltage is lower than your power supply's voltage. As others have mentioned, there aren't a lot of 5V batteries out there...
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
helloworld5
PostPosted: May 18, 2012 - 07:12 AM
Wannabe


Joined: Jun 23, 2011
Posts: 65


larryvc wrote:
helloworld5 wrote:
...but other than that, I am a total noob with microcontrollers.

Welcome to the hobby!!! Smile


Haha, thank you. Very Happy


nleahcim wrote:
helloworld5 wrote:

nleahcim wrote:
On a recent design I had a 5V LDO and a 3V battery as my power sources. I dioded the two supplies together (anode 1 connected to 5V, anode 2 connected to 3V, both cathodes tied to my AVR's supply voltage. During normal operation the device was powered through the diode by 5V. But when the 5V dies the battery kicks in.

I don't see any good reason to pay extra for a Maxim RTC for most applications - doing it onboard the microcontroller is pretty easy.


That is an interesting design, I'll definitely try this out. But, it seems pretty much like what I was doing before except using a lower voltage battery.

No - you're using a resistor for some reason that I cannot explain. My suggestion is to use a diode so that your power supply does not back feed your battery. This is making the assumption that your battery's voltage is lower than your power supply's voltage. As others have mentioned, there aren't a lot of 5V batteries out there...


Yes, you are absolutely right. I will be implementing this circuit onto my design (using one round 3V button battery as backup) and buy some ATmega88PA. I'll be using one ATmega88PA and RTC will be on it as well. I'll add a transistor on the design so that it will detect when the main source is gone and the program goes into a "power saving mode" (if anyone knows any good resources to learn about power saving mode, please do post!).

One more question. I'm looking at digikey and there is ATMEGA88PA-PU-ND and ATMEGA88PA-PN-ND (this one is more expensive). What are the difference between these two?


Thanks again everyone.


EDIT: can anyone by any chance recommend any good transistors to use with microcontrollers? I've been using 2N3904 NPN transistors and they heat up so quickly! (http://www.datasheetcatalog.org/datasheet/kec/2N3904.pdf).
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: May 18, 2012 - 08:27 AM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18520
Location: Lund, Sweden

Quote:

I'm looking at digikey and there is ATMEGA88PA-PU-ND and ATMEGA88PA-PN-ND (this one is more expensive).

The details on different package codes are readily available in the data sheet for the device. I'm too lazy to look it up for you.. Wink

Quote:
I've been using 2N3904 NPN transistors and they heat up so quickly!

Are you using curent-limiting resistors?
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
helloworld5
PostPosted: May 18, 2012 - 08:48 AM
Wannabe


Joined: Jun 23, 2011
Posts: 65


The difference was the temperature of operation and I used 6V power source, 100 Ohms with an LED, and the base of the transistor was connected to one of the pins of the ATmega8.

Also, is it wise to just use one diode and let the motor get most of the 2A current from a DC adapter? From my very limited understanding of using motors in a circuit design, I would treat the motor as an inductor am I right? Or should I limit the current with a resistor?
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: May 18, 2012 - 09:50 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62220
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

The details on different package codes are readily available in the data sheet for the device. I'm too lazy to look it up for you.

I happened to have the datasheet open so did but my copy (8161D–AVR–10/09) does not seem to know about the -PN variant only the -PU.

(as always the model numbers are explained in the "Ordering Information" chapter towards the end).

BTW I just thought: why is this thread in General Electronics - it's surely on topic for AVR Forum? Should I move it?

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: May 18, 2012 - 10:02 AM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18520
Location: Lund, Sweden

Quote:

Also, is it wise to just use one diode and let the motor

First use of the word "motor" in the whole thread, and still you sound like it is obvious what you are doing. This seems to turn into the usual guessing game, so I'm out.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
helloworld5
PostPosted: May 18, 2012 - 10:32 AM
Wannabe


Joined: Jun 23, 2011
Posts: 65


clawson wrote:
Quote:

The details on different package codes are readily available in the data sheet for the device. I'm too lazy to look it up for you.

I happened to have the datasheet open so did but my copy (8161D–AVR–10/09) does not seem to know about the -PN variant only the -PU.

(as always the model numbers are explained in the "Ordering Information" chapter towards the end).

BTW I just thought: why is this thread in General Electronics - it's surely on topic for AVR Forum? Should I move it?


The original post was about how to design a circuit with backup battery to keep an RTC running. I guess I should have posted a new thread in the correct section.


JohanEkdahl wrote:
Quote:

Also, is it wise to just use one diode and let the motor

First use of the word "motor" in the whole thread, and still you sound like it is obvious what you are doing. This seems to turn into the usual guessing game, so I'm out.


I'm confused about what you said but I am sorry if I offended you in any way. I'll try to google a proper DC motor design instead.
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: May 18, 2012 - 10:55 AM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18520
Location: Lund, Sweden

Quote:

I'm confused about what you said

Let me try to explain: We've had almost two full pages discussing mainly a battery backup system and an RTC. Then suddenly you pull up a motor like a rabbit out of a hat. There has been no earlier mention of it, but you say "the motor", with formulations that clearly indicate that you believe we know about what kind of motor, how you have currently connected it and the alternative you discuss. We don't. How can we?!

This is typical for many posts here at AVRfreaks. The poster assumes that us others can see what he has on his bench, and how he has wired it up. We can't. If we are really nice we have patience, and ask nicely about it to get the details. It then often spins on with many posts before we start to get a picture of what it is all about. This is what I call "the usual guessing game".

Today I don't have that patience, so I'll leave it to others to play TUGG with you.

Before you click the submit button for a post, do this exercise: Read through your post but imagine that you are the presumptive reader of it, and think about what he knows about your problem.

Finally, I often repeat here at AVRfreaks: The quality of the answers you get is highly correlated with the quality of the question you ask.

Think about it..

Everything above in all friendliness, and as an advice on how you can get better answers here at 'freaks and keep people interested in your questions and problems. Personally I lost interest right about "the motor".
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
helloworld5
PostPosted: May 18, 2012 - 11:30 AM
Wannabe


Joined: Jun 23, 2011
Posts: 65


JohanEkdahl wrote:
Quote:

I'm confused about what you said

Let me try to explain: We've had almost two full pages discussing mainly a battery backup system and an RTC. Then suddenly you pull up a motor like a rabbit out of a hat. There has been no earlier mention of it, but you say "the motor", with formulations that clearly indicate that you believe we know about what kind of motor, how you have currently connected it and the alternative you discuss. We don't. How can we?!

This is typical for many posts here at AVRfreaks. The poster assumes that us others can see what he has on his bench, and how he has wired it up. We can't. If we are really nice we have patience, and ask nicely about it to get the details. It then often spins on with many posts before we start to get a picture of what it is all about. This is what I call "the usual guessing game".

Today I don't have that patience, so I'll leave it to others to play TUGG with you.

Before you click the submit button for a post, do this exercise: Read through your post but imagine that you are the presumptive reader of it, and think about what he knows about your problem.

Finally, I often repeat here at AVRfreaks: The quality of the answers you get is highly correlated with the quality of the question you ask.

Think about it..

Everything above in all friendliness, and as an advice on how you can get better answers here at 'freaks and keep people interested in your questions and problems. Personally I lost interest right about "the motor".


Ahhh, I see. My apologies for not being clear. I thought I mentioned it in the earlier posts but I clearly did not after reviewing over it. My whole "goal" for this project is to create a spinning LED like this one:

http://www.youtube.com/watch?v=fUrwy3l0XfA

So, I was hoping to connect the main source to the motor and the whole other circuit from the first post and the motor will be in parallel with the whole other circuit. But, as mentioned before, I have very limited knowledge in pretty much everything (especially motors since I never really touched them before) since I only know the general concepts so far in electronics. I've attached a very simple diagram to show you what my end project will look like.

I do not know how the DC motor will behave but it seemed to work fine (fine as in no significant change in DC motor spinning) when I tested it out for half a minute with the DC motor in parallel with the other "whole" circuit. So, I guess the main question is, how will the motor behave when different amount of LEDs will blink in different frequencies? Because, my concern is that if there is even a small amount of change in the current flowing in the DC motor (due to different current being drawn because of fewer or more LEDs are blinking), it will screw up the precision of how the LEDs will display letters and such as seen in the video. I'm sure the change won't be very noticeable but I'm hoping to be as much accurate as I possibly can be.

I think my solution would be to add a very small amount of resistor for the motor so that I can at least control the current flow into the motor and there will be very very little change when different amount of LEDs blink.

As for connecting the VCC and GND from the DC adapter to the actual spinning object, I'm hoping to design a slip ring to get the power to the microcontroller.
 
 View user's profile Send private message  
Reply with quote Back to top
Jepael
PostPosted: May 18, 2012 - 12:57 PM
Raving lunatic


Joined: May 24, 2004
Posts: 5994
Location: Tampere, Finland

helloworld5 wrote:
The difference was the temperature of operation and I used 6V power source, 100 Ohms with an LED, and the base of the transistor was connected to one of the pins of the ATmega8.


If you connect a base of a (BJT) transistor directly to IO pin, no wonder it heats up. Assuming NPN transistor used to control something, emitter is ground, base goes to AVR through about 1kohm resistor, and collector has the big load. Other end of the load is the positive side of some power supply. If you had a N-channel FET, you can usually do without the gate resistor to AVR.

helloworld5 wrote:

Also, is it wise to just use one diode and let the motor get most of the 2A current from a DC adapter? From my very limited understanding of using motors in a circuit design, I would treat the motor as an inductor am I right? Or should I limit the current with a resistor?


Sorry to be a nit-pick, but a DC adapter is not a constant current source. It is a constant voltage source, and every load pulls the amount of current it needs at the rated voltage. If you have a 6V 2A rated power supply, it will provide 6V to any load from 0 to 2A, and pulling more than 2A will make output drop or it to shut down.
 
 View user's profile Send private message  
Reply with quote Back to top
helloworld5
PostPosted: May 19, 2012 - 02:47 PM
Wannabe


Joined: Jun 23, 2011
Posts: 65


MOSFET it is then!

Jepael wrote:
Sorry to be a nit-pick, but a DC adapter is not a constant current source. It is a constant voltage source, and every load pulls the amount of current it needs at the rated voltage. If you have a 6V 2A rated power supply, it will provide 6V to any load from 0 to 2A, and pulling more than 2A will make output drop or it to shut down.


Alright, I guess I will be using very small resistors.


EDIT: Jepael, you are right. Few of my D pins are working incorrectly (always keeps a test LED on even when the switch is open whereas the C pins work correctly to the state of my switch).


EDIT#2: Alright, I've added the new circuit design on the attachment and I am planning to use ATmega88PA along with the 3V coin cell battery as you can see on the design. I'm currently trying to learn how to use the low power RTC (it's the document AVR134 I believe) and I was wondering if I can use this circuit design if I plan on using the low power RTC using the 32.768 kHz crystal for the timer and the internal 8 MHz clock of the ATmega88PA. Thank you.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits