Remote push button switch (250’ buried cable) interface to uController - Page 1
Forum section: electronics / projects

author: Jester
author_rank: Frequent Contributor
timestamp: June 11, 2021, 02:43:36 pm
content: I have a shed in the backyard that is about 200+ feet from the house. I have the need to trigger a microcontroller input in the house with a simple momentary push button switch located in the shed. I’m considering a simple opto isolator interface with say 20mA of LED current. Anyone see any issues with this approach?

author: Terry Bites
author_rank: Super Contributor
timestamp: June 11, 2021, 04:10:08 pm
content: A current loop on a shielded twisted pair is ideal. Ground Shield at TX end only, if you use the shield at all.It seems like a lot of work, but if you already have the tp or stp...

author: Renate
author_rank: Super Contributor
timestamp: June 12, 2021, 11:24:15 am
content: The 250' of buried cable is a big deal in terms of effort and cost.Don't limit yourself. Today you want a pushbutton, tomorrow you might want 1GB internet.You want duplex even for a pushbutton. You need confirmation that what you wanted happened.Minimal: RS-485 half duplexMore: RS-422 full duplexMore: Cat6 with 4 pairMore: Fiber

author: beanflying
author_rank: Super Contributor
timestamp: June 12, 2021, 11:34:29 am
content: EOP should work ok over that range for way less than digging a trench and cable (assuming you have power to the shed). Due to current circumstances I have had this from the house to the shack working fine at over 100' for several years now. Then you have a heap of options including feedback showing status of your device etc.

author: Circlotron
author_rank: Super Contributor
timestamp: June 12, 2021, 11:46:38 am
content: What about a carefully aimed red laser and suitable detector?

author: Ian.M
author_rank: Super Contributor
timestamp: June 12, 2021, 11:54:30 am
content: 250' of cable to a different building, even buried, is asking for trouble if it isn't *FULLY* isolated at the MCU end. Large common mode transients may be induced in it by nearby lightning strikes, electrical supply faults, or rarely by geomagnetic storms, and if it shares a ground or supply connection with the MCU, these can damage your MCU board, maybe even blowing tracks off it.Therefore at the very least, in addition to an optocoupler, it requires an isolated supply to power the opto LED. It should also be clamped to local ground where it enters the building, by gas discharge surge suppressors or beefy TVS diodes. Don't forget an anti-parallel diode across the opto LED so it doesn't get damaged by reverse transients.If the button is only pressed occasionally, consider simply using a battery to power the opto LED.

author: phil from seattle
author_rank: Super Contributor
timestamp: June 12, 2021, 01:41:27 pm
content: Quote from: Renate on June 12, 2021, 11:24:15 amThis. The cat5 solution is probably only slightly more expensive than a cheap current loop one. Digging dirt overwhelms all other costs.However, the OP didn't say if there was power in the shed.If no power, then I'd look at LoRa. Digging in dirt is expensive so running cable will cost more than a couple of transceivers and a battery.If power, then wifi with directional antennas.

author: ajb
author_rank: Super Contributor
timestamp: June 12, 2021, 06:02:54 pm
content: What a thread.OP: I need to put a pushbutton over thereEEVBlog: But what if you actually want gigabit Ethernet over there?EEVBlog: An entire wireless IP stack is clearly the best way to transport one bit of state.Of course it's reasonable to consider future expansion and wireless is absolutely a valid way of sidestepping the sort of faults that can appear on buried cable (not to mention saving your back from all that digging), but there's really nothing technically wrong with the OP's proposed approach. It needs adequate protection, sure, but it's a big jump to say that they should go to a solution that's several orders of magnitude more complex instead.Adding isolated power to the MCU side is trivial, an off-the-shelf isolated DC-DC converter is like $3 at qty 1, so well worthwhile to break the potential fault current path. You don't even need the isolated side to be regulated for an LED and opto.

author: SiliconWizard
author_rank: Super Contributor
timestamp: June 12, 2021, 06:23:20 pm
content: Whatever the solution, proper protection here is not optional and will likely be the most difficult and "expensive" part of this project. Cheap isolation is not enough. Proper protection against overvoltage is also necessary.

author: james_s
author_rank: Super Contributor
timestamp: June 12, 2021, 06:52:01 pm
content: That depends on where he is. Lightning strikes are quite rare where I am, I wouldn't bother with protection, in that rare event that something happens just replace whatever is damaged.The RF idea is not bad though, lots of simple RF remote links that could do the job cheaply and reasonably reliably for a lot less work than digging a 250' trench.

author: Renate
author_rank: Super Contributor
timestamp: June 12, 2021, 10:00:02 pm
content: Quote from: ajb on June 12, 2021, 06:02:54 pmNo, I just meant that if you're digging 200 feet of ditch and throwing in a cable it might make sense to have an extra conductor or two.I don't know what you charge for a Ditch Witch and digging 200 feet,but I'm sure an Arduino or two and some RS-485 converters doesn't significantly add to the cost.

