not that some people care on this forum- but a small update- i added a cheap esp8266 to my device. above the one I am using is capable of handling 5v, all i connect to the uno is positive and negative, and tx to the rx of the esp8266
edit these line to include this
if (CT2) { …
Serial.print("cmd_1("); Serial.print(invert); Serial.println(")");
}
if (CT3) { …
Serial.print ("cmd_2("); Serial.print(grid); Serial.println(")");
}
if (CT4) { …
Serial.print ("cmd_3("); Serial.print(wind); Serial.println(")");
then upload lua firmware to esp8266
and for the init.lua
used this
– load credentials, ‘SSID’ and ‘PASSWORD’ declared and initialize in there
function startup()
if file.open("init.lua") == nil then
print("init.lua deleted or renamed")
else
print("Running")
file.close("init.lua")
-- the actual application is stored in 'application.lua'
-- dofile("application.lua")
end
end
print("Connecting to WiFi access point...")
wifi.setmode(wifi.STATION)
wifi.sta.config("wifi","1234567890") --SSID and password
-- wifi.sta.connect() not necessary because config() uses auto-connect=true by default
tmr.alarm(1, 1000, 1, function()
if wifi.sta.getip() == nil then
print("Waiting for IP address...")
else
tmr.stop(1)
print("WiFi connection established, IP address: " .. wifi.sta.getip())
print("You have 3 seconds to abort")
print("Waiting...")
tmr.alarm(0, 3000, 0, startup)
end
end)
dofile("serial3.lua")
and created another script called serial3.lua up load it to esp8266 that includes this
uart.setup(0,9600,8,0,1)
port = 80
print ("uart.setup(0,9600,8,0,1) finished")
print ("waiting for serial data....")
function cmd_1(value)
i= value
end
function cmd_2(value_2)
g=value_2
end
function cmd_3(value_3)
w=value_3
end
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn, payload)
print(payload)
conn:send("HTTP/1.1 200 OK\nContent-Type: text/html\nRefresh: 10\n\n" ..
"<!DOCTYPE HTML>" ..
"<html><body>" ..
"<h1>GTI LIMITER</h1>" ..
"<b>Solar Output : " ..i.. " watts </b><br>" ..
"<b>Grid Level : " ..g.. " watts </b><br>" ..
"<b>Wind Output : " ..w.. " watts </b><br>" ..
"</html></body>")
end)
conn:on("sent",function(conn)
conn:close()
end)
end)
this creates a simple webpage that is accessible from anywhere. an orange pi ( similar to a raspberry pi) with a 7 tinch touch screen - connect to these simple web page and displays info from 10 different esp8266 modules , that display gti limiter status. sun luminosity, evacuated solar tube status and temps green house temps, boiler temps, heat pump information, and much more . cataloguing into a databases
I used the esp8266 on my gti limiter as it has it own processor it simply reads serial data and creates visual data from it with out impacting the performance of the uno. and really I need significant distance as some of my monitoring outpost are pretty far away over a 1000 metres … and i have the option to easily include data from other esp8266 modules that are on completely different networks
good luck have fun …
init.lua.zip (1.3 KB)
forgot to say if you do not want to use a a pi device you can use a android tv box ( cost $25 and up) that what i was originally was using. just install androphp from mobile1 repository ( google does not have it) it will install all php addins , webserver and mysql if you want. and run the webserver off that to process and data log all info for all the remote esp8266 and ardunio devices. – but really if you want a interactive display mount use the pi if you want a webserver backend only use a android tv box… cheaper easier and already in a nice looking box