Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Modify circuit to power on/off Attiny85 by remote

Status
Not open for further replies.
CIRCUIT A.JPG


Circuit B.JPG


I found this circuit (Circuit A) on the randomnerdtutorials website.
I modified it for my needs which is to start and shutdown an ATTINY85 using a tx/rx pair (Circuit B).
I'm running it on two AAA batteries.
The wireless receiver gives a long enough pulse for the Attiny to boot with no problem.
I wrote a rough code to drive pin2 high first thing on boot and reads for a high pulse on pin 5 thereafter to write pin2 low. it works well but I need to know if I've removed any important components or currently have any unnecessary ones (diodes for eg). I also have a few " for my information" questions about the original circuit.
3 queries:

1. If at some time in the future I had to replace my wireless receiver with one which was only able to supply a short pulse,
Is there a way to add a capacitor to the base of that transistor to sustain the pulse till gpio pin2 goes high.

2. Does there need to be a transistor between my wireless receiver output
and the 10k resistor or is it ok as I have it. My wireless receiver manual
is vague chinese but says "it's outputs are able to source less than 20ma at near VCC"
:)) specific) . When turned off it's wireless outputs are a flat 0v which allowed me to eliminate the 220k pulldown.
I'm not sure about the elimination of the 100k pulldown which seemed to be there to prevent a floating base. It works without it.

3. I saw the following comment below the original design:

"With this design, it need 16 mA to keep the circuit on. Not suitable for battery circuit. (5v -.7-.7)/220= 16mA + some low current via 100k

When the 2n3904 is on. The current is passing by the transistor instead of your 100k. Replace the 100k by 1M and replace the 220 ohm by a 100k. Will work fine :)
(5v from arduino-.7-.7)/100k= 36uA that's a lot better".

Would someone please explain what "passing by the transistor" means and is that analysis correct.

Thanks.
 
Last edited:
Those comments make no sense. Ignore both of them. The power circuit (Q1, Q2, R1, R2) draws 210 uA when on, and 0 uA when off. The ATTiny or the wireless receiver might draw 16 mA, but nothing in the power circuit affects that. Remember that with a power MOSFET, there is z.e.r.o static current between the source and gate, and between the gate and drain.

In the first circuit (the one without reference designators - !), the 220K, 10K, and left-most diode can be eliminated. The 100K to GND can act as a pull-down for both the transistor and the switch. Increase the 220 ohm to 10K, and delete the right-most diode. That diode is there to prevent a current "back-flow" from the closed switch to a GPIO pin. Increasing the resistor to 10K reduces this current (if there is any at all) to a max of less than 1/3 mA. Many uC's boot up with GPIO pins in the I mode, and they certainly can handle the current of an in-range voltage through a large resistor.

In the 2nd schematic, what are the functions of pins 2 and 5? You probably should move D3 so its cathode connects to R2.

ak
 
Last edited:
Oversight thanks. I've modified my original post to provide a link to the first circuit and also to add the missing voltage reference. Pin 2 serves the same purpose in both circuits to maintain power after initial boot pulse. Pin 5 as I said is read repeatedly to see when it pulses high (remote is pressed to initiate power-down) after which code will write pin 2 low. So question, if you remove the 10k in Circuit A what will limit current from switch to transistor base?
 
Last edited:
I'd re-fit the base to emitter resistor on Q2 (lower diagram). It would take next to zero leakage to start turning the FET on slightly and draining the battery. 100K is fine.

I was curious about the purpose of D3 as well?? Does pin 5 have a pullup enables & you are using that to read data from the receiver?
 
I was curious about the purpose of D3 as well?? Does pin 5 have a pullup enables & you are using that to read data from the receiver?
Pin 5 is an input serving only to read a low to high transistion from the wireless output which code interprets as signal to write pin 2 low powering down the chip. To be honest it should have an external 100k pulldown on it as it is currently being held low by the wireless receiver output. I think D3 was originally there to protect pin5 when I wasn't sure what voltage my circuit would be using. I will also refit a 100k to the Q2 base as you've suggested.
 
I'm rather bemused about what you're trying to do? - the RF receiver is permanently powered, and will be drawing a 'reasonable' amount of current all the time - why add all this complexity, when you could just place the micro-controller in a VERY low power sleep mode, where it will use massively less than the RF receiver.

I presume the ATTiny has those facilities, certainly PIC's do, which you could use just as easily.

Have you measured the current consumption of the RF receiver?.