author: phil from seattle
author_rank: Super Contributor
timestamp: June 12, 2021, 10:22:43 pm
content: Quote from: ajb on June 12, 2021, 06:02:54 pmHere are the points some of us are making.:If you are gong to the trouble of running a wire, run extra at a fairly low incremental cost.If you are trenching, then that will overwhelm all other costs. Ethernet cable and a cheap router are tiny costs in comparison.If you can avoid trenching (LoRa, WiFi or other RF solutions), then do so.So, no, ethernet, WiFi, what ever is not massive over kill. It may seem like it until you factor in all costs.

author: frogblender
author_rank: Regular Contributor
timestamp: June 12, 2021, 10:47:36 pm
content: There is a reason why 4-20mA is predominant: it doesn't matter if your cable is 6 inches or 6 miles.

author: ajb
author_rank: Super Contributor
timestamp: June 12, 2021, 11:35:38 pm
content: Quote from: phil from seattle on June 12, 2021, 10:22:43 pmOh I get the points everyone is making, and I think a lot of them are pretty reasonable in the context of the assumptions that a lot of people are making here. I just think it's funny how someone can show up with a very simply stated problem and a very simple proposed solution that would probably be perfectly adequate (granted, with a few caveats) and get these wildly more complicated suggestions. Sure, LoRa or wifi might be an easier/cheaper solution, but it's only 'better' if the OP 1) is comfortable with the level of complexity/power requirement of a wifi or other radio device in the shed, 2) either hasn't yet run the cable or doesn't have other reasons for wanting a wired connection to the shed, and/or 3) has any interest in planning for additional future capabilities. Any of those assumptions may or may not be accurate, but that's not known because there's hardly info in the OP:Quote from: Jester on June 11, 2021, 02:43:36 pmThe objective answer to the question given here is "no, there aren't any issues with that solution provided you include electrical protection adequate to the environment", which is more or less what a few people said. The other suggested solutions may be helpful and may even be better, but strictly speaking do not answer the question.All that said, I've been here (and on other forums) long enough to know that it's just how these things go, so I'm not trying to shit on anyone for offering well-intentioned ideas. Like I said, I just thought it was funny how the thread immediately went from a pushbutton and some wire to a full on wifi network.

author: Ian.M
author_rank: Super Contributor
timestamp: June 13, 2021, 02:45:18 am
content: The trench can be reasonably affordable if you can get yourserfschildrento dig it for you for $1 per yard instead of hiring a DitchWitch!

author: beanflying
author_rank: Super Contributor
timestamp: June 13, 2021, 02:54:56 am
content: Even if you hire a team of slaves or better yet a DitchWitch/Dingo you are looking at likely toward $1k with conduit, wire, and hire before you get to your time. Simply a bad option unless you have a need to run a trench for other services.Assuming power Ethernet over Power $100'ish with appropriate side benefits. Battery or Power WiFi/Lora or even 400mHz even with a Battery likely even lesseBay auction: #224050033693HUGE pinch of salt on the 3km claim

author: Circlotron
author_rank: Super Contributor
timestamp: June 13, 2021, 03:47:07 am
content: I got one of these for a job work was doing recently. Got someone to stand on an elevated bridge and I drove down the road holding the transmitter above the car roof. Claimed working distance is 2km, I got 700m across open space.https://au.element14.com/rf-solutions/trap-s1/remote-control-system-1-ch-868mhz/dp/2841180

