Here is proof (if only to my failing memory) that the off current really is 100nA.
I was thinking that it might be possible to just use a sensitive movement switch, and cut the sleep current all the way down to 100nA from the processor. I bought a few of different kinds from China, and have been trying them out. The best seems to be a rather large vibration switch.
Vibration Switch Tests
Mercury Switches 3MM X0014WJFK5 (Orientation determines default ON)
GAOXIN SW18010P (Normally ON)
DonGrong 520D (Normally OFF)
GikFun HDX-2 (Normally OFF)
Using it to wake up the processor.
Pull high GPIO low
I connected the switch between GPIO and ground, with a pullup on the GPIO. So when it is quiescent (closed), it pulls the GPIO low, but when the switch is disturbed the pullup on the GPIO drags the GPIO high, and the processor is triggered to wake up on pin-hi. This works OK most of the time, but not perfectly.
In quiescent state the switch is closed, and the processor is sucking about 800nA, which is about 700nA more than I expected. The problem is that there is some current leaking to ground through the GPIO most of the time.So perhaps I need a resistor of some sort to limit the current… or a capacitor? Need to do some high-school physics, or ask David.
nrf_gpio_cfg_sense_input(3, NRF_GPIO_PIN_PULLDOWN, NRF_GPIO_PIN_SENSE_LOW);
In this mode it draws a 100nA when quiescent, which seems like a distinct improvement.
<Old video removed – see the one below>
DonGrong 520D (Normally OFF)
GikFun HDX-2 (Normally OFF)
But clearly with 8 mercury switches mounted at appropriate angles, in series with the vibration switch, the latter could be disabled at the critical angles where it doesn’t work well. I lashed up something to see if I could disable the vibration switch in one of it’s difficult quadrants, and I could! I really needed two sets of four pointing up at 45 degrees, and another set pointing down at 45 degrees in series.
But even if this worked, I would need two vibration switches, each with it’s own constellation of 8 mercury switches. if this is going to work for every angle, and only use a single GPIO pin. (I think 12 mercury switches would do it, because they could share four. But that’s not going to be either pretty, or small.
BUT… another brainwave. I think it might be possible to do what I want with just two orthogonal tremblers connected to two seperate GPIOs. But I’d have to figure out which one is best to generate the processor interrupt before I send the processor to sleep. So reading the accelerometer would provide the gravity orientation, and then before shutdown I could select the best trembler.
AND… of course it is important to be able to turn the IMU fully off, so that it consumes zero power. That’s going to require another GPIO, or a programmable latch of some sort, so now I am looking at perhaps three GPIOs to shut this puppy down. A GPIO can source 3mA (15mA total). The IMU needs 0.8mA max, so maybe it can be powered directly of the GPIO.
This link explains the limits well.
We recommend 15mA total current sink/source on the chip for normal operation. This can be on one pin if you want (different than nRF51). We recommend that you sink current rather than source current because of more ground pads than vdd pads.
So I hacked a bit more and here’s a new prototype.
This was a struggle. I managed to figure out how to store data in RAM across a SYSTEMOFF sequence. The challenge is figuring out how not to leave more memory than I need switched on.
There is actually an 8 bit register that I discovered persists across SYSTEMOFF. Since I only need one bit, well perhaps two, I could have saved myself a chunk of sweating.
I read most of your post two days ago when you posted it but hadn’t finished so didn’t comment. I can’t tell much from the video except to see that when the board was tapped there was a response in the scope. That switch is quite interesting. I’m intrigued with how it works, especially since it is normally closed and isn’t “snap action”. Maybe it has some type of wax in it. Did it come with a data sheet?
How big of a pullup or pulldown resistor can you have? I think you saw 700nA because of burning power through the pullup. Current will flow as long as the switch is closed. In the other configuration, current also flows through the pulldown until the switch opens, so I don’t understand why the current measured was less (100nA). The resistor needs to be as large as possible to get down to nA current values. A 1M resistor will draw 1.8uA at 1.8V.
What you thought up is really cool. Now if there is a smaller version of the switch available. Can you send me the link to it?
I was trying to get a clean bit of video to post, which is why I never finished.
The problem is that every now and again the lights get stuck on – usually after a heavy tap. It’s like the switch get’s physically jammed. One problem is that the switch is probably generating a whole bunch of of interrupts in quick succession. I thought that if I put some capacitor, or some random diode in series, or in parallel (you can tell how scientific I am being) maybe I could make it smooth them all out somehow.
Please have a look at the end of the post, at the replacement video and you’ll get the gist. http://blog.touchstone-labs.
Notice three things:
- Sensitivity: Actually as I type this message each keystroke is triggering the LEDS on/off – and it’s a good foot away from my keyboard.
- Flashing: it seems like each tap is triggering multiple interrupts. I can write code to debounce the switch, but it seems to keep ringing for several seconds sometimes.
- It sticks on if I hit it a bit too hard.
The switch I’m using dimply came in packet marked Gikfun HDX-2 Vibration (“Geek Fun?”) I’m just using the programmable internal pullup provided by the Nordic uC. I have the current down to around 100nA now, and that seems to be about as good as it can get with the button-press demo program they provide. I find the Nordic documentation a bit confusing, so maybe it can be lower, bit I don’t see how.
I am so far out of my depth, so please suggest ideas.
Maybe you already have seen these links.
This one is normally open.
productdetails/14_SENSOR_ VIBRATION_SWITCHhttp://www.ekt2.com/pdf/14_ SENSOR_VIBRATION_SWITCH_SW- 18010P.pdfhttps://www.amazon.com/Uxcell- Vibration-Sensor-Switch-Piece/ dp/B00GWFDH3O/ref=pd_bxgy_147_ 2
wholesale?catId=0&initiative_ id=SB_20170502204015& SearchText=vibration+sensor
vibration-switch-hdx2-p-523. htmlhttp://jprogramar.blogspot. com/2014/07/how-to-work-with- hdx2-vibration-switch.htmlhttps://e-radionica.com/ productdata/SW-18020.pdf
I can’t find the HDX-2 datasheet either, not even on the manufacturers website.
c-8/10pcs-waterproof-hdx2- electronic-vibration-sensor- switch-p-302.htmlI sent them a message asking for it. They’re in Guangdong.
I watched the new video. Either it’s a unreliable POS or it can’t withstand more than a certain amount of force. How would we know that if there are no specifications? If it were mounted inside an enclosure and there were no direct blows to it would it also get stuck? Could you unstick it eventually?
The SW-18020 datasheet provides a suggestion of what might be inside one of these sensors.
I can’t see why it would get stuck if there is only a very small current.
Thinking some more, a normally-closed spring-type vibration sensor (like the picture) is probably going to be less reliable than a normally-open type, and it’s more difficult to use. A pullup on a GPIO with an open switch to GND isn’t going to draw any current. What do think about ordering some of the NO sensors?
I didn’t show you my other tests. I did all four again today – a little more carefully so I could get your comments. I updated http://blog.touchstone-labs.com/2017/04/vibration-switch.html
Re. your links:
The three NO switches you pointed me at are (I think) the same as what I have. (My previous test was with an NO switch, I was confused)
I don’t have a tilt sensor. It would be good to try and see if it had any advantages, but it seems like it would have the same issues as the mercury switches, and get stuck on in 50% of the orientations.
I checked out all the modules (at Ali Express) but they all needed power, which was what I was trying to avoid. Perhaps they are more reliable though.?
Hi Mik, Thanks for your questions. Yes, these sensors are normally closed, or on, so to speak. We do make some normally open, or off, devices though these are relatively high g level shock and acceleration switches. High sensitivity mechanical parts will self trigger if normally open because gravity will cause the devices to close. Best,Mark ******************************
They actually need 5G to trigger which is way too much. As he mentions, there is a constant 1G vector acting on any switch of course, and I need a switch that triggers when there is a small change in the gravity vector. So it seems like my solution, which uses two switches at right angles, is the way to go. The trick is to make sure that the correct switch is selected based on the orientation. You’d think they would have an integrated product for that wouldn’t you?