crocket
Posts: 112
Joined: Thu Mar 07, 2019 12:38 pm

Can a power line provide Raspberry Pi and a lamp with power?

Wed Apr 17, 2019 4:06 am

I want to control a lamp with Raspberry Pi and a relay. However, I want a single power line to provide power for Raspberry Pi and the lamp.

How can I do that? In other words, I want to construct a WiFi lamp with Raspberry Pi, a relay, and a lamp.

Andyroo

Re: Can a power line provide Raspberry Pi and a lamp with power?

Wed Apr 17, 2019 11:10 am

Mains can kill and burn down your house if you do not know what you are doing - it is also illegal to be unqualified and alter things in lots of places and if you need to ask a basic question like this then I would recommended getting professional advice if you want to design the hardware :)

Safer to use one of these https://energenie4u.co.uk/catalogue/cat ... ccessories to do the work.

Plug an extension lead into the wall
Plug the Pi into one socket
Plug the switch box into another
Plug the lamp into the switch box and off you go

Lots cheaper than buying a new house :lol:

User avatar
omegaman477
Posts: 148
Joined: Tue Feb 28, 2017 1:13 pm
Location: Sydney, Australia

Re: Can a power line provide Raspberry Pi and a lamp with power?

Wed Apr 17, 2019 12:17 pm

crocket wrote:
Wed Apr 17, 2019 4:06 am
I want to control a lamp with Raspberry Pi and a relay. However, I want a single power line to provide power for Raspberry Pi and the lamp.

How can I do that? In other words, I want to construct a WiFi lamp with Raspberry Pi, a relay, and a lamp.
If this is a table lamp and you have access to both the UNSWITCHED active and neutral wires, then you can splice in a small power supply to supply the RPI. The RPI relay then switches downstream of the power supply mains input. As said by others, make sure its an appropriate power supply and the mains wiring is done safely and correctly.

If its a built in ceiling light and wall switch then it gets complicated. Often (but not always) the wall switch just has the active wire and no neutral wire. In these situations its impossible to feed a standard power supply with running a neutral wire to the wall switch location. The neutral wire is found at the light socket, but to save cost, its rarely run down the wall to the switch.

Parasitic power supplies and HA smart wall switches are emerging, that will operate on just the active wire. But building one is a very complex task.

Consider using a WiFi or Phillips Hue style smart Bulb, and talking to it from the RPI directly or via IFTTT.
..the only thing worse than a stupid question is a question not asked.

crocket
Posts: 112
Joined: Thu Mar 07, 2019 12:38 pm

Re: Can a power line provide Raspberry Pi and a lamp with power?

Wed Apr 17, 2019 3:39 pm

"European Remote Controlled Sockets with Pi-mote" seems interesting. Is there a WiFi bulb that's not locked to a specific vendor software?

PhatFil
Posts: 1425
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Can a power line provide Raspberry Pi and a lamp with power?

Wed Apr 17, 2019 4:47 pm

Most 'smart' devices based on esp8265/6 wifi socs can with varying ease be reflashed with alternative firmware. Tasmota being a Very popular and fully featured option. - smart sockets advertised for use with an app called "smart Life" or "BrandName-Life" can CURRENTLY, be reflashed OTA without any physical mods or opening of cases.. (Google "Tuya-Convert" for the github repo and utubes detailing the process..)

so spend a fraction of the cost of a 240v ac safe Pi case psu grommets etc needed to make your oringinal proposal safe on 1 x smart socket.
reflash it, host a mqtt broker on your pi and then use any mqtt interface for easy control, use node-red and the alexa-local node for hassle free local alexa control etc..


https://github.com/arendst/Sonoff-Tasmota/wiki

https://github.com/arendst/Sonoff-Tasmota/wiki/Tuya-OTA

crocket
Posts: 112
Joined: Thu Mar 07, 2019 12:38 pm

Re: Can a power line provide Raspberry Pi and a lamp with power?

Thu Apr 18, 2019 1:38 am

PhatFil wrote:
Wed Apr 17, 2019 4:47 pm
Most 'smart' devices based on esp8265/6 wifi socs can with varying ease be reflashed with alternative firmware. Tasmota being a Very popular and fully featured option. - smart sockets advertised for use with an app called "smart Life" or "BrandName-Life" can CURRENTLY, be reflashed OTA without any physical mods or opening of cases.. (Google "Tuya-Convert" for the github repo and utubes detailing the process..)

