Q: Bundle sensors with an ESP8266 or separate them?

Following on from this post: Fastest OneWire (ds18b20) update rate on Raspberry Pi

I use digital BH1750 sensors internally to measure light levels.

My only external integrated sensor is currently a very old and now cranky Oregon Scientific temperature/humidity sensor.

I know I'm going to have to replace it before long and actually I really want Air Pressure, Light, Temperature & Humidity which isn't hard to do.

My only question is whether I put the sensors with an ESP8266 in a single box or whether I run power/data to a sensor box and keep the ESP separate?

There are good reasons to keep the ESP separate to the sensors (high-frequency interference from the WiFi) but I'm not that knowledgeable about electronics and so I'm not certain about the wiring it would need.

Power is not an issue by the way since the position of the sensor means that I can power it from mains.

Most sensors are I2C so cable length is a problem, this might be helpful if you want the sensors separated from the ESP8266 over a greater distance:

1 Like

Thanks. Also found this which is very interesting and has taught me a lot in a few minutes including some stuff about shielded cables that I'd never known.

I think that I'll need maybe a few feet at most, I could probably keep it down to 1-2 feet and that sounds achievable using shielded cable?

Also looks like I can use some spare CAT5 network cable with the pairs arranged like this:

(The 3 and 5 refer to 3.3v and 5v) This pairs the data wires with ground which reduces crosstalk and impedance while maintaining steady capacitance.

https://www.raspberrypi.org/forums/viewtopic.php?t=82049

3 Likes

Excellent find Julian. You should be OK for a few feet after reading that.
I do hate white text on a black background though :slight_smile:

1 Like

I'll jump in here for a quick touch base.

This is from another perspective:
You can load up the ESP8266 with sensors, but you have to check the speed/timing.

If it is too over worked it can cause problems with reading all the sensors and transmitting the data back easily.

Though I shall say that is only if you want fast data transfers. But I guess that isn't really critical for what you are doing.

However, something to keep in mind.
Some boards may get overwhelmed with things and can't spit out the data fast enough to your requirements.

There is also the problem that is you have a few too close together, you could get congestion/interference with the WiFi signals. Especially if you are only using 2.4g.

I'll stop here, because I may be getting off track to your needs.

Thanks for that. Yes, totally agree. However, the reality is that I'll probably only be using two actual sensors. Three at the most. A BME280 and a DH1750. Those 2 will give me all of the measurements I need.

Also, I only need measurements once a minute to be in keeping with my other sensors. I could go down to once every 5 minutes without any real impact.

Yes, that is what I'm trying to avoid. Especially as this ESP will be quite a distance from the AP. Otherwise I would simply mount everything on a single piece of veroboard and be done with it.

The other issue that I've not mentioned is power to the ESP. I will probably use a stock Wemos D1-Mini and it can be hard to get USB cables long enough without loosing too much voltage. So I don't want to make the USB cable too long otherwise I'll have to switch to a different type of power supply. Of course, I can also provide a mains extension cable and I may have to do that. Just more stuff to deal with.

That looks like "straight through" cable wiring T568B.

1 Like

@TotallyInformation

Also looks like I can use some spare CAT5 network cable with the pairs arranged like this

I wish I could pair my cables to reduce cross talk like you show.

However I've found it more important to separate 3v and 5v lines with a ground. Keeping the 5v away from my I/O connections as it will fry things if it jumps due to condensation or corrosion.

If you must pair the wires off like that use some dielectric grease.

Automation_Plug_1

1 Like

If you have condensation issues on that cable, I'd say you have bigger issues! Use some hot-glue to seal things up.

I think having 5v and gnd in the same pair can cause a lot of noise. Of course, it helps to remember only to connect gnd at one end, not at both.

By the way, it looks as though you connector is being used not for I2C but for other purposes. I2C is very sensitive to noise as I understand things which is the reason to use paired ground wires.

Pairing the data wires is likely only important if you want extended cable runs as far as I can tell. It may not make much difference for short runs.

If you are really worried about 5v, run a separate power cable.

In my own instance, the cable connectors would be inside a sealed case as the ESP end with a sealing grommet. At the sensor end, I would be using hot-glue and heat-shrink to seal everything as that end will be exposed to the weather - in a case of course but with holes for the pressure/humidity sensors - though somewhat protected by an overhanging soffit.

1 Like

Dear Julian, I'm using an adapter USB to 1wire (DS9490R) directly attached to a RPi's usb port. It is providing power enough to the few 1-wire devices I have connected to it:

I think the ESD protection is not such a bad idea, especially if using long cables

Regarding the case keeping sensors away from the ESP board, I can only say, I would for sure keep them separated to avoid not only interference but also from the heat generated by the ESP itself. Not only would the temperature sensor be influenced but also the humidity sensor would actually show "wrong" readings

From my own experiments, as part of my ongoing project, I've found the ESP8266 can handle quite a number of sensors and output devices before it gets even close to seriously loaded. I've been measuring processor and memory use, and it looks like you'd need to hang at least a couple of dozen devices off it before you're likely to hit any kind of problem.

