TL;DR
My favourite IoT board, the Wemos D1 Mini, only has ONE analog input - this limits me to using just one thermistor at a time. Read further as I look at my options.
Why Wemos?
The Wemos D1 Mini has WiFi built in, it’s easy to program with the Arduino IDE, it is well supported, and on top of all that it’s very affordable. For all of those reasons I have been using this little board for my IoT temperature sensors. It also has a nice compact form factor, but still gives access to more than enough pins than I need for my projects, which so far have had at most 2 separate sensors.
My previous setup has been using only digital sensors: the DS18B20 and the BME280, and the D1 mini has more than enough digital pins to support that. They’ve been fairly solid too, happily reporting values every minute every day for a few years now.
Thermistors are Analog Devices
Thermistors are much simpler devices than the digital sensors I’ve been using. This makes them more affordable, but they are analog, which requires analog to digital conversion. This is where the D1 Mini, and ESP-8266 in general, can’t quite keep up to the task - it only has one ADC (1 analog input pin). The D1 Mini has pin A0 for this.
For most of my IoT temperature sensors that’s not too big a deal, as I generally have been using one board per sensor anyway, to keep things simple but also to allow the extra flexibility of moving things around.
For the hummingbird feeder project, however, it makes sense to have one board report both the nectar temperature as well as the outdoor temperature.
If I were to do this project using only thermistors on the D1 Mini, I would need to add some extra magic.
Adding External ADC support
One way to get around the ESP's analog input limitation is to use an external ADC, like this 16-bit 4-channel break-out board in the element14 store, which would allow me to use up to 4 thermistors - far more than I need, which is nice. Plus the 16 bit resolution is a LOT more accurate than the built-in 10-bit ADC found on the ESP-8266 and the Arduino Uno. Also very nice. However, if we are using thermistors to cut costs, then this extra hardware kind of defeats that purpose. It also adds complexity. On the other hand, if you’re looking for accuracy, the extra resolution might be a critical deciding factor.
Multiplexing one ADC to multiple devices
A second way to get around the single-ADC limit might be to multiplex the signal to the ADC somehow. I haven’t seen too many examples out there that don’t involve some kind of chip, but I imagine using a couple of transistors to select the input line might do the trick. That also adds extra complexity I’d rather avoid. The fewer external components needed, the better. Thankfully, scottiebabe will be looking into multiplexing thermistors during this challenge, so I’m looking forward to see what she invents :)
Ditch and Switch?
At this point it might make sense to upgrade to using ESP-32 boards instead. This ESP-WROOM board I bought last winter, for instance, has something like 18 (did I count that right?) analog inputs available, and they have better 12-bit resolution as a bonus. It also has Bluetooth available, which could allow for a nicer more flexible WiFi provisioning experience. I haven’t had the chance to try out that board yet (other than blinking the LED to test that it works), so this could be a good excuse to get that figured out. The element14 store carries a similar board from DFRobot.
What about the New Pi Pico?
I did consider maybe using a Pi Pico W for this, but I don’t have one handy (and I’d rather not have unknown delays waiting for one), plus I hear the ADCs on it are a bit on the noisy side. I’m hoping that will be cleared up in the future, but right now I’d rather not add that extra unknown.
Me and My Wemos D1 Mini, to the end!
So in the spirit of keeping things simpler, and to allow me to just focus on the thermistors part of this challenge, I have decided to simply use one thermistor for the nectar temperature sensor, and to keep using the BME280 as the outdoor sensor. The added benefit is that the BME280 also provides humidity and pressure, as well as temperature. Plus it’s digital so the A0 analog input is available for the thermistor.
In terms of the final solution it also makes sense - the thermistor is tiny and can more easily fit snuggly up against the nectar bottle than the bigger DS18B20 I’m currently using can. The external sensor doesn’t need to be tiny, as it gets encased separately and should be mounted further away anyway. Unfortunately the BME280 sensors are much more expensive, but the ease of use and extra weather data make it worth it. It also saves us from having to switch to a more expensive microcontrolle or adding extra external hardware.
Bonus Question
On an extra side-note, I’m still debating on the best place to locate the microcontroller board when it’s in use - the D1 Mini does give off a bit of heat, as most processors do. Having that inside the insulated sleeve, up against the hummingbird feeder bottle, can put that waste heat to good use in keeping the nectar warm almost without needing much of a heater. Maybe just calculate Pi when the temperature dips ;) I haven’t tested how that might affect WiFi performance. The insulated sleeve is just a neoprene bottle cover, and the nectar bottles are glass. If you have any thoughts on that, I’d love to hear it!
First Steps
For my first experiments, however, I will use my trusty ole Arduino Uno. Tried and true, known to be reliable. Then once I have the basics covered I should be able to transfer the code onto the Wemos D1 Mini.
To test a handful of thermistors at once, however, it looks like the Arduino Nano (or the ESP32 board) will be my best options, as they have more analog inputs available (the Nano has 8, the ESP32 has 18), to test multiple thermistors all at once.
This is looking like a fun challenge already
Top Comments