-
Notifications
You must be signed in to change notification settings - Fork 5
Henry's Notes
- TODO
- 4/2/15
- 3/11/15
- 3/10/15
- 3/9/15
- 3/6/15
- 3/5/15
- 3/4/15
- 3/3/15
- 3/2/15
- 2/27/15
- 2/26/15
- 2/25/15
- 2/24/15
- 2/23/15
- 2/20/15
- 2/19/15
- 2/18/15
- 2/17/15
- 2/13/15
- 2/12/15
- 2/11/15
- 2/10/15
- 2/9/15
- 2/5/15
- 2/4/15
- 2/3/15
- 2/2/15
- 1/30/15
- 1/29/15
- 1/28/15
- 1/27/15
- 1/26/15
- 1/23/15
- 1/22/15
- 1/21/15
- 1/20/15
- 1/16/15
- 1/15/15
- 1/14/15
- 1/13/15
- 1/5/15
- Weekly Reports
- Pic32 real-time computations in incoming data samples. Format, and send to esp in ~1Hz interval.
###Low Priority
- Develop pic32 firmware for SEAD lite (RMS wattage, and RMS current. We have current right now only).
- Use the RTC on the pic32, and send that as a timestamp for the ESP to handle offset.
###ESP8266-03 Flashing To start into flashing mode
- CH_PD to VCC
- GPIO00 to GND
- GPIO15 to GND
To start regularly
- CH_PD to VCC
- GPIO15 to GND
The objective is to determine if it is better to maintain a TCP connection to the server, or connect and disconnect every time there is information to send from the ESP8266. My predictions were that it would be faster to send and receive the data when not having to re-establish the connection and disconnect it every time. The power consumption of the ESP8266 when idling with the connection open would probably be greater than it idling with the connection closed. The idea is that the ESP8266 isn't going to be idle a lot of the time, and is always going to be packing, and sending data. This rules out the hypothetical benefits of connecting and closing a connection each time.
What I found that throughput did indeed increase when maintaining the connection. We are able to send and receive messages faster (on average).
This is the time that it took to send and receive messages for 10 different messages. I timed the start and end using a stopwatch, and watched the outputs on my terminal to see when things started and stopped.
Current draw while staying connected to the server and being idle was on average 10mA more than what the current draw was when idling without being connected.
The current draw was around 20mA without being connected, and 30mA while being connected when idling. It randomly spikes when idling, which I think is due to being connected to the access point. The spikes happen more often, with higher amplitude when we are connected on the extra TCP link. The recordings happened with my uniformly reading current draw every half of a second from a power supply.
Current draw while sending http requests was lower while sending http requests and staying connected, than establishing a connection each time. The chip seems to be using more current when trying to establish a connection, and when it disconnects, as well as the duration is longer (our first graph), so it would use draw that current for longer.
As you can see on the graph, because sending while maintaining the connection is faster, the module draws less current because the sending duration is shorter (due to not having to configure callback functions for different link states, and other overhead, etc).
I believe it is best to keep the link open on the module rather than disconnecting and reconnecting like a curl command. There is an additional timeout period, where the connection times out if there is nothing sent or received for about a minute.
It takes an average of 95mW when sitting idle and connected to the server, and it takes an average of 73mW when idling and not connected to the server. It takes an average of 100mW when we are already connected and sending data to the server, it takes an average of 175mW to connect and then send, and then disconnect.
It doesn't seem like disconnecting will save that much power when we are talking on this kind of scale, and the most important thing we need is throughput, so we are going to stick with continuous connection to the server.
# 2/4/15 * Recorded information on the ESP8266 about how long it takes to send/receive http requests, as well as how much current it is using during that time, as well as idle. * Created an iteration of the firmware that maintains connection with Bryan's server. More to be done to fix speed, and optimize the protocol. * Trying to open and close the connection takes more power, and is slower. There are tradeoffs. TODO: Make a report about the tradeoffs and observed behavior. # 2/3/15 * Looking into power computations with the pic32, as well as fft. * Theoretically computed how many cycles the pic32 would take to make a RMS calculation on 130 points. Given 130 data points, we square all of them and add them. This would be around 6600 cycles from using [this website](http://hades.mech.northwestern.edu/index.php/PIC32MX:_Benchmarking_Mathematical_Operations). It is assumed we will take around 1 cycle per addition, 100 cycles for a division, and 700 cycles for the square root. This is estimated out to be around **_7530_** total cycles with a 130 window size. # 2/2/15 * Looking into how I can get the current unix timestamp from a http request so we can have accurate timestamps. * Will look at RMS calculations, real power, apparent power for power factor, and fft on the pic32. # 1/30/15 * Finished second iteration of ESP8266 firmware, integrated into Bryan's web firmware for configuring the wifi. * Able to configure the wifi module to connecto to a specific access point via the web, and then will send http messages on an established tcp link with Bryan's server * Learned memory mapping of the ESP module, should have enough space for code now, buffers were taking up too much RAM space. * Fleshed out ESP8266 FSM a bit more (see picture) ![Image](http://i.imgur.com/8ESlsln.png) # 1/29/15 * Found out my circular sending buffer was taking up tons of RAM space. Trimmed down the code, and now have tons of space to work with. * Fixed circular buffer code. Have acceptable input output formatting currently implemented for UART drivers. * The only thing left to do is to establish a TCP connection with Bryan's server, and then try to send data to him that way. # 1/28/15 * [found a different smaller esp webserver firmware, planning on developing on that instead](https://github.com/IOCare/esp8266GUI) * [esp memory layout and linking](http://www.esp8266.com/viewtopic.php?f=5&t=9&start=40) * [this is a potential fix](http://www.esp8266.com/viewtopic.php?f=9&t=1001) # 1/27/15 * Will need to figure out a way to remove bloat from the firmware. There is currently too much code involved. * Merged the two projects, having the same code bloating issue as before, there isn't enough memory to fit the text. * Ram is overflowing # 1/26/15 * Created the merged project for Bryan's firmware and my firmware # 1/23/15 * Encountered firmware bloat, not being able to fit text on the ESP's flash. * Trimming down the firmware, and going merging with Bryan's httpd server firmware # 1/22/15 * Planning on merging my ESP project with Bryan's ESP project for a fully function wifi configuring, uart receiving, wifi sending firmware. * Integration of the two projects will be hard. * Must also test test test the different buffer libraries created, as there are most likely bugs. * Currently implemented NMEA message talker ID's: * SE * Currently Implemented NMEA message type: * DAT * Example command: $SEDAT,1776,1283945892000[*checksum]\n # 1/22/15 * Finishing up implementation of circular storing buffer, having problems with not enough space in the flash or memory mapping for the ESP compiler. # 1/21/15 * State machine finished, and can use a little bit of work, currently only supports simultaneous receiving, and sending as well as receiving and storing. Could do all three in some cases but I'm not sure how to do it (something like mutex) * Finished up NMEA protocol libraries for the ESP, including checksum. * Added two semiphores for the uart receive buffer for simultaneous read and store as well as read and send # 1/20/15- Started writing buffer libraries for uart, as well as data to be packaged and sent out.
- Added uart receive, buffer store, and tcp send state machine.
- Debugged the 400 bad request response from Bryan's server
- Required a special sequence of characters documented under ESP8266/Bryan's API
- Unsuccessful debugging the 400 bad request response from Bryan's server
- Documenation of the AT command located here, and learning how to send data.
- Figuring out how to communicate between seads.brabsmit.com and the ESP.
- Previously used:
curl -X POST seads.brabsmit.com/api/event-api/ -d '{"device": "/api/device-api/2/", "wattage":"100", "timestamp":"1203950300"}' -H "Content-Type: application/json" -H "Authorization: Token 0d1e0f4b56e4772fdb440abf66da8e2c1df799c0"
- seads.brabsmit.com
- Correctly compiled and flashed the AT demo, continuing UART demo communication.
- Forked the AT demo into our repository
- Left the demo to play around with, and created a copy to modify and start on the uart send/receive, http send/receive drivers
- Set up firmware to configure an internet connection if there is none.
- With internet connection, be able to send some garbage data to the server via UART
- Server hardcoded for now, that isn't configured
- Doesn't establish a connection, just sends garbage, and receives the http response
- What this entails: UART send/receive drivers, TCP send/receive drivers
- Starter code began with esp webserver http://git.spritesserver.nl/esphttpd.git/, and AT example
The newer ESP-03
The older ESP-V091