A few words about my project: An accelerometer is monitoring endlessly for a free-fall. When this happens should start logging and when the phenomenon ends an interrupt is occurred in order to power up Arduino Nano. Then Arduino should read those data through I2C and dump them to a text file on an SD card and finally go off.
Accelerometer is connected to 2 AA alkaline batteries and arduino to either a 4pack NiMh or double li-po.
INT1 (blue line) turns NPN switch ON when free fall starts and then D2 (cyan line) keeps it ON until everything is done.
INT2 (white line) is connected to D3 to signal when free fall logging stops.
If I use a circuit like the attached one will I have any problem?
Interfacing via I2C with IMU's Vcc below arduino's Vcc can cause any problem? Should I look for a level converter?
In theory I2C will work so long as the pull-ups are to 3.3V (3.3V will read as high to a 5V Arduino),
but you must check the I2C driver isn't actively pulling up on the bus.
Without a common ground between IMU and Arduino it won't work at all...
And surely the base resistor goes on the base of the transistor after the diode(s), not in
parallel - you need to limit current however the transistor is operated.
I think you've fallen into the trap of using a single transistor to make a latching on-switch,
which can never work as transistors are inverting, so the powered down Arduino
is automatically going to be powering the transistor on via its protection diodes.
MarkT:
In theory I2C will work so long as the pull-ups are to 3.3V (3.3V will read as high to a 5V Arduino),
but you must check the I2C driver isn't actively pulling up on the bus.
Without a common ground between IMU and Arduino it won't work at all...
And surely the base resistor goes on the base of the transistor after the diode(s), not in
parallel - you need to limit current however the transistor is operated.
check the attachment
MarkT:
I think you've fallen into the trap of using a single transistor to make a latching on-switch,
which can never work as transistors are inverting, so the powered down Arduino
is automatically going to be powering the transistor on via its protection diodes.
Can you suggest me any alternative that will work? I came up with all these because I've read that you cannot go sleep with arduino and a SD card module (bug of library that cannot re-initialize the card). The other thing is an EEPROM but the problem is its limited size.
Yup, better circuit. But the latching on-switch is going to be more complex. You could have your
high-side PNP transistor (note its wrongly labelled in the Fritzing diagram as N) driven by
an NPN from ground. Then when the power is off, the Arduino pins at 0V won't turn on the NPN.
I'd personally just use a CMOS RS flipflop that's permanently powered to drive the switching device,
that's very flexible and CMOS uses a few nanoamps quiescent so no issue with battery life. Have the
accelerometer set the flip-flop, let the Arduino reset it to power off again. No worries about race conditions.
A CMOS flipflop can also be constructed from 2 NAND gates or from two NOR gates.
MarkT:
Yup, better circuit. But the latching on-switch is going to be more complex. You could have your
high-side PNP transistor (note its wrongly labelled in the Fritzing diagram as N) driven by
an NPN from ground. Then when the power is off, the Arduino pins at 0V won't turn on the NPN.
I'd personally just use a CMOS RS flipflop that's permanently powered to drive the switching device,
that's very flexible and CMOS uses a few nanoamps quiescent so no issue with battery life. Have the
accelerometer set the flip-flop, let the Arduino reset it to power off again. No worries about race conditions.
A CMOS flipflop can also be constructed from 2 NAND gates or from two NOR gates.
Thank you once again for your help MarkT. I'll follow your advise on flip-flop.
Cheers.
A lean approach using TI CD4013.
When accelerometer's logging is done INT1 (blue line - S) powers Arduino up (white line - Q>Vin).
Arduino pull D4 high to self-shut down by resetting (cyan line) flip-flop.
A voltage divider is used to reduce total weight and size (2 batteries less needed)