author: Nominal Animal
author_rank: Super Contributor
timestamp: June 13, 2021, 03:51:02 am
content: Quote from: ajb on June 12, 2021, 11:35:38 pmWhen somebody asks you how hard do they need to hit their thumb with a hammer to forget their headache, you think it is funny how instead of answering "pretty hard, but try not to pulverize the bones in your thumb", people immediately start going with some full on "take an aspirin and go to a doctor" nonsenseYou, sir, are an idiot.Simple answers are harmful when they omit the wisdom of experience.Here, the biggest task will be digging the ditch to put the cable into. Having to do ittwicebecause you didn't think it through the first time, will hurt. If you pay someone else to do it, the cost will dwarf everything else in this project, so leaving yourselfoptionsis worth it.As others have already mentioned, this assumes you have already decided you want a wired connection, and not a wireless one (WiFi/LoRaWAN/etc.). A wireless one is something to carefully consider at this point, because of its minimal installation cost.A 100m (330') roll of Cat6a S/FTP that can be directly installed in a shallow ditch without mechanical shielding costs about 100€ here. If you pay someone else to dig the ditch, use either aluminium (~20mm diameter) or plastic (~50mm diameter) piping intended for exactly this purpose, to minimize ground frost damage (if living in an area where the ground freezes during winter at the depth the cable is installed at) and to let you pull additional cables to the shed later on if desired; the added cost is very small compared to the cost of having to re-dig the ditch. I personally would not bother, and would just use sand as a buffer around the Cat6a, and do the shovel work myself.Cat6a is twisted pair, and can be used for Ethernet, or RS-485, or even a current loop over individual pairs. Tool-less RJ45 connectors cost about 5-10€ in singles here (the ones I'd use are 5€ for males, 10€ for female connectors); I'd definitely put female ones at each end in a small utility panel, and connect to those via short patch cables etc. If using it for non-Ethernet purposes, I'd use cheap ready-made Ethernet cables, cutting them in half, plugging them into the utility panel at each end. Keep your options to a maximum: it is annoying to have to redo everything because you forgot to leave yourself choices to change your mind.An approach I personally would consider here, is to use a passive PoE injector to supply the power needed by the microcontroller in the shed, and a PoE Ethernet shield (similar to theArduino Ethernet Shield 2) in the shed to power the microcontroller and communicate with it. TheRaspberry Pi 3/4 PoE adapteris a cheap option, if instead of a microcontroller you switch to a 'Pi. There are also a lot of POE-capable cameras, in case you decide put a camera at the shed.(I happen to have a very similar use case, and some 50m of ditch-digging, waiting for me later this summer a bit north of the Arctic Circle, you see. Fortunately, the ground is all sand, no rocks, only an occasional small pebble, so I can get away without conduit/mechanical shield piping, and ground frost is unlikely to cause major issues with the shielded Cat6a cable.)

author: Ian.M
author_rank: Super Contributor
timestamp: June 13, 2021, 04:14:07 am
content: There are also issues with the minimum separation permitted between buried power and data cables by the NEC (or rather the CEC as the O.P's in Canada).If you are running mains power to the outbuilding, powerline ethernet adapters or powerline modems for the data link may well be preferable to digging a wider trench (or a deeper one that will probably require shoring) so you can run two seperate conduits for power and data with the required separation.

author: james_s
author_rank: Super Contributor
timestamp: June 13, 2021, 04:22:35 am
content: Digging a proper trench may not be necessary, same with conduit, direct burial cable is readily available although PVC conduit is cheap enough that it might work out a better deal anyway. Often times low voltage wire is buried just a few inches deep, not the 18" that would be required here to run utility power.

author: ajb
author_rank: Super Contributor
timestamp: June 13, 2021, 05:19:37 am
content: Quote from: Nominal Animal on June 13, 2021, 03:51:02 amlol ok.I don't know why you're so wound up about a throwaway observation on the way the solutions in the thread escalated based on assumptions about the OP's situation and priorities. All of it was sound advice for various circumstances, but some of it was a substantial complication of the OP's stated goal. The wisdom of experience should also include a wariness of over complicated solutions, and more importantly the assumptions you make when you don't have all the facts. I honestly find it hilarious, I don't think I've ever been called an idiot so dramatically before.

author: Nominal Animal
author_rank: Super Contributor
timestamp: June 13, 2021, 06:28:31 am
content: Quote from: ajb on June 13, 2021, 05:19:37 amProbably because nobody has taken you seriously before, and simply ignore your inane "advice". You find it hilarious, I find you spreading advice that can backfire; I do not find anything about that funny.The reasonthisforum is useful, is exactly because there are people here who have done these things before, and can provide advice based on their experiences; especially on the mistakes they have done before. Theiropinionsdon't matter; what matters is their experience and related real-life observations.As an example, I do have a non-twisted pair or wires running to where I want them, used for something like a remote doorbell/intercom running at 12V, but it just won't work for the use case I have in mind (camera, possibly a remote Linux SBC). That location does not have power either, so even with wireless, I'd have to pull a power line there anyway.Iam definitely looking at not redoing this again the next summer or the summer after that, so I am actually going to put a thicker conduit with 240VAC 3×1.5mm2part way, to an largeish IP66 enclosure I can put a small POE-injecting switch also, and just run the POE Cat6 STP cables from there. (Probably will use a separate box for the mains stuff, just because I don't like dealing with mains, and prefer a sparky to do those for me.)

author: Jester
author_rank: Frequent Contributor
timestamp: July 10, 2021, 07:12:52 pm
content: Thanks to everyone for responding. I guess it goes without saying give a problem to a bunch of engineers and feature creep is soon to set it.In the end I bought a huge box of X10 modules on KiJiji for dirt cheap. Plugged one of the controllers in the shed, used one of the modules with a dry contact for the other end. The signal would not make it all the way from the shed to the basement, however the signal did reach from the shed to an outlet in another structure just outside the house and from the basement to the other structure. Fortunately there is a multi wire cable with spares in the other structure going to the basement, so 30 minutes start to finish and its working.

author: james_s
author_rank: Super Contributor
timestamp: July 11, 2021, 07:57:14 pm
content: I remember that X10 stuff, I thought it was really cool back in the 80s, I used to have a bunch of it. I gave it all away years ago though because it just isn't reliable anymore, I think too many SMPSs injecting noise into the line and/or too many filters on said SMPSs attenuating the signal. The most serious flaw of X10 is that it is a one-way communication with no way to verify the command was received and no way to check the state of the device. I use wifi and zigbee for all of my remote control and automation now.