nodeMCU dimmer/switch/temp.sensor without arduino

4 years 11 months ago #666 by cdj
Dennis, thanks for your amazing howto. Just a couple of questions :

1) Can you use static ip address in esp with this modified firmware ? You write "you need to connect module to your wifi, then note its IP address"... so always in dhcp ?
2) The two gpio acts separately ? for ex. one for dimmer and one for switch? (i suppose no)
3) Can we use EasyIOT dimmer project with mosfet in this application ?

Dario

Please Log in or Create an account to join the conversation.

4 years 11 months ago - 4 years 11 months ago #667 by Dennis

cdj wrote: Dennis, thanks for your amazing howto. Just a couple of questions :

1) Can you use static ip address in esp with this modified firmware ? You write "you need to connect module to your wifi, then note its IP address"... so always in dhcp ?
2) The two gpio acts separately ? for ex. one for dimmer and one for switch? (i suppose no)
3) Can we use EasyIOT dimmer project with mosfet in this application ?

Dario


Hello Dario,

1) I think its possible to use static IP instead of DHCP with nodeMCU, see github.com/nodemcu/nodemcu-firmware/issues/12
(but I consider DHCP a good solution here, since we can control in one central place which module gets which IP address, without modifying the modules themselves...)

2) they act separately - you can decide if you need PWM or On/Off, simply by selecting appropriate virtual node type (type can even be changed after setting up the module), and you can also use only one of the two outputs if you just need one output, and you can also simultaneously use one for dimmer and one for switch (like in my screenshot above - red and green LED attached to same esp8266) edit - just wanted to add that the virtual dimmer module also contains switching fuctionality so you can turn on/off in addition to dimming, but the virtual switch module can only turn on/off (no dimming).

3) not sure which dimmer project you mean, but the above code should work well with the dimmer hardware described here: blog.quindorian.org/2014/12/esp8266-wifi...-part-1-of-x_30.html

regards

Please Log in or Create an account to join the conversation.

4 years 11 months ago #671 by cdj
Thanks for prompt answers. Just a doubt :

Dennis wrote: 1) I think its possible to use static IP instead of DHCP with nodeMCU, see github.com/nodemcu/nodemcu-firmware/issues/12
(but I consider DHCP a good solution here, since we can control in one central place which module gets which IP address, without modifying the modules themselves...)


Why? if you use it with dhcp address always change and you must put new ip in automation code, or not?
Or you're using fix assignment to a mac address from your router ?
Thanks
Dario

Please Log in or Create an account to join the conversation.

4 years 11 months ago - 4 years 11 months ago #673 by Dennis
Hello,

from my experience, DHCP clients always try to renew their existing IP address lease from the DHCP server *before* the lease expires. So while the client is up and running, it will not change IP address.

Even if the client is offline for a while, it still tries to get the same IP again when connectivity to the DHCP Server is re-established.

Most DHCP Servers have lease expiration intervals configured in the order of a few days to weeks, so if no other client gets the same IP address in the meantime (for example, because it was released by the posessing client or the lease deleted by an admin trying to free up some IPs, due to DHCP pool congestion), then the IP address remains "reserved".

And if you're in a large IP subnet with lots of clients where IP address pool is subject to strong fluctuations in use (probably not the case if you're at home): you can always create DHCP reservations for the MACs of your esp8266 nodes, so these reserved IPs are not given out to other clients, and are "free" for use by the esp8266 nodes. If a node requests an IP, it will always get the IP that you reserved for it.

btw. reliability of the nodeMCU firmware is good so far - my test node hasn't crashed yet (2 days uptime).


regards

Please Log in or Create an account to join the conversation.

4 years 11 months ago #674 by cdj
Ok Dennis, i understand dhcp issue, thanks.

I spent all the afternoon trying to flash esp8266 with my Arduino Nano unsuccessfully..

Always same setup :
10k res to arduino pin0(TX1) - esp rx - 20k to gnd)
esp tx to arduino pin1 (RX0)

Tried also to put direct arduino tx to esp rx.
Tried to replace esp with a brand new one

Also built a little board with two buttons, 1 reset btn and 1 that put gpio0 to gnd. Tried also to wire fixed GPIO0 with gnd.
Nothing, always rest in :
Begin find ESP8266.... Waiting MAC.

If i unconnect GPIO0 from ground and try the board normally with arduino softserial it works...

What's wrong? have you got some suggestions ?

thanks
Dario

Please Log in or Create an account to join the conversation.

4 years 11 months ago - 4 years 11 months ago #686 by Dennis
Hello,

your voltage divider sounds ok.

What I'd do:

1. load "blink" sketch to arduino, so nothing interferes with serial

2. CH_PD of the esp needs to be tied to 3.3v permanently

3. try to connect via serial terminal of arduino IDE first, 9600/8/N/1 or 115200/8/N/1, and see if you can get response from typing "AT" (followed by enter key)

4. if it doesn't work and arduino LEDs are blinking wildly, you need to swap tx and rx (keep in mind you always need voltage divider on arduino tx!)

if you can successfully connect via serial terminal, you have it wired up correctly for fw update: now just add permanent connection from GPIO0 to gnd, then power-cycle the esp to boot into fw mode

5. the fw flash tool needs admin privileges > rightclick and "run as..."


regards

Please Log in or Create an account to join the conversation.

Time to create page: 0.269 seconds

Forum latest

  • No posts to display.