I share a backup generator with several houses on a campus. I would like to install an indicator light in each home to indicate when we are on backup power. My thought is to install a RasPi at the generator to signal when the generator is on-line. Is there a way to use a Wi-Fi enabled relay to turn on lights (maybe with a ESP8266?), or would I need a RasPi in each home?

I'm new to RasPi and would appreciate any help!


you will need few things

  1. detect if generator is on/off -- the easiest way to do this is use a current sensor, because when generator is on line it will read the current going out of the generator, so you will be able to detect that generator is on line and also you will be able to read how much power you are consuming. please checkout this video how to read current

  2. after reading the current you can post the current readings on cloud and can also indicate that generator is on line. the easiest way to do this is use Particle photon and its super easy to use and you will able to see all the output on your dashboard without a lot of coding.

  3. then you can use one channel relay board with particle photon in each house. all the particle photon module can talk to the particle module which is connected with generator through cloud.so whenever there is current detection you can turn on a indication light in all houses.

particle cloud is well developed so it wont take much time.

You can find the current sensor code over here.

You can find the wifi relay code over here.

| improve this answer | |

Yes you can have a wireless enabled light.

I have tried it out on a ESP8266 NodeMcu - AI-THINKER dev board. This board supports lua however you also have a javascript/micropython firmware available for this board.

There is good readme.md available on how to install micropython in ESP8266. Please refer the link https://github.com/micropython/micropython/tree/master/esp8266.

Once you install this firmware you can connect the device first time for configuration using serial port with baud rate 115200. For windows the serial driver is available. Read the hardware spec of Node mcu which gives the link for windows driver.

You can access the device through WEBREPL. Refer the docs here. http://docs.micropython.org/en/latest/esp8266/esp8266/tutorial/repl.html

However you need to do the below steps

import webrepl

This needs to be added to a file called boot.py/main.py which resided in the core of ESP8266. You can do this the first time when you login through the serial console.

The steps below will help you to pair the ESP8266 to wireless network.

import network

wlan = network.WLAN(network.STA_IF) # create station interface
wlan.active(True)       # activate the interface
wlan.scan()             # scan for access points
wlan.isconnected()      # check if the station is connected to an AP
wlan.connect('essid', 'password') # connect to an AP
wlan.config('mac')      # get the interface's MAC adddress
wlan.ifconfig()         # get the interface's IP/netmask/gw/DNS addresses

Once you get this done. You can use ssdp discovery to get the ip of the device. There is sufficient code to send and get repsponse which you can reuse to trigger and get response from ESP8266. This means your raspberry pi can talk to ESP8266 (Trigger and collect data.)

There is also a module called machine. This enables to control the GPIO in ESP8266 the same way as you use GPIO module in raspberry pi. There is a very good documentation available with all the above mentioned details in the link below.


Hope this helps.

| improve this answer | |
  • Thx for the help! I will do some research and may have follow up questions. – J Pfled Sep 1 '16 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.