so spend a fraction of the cost of a 240v ac safe Pi case psu grommets etc needed to make your oringinal proposal safe on 1 x smart socket.
reflash it, host a mqtt broker on your pi and then use any mqtt interface for easy control, use node-red and the alexa-local node for hassle free local alexa control etc..


https://github.com/arendst/Sonoff-Tasmota/wiki

https://github.com/arendst/Sonoff-Tasmota/wiki/Tuya-OTA
I do not want to reflash a device. Is there a WiFi bulb that I can control without a special vendor software and without reflashing?

PhatFil
Posts: 1425
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Can a power line provide Raspberry Pi and a lamp with power?

Thu Apr 18, 2019 5:59 am

crocket wrote:
Thu Apr 18, 2019 1:38 am
I do not want to reflash a device. Is there a WiFi bulb that I can control without a special vendor software and without reflashing?
not as far as i am aware..

you can ebay a very basic and blank esp8266-01 controlled relay module that you can program yourself
Image
https://www.ebay.co.uk/itm/ESP8266-5V-W ... 5b8d0425fa

using the arduino ide, platform-i0/atom, or visual code etc.. But there is a lot more work involved doing that.


whats your aversion to reflashing? it takes about an hour waiting for downloads and etcher to write an sd card and seting up a virgin raspbian system sd card with the software. most of which is sat supping tea or coffee waiting. but once done its a 5 minute job running a cli script
And once you have invested in one device, flashed it, played with it for 5 minutes, its VERY probable you will concieve of many more uses for devices and start collecting them,, hehe

https://youtu.be/MxiPRBd5HEg


crocket
Posts: 112
Joined: Thu Mar 07, 2019 12:38 pm

Re: Can a power line provide Raspberry Pi and a lamp with power?

Fri Apr 19, 2019 4:54 am

PhatFil wrote:
Thu Apr 18, 2019 5:59 am
you can ebay a very basic and blank esp8266-01 controlled relay module that you can program yourself
If such a module supports 802.11ax, I'm willing to learn how to program ESP8266. 802.11n and 802.11ac are not great for IoT devices.

btidey
Posts: 1624
Joined: Sun Feb 17, 2013 6:51 pm

Re: Can a power line provide Raspberry Pi and a lamp with power?

Fri Apr 19, 2019 3:23 pm

I know there have been lots of articles about neat wifi 6 features helping IoT but ...

ax is not even ratified yet, (Q3 2019?)
some pre-ratification products are only just starting to appear (Samsung 10),
and your router will need an upgrade.

A lot of IOT is quite usable today without the extra features. On the security side I would worry more about bad programming practices on many commercial IoT devices rather than the raw Wifi networking protocols.

PhatFil
Posts: 1425
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Can a power line provide Raspberry Pi and a lamp with power?

Fri Apr 19, 2019 4:24 pm

if wifi security is such a concern? Perhaps consider looking at alternative wireless protocols, bluetooth, RF, IR etc..

its just that the wifi/smart device route is currently a very easy s/w only solution. And loading an open source f/w will mitigate ALL the real world remote (data mining?) server risks involved with commercially developed cloud based apps.

crocket
Posts: 112
Joined: Thu Mar 07, 2019 12:38 pm

Re: Can a power line provide Raspberry Pi and a lamp with power?

Tue Apr 23, 2019 12:07 am

PhatFil wrote:
Thu Apr 18, 2019 5:59 am
you can ebay a very basic and blank esp8266-01 controlled relay module that you can program yourself
Flashing software is relatively straightforward.

The real challenge is making physical connections. The relay requires 5V power input and intercepts a power line. I don't know how to make physical conections without making a mess. This seems to require two power outlets unless I know how to put a power strip and the relay in a miniaturized plastic container. This is far beyond my expertise.

PhatFil
Posts: 1425
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Can a power line provide Raspberry Pi and a lamp with power?

Sun Apr 28, 2019 12:17 am

crocket wrote:
Tue Apr 23, 2019 12:07 am
PhatFil wrote:
Thu Apr 18, 2019 5:59 am
you can ebay a very basic and blank esp8266-01 controlled relay module that you can program yourself
Flashing software is relatively straightforward.

