Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

special time delay circuit

Status
Not open for further replies.

michcfr

Advanced Member level 4
Joined
Mar 7, 2012
Messages
106
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,011
Hello,
I need to switch on/off a device from a real time clock (RTC) module like this:
RTC module (interrupt pin) => (switchOnOff pin) Device
On alarm, the RTC module triggers its interrupt pin to switch on or off the device. It is at logic level of 3.3V. The behavior of the Device is:
-To turn on the device; switchOnOff pin have to be maintained LOW during 30ms, but no more than 2s, then it have to be kept HIGH
-To turn off the device: maintain the switchOnOff pin LOW during at least 2s
I think it can be implemented with time delay circuit (TDC).
Can you please suggest a very basic, low cost solution?

Thx
 

Hi,

Please draw a sketch about signal flow:
(Is it: RTC --> microcontroller_INT --> microcontroller_port --> relay --> device ???)

I guess it´s hard to find an RTC which can control the trigger pulse length.
Why not using software RTC?

Klaus
 

Hello Klaus,
Thank you for your response.

What I need: start and shutdown the MCU at specific times.

The RTC is the DS3231 programmed by the MCU through the I2C. https://datasheets.maximintegrated.com/en/ds/DS3231.pdf
The device is a battery mgt system (BMS) that charges the battery and also delivers power (3.3v) to the MCU. The BMS has a special pin (switchOnOff pin) whith the following behavior:

-To turn on the BMS: maintain switchOnOff pin LOW during 30ms, but no more than 2s, then keep it Hi-Z (not HIGH as I said before)
-To turn off the BMS: maintain the switchOnOff pin LOW during at least 2s

1637249530378.png


So, the scenario is as follow:
-at startup the MCU programs alarms inside the DS3231 to start and stop the MCU at specific time.
-then, the DS3231 will drive the BMS to switch it on or off at these times.
 
Last edited:

This can be done with a nano board, timing very accurate over T and V. << 1% error

1637249555142.png


The above is a gui tool for programming board, very simple. IDE is mBlock. Kids in 7'th grade use it
to program robots. Even more complicated capabilities example -

https://www.edaboard.com/threads/moved-pulse-sequence-generator-smart-timer.398291/

1637249643897.png



Board < $ 3

You can use board and program an ATTINY85 with it for an even simpler solution

1637249747282.png



Its timing accuracy more like 5%



Regards, Dana.
 

This can be done with a nano board, timing very accurate over T and V. << 1% error

View attachment 172969

The above is a gui tool for programming board, very simple.

View attachment 172970


Board < $ 3

You can use board and program an ATTINY85 with it for an even simpler solution

View attachment 172971


Its timing accuracy more like 5%



Regards, Dana.
thank you Dana
I was rather thinking about something based on 555 or transistors: basic, cheap and very very low energy
 

Hi

I´m confused. Before you wrote you want to switch ON/OFF a device.
Now you want to start and shutdown a MCU.

It´s more clear when you exactly name which device or exactly name which MCU.

In case of MCU: What does switch OFF / shut down the MCU exactly mean?
switch OFF power? just 3.3V or the complete power supply (mains)?
Or put the MCU in a power saving mode / sleep mode? Which mode exactly?

Usuefull additional information could be how long is a usual active time and a usual OFF time?
Is it in the ms range or some days range?

Klaus
 

Thank you Klaus,
Sorry for the confusion. It is actually sending a signal (ON/OFF) to the device that in turns switch off (start and shutdown) the MCU.
It switch OFF the complete power supply of the MCU.
-usual active time: not ms, mn to hours
-usual OFF time: not ms, hours to days

regards
Hi

I´m confused. Before you wrote you want to switch ON/OFF a device.
Now you want to start and shutdown a MCU.

It´s more clear when you exactly name which device or exactly name which MCU.

In case of MCU: What does switch OFF / shut down the MCU exactly mean?
switch OFF power? just 3.3V or the complete power supply (mains)?
Or put the MCU in a power saving mode / sleep mode? Which mode exactly?

Usuefull additional information could be how long is a usual active time and a usual OFF time?
Is it in the ms range or some days range?

Klaus
 

It is actually sending a signal (ON/OFF) to the device
"It" is what? the RTC?
"the device" is what? the BMS?

If "OFF" really swtiches OFF the power supply of the MCU it can not be woken up with an INTerrupt.

Again: Please draw a sketch of all this.
Hand drawn is O.K. But with signals, clear names, some timing informations, some signal flow informations....
nothing perfect, not a "solution" just your idea how you think it should work.

Just a drawing we can discuss about.

Klaus
 

"It" is what? the RTC?
"the device" is what? the BMS?

If "OFF" really swtiches OFF the power supply of the MCU it can not be woken up with an INTerrupt.

Again: Please draw a sketch of all this.
Hand drawn is O.K. But with signals, clear names, some timing informations, some signal flow informations....
nothing perfect, not a "solution" just your idea how you think it should work.

Just a drawing we can discuss about.

Klaus
Thank you Klaus.

