Impowered AC Outlet

Yet another Imp Powered AC outlet. Posted on instructables and then noticed @mlseim had posted an Instructable as well. Then noticed another from @jwehr on this forum… I didn’t expect to be first and it solved a real problem with the poor quality of the device I originally bought off-the-shelf to solve my remote lighting issues.

The instructable is here:

Good find on the donor product too, this is a really neat solution :slight_smile:

Really nicely done…a project as well built as that is just fun to look at. :slight_smile: Nice work on the Instructable too. I know how much work tutorials are. I read over it quickly and unless I missed it, I don’t think you mentioned where you got the relay board? The first few switches that I built had focused on being as tiny as possible, but recently I’ve been searching through Digikey for a high load relay that could safely handle 20A, as you mention in your Instructable, and still switch around 5V DC. Glad you reminded me about Jameco… I hadn’t been using them as a parts source.

@jwehr, thanks for spotting the missing relay in the parts list. I used the SainSmart 2-Channel Relay Board. Has opto-isolator inputs. I bought this board for another project (bluetooth switch). At that time (August 2013) it was under $5 delivered with Amazon Prime. The current price is $9

The board says it needs 15-20mA to drive the relays, but you are driving each from a single Imp pin. I’m surprised you don’t need a transistor in there…as the Imp Card module is only supposed to source up to 4mA/pin? That is one of the reasons I looked at solid state relays for a while… there are some that can be driven with only 3mA, and most are optically isolated.

I cant see what the 4 pin chip is on the board, but maybe those are handling the current issue? The description on Amazon seems to indicate that your controller needs to supply 15-20mA.

I guess Q1 & 2 must be transistors?

They’re opto-isolators: (second picture). The 20mA to drive the relays doesn’t come straight from the imp.


Ah, I missed the schematic, which doesn’t match the component numbers on the board. It clearly does have a transistor… wonder why they still say it needs 15-20mA?

The two input devices on the relay board are opto isolators. The Imp pin drives the LED of the opto causing the phototransistor to conduct.

Update: I edited my previous response as it wasn’t that helpful.

From the photographs of the relay board, the circuit values appear to be

Current Limiting Resistor: 1K
Opto Isolator: Liteon LTV-817C
Surface Mount Green LED: Unknown P/N

With that circuit connected to the Imp output pin, we can assume the following when the Imp pin is driven low to turn the relay on:

Opto Isolator LED Voltage Drop + Green LED Voltage Drop = 2.2V (817C Datasheet shows voltage drop to be about 1V and assuming green LED about 1.2V due to the low current that will be flowing through it)

Current through opto isolator LED = 3.3 (Vcc) - 2.2V (LED Drops) / 1K = 1.1mA

This is the same current that needs to be sunk by the Imp pin.

The opto Isolator has a Current Transfer Ratio of between 200 and 400%. However, for low forward current through the opto LED, you may only see about 60% of this CTR so at the minimum spec of 200 we can expect to see CTR of 60% * 200 = 120%.
The collector current of the phototransistor is then approximately 120% * 1.1mA = 1.32mA assuming Vce 5V.

This is the current that is available to drive the base of the transistor (Q1 for example) that drives the relay coil. Assuming a Vbe saturation voltage on Q1 of 0.7V and a 510Ohm current limiting resistor on the base of this transistor, the 1.32mA available from the phototransistor will be plenty to saturate Q1. Assuming the relay coil needs about 20mA (I assume they mean that 15-20mA is the total current draw of the relay switch side when a relay is on), Q1 would only need a current gain of 20/1.32 = 15 which is very low for your typical garden variety NPN transistor which means that the circuit has a wide margin of operation which is a good thing.

So after all this indepth analysis, the Imp needs to sink at most 1.1mA which is well within it’s operational capability.

Yep… Looks like a nice design… and a really good price.

Looks way nicer than mine … but I built mine with scrap parts. I’m halfway done getting my outdoor Christmas light display setup. Everything imp-wise is working perfect so far. I am going to add a new youtube video to my instructable when we get some good snow cover.

The compactness of midnightmaker’s imp outlet is outstanding.

Has anyone experimented with the Belkin WeMo devices?

I picked up couple of the WeMo devices last month for a second home, and got them on the air and set up after a bit of fiddling around. I’ve got local schedules set up, and of course I can control them remotely via the WeMo app. (Not too bad, but the firmware update and set up were a bit funky … I could see it perhaps being a problem for non-technical sorts).

So far they seem to be working fine … but it took the app about 15 minutes to load the the devices when I went to look at them tonight. Very strange. I thought they had perhaps fallen of the air , especially after reading all the negative Amazon reviews re: their apparent inability to recover gracefully from a WiFi outage. Anyway, the app did eventually load them, and they do seem to be working fine (since I installed them about a month ago now).

From a packaging standpoint those these things are really clunky … I have no idea why so big.

I was tempted to buy the WeMo myself. But, having all the parts for an Imp solution on-hand from previous abandoned projects, a DIY approach was the way to go. If you look at the true cost though:

Imp $25
April Board $12
Relay Board $9
Stanley Power Adaptor $15
iPhone Charger $5

This very quickly adds up to $66 without shipping costs.
The WeMo retails for $49… and they still need to make a profit. Makes me wonder what their real gross margin is.

I understand that the WeMo can be controlled only by a phone/tablet (or by a shedule), while this solution has all the Imp possibilities…

There certainly is a niche for the Imp that nobody else covers. I was just curious about the reliability, construction and ease-of-use for the WeMo.

The way that the imp can recover from WiFi loses, power outages, etc. makes it a very reliable thing to work with. Probably best of all is the support for the Imp, in regards to hardware and software and this website/forum.

I have a couple of wemos and i like it; the wemo is design for a specific purpose i.e. a wifi web ac outlet, unlike the imp which of course allows customisation. As an net controlled ac outlet, i think it is a good solution, much cheaper (see @deonsmt, plus labour cost) and the form factor is better that any diy solution i seen. The wemo also detect if the switch been activated. The real plus is the IFTTT interface, instantly connecting the ac outlet to sms, twitter, etc with ease.
Wemo’s con is difficult to “hack”.

Just came across this for folks investigating options within this space … (A way off though … if it makes it).

Nice of them to show it with the cover off. Gives me more ideas. WiFi chip doesn’t support 802.11n though. Seems like that might give it a pretty short lifespan.

The does have a nice feature set. Overall I like it. Thanks for the post @LarryJ