Post about your Basic project here

Moderator: Mmiscool

User avatar
By stern0m1
#43834 Here's a rough draft to read an ekm electricity meter and constantly update to things speak.

You need an adapter to convert from rs-485 to ttl as the meter uses rs-485.

I had to compile my own version of esp8266 basic because you have to set the data/parity to 7E1 which is not the default.

cls
memclear
timer 300000 [ekm] // how often you want to update

textbox tex
button "Exit " [getout]
button "Ekm" [ekm]
wait
[ekm]
serialtimeout 1000

input "/?000000017530!" da // this is for my meter, every 1 is diff
se = mid(da,20,4) // position of total kw in the string returned

dec = mid(da,24,1) // this is the decimal point

tk = se & . // create string with decimal point
tk = tk & dec // create string with decimal point
tex = tk
sendts("************",1,tk)

input "B0u" y // closing string thats supposed to be sent to meter, dont know why.

wait


[getout]
end