I use very similar power switching (but all bipolar) in many of our commercial products, but only in ones where there's any reason to do so - such as in your case you were also switching the RF receiver, which would prevent it working of course.
 
I'm rather bemused about what you're trying to do? - the RF receiver is permanently powered, and will be drawing a 'reasonable' amount of current all the time - why add all this complexity, when you could just place the micro-controller in a VERY low power sleep mode, where it will use massively less than the RF receiver.

I presume the ATTiny has those facilities, certainly PIC's do, which you could use just as easily.

Have you measured the current consumption of the RF receiver?.

I use very similar power switching (but all bipolar) in many of our commercial products, but only in ones where there's any reason to do so - such as
you were also switching the RF receiver
To be clear power to the wireless was never switched.
in your case you were also switching the RF receiver, which would prevent it working of course.
Have you measured the current consumption of the RF receiver?.

I serve at the pleasure of the bemused Nigel.
The wireless is the one part of this circuit which must "never" be asleep.
It's measured current draw (4.7mA) was paramount in it's choosing.
More than familiar with putting Atmels to sleep thanks.
 
I serve at the pleasure of the bemused Nigel.
The wireless is the one part of this circuit which must "never" be asleep.
It's measured current draw (4.7mA) was paramount in it's choosing.
More than familiar with putting Atmels to sleep thanks.
So why all the power OFF circuitry?, the ATTiny's current in sleep should be insignificant compared to 4.7mA for the receiver.

I presume you've already got the receiver?, and tested it? - as many RF receivers put out continuous noise which would continually trigger the power OFF circuitry to ON. It would also continually trigger the Tiny out of sleep, if you used my suggestion.
 
So why all the power OFF circuitry?, the ATTiny's current in sleep should be insignificant compared to 4.7mA for the receiver.

I presume you've already got the receiver?, and tested it? - as many RF receivers put out continuous noise which would continually trigger the power OFF circuitry to ON. It would also continually trigger the Tiny out of sleep, if you used my suggestion.
the ATTiny's current in sleep should be insignificant compared to 4.7mA for the receiver

I'm not sure why you're still arranging a current draw comparison between the atmel and the wireless if I've said plainly the wireless must "never" be off. Your remaining issue would then only be should the atmel sleep (low current) or shutdown (no current). The typical circuit where the atmel is touched or timed to wake up and power up peripherals is not what's needed here.
I presume you've already got the receiver?, and tested it?

The circuit has been up and working with no problems for a week even without the pulldowns which i will indeed add for peace of mind. My questions here were about removing unnecessary parts and about values.
 
I'm not sure why you're still arranging a current draw comparison between the atmel and the wireless if I've said plainly the wireless must "never" be off. Your remaining issue would then only be should the atmel sleep (low current) or shutdown (no current). The typical circuit where the atmel is touched or timed to wake up and power up peripherals is not what's needed here.

You seem to be missing the point?.

I'm fully aware that the receiver has to be permanently powered, for the circuit to work - THAT's the point.

