← Home About Archive Photos Replies Also on Micro.blog
  • Energy harvesting WiFi logger and timelapse camera

    I recently put up a greenhouse in our backyard. So naturally I’d like to start logging temperature, humidity and maybe soil moisture or solar radiation levels, maybe take some pictures for creating a timelapse of the plants growing through the seasons, perhaps even automate watering the plants or opening and closing the window..

    So I started looking into options for doing this. As I’ve found several times before every electronics project seems to start with (and largely revolve around) how to power it.

    The way I see it there are several options here:

    1) Lay a power cable from the house to the greenhouse. I’m renting the property so don’t know about making permanent changes. Also not clear about whether that would require planning permission.

    2) Power it with a battery and then replace the battery when it runs out. With some basic power saving techniques even a small battery would easily last a month. But this just feels inelegant and not like a lot of fun.

    3) Keep a battery charged with solar power.

    4) Keep a battery charged with a small wind turbine. This is a fairly small backyard and I don’t know how my neighbours would feel about a wind turbine.

    5) Skip the battery and charge a supercapacitor with a small solar panel. This is actually the cheapest option, in some ways the trickiest but also the one I find most interesting.

    Solar panels have become ridiculously cheap and seem to still be on a technology curve, so still no end to the price drops in sight. Small (less than 10 watt) panels are now only a few dollars each.

    Small supercapacitors are also surprisingly affordable. A downside of supercapacitors is the low maximum voltage of typically around 2.7V for EDLCs. This is a bit low for powering 3.3V electronics. You can put them in series to increase the voltage, but it is necessary to balance them to stabilize the voltage due to slight differences in capacitance and ESR caused by manufacturing tolerances. This would slightly increase the complexity of working with them. Alternatively you could use a boost converter that can start up at a very low voltage, but this increases the cost.

    However, you can now buy 5.5V or 6V supercapacitors that actually have multiple inside them in series. I’m not sure if they contain balancing circuitry or if they are just “matched pairs”, but the point is that that becomes an implementation detail that’s already taken care of for you. The higher voltage is nice because then you can charge them with USB, power 5V electronics directly (AVR microcontrollers can handle up to 5.5V) and much more of their charge becomes useful or accessible without needing a boost converter.

    You also get ultra low dropout (say 350mV or even less) linear regulators that are much cheaper and simpler than a buck/boost converter.

    One inefficiency is that you ideally want MPPT charging to get the most out of the solar panel, but you can also just overspec the solar panel. In this kind of application it is bound to be cheaper and even a couple of watts is already overkill for what I’m doing here anyway.

    For a low power WiFi and camera module the obvious choice is an ESP32-CAM which (somehow) costs less than $10 each. It runs on 3.3V. It has a 5V input with and “LDO”, but “low” here means +/-1.2V, so not very useful for our purposes so we’ll have to bypass it and power it with 3.3V directly. I’d like to measure the supercapacitor’s voltage which requires ADC, but all the esp32’s ADC pins are already taken up. There are hackish ways to use some of the remaining pins or to repurpose the LED’s pin, but I’m not going to go there. Besides - according to the “datasheet” for the ESP32-CAM it draws 6mA of current even in deep sleep. This is unreasonably high. I didn’t bother testing it myself because I figure they are unlikely to advertise figures that make it sound worse than it really is.

    I came up with this solution:

    1) A 5.5V maximum (once you include a blocking diode’s drop) solar panel charges a 5.5V (or higher) supercapacitor.

    2) The supercapacitor directly powers a 5.5V capable microcontroller. I like the new “mega” attiny series.

    3) The attiny sleeps just about all the time, but wakes up every minute or so (configurable) and checks its supply voltage.

    4) If the supply voltage is high enough (meaning the supercapacitor is reasonably charged) it turns on power to an LDO that powers the esp32-cam through a P-Channel MOSFET high side switch.

    5) The attiny immediately goes back to sleep.

    6) The ESP32-CAM reads the temperature and humidity from a sensor and takes a picture. It then asks the attiny for the supply voltage over i2c.

    7) The attiny wakes up from the i2c connection, reads the voltage, sends it and goes straight back to sleep.

    8) Then the ESP32 sends the temperature, humidity, voltage and photo to a server over wifi.

    9) Once it is done it asks the attiny to turn it off, again over i2c.

    10) The attiny wakes up from the i2c connection, toggles the power to the esp32-cam and goes back to sleep.

    I breadboarded this and it works remarkably well. The entire cycle uses very little power. Everything is as “off” as it can be as much as possible. I still need to measure it, but over time this averages out to well under 1mA even though the esp32 uses hundreds of milliamps during the moment it is fully powered and transmitting over wifi.

    An obvious optimisation would be if the server could tell the esp32 about sunset and dawn times and it could then communicate back to the attiny how long it should let the esp32 cam sleep before it powers it down. Because at night it would be too dark for timelapse pictures anyway and it would just drain the supercapacitor before the morning. Alternatively we could still log all the stats through the night and just not take any pictures.

    I plan to design a PCB and enclosure to turn this into a proper project. Will build it and report back ;)

    → 9:46 PM, May 13
  • Ask yourself: What if I succeed?

    As technically minded people we often get ideas for projects, products or similar and it can be easy to get carried away. I often design things in my head, think about how I’d build it, what it would involve, what it would cost to make, how I’d get it made, what programming it might involve, how I’d do that, etc. This is just something I enjoy doing and for whatever reason it is the kind of thing my mind often does when I should be sleeping or doing other things.

    Sometimes my ideas progress further and become projects and I can easily get lost in them. Then eventually I start to think about whether this would be useful to others or is there even a market for it and the doubt starts to creep in. And often that’s where I end up losing the drive to complete the project.

    There are of course many reasons for taking on a project. If you just want it for youself, then that can be a fine goal. If you’re doing the project so you can learn some new skill in the process then that’s excellent too.

    But I’m now old enough to realise that I have to pick my battles. And there are enough project ideas out there where I can potentially have it all: Learn something new, get something useful or fun I can use AND maybe end up with something useful to others or maybe (just maybe) even a viable product.

    So I’ve added this to my checklist for before I start on yet another hobby project: “What if I succeed?”


    For product features I think teams should ask the same thing: “What if we succeed?” It is so easy to get lost in discussions about whether something is possible, how much work it would be, how long it would take to implement, etc. that people often don’t pause to think whether they should be adding this feature at all. Often whatever you do you do at the cost of everything else you could be doing. And features are never free - they often have to be maintained and always add complexity.

    → 10:09 PM, May 10
  • The importance of taste

    Something I’ve been thinking about on and off for a while now is how important it is for each project that the people in charge have good taste. I realise that this kind of discussion is a minefield because it immediately comes across as an accusation, but hear me out.

    What is taste? Taste is unfortunately subjective. It is a bit “I know it when I see it”. It is not the same as design, but there is certainly overlap. Although thinking about it in fact I think you can argue that it is design in the broader, purer sense.

    Taste is often about saying no. It is about pushing back. It is about simplifying. Sometimes it involves asking rather pointed questions. It can be making decisions. Paring back. Thinking about the bigger picture and the overall direction. Rethinking past decisions and reconsidering alternatives when things change.

    It is an important tool to guard against feature creep and bloat or to just stop things getting out of hand and becoming a mess. It is essential for staying focused.

    Taste is what separates great leaders, products, teams or companies from the rest.

    → 9:48 PM, May 10
  • RSS
  • JSON Feed
  • Micro.blog