nodeMCU dimmer/switch/temp.sensor without arduino

5 years 7 months ago - 5 years 7 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.

5 years 7 months ago #705 by cdj

Dennis wrote: 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


Nothing to do with Arduino, AT commands work perfectly but when i put esp in flash mode (i've a switch that ground GPIO0) and launch flasher i've no success.
This morning arrived my CP2102 and EVERYTHING WORK PERFECTLY....

Now i've flashed my nodemcu f***d firmware :)
Thanks a lot, in the afternoon start to interface with easyiot !

Dario

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

5 years 7 months ago #710 by Dennis
Glad it works now, congrats. Have you tried nodeMCU already? What do you think of it?

regards

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

5 years 7 months ago #711 by cdj
No, at the moment i've built a "esp programmer" with switch, usb2ttl... and have reflashed all the esp module that i have with 0.95 and one with nodemcu. Built the interface for led dimmer and tomorrow rock'n'roll i end and try it....

Thanks for interest

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

5 years 7 months ago - 5 years 7 months ago #721 by cdj
Ok I Edit post :
Now it connect, but Christmas is arrived ! Led fades on and off automatically sometimes... better stability if i set number from keyboard clicking on number itself. But if i try to use mouse for move wheel start christmas song :)

My Hardware :
IRLZ44N with
- GATE CONNECTED TO GPIO0
- DRAIN CONNECTED TO LED STRIP MINUS
- SOURCE CONNECTED TO COMMON GND (Esp gnd, ams1117 gnd, 12v gnd....)

plus of 12v connected direct to led strips... whats wrong? This mosfet is used in easyIOT led dimmer... is it not the same ?

And, i've attached DHT11 Temp Sensor to GPIO2, and program automation correctly but always 25.33° comes....OPS i've read :

- I also added a temperature readout command to the nodeMCU ini.lua, now we can send "GETTEMP" to nodeMCU and get a reply containing temperature as decimal value (atm just a static value is returned; I still need to implement proper sensor readout in init.lua, as soon as I can find a spare Ds18b20 sensor for testing)

But i've a DHT11 and not a DS18B20 :(

Your script recognize automatically what is attached and where, if GPIO0 or GPIO2 ?

It will be amazing if we can control humidity value come from dht and air pressure from bmp180?

Thanks
Dario

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

5 years 7 months ago - 5 years 7 months ago #728 by cdj
Dennis, found and tested this amazing LUA script
-- Measure temperature, humidity and post data to thingspeak.com
-- 2014 OK1CDJ
-- DHT11 code is from esp8266.com
---Sensor DHT11 is conntected to GPIO0
pin = 3

Humidity = 0
HumidityDec=0
Temperature = 0
TemperatureDec=0
Checksum = 0
ChecksumTest=0


function getTemp()
Humidity = 0
HumidityDec=0
Temperature = 0
TemperatureDec=0
Checksum = 0
ChecksumTest=0

--Data stream acquisition timing is critical. There's
--barely enough speed to work with to make this happen.
--Pre-allocate vars used in loop.

bitStream = {}
for j = 1, 40, 1 do
     bitStream[j]=0
end
bitlength=0

gpio.mode(pin, gpio.OUTPUT)
gpio.write(pin, gpio.LOW)
tmr.delay(20000)
--Use Markus Gritsch trick to speed up read/write on GPIO
gpio_read=gpio.read
gpio_write=gpio.write

gpio.mode(pin, gpio.INPUT)

--bus will always let up eventually, don't bother with timeout
while (gpio_read(pin)==0 ) do end

c=0
while (gpio_read(pin)==1 and c<100) do c=c+1 end

--bus will always let up eventually, don't bother with timeout
while (gpio_read(pin)==0 ) do end

c=0
while (gpio_read(pin)==1 and c<100) do c=c+1 end

--acquisition loop
for j = 1, 40, 1 do
     while (gpio_read(pin)==1 and bitlength<10 ) do
          bitlength=bitlength+1
     end
     bitStream[j]=bitlength
     bitlength=0
     --bus will always let up eventually, don't bother with timeout
     while (gpio_read(pin)==0) do end
end

--DHT data acquired, process.

for i = 1, 8, 1 do
     if (bitStream[i+0] > 2) then
          Humidity = Humidity+2^(8-i)
     end
end
for i = 1, 8, 1 do
     if (bitStream[i+8] > 2) then
          HumidityDec = HumidityDec+2^(8-i)
     end
end
for i = 1, 8, 1 do
     if (bitStream[i+16] > 2) then
          Temperature = Temperature+2^(8-i)
     end
end
for i = 1, 8, 1 do
     if (bitStream[i+24] > 2) then
          TemperatureDec = TemperatureDec+2^(8-i)
     end
end
for i = 1, 8, 1 do
     if (bitStream[i+32] > 2) then
          Checksum = Checksum+2^(8-i)
     end
end
ChecksumTest=(Humidity+HumidityDec+Temperature+TemperatureDec) % 0xFF

print ("Temperature: "..Temperature.."."..TemperatureDec)
print ("Humidity: "..Humidity.."."..HumidityDec)
print ("ChecksumReceived: "..Checksum)
print ("ChecksumTest: "..ChecksumTest)
end

With function getTemp(); we have Temperature and Humidity...
tried lots of hours to integrate in your init.lua without success....

Thanks
Dario
The following user(s) said Thank You: Dennis

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

Time to create page: 0.345 seconds

Forum latest

  • No posts to display.