The receiver is drawing 4700uA continuously, an ATTiny, in sleep, presumably draws less than 47uA? - less than 1% of the RF receiver current (could be much less, depending low good Tiny's are). So you're adding 7 more component's to save less than 1% extra current, which is an insignificant amount.

The circuit has been up and working with no problems for a week even without the pulldowns which i will indeed add for peace of mind. My questions here were about removing unnecessary parts and about values.

You want to remove unnecessary components?, then remove the un-needed power switching ones - you're adding seven (or more) extra components, and gaining essentially nothing.

I would suggest adding a reservoir/decoupling cap across the battery though.

If an ATTiny isn't capable of doing the job (sitting in sleep using almost no power and waking on a pin change), then use a PIC instead - however, as Atmel's entire business plan was to try and compete with MicroChip PIC's I would expect it to have at least those similar capabilities.
 
You seem to be missing the point?.

I'm fully aware that the receiver has to be permanently powered, for the circuit to work - THAT's the point.

The receiver is drawing 4700uA continuously, an ATTiny, in sleep, presumably draws less than 47uA? - less than 1% of the RF receiver current (could be much less, depending low good Tiny's are). So you're adding 7 more component's to save less than 1% extra current, which is an insignificant amount.



You want to remove unnecessary components?, then remove the un-needed power switching ones - you're adding seven (or more) extra components, and gaining essentially nothing.

I would suggest adding a reservoir/decoupling cap across the battery though.

If an ATTiny isn't capable of doing the job (sitting in sleep using almost no power and waking on a pin change), then use a PIC instead - however, as Atmel's entire business plan was to try and compete with MicroChip PIC's I would expect it to have at least those similar capabilities.
No Nigel you're missing the point. the circuit is not within physical reach and can only be triggered by wireless. You made assumptions without asking proper questions about what I meant by "the wireless must be on" .
 
No Nigel you're missing the point. the circuit is not within physical reach and can only be triggered by wireless. You made assumptions without asking proper questions about what I meant by "the wireless must be on" .

That's EXACTLY what I've said all along - and that's the reason why the power switch is pointless - the RF Receiver takes so much power, there's no point in powering the Tiny down.

If you want me to ask a question - then what is the FET switch there to do?, and why?.
 
Hey Nigel with all due respect. I do electronics for fun and I don't want the fun removed from it. I have a wireless receiver which needs to be on all the time for my purposes. I have a microcontroller that needs to be on maybe twice for the week. I have opted to keep it powered down instead of sleeping. If i'm incorrect for doing it this way I'd like to hear from someone else why because you have provided me with no reason in a comprehensible language to do it differently. So I appreciate your time and thanks.
 
Hey Nigel with all due respect. I do electronics for fun and I don't want the fun removed from it. I have a wireless receiver which needs to be on all the time for my purposes. I have a microcontroller that needs to be on maybe twice for the week. I have opted to keep it powered down instead of sleeping. If i'm incorrect for doing it this way I'd like to hear from someone else why because you have provided me with no reason in a comprehensible language to do it differently. So I appreciate your time and thanks.

You're not 'incorrect', any way that works is 'OK' - just that you're wasting seven+ components for no worthwhile gain.

I've no idea what you mean by 'comprehensible language'? - it can't be much simpler, the extra components aren't saving any amount of power worth saving, so why add them?.

Many of my projects sit in sleep other than waking every second to update the RTC (so fast it uses effectively zero power), and wakes from sleep in response to an external input (a bit like your receiver data) again using almost no power at all, and then once a week (or how often you configure it) it uploads the accumulated data to an internet server. The fact it's in sleep almost all the time means that battery life is in excess of five years - using a special long life battery.

However, you can't do that - your receiver MUST be running permanently - and the current required for that swamps anything your processor might be doing anyway.

One thing you might not have considered?, whether it's possible depends on your exact application - is only powering the receiver at certain times. For example, if it's for undoing a lock on a door at work - which is only ever used between 06:00 and 18:00, you could power the receiver down outside those hours, doubling battery life. Likewise, if weekends aren't required, you could power it down all weekend as well, extending life further.

But if you need or want 24/7 coverage, those ideas aren't possible.

Battery wise, have you done the sums? - I just did (and unless I've made a huge error somewhere?), and I'm staggered at the power consumption. 4.7mA consumption is over 41Ah per year - the special batteries we use at work are D sized, and only rated at 19Ah.
 
My application
The typical circuit where the atmel is touched or timed to wake up and power up peripherals is not what's needed here.
I don't know if you read this post from me. My atmel's job has to be human initiated, not routine, and the circuit is not physically accessible to humans. I'm sure I put that in another message as well. Hence the "wireless must always be on". I feel like we just haven't been on the same page. I've only read a million posts on putting atmels to sleep. I think it was Nick Gammon who did a comprehensive page on the how's and benefits which I read a long time ago. I also did a christmas circuit with code I wrote for an esp32 a little over a year ago where I put it to sleep. I think the principle of sleep is understood and I do appreciate your resolve. I'm not very different.
 
My application

I don't know if you read this post from me. My atmel's job has to be human initiated, not routine, and the circuit is not physically accessible to humans. I'm sure I put that in another message as well. Hence the "wireless must always be on". I feel like we just haven't been on the same page. I've only read a million posts on putting atmels to sleep. I think it was Nick Gammon who did a comprehensive page on the how's and benefits which I read a long time ago. I also did a christmas circuit with code I wrote for an esp32 a little over a year ago where I put it to sleep. I think the principle of sleep is understood and I do appreciate your resolve. I'm not very different.

I don't know if you're just a troll or not?, you totally ignore any posts and just post the same meaningless rubbish - based on this thread it appears you are just a troll, but I'll go and check your previous posts and decide then if you're banned or not.

In the meantime this thread is closed - moderator.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top