"It" is what?
=> the MCU as depicted in the figure at #3

"the device" is what? the BMS?
=>Yes, it is the BMS

If "OFF" really swtiches OFF the power supply of the MCU it can not be woken up with an INTerrupt.
=> Yes, this is because I need the RTC that switch on the BMS that in turns, powder the MCU

Ok, I understand. I'll do the drawing asap. Thank you


Michel
 

Hi,

if "It" is the MCU ... and the MCU is powerd down .. how could "It" send the ON signal to the BMS???

Klaus
 

Klaus,
Sorry, it is the RTC as depicted in the diagram at #3
Klaus,
Please find below the drawing. I need to know what would be the Delay circuit. Delay "simulates" the behavior of pushing the button on the BMS. Thx

1637272726291.png
 

Hi,

O.K.
The shown path is useful to only switch ON the BMS.
I think you need an additional circuit to switch OFF the BMS. This should be controlled by the MCU. I see no problem to combine both.

Now I think about reliability.
What if the RTC_Int already is LOW when you switch OFF the BMS. Then it never has the chance to switch ON again.

A workaround could be to repeatedly send ON pulses to the BMS. Maybe every 5 seconds .... as long as the RTC_Int is LOW.

Not shown in your sketch: How is the RTC powered? A coin cell?
What kind and size is the 'big battery' ?
Is there an undervoltage protection inside the BMS?

If yes:
What is your idea when the big battery is low voltage while the RTC wants to switch ON the BMS?

Before designing the circuit you need to consider how it should work under different conditions.

My idea:
If the RTC is powered by a coin cell you must not connect the shown pull-up resistors to the coin cell, because they may drain out the battery. They may draw a lot more current than the bare RTC.

Maybe it's possible to add a very low power auxiliary supply from the big battery ..

You need to consider safe software for the MCU to ensure the BMS will safely switch ON after the MCU shuts down. ... like checking that the RTC switch ON time setup really is in the future..

Klaus
 

Power up/dwn of delay circuit should also be bulletproof unless its a don't care.

Most modern processors have known state during startup and shutdown, like
ATTINY85 and many others.

In so far as cost some versions < $1.


Regards, Dana.
 

Thank you Klaus,

The shown path is useful to only switch ON the BMS.
=> I agree. The BMS can be switched off by the MCU

I think you need an additional circuit to switch OFF the BMS. This should be controlled by the MCU. I see no problem to combine both.
=>ok

What if the RTC_Int already is LOW when you switch OFF the BMS. Then it never has the chance to switch ON again.
=>correct.

A workaround could be to repeatedly send ON pulses to the BMS. Maybe every 5 seconds .... as long as the RTC_Int is LOW.
=>other possible workaround: connect the RTC/RST pin to the BMS/pushbuton? but I am not confident about the bidirectional aspect of the BMS/KEY pin: it can light a LED but also "sense" the push button

Not shown in your sketch: How is the RTC powered? A coin cell?
=>powered by the BMS at the VCC pin of the RTC (like the VCC of the MCU)
=>powered by a tiny coin cell at VBAT pin of the RTC (like in the picture)

What kind and size is the 'big battery' ?
=>very very tiny, maybe 1cm diameter

Is there an undervoltage protection inside the BMS?
=>No, but a protection PCB circuit is packaged with the battery cell

My idea:
If the RTC is powered by a coin cell you must not connect the shown pull-up resistors to the coin cell, because they may drain out the battery. They may draw a lot more current than the bare RTC.
=>which pull-up resistors? I don't see

Maybe it's possible to add a very low power auxiliary supply from the big battery ..
=>I prefer to avoid additional extra battery

You need to consider safe software for the MCU to ensure the BMS will safely switch ON after the MCU shuts down. ... like checking that the RTC switch ON time setup really is in the future..
=>ok, it makes sense
--- Updated ---

Power up/dwn of delay circuit should also be bulletproof unless its a don't care.

Most modern processors have known state during startup and shutdown, like
ATTINY85 and many others.

In so far as cost some versions < $1.


Regards, Dana.
Thank you Dana for your analysis.

The accuracy is an additional criteria:
-for the RTC, it is about 0.0003% (2ppm-3.5ppm) => 0.26s of drift per day
-for the ATTINY85, it is about 5% => 72mn of drift per day

Regards,
Michel
 
Last edited:

Hi
=>other possible workaround: connect the RTC/RST pin to the BMS/pushbuton? but I am not confident about the bidirectional aspect of the BMS/KEY pin: it can light a LED but also "sense" the push button
So you say a manual pushbutton is a valid workaround to restart the system..
I don´t care about the BMS internal KEY pin circuitry. I´d just connect the pushbutton according datasheet informations.

What kind and size is the 'big battery' ?
=>very very tiny, maybe 1cm diameter
I asked about the big battery, not the tiny one. You did not mention yet what it is.

=>which pull-up resistors? I don't see
All around the RTC. But now I see that you use the BMS output to power them.
But especially the pullup at the RTC_INT can´t work properly when BMS is down. .. so restarting the BMS won´t work properly.

