Let's Make Robots!

Arduino power up by RTC alarm

 

 

I’m trying to build a data logger that will only store data to an eeprom once an hour, and to conserve energy and have it log data for long periods I would like to turn the power off for everything except the Real Time Clock (DS1337).

So this is my setup.

I have a power source and a voltage regulator (3.3V) that will power the RTC all the time. When the alarm is tripped a digital line on the RTC goes low for 1 second (I think) then I need to power up everything else and keep the power on while I take my readings. 

Here I think I need a MOSFET or a transistor or something to feed power to the rest of my circuit,  until the ‘Arduino’ (clone) is done and pulls a digital pin low (or high) to go back to sleep.

Any ideas ?

UPDATE:

 

Could this work? Or if not, what could be done to make it work?

My plan is still to turn everything off until the RTC alarm pin goes low. Then I hoped that I could use a MOSFET to switch the power on for everything else.

So this is a schematic of my idea. The net ‘Main 3.3V’ (circled in red) will always have power and it goes into the source of the MOSFET P-channel (AO3401). With the gate pulled high by the pullup resistor R6 the transistor should be off and no current is flowing through to the microcontroller or other devices. 

When the RTC alarm pulls the line low, the transistor should be on and supply power from the ‘Main 3.3V’ net to the ‘3.3V’ net and power everything else up. The very first thing the microcontroller should do is pull the connected pin low to hold the switch in the on position until all logging is done and the microcontroller can ‘kill it self’ by pulling the pin high an losing power until the next logging sequence.

The header U10 (marked in green) is there for programming and testing purposes so we can lock the power to be always on.

I must admit that I really suck at this type of electronics and would appreciate any help to get this working. 

 

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Yes that should work fine. No ovbious mistakes. I would reduce R9 to about 470Ω. Depending on the current you need to supply and the gain of the PNP transistor. 10K might be too high for a 3.3V circuit, I would probably reduce R6 & R8 to 4K7. This will allow about 0.6mA to flow which is enough to have good noise imumity but won't sap your batteries too much.

The thing is you have not said how much current this needs to switch. You should also consider that unlike a FET, the BJT will drop your 3.3V by as much as 0.4V at 50mA assuming you have 5mA base current. The 470Ω resistor I suggested will give you about 5mA base current in your PNP.

Thank you OddBot.
This is just the kind of information that I was looking for. And for the current consumption it will be way below 100mA.

If possible test it on a breadboard first.

Although I cannot see any obvious mistakes, it's the not so obvious ones that can trip you up.

Out of curiosity, what program are you designing the PCB on? It seems to produce a nice 3D image of how the PCB should look.

I’m using DipTrace and absolutely love the program. It can be a pain to find the right components in the libraries but I have made my own library and imported more or less all the components I have at hand and adding new ones is straight forward.
http://www.diptrace.com/
Many will route manually but I use autorouter all the time with some final touchup at the end. Then I can go back and forth between the schematic and the PCB and they will always be in sync.
And as a LMR member you can get an upgrade on the free version from 300 pin to 500 pin boards

Heya Geir, this isn't an arduino/avr, but I'm working on something similar.

http://voodoofishdesign.blogspot.com/2012/07/datalogger.html

I had one initial addon board that breaks out the ADC channels but in thinking about it, I'm going to go with a way to turn off the power to those components feeding those adc channels(so as not to waste energy on non readings). I was going to go with a simple 2n3904 or 2n2222 transistor for that instead of a mosfet.

I'm using the WDT(watchdog timer) on the device in an interval mode as an interval timer(so no resets) and just coded this part last night. The function takes 2 params, the timer mode(4 different ones for lengths of time to set the interval)1.9ms, 16ms, 250ms and 1000ms(though this is with a 32khz crystal) and the number of loops to itereate through. 

I've started posting quite a bit on it and have the code posted on GitHub. The code would be similar in theory to what you would write for the AVR chip....

The one thing about my setup is that it uses a DCO(digitally controlled osc) and auxilary clock which runs at 12khz. Not super accurate, but it would get the job done. I've considered designing another board with a higher pincount proc that would allow for a 32khz watch crystal to be used. This would be just as good if not close second to a RTC(and no programming the rtc so less headaches). 

Not sure if this helps, but figured I'd mention is as it's something along a similar vain.

 

I'm not so sure about your using the same line to switch the mosfet as the line is waiting for a low signal from the rtc. Maybe somebody else can add more light on doing it that way. I would prefer to use a dedicated pin for switching the mosfet and by the looks of your circuit you still have spare pins for that.
I'm not clear on your intentions of joining inta and intb pins on the rtc. I had a speed read of the datasheet and it looks to me inta outputs low on alarm and intb outputs a squarewave at a selected frequency.
As it says you can leave intb floating why not just wake the mcu with inta?
I couldn't see where the datasheet spoke how long the low signal from inta was held. But this isn't important if you only use it to wake the mcu and then switch the mosfet with another pin from mcu.

Sounds like you need  wake up on interrupt code. Maybe this will help? Its written in 3 parts. He uses a switch going low for triggering his wakeup interrupt which you can easily substitute for your low signal from rtc.
The arduino board apparently uses 10ma by the regulator even when micro is in sleep mode. So you might want to consider that in your board design if you planned on using a similar regulator. Best way to avoid that is run straight from the battery if the voltage is right.

Over here http://letsmakerobots.com/node/31663 I did it on a attiny13a. I simply set the watchdog timer to wake me up from deep sleep every 8'th second. From there it would just be a matter of counting 8-second cycles and when it's time, launch the make-a-sample code. (ok, I had the watchdog reset the chip, making a counter survive a reset will be difficult). The Pico power chips has several power saving features...

I will not recommend using an Arduino board. They are very power hungry: regulator, led, USB being on all the time.

I’m not actually using an Arduino but I’m trying to build something around an ATMEGA328P-AU using the Arduino / LiliPad as a guideline.

I’m probably way over my head on this one as I just started soldering some 0805 SMD components. But then again I love a challenge :-D

This is how the board looks like with its current layout but I’m a long way from ordering anything just yet.

... this is the best I can point you to: http://arduino.cc/playground/Learning/ArduinoSleepCode

I did not worry about power yet :)