Updates sensor data live to the cloud - with no external microcontroller.
I hooked up a LDR to my new (!) fully-broken-out ESP module, and I've got it pushing to data.sparkfun.io!
You can also check out the graph of the stream on analog.io; I'm not actually sure if I'm going to implement talking to plot.ly, since it's not really a data logging platform like Phant.
Adafruit has this code for making a HTTP request:
sk=net.createConnection(net.TCP, 0) sk:on("receive", function(sck, c) print(c) end ) sk:connect(80,"www.adafruit.com") sk:send("GET /testwifi/index.html HTTP/1.1\r\nHost: www.adafruit.com\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n")
The bizarre thing is that this works fine entered line-by-line in the terminal, but if I toss it in a lua file and run it with dofile, it doesn't work. But if I change "www.adafruit.com" in sk:connect to the IP for www.adafruit.com, it works in the file. I wonder if there's a race with the DNS where it can't do the DNS lookup fast enough, and then sk:send tries to send before it's completely connected. I'm going to report it to the NodeMCU devs, but for now I'm going to be using the Arduino port to the ESP8266.
I haven't really posted anything worthwhile for a long time on this project, mostly because I've been ridiculously busy with school and other projects.
For a while now, I've been trying to write a C(++) HTTP client for the ESP8266. I'm tired of working on it, and I just want to get to actually logging data.
Back when I decided against NodeMCU, Lua on the ESP8266 was a totally different thing than it is now. It's been open-sourced and improved *incredibly*, and it's so much more reliable and useful now.
I'm going back to Lua, since there's really no reason to be sadistic and force myself to write a C HTTP client.
I have a new Github organization with some libraries I'm working on for Lua, to talk to Phant and Plot.ly. Hopefully I'll have something working before the end of the day :)
I'm going to switch everything from C++ to C for the ESP8266 Requests library, since I want it to be more easily integrated with other C code.
I've been working in mainly NodeMCU/Lua.
I think that was a bad choice, it has bad ways of transferring programs to the ESP8266.
It also runs at 9600baud, and that can't be changed.
I'll be switching to C/C++ for most ESP stuff now, I think that will make it easier to write a HTTP client library, as I know C++ well.
I'm connecting a cheapo kitchen scale strain gauge to a MCP3008 ADC, connected to the ESP8266.
The ESP8266 will be connected to Plot.ly, and an RTC.
Then I'll put a candy bowl on the scale and set it up on a counter for Thanksgiving.
Interesting plots will come soon :)
Picked up my module today, have yet to solder on headers.
Going to do that as soon as I clean my workbench :)
This is crazy... but it seems that no one has written a HTTP client library for the ESP8266 which runs natively on the SOC. If you know of one, prove me wrong and leave it in the comments ;)
It looks like I'll have to write my own :(