Page 4 of 6

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

Posted: Sat Jun 15, 2019 7:39 am
by jimmo
This is quite common, the LED is connected between Vcc and the pin. (Some microcontrollers are capable of doing this at a higher current than the other way around).

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

Posted: Sat Jun 15, 2019 12:25 pm
by RajaRamesh
RajaRamesh wrote:
Wed Jun 05, 2019 7:07 am
pythoncoder wrote:
Wed May 29, 2019 8:33 am
Assuming you have the LED working as per the advice of @jimmo, you need something like
The RTC on the ESP8266 is notoriously inaccurate. You might want to use similar logic to call settime() once at (say) 4:00.
Thank you for sharing the details pythoncoder. i will try and get back to you if i face any issues.
Hi pythoncoder, i changed from hour to mins as below and LED blinks with the logic shared by you. is it possible to implement same logic without ntptime function?

for mins,
led_on=False
if t[5]<15 and not led_on:
led_on=True
pin.on()
if t[5]>=15 and led_on:
led_on=False
pin.off()

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

Posted: Sat Jun 15, 2019 12:26 pm
by RajaRamesh
jimmo wrote:
Sat Jun 15, 2019 7:39 am
This is quite common, the LED is connected between Vcc and the pin. (Some microcontrollers are capable of doing this at a higher current than the other way around).
ok....jimmo

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

Posted: Sun Jun 16, 2019 8:32 am
by pythoncoder
@RajaRamesh The ntptime module is merely used to initialise the RTC. If you have an internet connection it's the obvious way to do it, but you can set it by any means you wish. Note that the RTC on the ESP8266 is not very accurate and it may need setting at regular intervals.

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

Posted: Mon Jun 17, 2019 7:41 am
by RajaRamesh
pythoncoder wrote:
Sun Jun 16, 2019 8:32 am
@RajaRamesh The ntptime module is merely used to initialise the RTC. If you have an internet connection it's the obvious way to do it, but you can set it by any means you wish. Note that the RTC on the ESP8266 is not very accurate and it may need setting at regular intervals.
Ok...pythoncoder. is it possible to pass a parameter to ESP8266 externally? like for example, in below code can we send value to ' a ' variable.

a= input('value')
b= 2
print(a+b)

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

Posted: Mon Jun 17, 2019 8:07 am
by pythoncoder
I'm not sure what you're asking. That code would work on an ESP8266.

If you're planning to use that technique to set the RTC manually you could input a time/date string but you'd need to parse it in code and do some validation.

In considering ways to compensate for RTC drift you need to consider the effect on your program of sudden jumps in RTC time. Doing regular updates from internet timeservers is the safest way to keep time on track: update the RTC before it has time to drift far enough to affect your application.

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

Posted: Mon Jun 17, 2019 1:20 pm
by RajaRamesh
pythoncoder wrote:
Mon Jun 17, 2019 8:07 am
I'm not sure what you're asking. That code would work on an ESP8266.
Hi pythoncoder, below screenshot may give an idea what i am trying to say. is it possible to pass a value from external device at runtime to ESP8266 ?
image.png
image.png (222.98 KiB) Viewed 5412 times

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

Posted: Mon Jun 17, 2019 5:51 pm
by pythoncoder
There are many ways to do it, depending on the electronic interface of the device. MicroPython supports various interfaces: UARTs, I2C, SPI, CAN or simply changing Pin inputs. There are also drivers for various devices, some official, some contributed by users. UARTs are somewhat problematic on ESP8266 because the hardware only has one proper UART: this is used for the REPL.

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

Posted: Tue Jun 18, 2019 9:11 am
by RajaRamesh
pythoncoder wrote:
Mon Jun 17, 2019 5:51 pm
There are many ways to do it, depending on the electronic interface of the device. MicroPython supports various interfaces: UARTs, I2C, SPI, CAN or simply changing Pin inputs. There are also drivers for various devices, some official, some contributed by users. UARTs are somewhat problematic on ESP8266 because the hardware only has one proper UART: this is used for the REPL.
So, could you please share the electronic device names or share the links where i can get an idea. so that i will try to send values to ESP8266 and then display the output on LCD screen.

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

Posted: Tue Jun 18, 2019 9:49 am
by pythoncoder
The Wiki http://wiki.micropython.org/Home has links to drivers for a variety of devices. You can also search this forum.