The main restriction is the hardware watchdog timer (the S/W one can be disabled) which will force a reset if user code doesn't yield within 7(-ish) seconds. However, 7 seconds is way too long to not allow the WIFI subsystem to run, so you'd probably want a much shorter loop time - but you should certainly be able to service umpteen devices :slightly_smiling_face:

I haven't really tested for conflicts when there are too many too close together, but running 4 in very close proximity while trying to calibrate my light sensors (LDRs on the A0 pin) I didn't get any problems with connectivity.

Anyway, I have to say I'm very impressed with the capabilities of the ESP8266, and since they're so small and cheap, bundling the sensors in with them in your devices seems to me to be the way to go.

1 Like

dew point is a hell of a thing. Got sensors and connections in industrial coolers and refrigerators.
You can silicone and waterproof all you want but if there is a smidgen of humidity in the unit you put together at room temp and you then move it into the cold it will sweat.

Silica Desiccant,
dielectric grease,
assembly in a room with a good dehumidifier,
coating boards in waterproof coatings,

oh the fun of it all.

Installing temp sensors 3ft down from the roof 40ft in the air.
I see a pipe and think, "I'll zip tie it to that. Its in the perfect spot."
2 weeks later the sensor goes down. I go back up there and i pull apart the failed unit and it looks like its been shook apart.
Putting new sensor up and the hot gas ammonia kicks on and the whole pipe starts shaking like mad.
If the hot gas had not gone off id never have known what was shaking my sensor apart !

2 Likes

Thanks Walter. Unfortunately 1-wire doesn't seem to have the range of sensors that I need, at least as low-cost sensors. ESD not likely to be much of an issue for me as the main part of the wiring is inside a solid boiler room. Only WiFi interference is likely to be an issue, though some possible noise from the boiler switching.

In regard to the heat of the ESP. Agree that it is an issue if trying to keep things really close together, but even a cm or so to one side is more than enough to prevent that. The DHT "hat" that Wemos produce is worse than useless though both because it is a worthless DHT and due to the heat from the ESP chip underneath.

By the way, if you have your sensors on the roof are they (more importantly are you) protected from lightning?

Haha, thankfully I don't have those issues :rofl:

Indeed, I'm probably being overly cautious worrying about cable length. This will be a simple setup with 2 sensors attached to a single ESP8266 (actually there is another one of those not far away in the form of a SONOFF that is switching on/off the LED tree lights in the Copper Beach tree at the back of our yard).

The devices are in a "shed" that contains the boiler for the house and so it never gets too cold though it can get a little damp. Hmm, maybe I should have an internal temperature/humidity sensor as well as the external one. :slight_smile:

The shed has a good gutter on an overhanging soffit so there is plenty of room under that to mount a small sensor box, it is out of direct sunlight and somewhat protected from wind and rain.

The component costs are cheap enough that if it all fails after a few years, I will happily replace it.

Oh yes, tell me about it! I live in the North of England and dewpoint is a major issue inside houses here. I've just spent a lot of money fixing condensation issues by having insulation fitted internally - we don't have cavities to be filled and the outside of the house is largely stone so no easy way to fit external insulation.

This was one of the reasons I started building my own sensors in the first place. Along the way, I've learned a LOT about humidity. Far more than I ever really wanted to know if I'm being honest :grimacing:

Anyway, what I can say is that a hot glue gun is possibly one of the most useful tools you can have :star_struck:

2 Likes

In that case a ground plane on the inside of the shed shielding the sensors from the ESP8266 might be a good idea, it would also improve the Wifi in the direction away from the ground plane.

Interesting. I guess that whatever case I use for the ESP could be lined on 3 sides with metal foil and that connected to the ESP's gnd pin?

Just my two cents...

I am using BME280 sensors connected to ESP8266. Usually I try to keep the sensor cable short, 1m at max.

Regarding cable length and I2C, it is a bit trial and error. In one setup I have even two BME280 on one bus, with one cable of 5m running in one direction, and one 4m cable in the other direction. Not an ideal environment for I2C, but running without any errors for weeks so far. For the wiring I used standard USB 2.0 cables.

1 Like

I'll just chirp in that there are documented wires for use in Cat-5. Though academic if not used with networking it may be a good idea to try to obey the standard as much as possible.

Or a metal case with a plastic lid. And yes, ground the case/foil. You can also wear a foil hat, it will not help at all but may dispel bad spirits :slight_smile: :slight_smile: :slight_smile:

6 Likes

I've always found that a shot or two of whisky is sufficient to dispel bad spirits :rofl:

Well, today's job was to tweak my WiFi setup so that the WiFi connection into the boiler room is more reliable and that tweak seems to have been successful thanks to Ubiquiti UniFi. My old AP-LR now pressed into service as a mesh extension (no wired connection, just a WiFi downlink). Also power settings and channels tweaked on the 2.5GHz network which I've now separated from the 5GHz. Seems to have about doubled the WiFi experience.

Thanks to everyone who has chipped into this thread, very helpful.

4 Likes