=>I prefer to avoid additional extra battery
I guess you have two batteries. A small one just for the RTC backup and a big one for the BMS....
I´m not talking about a third battery.

*****
so for the ON pulse circuit:
Look for a
* monostable multivibrator (one shot)
* non retriggerable
* reacting on the falling edge
circuit. There should be plenty in the internet.

Remaining question: How to power it? I recommend to power it from the big battery.

****
for the OFF circuit:
I´d just use a so called digital transitor controlled by an MCU port pin.

Klaus
 

Thank you Klaus,

The shown path is useful to only switch ON the BMS.
=> I agree. The BMS can be switched off by the MCU

I think you need an additional circuit to switch OFF the BMS. This should be controlled by the MCU. I see no problem to combine both.
=>ok

What if the RTC_Int already is LOW when you switch OFF the BMS. Then it never has the chance to switch ON again.
=>correct.

A workaround could be to repeatedly send ON pulses to the BMS. Maybe every 5 seconds .... as long as the RTC_Int is LOW.
=>other possible workaround: connect the RTC/RST pin to the BMS/push-button ? but I am not confident about the bidirectional aspect of the BMS/KEY pin: it can light a LED but also "sense" the push button

Not shown in your sketch: How is the RTC powered? A coin cell?
=>powered by the BMS at the VCC pin of the RTC (like the VCC of the MCU)
=>powered by a tiny coin cell at VBAT pin of the RTC (like in the picture)

What kind and size is the 'big battery' ?
=>very very tiny, maybe 1cm diameter

Is there an undervoltage protection inside the BMS?
=>No, but a protection PCB circuit is packaged with the battery cell

My idea:
If the RTC is powered by a coin cell you must not connect the shown pull-up resistors to the coin cell, because they may drain out the battery. They may draw a lot more current than the bare RTC.
=>which pull-up resistors? I don't see

Maybe it's possible to add a very low power auxiliary supply from the big battery ..
=>I prefer to avoid additional extra battery

You need to consider safe software for the MCU to ensure the BMS will safely switch ON after the MCU shuts down. ... like checking that the RTC switch ON time setup really is in the future..
=>ok, it makes sense
--- Updated ---


Thank you Dana for your analysis.

The accuracy is an additional criteria:
-for the RTC, it is about 0.0003% (2ppm-3.5ppm) => 0.26s of drift per day
-for the ATTINY85, it is about 5% => 72mn of drift per day

Regards,
Michel
The ATTINY accuracy is based on internal non xtal based osc, but add a xtal
you get much better accuracy. However I was not thinking of taking over RTC
functionality, certainly doable, just delay accuracy versus using a 555 timer
which has serious deficits in accuracy over T and V and component variation.
And 555 has no specs on power up transients (maybe newer versions do ?).

Of course you can roll the RTC and MCU and DELAY all into 1 chip. Get timing
from GPS or power line -




GPS can achieve 100 nSec accuracy on a 1 PPS pulse. GPS modules -


Lastly the MCU all solution can be put to sleep and wake up as needed for power
\considerations.


DS3231 a pretty pricey chip.

Regards, Dana.
 
Last edited:

Hi

So you say a manual pushbutton is a valid workaround to restart the system..
I don´t care about the BMS internal KEY pin circuitry. I´d just connect the pushbutton according datasheet informations.


I asked about the big battery, not the tiny one. You did not mention yet what it is.


All around the RTC. But now I see that you use the BMS output to power them.
But especially the pullup at the RTC_INT can´t work properly when BMS is down. .. so restarting the BMS won´t work properly.


I guess you have two batteries. A small one just for the RTC backup and a big one for the BMS....
I´m not talking about a third battery.

*****
so for the ON pulse circuit:
Look for a
* monostable multivibrator (one shot)
* non retriggerable
* reacting on the falling edge
circuit. There should be plenty in the internet.

Remaining question: How to power it? I recommend to power it from the big battery.

****
for the OFF circuit:
I´d just use a so called digital transitor controlled by an MCU port pin.

Klaus


Thank you Klaus,

I think this the 74HC221 would work: https://assets.nexperia.com/documents/data-sheet/74HCT221.pdf
It operates at 2-6V: can be powered from the big battery (1 cell at 3.7V)
Pulse duration: according to the datasheet, it is T=0.7RC at VCC=4.5V. So (for exemple) it works with: R=15M, C=4.7uF => T=49.35ms

And for the schematics:
-/1A (falling edge) connected to RTC/INT-SQW pin
-/1Q (LOW) connected to BMS/KEY pin
-VCC/GND pin connected directly to the big battery cell

Questions:
-connect the RTC/RST pin to the BMS/KEY pin?
-about the pullup at the RTC_INT: remove it? (because you said: when BMS is down restarting the BMS won´t work properly)
-for the OFF circuit: what about taking a retriggerable version to increase the duration T? the MCU can "ask" (45 times, each 45ms => 2025ms) to the RTC to trigger the RTC/INT-SQW. It would maintain LOW the BMS/KEY pin for more than 2s.


Regards
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top