How to switch on a electric bulb with ESP8266 board?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
ThomasChr
Posts: 121
Joined: Sat Nov 25, 2017 7:50 am

Re: How to switch on a electric bulb with ESP8266 board?

Post by ThomasChr » Mon May 13, 2019 9:41 am

@RajaRamesh:
You simply switch on or off the Pin which is connected to the Relay. There is no magic involved here!

RajaRamesh
Posts: 51
Joined: Wed May 08, 2019 10:54 am

Re: How to switch on a electric bulb with ESP8266 board?

Post by RajaRamesh » Mon May 13, 2019 5:20 pm

Thank you Thomas...i will try and get back to you.

RajaRamesh
Posts: 51
Joined: Wed May 08, 2019 10:54 am

Re: How to switch on a electric bulb with ESP8266 board?

Post by RajaRamesh » Fri May 17, 2019 3:50 pm

Hi,

is it possible to schedule the code to run particular day,time on esp8266 board ?

Thanks

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: How to switch on a electric bulb with ESP8266 board?

Post by jimmo » Sat May 18, 2019 12:23 am

Have a look at https://docs.micropython.org/en/latest/ ... e.RTC.html

Note you'll need a way to set the current time -- there's an ntptime module available as a frozen module: https://github.com/micropython/micropyt ... ntptime.py

RajaRamesh
Posts: 51
Joined: Wed May 08, 2019 10:54 am

Re: How to switch on a electric bulb with ESP8266 board?

Post by RajaRamesh » Mon May 20, 2019 4:04 pm

jimmo wrote:
Sat May 18, 2019 12:23 am
Have a look at https://docs.micropython.org/en/latest/ ... e.RTC.html

Note you'll need a way to set the current time -- there's an ntptime module available as a frozen module: https://github.com/micropython/micropyt ... ntptime.py
Hi ,

i gone through the links and understand machine.RTC one and build as below.
rtc=machine.RTC()
rtc.datetime((2019,5,20,9,0,0,0,0))
rtc.datetime() # displays current time but it is showing different time stamp.how can i get IST standard?

Now i am trying to display year alone and month...etc and receiving error as below. how can i get year/ month/day/hour/....?

>>> print(rtc.datetime('year'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object 'str' is not a tuple or list

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: How to switch on a electric bulb with ESP8266 board?

Post by kevinkk525 » Mon May 20, 2019 4:51 pm

Code: Select all

t = time.localtime()  
t = t[0:3] + (0,) + (t[3] + TIMEZONE_OFFSET,) + t[4:6] + (0,)
print("{}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}".format(t[0], t[1], t[2], t[3],t[4],t[5])
Creates this output: 2019-05-20 14:56:03 (YYYY-MM-DD HH:mm:SS)
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

RajaRamesh
Posts: 51
Joined: Wed May 08, 2019 10:54 am

Re: How to switch on a electric bulb with ESP8266 board?

Post by RajaRamesh » Wed May 22, 2019 4:06 pm

kevinkk525 wrote:
Mon May 20, 2019 4:51 pm

Code: Select all

t = time.localtime()  
t = t[0:3] + (0,) + (t[3] + TIMEZONE_OFFSET,) + t[4:6] + (0,)
print("{}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}".format(t[0], t[1], t[2], t[3],t[4],t[5])
Creates this output: 2019-05-20 14:56:03 (YYYY-MM-DD HH:mm:SS)
Thank you for sharing the details Kevin.
is it possible for esp8266 to communicate with high power ....meaning 3-phase power supply 415v for heavy loads. if yes what kind of relays we can use.

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: How to switch on a electric bulb with ESP8266 board?

Post by kevinkk525 » Wed May 22, 2019 4:22 pm

RajaRamesh wrote:
Wed May 22, 2019 4:06 pm
is it possible for esp8266 to communicate with high power ....meaning 3-phase power supply 415v for heavy loads. if yes what kind of relays we can use.
If you find the right relay, it surely can. But I don't know about that kind of relay. I only bought ones for 230V
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: How to switch on a electric bulb with ESP8266 board?

Post by jimmo » Wed May 22, 2019 4:44 pm

RajaRamesh wrote:
Wed May 22, 2019 4:06 pm
is it possible for esp8266 to communicate with high power ....meaning 3-phase power supply 415v for heavy loads. if yes what kind of relays we can use.
I'm sorry to keep going on about this and I absolutely mean this with best intentions in a "this might save your life" way.. but if you have to ask that then you probably shouldn't be doing it.

I strongly recommend finding an existing product designed for this purpose that supports interfacing with it over a low voltage, well isolated and documented digital interface.

RajaRamesh
Posts: 51
Joined: Wed May 08, 2019 10:54 am

Re: How to switch on a electric bulb with ESP8266 board?

Post by RajaRamesh » Thu May 23, 2019 1:23 pm

jimmo wrote:
Wed May 22, 2019 4:44 pm

I strongly recommend finding an existing product designed for this purpose that supports interfacing with it over a low voltage, well isolated and documented digital interface.
Ok....i will try for existing product for this.

Post Reply