Before you start, please read my previous topics how to program and prepare your esp8622 here: http://coding-talk.com/forum/main-fo...ows-is-similar 
to make your weatherstation,
you need:
Download the attached weatherstation.zip php script and upload it to your webhost, remember the url of the receive_data.php file, you will need it in next steps.
Make sure you have correct firmware installed, this setup requires the dht and http module included in your build.
upload this init.lua code to your esp8266
and main.lua
change yoursite.net in the code to your domain name, you can also define your custom key in the url instead blabla and do the same in the receive_data.php file which is located in the attached php script.
Now connect everything like on the image:
if you have done everything correctly, you should be able to view your sensor data in the generated graph with a php script.
There is another better, battery saving setup with esp8266 sleep mode, if you are interested in such setup please post your request here.
to make your weatherstation,
you need:
- Breadboard
- some cables
- 104 ceramic capacitor
- 10kOhm resistor
- dht11 or dht22 temperature and humidity sensor, (dht22 is more accurate but more expensive)
- AMS1117
- USB to TTL Programmer
- ESP8266 ESP-03 (or other)
Download the attached weatherstation.zip php script and upload it to your webhost, remember the url of the receive_data.php file, you will need it in next steps.
Make sure you have correct firmware installed, this setup requires the dht and http module included in your build.
upload this init.lua code to your esp8266
Code:
--init.lua wifi.setmode(wifi.STATION) wifi.sta.config("your_wifi_ssid", "password") wifi.sta.connect() -- Connect tmr.alarm(1, 1000, 1, function() if wifi.sta.getip()== nil then print("IP unavaiable, Waiting...") else tmr.stop(1) print("IP avaiable:"..wifi.sta.getip()) dofile ("main.lua") end end)
Code:
-- main.lua -- tmr.delay(5*1000000) sensor = 1 --define the sensor number if you use multiple pin = 4 -- send data every 10 minutes tmr.alarm(2, 600000, 1, function() status, temp, humi, temp_dec, humi_dec = dht.read(pin) http.get("http://yoursite.net/weatherstation/sensors/receive_data.php?temp="..temp.."&humi="..humi.."&sensor="..sensor.."&key=blabla", nil, function(code, data) if (code < 0) then print("HTTP request failed") else print(code, data) end end) end)
Now connect everything like on the image:
if you have done everything correctly, you should be able to view your sensor data in the generated graph with a php script.
There is another better, battery saving setup with esp8266 sleep mode, if you are interested in such setup please post your request here.
Comment