-
Battery testing... and failing
12/02/2017 at 10:08 • 0 commentsThis weekend, I decided to test the battery life of my prototypes.
The program is currently processing for 30 seconds, then sleeping for 1 minute
- ESP01 LiPo 18650 - Claim 3000mAh, but probably 1100mAh - 16 hr 40 mins
- Wemos D1 - LiPo 18650 - Claim 3000mAh, but probably 1100mAh - 34 hr 25 mins
Those times are fairly disappointing. I don't want to be changing batteries every day.
I might go down the static IP route to speed up the connection, and then play with the awake/sleep ratio. I should be able to decrease awake time, and increase sleep time.
-
ESP sleep state problem and resolution
12/01/2017 at 12:24 • 0 commentsA while back, to extend the battery life on the esp8266, I added the sleep function, so every few minutes the ESP wakes up, check the retained message on the MQTT queue, processes and goes back to sleep. The lag of a couple of minute is an okay trade off for extended battery life,
However there was a problem. The every time the esp wakes up a new wifi and MQTT connection is established, and the retained message was reprocessed. So 2 weekends ago I finally had time to read up on MQTT. Turns out it is a very simple fix, writing back a 0 byte MQTT message with retain flag on to the queue clears the queue.
So I modified my code to, clear the queue before the ESP goes to sleep, and the state problem was resolved.
I also soldered up a new prototype, this one is a hat for Wemos D1. IT works great, and the serial interface is a lot easier to debug than the esp-01 board I made. Great for tracking down bugs.
Now on to test the battery life.
-
Github repo link ConAir Added
11/03/2017 at 12:06 • 0 commentsFinally I have checked in the andorid app and arduino code into github and shared. Sorry about the delay... here is the sad sad story...
Two weeks ago, I converted my code over to use JSON, and wrote an android app to send the JSON messages over MQTT. I got it working, I was very happy and thought, I will clean up the code the create a github repo and share. This is a good idea, however in the wrong order... always check into source control before you clean up the code. I made a mistake, broke my code and spend many hours last weekend trying to fix it. I hope you can learn from my mistake.
Now, I'm off to clean up the code.
-
Iteration 3 - Android app sending Json to ESP-01 via MQTT
10/21/2017 at 13:23 • 0 commentsQuick update on the project...
Aircons are HVAC systems and receive the full state in every message - i.e. if you press temp down 1 degree, the remote actual sends the temp setting, the fan setting, the swing setting etc every time. Previously I had to use a work around because the free android MQTT clients I found, could not send settings from multiple controls in a single message. I've written my own now, am iterating to remove the unneeded complexity.
I've developed a basic MQTT android app that can send the full state. I've started using JSON payloads in the MQTT messages, and I'm rewriting the firmware on the ESP-01 as well.
I'll write this up more completely another time and upload the code to GitHub, but for now here is a couple of screenshots,
And the latest iteration of the device... I've changed the power source to a 18650 instead of 2 AA... after losing 3 hours on a bug that was actually a power issue... I've also broken out the reset pin so I can add back the ESP Deep Sleep function to extend battery life.
-
ESP01 version - board pics
09/04/2017 at 09:44 • 0 commentsHere are a couple of pics of an ESP 01 version I made on the weekend.
This version uses a switching transistor to drive the LED, but can't use the ESP sleep function the previous one uses as it doesn't expose the right pins, although there are work-arounds I will explore in the future.
-
Adapted my code to run on the ESP01 module
09/01/2017 at 14:08 • 1 commentAfter stumbling and bumbling I've revised my code to run on the ESP 01. I'll be trying to build some boards over the next few months and controlling all 6 AC units in my house.
-
ESP8266 RTC memory
09/06/2016 at 13:51 • 1 commentQuick update, I've revised my new version of the code to use RTC clock memory to save state in preparation for implementing deep sleep. This is hopefully the first step towards increasing battery life. Before I implement this, I need to come up with a mechanism to store and forward MQTT messages to the ESP when it wakes up, I maybe able to trick it with the MQTT retain flag, but need to investigate delivery order, and mitigate the risk of firing off IR commands after every deep sleep, even when no changes have been received. I think it is do-able.
I used Andreas Spiess Youtube video as a guide on how to use RTC memory. Check it out -