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
theusch
PostPosted: May 17, 2012 - 09:00 PM
10k+ Postman


Joined: Feb 19, 2001
Posts: 25897
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: 18537
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: 62246
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: 18537
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: 18537
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