Switching the imp on/off

I’m looking for a way to reset the imp programmatically.
I guess the best and most efficient way is to switch it using a p-type transistor in order to cycle the power.
My question is- can I gate the operation using one of the imp’s digital pins?
So when the pin is high, the imp shuts off. This causes the pin to go low again and the imp is powered back on.
Is that feasible at all, or do I need to gate it some other way? Anyone have a better and more elegant solution?

Some regulators have a enable pin, if you pull that low/high with imp the regulator would turn off, in turn turning off the imp and releasing the pin.

Although the delay would probaly be very short, a few ms at most.

A PFET in the power line to the imp would do this. Source to 3.3v, drain to imp, gate pulled up weakly (say 200k) to source, put 0.1uF from gate to ground and also connect gate to an imp pin.

When the imp drives this low the power will be interrupted briefly.

Not tried it, and there’s possibly some tuning required depending on the capacitance downstream of the FET, but it should work.

The regulator enable work work in much the same way.

Thanks, Hugo.
But are 3.3V enough to power the Imp, with all its features? I’m using the April evaluation board…

What’s the actual problem you’re trying to solve? There might be a better way than power-cycling the imp.


Well, I’ve been having some issues with offline operation and reconnecting after an unexpected disconnect… I’ve tried testing it by unplugging my WiFi for a few minutes. It seems like there’s a lot of inconsistency, although I haven’t had the time to really take a look at everything. Sometimes the imp reconnects almost immediately, and sometimes it just hangs. I figured this could be a nice workaround until I have time to fully debug my code. Plus, it’s nice to be able to reset your imp from afar, just in case something goes wrong!

If the imp is still connected to the server, you can reset it from afar by using the “Build and Run” button. If it’s not connected to the server, you won’t be able to reset it from afar anyway.


if the imp cant connect to wifi for 1 minute it will go into deep sleep by default.

If SUSPEND_ON_ERROR is in effect (this is the default behavior), the imp will stop executing code, attempt to reconnect to the server for 1 minute, then go to sleep. Every 9 minutes the imp will wake up and try to connect for 1 minute, and then go back to sleep if it cannot establish a connection.

By default, yes, but you can override this behavior if you wish.

Peter- my original idea was to program the device to ping the agent every hour or so. If the agent doesn’t return anything, to try and reconnect and cycle the power intermittently until connection is achieved. In my opinion, the availability of such a function on the device could be quite useful…

Mora- I’m actually using the RETURN_ON_ERROR option, because I would like the imp to continue running code offline while trying to reconnect.

Anyway, I’ve tried to implement a way to cycle power to the Imp using an Arduino, but for some reason it doesn’t work… The Imp becomes unstable and resets at will. In addition, whenever it programmatically triggers on a motor, it remains stuck and won’t turn it off… I’m still trying to figure out why that happens.

Thank you all for your input.

How are you controlling power with the arduino? If the imp is unstable, it’s likely your method of controlling the power is not ensuring the imp gets a stable supply. The imp can take pretty large current peaks (250mA) with very sharp edges.

Thanks Hugo.

For now, I’ve connected the arduino’s digital output to the gate input of a transistor situated on the imp’s Vin line. The source is connected to ground and the drain to the imp’s GND input. The gate is also pulled down using a 10k resistor. In order to check that it works, I’ve programmed the arduino output to a constant high. As I’ve said, it’s unstable.

I thought the problem might be lack of current from my power source, but I am using a 5V, 2A supply to power the entire thing. Should be enough, right?

My ultimate goal is to programmatically trigger the arduino output to LOW using a digital pulse from the imp whenever a reset is wanted.

Any ideas?

This sounds strange; you said the transistor is on the Vin line, but then say source/drain are on the GND side? If you are trying to disable power by cutting ground, this is not a good thing - you should only do it high side (ie on Vin).

Thanks again Hugo.
I’ve looked into the LTC4055… looks like that’s what I was looking for!
However, I see it’s limited to 0.5A. Do you think I could implement it for even higher currents? Say, for up to 2A? I need enough current for the Imp, 2 engines and possibly an Arduino in the future…

Sure, just pay linear tech more money :slight_smile:


Thanks, Hugo. I’ll give it a shot…
I have another question, not entirely unrelated-
I’m thinking of building a UPS battery for my project. Since 5V are required, I thought of regulating 4 rechargeable AA batteries… Could you recommend a scheme for that? Is there a way for me to continuously monitor how full the batteries are? I’ve seen some solutions, but I’m not so sure they can be safely applied for my specific needs.

I think LiPo rechargeables are better for this, because they have a nice linear discharge curve so you can measure the state of charge quite accurately from the voltage. This is used for the RPi in the very nice UPiS product, triggering progressive stages of shutdown as different voltage levels (discharge levels) are reached. Perhaps you could wire a UPiS directly to the April board.

Besides, LiPo cells are much smaller and lighter for the same capacity. But charge them carefully with a proper charger or they have been known to bring aircraft down.

Yes, something like the LTC4055 is great for this. Load (ie the imp) is connected to one pin on the chip, the battery to another, and the input power to yet another.

The input power will power the load, and with any spare power, charge the battery if necessary. If the input power goes away, the load is seamlessly switched to run from the battery.

We used this chip in the original iPhones, and I put a very similar one in the nest thermostat. LT make some very nice solid chips :slight_smile:

@Hugo this very intriguing

I put a very similar one in the nest thermostat
Your list of credits is quite amazing!
Shame you didn’t have any input to version 2 as mine keeps dropping out it’s zigbee link but my imp001 keeps working in same location :slight_smile:

Yeah, my version 1 (DVT serial number 1!) drops of wifi sometimes when imps stay connected. I wasn’t involved in the software for the nest :slight_smile: