Testbed part 3 the Wemos sub-assemblies

I like to try various different (cheap) sensors to find which ones are best in terms of:
  • build-quality
  • flexibility
  • size (they have to fit into Small boxes eventually)
  • price (as I'm going to need several of each)
To make life easier, I have done two things: 1) I have made everything modular from the start so I can just "swap out" various gadgets. This also makes testing the code a lot easier too: it's done one chunk at a time. 2) I have modularised my code too and written a library which adapts to pretty much any sensor type and does all the "heavy-lifting" for me. Try it out: http://github.com/philbowles/smartpins

The library is what allows me to do this in my main IOT firmware "Esparto":


Which is a real-time display of what all the pins are doing. One neat feature is that the pin descriptions change for each board type (NodeMCU, Sonoff etc)

Anyway, the "main" sensor module looks like this when dismantled:


And like this when assembled with the smaller of the PIR sensors:


There is plenty of debate as to whether the ESP8266 can tolerate 5v on its GPIO pins. A lot of folk say you can - but I'm not going to chance it when a) 3,3v works fine with most sensors* and b) once my IOT devices are deployed, I can't afford to rip down walls or climb ladders when I find out that most folk meant "...for a while" and never "soak-tested" their findings...Always best to play safe where electricity is concerned, as I have found (to my - ouch - cost) on more than one occasion.

*The PIR sensors are a good example. The larger one has an onboard 3.3v LDO, so even when fed 5v, the signal out is only ever 3.3v max, so it goes straight into a GPIO. Oddly, even when fed only 3,3v, it still works fine. The smaller one (fitted) will run with 3.3v but it  will not trigger. It has to have 5v to function properly.

The light and sound sensors are both marked with 5v Vcc on the boards, but both work fine with 3.3v - some don't and that's why a) I went modular  b) experimentation is the only true way to find out - but test the OUT pin with a meter first!!!



Comments