The real challenge is making physical connections. The relay requires 5V power input and intercepts a power line. I don't know how to make physical conections without making a mess. This seems to require two power outlets unless I know how to put a power strip and the relay in a miniaturized plastic container. This is far beyond my expertise.
Very wise practicing caution with mains power.
sorry if my ebay link to an example of the cheapest devices available was misleading and requires a 5v dc power supply,
that was a bad example to post in that case .. The crucial point being its essentially the same h/w thats inside the slightly more expensive smart plugs soc wise an esp 8265/6 system which is 801,11g re its wifi (ample for its traffic load btw).

And since reflashing devices currently based on a tuya daughterboard for the esp module that are marketed as being controlled by an app called 'Smart-Life' or in some cases 'BrandName Life' can be accomplished Over The Air (OTA) the $10-15 cost of such a smart switch isnt bad value.

Then once used for the flashing you can re-use your pi as the mqtt broker host and host any further s/w to control you lamp, node red and its alexa-local node make alexa verbal control a doddle,

crocket
Posts: 112
Joined: Thu Mar 07, 2019 12:38 pm

Re: Can a power line provide Raspberry Pi and a lamp with power?

Sun Apr 28, 2019 4:33 am

PhatFil wrote:
Sun Apr 28, 2019 12:17 am
Very wise practicing caution with mains power.
sorry if my ebay link to an example of the cheapest devices available was misleading and requires a 5v dc power supply,
that was a bad example to post in that case .. The crucial point being its essentially the same h/w thats inside the slightly more expensive smart plugs soc wise an esp 8265/6 system which is 801,11g re its wifi (ample for its traffic load btw).

And since reflashing devices currently based on a tuya daughterboard for the esp module that are marketed as being controlled by an app called 'Smart-Life' or in some cases 'BrandName Life' can be accomplished Over The Air (OTA) the $10-15 cost of such a smart switch isnt bad value.

Then once used for the flashing you can re-use your pi as the mqtt broker host and host any further s/w to control you lamp, node red and its alexa-local node make alexa verbal control a doddle,
I cannot understand your reply at all. You better show me with a video demonstration.

PhatFil
Posts: 1425
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Can a power line provide Raspberry Pi and a lamp with power?

Sun Apr 28, 2019 4:38 pm

crocket wrote:
Sun Apr 28, 2019 4:33 am
PhatFil wrote:
Sun Apr 28, 2019 12:17 am
Very wise practicing caution with mains power.
sorry if my ebay link to an example of the cheapest devices available was misleading and requires a 5v dc power supply,
that was a bad example to post in that case .. The crucial point being its essentially the same h/w thats inside the slightly more expensive smart plugs soc wise an esp 8265/6 system which is 801,11g re its wifi (ample for its traffic load btw).

And since reflashing devices currently based on a tuya daughterboard for the esp module that are marketed as being controlled by an app called 'Smart-Life' or in some cases 'BrandName Life' can be accomplished Over The Air (OTA) the $10-15 cost of such a smart switch isnt bad value.

Then once used for the flashing you can re-use your pi as the mqtt broker host and host any further s/w to control you lamp, node red and its alexa-local node make alexa verbal control a doddle,
I cannot understand your reply at all. You better show me with a video demonstration.
https://www.youtube.com/watch?v=O5GYh470m5k

crocket
Posts: 112
Joined: Thu Mar 07, 2019 12:38 pm

Re: Can a power line provide Raspberry Pi and a lamp with power?

Tue Apr 30, 2019 5:39 am

I think https://www.crowdsupply.com/anavi-techn ... rared-phat or any USB IR transmitter/receiver is the better solution because the light switch in my room can be controlled by an IR remote controller.

My computer monitor can also be controlled by an IR transmitter.

Andyroo

Re: Can a power line provide Raspberry Pi and a lamp with power?

Tue Apr 30, 2019 10:15 am

crocket wrote:
Tue Apr 30, 2019 5:39 am
I think https://www.crowdsupply.com/anavi-techn ... rared-phat or any USB IR transmitter/receiver is the better solution because the light switch in my room can be controlled by an IR remote controller.

My computer monitor can also be controlled by an IR transmitter.
Thanks for that link - bookmarked for summer :)

Return to “Automation, sensing and robotics”