A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By user1829
#21704 I have a fan that ventilates my basement (to reduce mold issues) that sucks air from the roofspace

I want to switch the fan on if the fan inlet temperature (read by DHT22) is higher than the basement temperature (read by DHT22).

I also want to control (override) the fan with my smartphone. and also control it based on the clock time (off between 11pm to 7am - sleeping time)

I am a 100% n00b at LUA coding and all I can do so far is make an LED blink, make a SSR relay turn on and off via my home network, and get a temperature reading to be displayed on the internet.

I am using ESPlorer to program my ESP8266 and my NodeMCU V1 and am kinda getting the hang of it all.

now my next big step is to get the fan control working - without wanting anyone to "please write my LUA code" I kinda just need to understand what components the code will need, then I can research more on how to write the code.

so I *think* I need:
1. code to read two DHT22 sensors
2. code to make a calculation of the DHT22 outputs (if temp1 > temp2, then fan relay (GPIOx) HIGH)
3. code to make a simple web interface to display the DHT22 reading and have an override button

am I way over my head, or will I be able to work this out with a bit of guidance?

thanks!
User avatar
By tytower
#21735 I have done something similar with DHT22 and a BMP180 but in "C++" using the ArduinoIDE . Its quite easy that way and I have not tried Lua but it does seem more complicated and more down toward the machine language level of an interpreter.

So for the Arduino version have a look at my projects in the Wiki . At least it may give you a starting plan.
User avatar
By user1829
#21745
tytower wrote:I have done something similar with DHT22 and a BMP180 but in "C++" using the ArduinoIDE . Its quite easy that way and I have not tried Lua but it does seem more complicated and more down toward the machine language level of an interpreter.


oh OK, i have used Arduino IDE 1.6.5 to upload some sketches, and it is pretty friendly, but was told LUA is OK too? that's why i am asking about the basic parts of the code i need to get this fan control happening...

this is SO confusing! everywhere i turn i have to learn new things, there is just so much assumed knowledge with this stuff, i have never used any programing... i am literally at the base of base levels here!

so to clarify - Arduino language is C++? and LUA is its own unique language?

So for the Arduino version have a look at my projects in the Wiki . At least it may give you a starting plan.


i couldn't find anything in this wiki: wiki/doku.php is that the wiki you are referring to?

opps, found it:http://www.esp8266.com/wiki/doku.php?id=esp-12_board_to_thingspeak_and_sparkfun_arduino

how do i get the data from the server to do the calculations?