Battery sleep wake up code

@brolly759 You asked if "Is it possible to wake up without turning the wifi on? ", the answer is yes and I got one million no-wifi wakes interspersed with 50,000 wifi wakes on five AA batteries.

One MEEEEEEELION wakes? Muahahaha :wink:

@Hugo Hi mate today i got a pdip74HC86 Quad 2-in EXOR Gate IC (missing the T and the N it seams the same?) i have some pictures here to see what i need to change. the green wires i have put in 2a,2b 3a,3b 4a,4b. the resistor i have put in 1a and 1b as well as the white wire (in 1a) that the other end goes to the reed switch. The capasitor is in 1b and the ground pin 7 on the gate. the chrome wire i have in 1y and pin 1 of the imp. And the red and white wire goes from the middle point of the reed switch to pin 2 of the imp.

I also have the ground pin on the imp to the reed switch do i still need that? and the battery power do i need to hook that to the breadboard?
Thanks very much for your time

@hugo Hi hugo I am having a little trouble getting this gate are any the same as the one you advice in earlier post. thanks josh

@hugo disregard that last post i have the gate now. Its small I am not sure I am able to put this together is there a you tube video or a link to give me a better idea? Thanks again josh

@hugo here is a picture. Is there a bigger one I don’t want to have to use a converter.

Mmm yes, they are small I’m afraid. If you’re trying to breadboard, then you can still get four of them in a PDIP package, eg here:,652/568-1569-5-ND/763173 - in there there are four gates, you’d just use one of them (and for the unused gates, tie all the inputs to ground to prevent the inputs floating).

…the issue here is that these are not schmitt trigger input devices, which means it could get noisy around transitions; that’s probably not an issue for this application though.

@LarryJ hi Larry Thanks for the reply. The three connections on the reed switch are com. - no. - no. (com to 1a on the gate, no to pin 2 of the imp, no ground on the imp.)

the no- to pin2 of the imp is in responce to Hugo’s post below.
(also connect the reed switch to another pin on the imp (so when you wake you can tell which state the switch is now in).

Maybe i have misunderstood this part.

No I don’t have anything in pin 14 i’ll do some research in to that.

Hmmm … two NO’s … haven’t seen that configuration before. Is it two SPST switches (which seems like it would work), or are the NO’s tied together internally (which shouldn’t)? At any rate, are you using something like DIGITAL_IN_PULLUP on both pins 1 and 2 to detect when the switch closes and pulls the pins to GND? I’m still a bit uncertain about how you’re generating your input signal to pin 1 of the XOR. Again, if you happen to have a part number for your switch that would be helpful to make sure you’ve got things wired correctly.

Your HC86 device needs power, so that’s necessary to supply on its Vcc pin (14). You should be fine to just connect 3V3 from your April card to provide this.

Ok, revisiting the first paragraph of that last post. (Not the power part … my comments were ok there). I got myself confused re: pin 1 of your HC86 and pin 1 of the imp. Still not exactly sure how things will work as I don’t see any sort of pullup on the input of pin 1 of your HC86.

Also, I just noted an overall grounding problem (this got by me before). You need to make sure that ALL your ground pins (all the XOR inputs, the one side of the capacitor, pin 7 of the HC86) get connected together, and get connected to GND of your April card. Again, a bit hard to tell from the photos, but it would appear you have some isolated/unconnected grounds here.

(If you have any add’l info on the switch I’ll try to sketch up a schematic for you. I don’t use Fritzing, so haven’t yet been able to draw up all those pretty breadboard pictures that I’ve seen folks do :slight_smile: ).

Hi Larry Sorry mate on a closer look the reed switch is com. - nc. - no. so sorry to give you the wrong info.

I have put all the XOR to GND but i had to double them up in the same ports as i would not have enough. I will draw what i have done to make it a little easier.

I am not sure about the pull up on the pin 1 of the HC86, I will look into it more.

Ill do a drawing now and send it to you.

The drawing will make this a lot clearer!

pin 1 of the HC86 should go to either NC or NO (makes no difference, really). That pin also needs a pull-up to 3.3v. Try 100k for now. You should also connect this to another pin on the imp as this allows your code to read the current state of the switch after being woken.

pin 2 of the HC86 should have the delay cap, and be connected to pin 1 of the HC86 by the delay resistor.

pin 3 of the HC86 should go to imp pin 1 (the wakeup signal). No resistor is required here as the HC86 is push-pull output.

As LarryJ says, pin 7 of the HC86 should go to ground and pin 14 should to go 3.3v.

Hi Larry here is my drawing looks like i have to do a few things to it. ill do a new one after i fix what hugo hastold me to do. thanks

ok hugo thanks I try this and send another drawing. thanks

Ok guys i made a few changes after hugo’s comments please have alook now

also i had to double up on the jumper wires/cap in the same spot on the GND of the OXR i only had 4 ports for 8 pins. is this ok?

I think I understand your drawing @jr, and would make the following changes …

  1. connecting pin 2 of the imp to Vcc doesn’t do much, so connect it to the relay n/c instead.
  2. similarly, remove your pullup resistor from XOR pin 1, and also connect to relay n/c.
  3. connect relay COM and your GND signal together.

I’ve got a few things going today which will keep me busy, but if you’re still having difficulties I will try to get to a drawing for you a bit later which would hopefully help clear things up.

(If I’m understand correctly, you should be fine doubling GND connections. As long as things are s’posed to go to GND, you should be good to go).

OK Thanks @LarryJ. I have made the changes. Just not sure if the COM to ground u mean the imp or the XOR, I did it to the imp. here are the changes. Sorry about the drawings its the best i can do i downloaded Fritzing but could not find the parts to download in library. Thanks again for your time.

Here’s a quick schematic @jr that will hopefully advance the discussion a bit, (and perhaps help others to offer suggestions that I may have missed). I hope this summarizes the wiring discussions we’ve been having.

To your question, ALL grounds in your system need to be connected together. This includes …

  • all six XOR inputs
  • the XOR ground (pin 7)
  • one side of the capacitor
  • COM on your reed switch
  • GND on the April

I’ve shown this on the schematic to hopefully clarify this a bit. I hope this helps.

Ok Thanks @LarryJ I have changed it. Just need to check it make sure i have it right. Do I have to add some code now as well?