Author Topic: Remote push button switch (250’ buried cable) interface to uController  (Read 1555 times)

0 Members and 1 Guest are viewing this topic.

Offline JesterTopic starter

  • Frequent Contributor
  • **
  • Posts: 859
  • Country: ca
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?
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2353
  • Country: gb
  • Recovering Electrical Engineer
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...


« Last Edit: June 12, 2021, 03:44:55 pm by Terry Bites »
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
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 duplex
More: RS-422 full duplex
More: Cat6 with 4 pair
More: Fiber
 

Offline beanflying

  • Super Contributor
  • ***
  • Posts: 7358
  • Country: au
  • Toys so very many Toys.
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.
Coffee, Food, R/C and electronics nerd in no particular order. Also CNC wannabe, 3D printer and Laser Cutter Junkie and just don't mention my TEA addiction....
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3168
  • Country: au
What about a carefully aimed red laser and suitable detector?
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12807
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.

 
The following users thanked this post: Jester

Offline phil from seattle

  • Super Contributor
  • ***
  • Posts: 1029
  • Country: us
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 duplex
More: RS-422 full duplex
More: Cat6 with 4 pair
More: Fiber

This. 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.
 
The following users thanked this post: Jester

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2582
  • Country: us
What a thread.

OP: I need to put a pushbutton over there
EEVBlog: 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.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14301
  • Country: fr
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.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
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.
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
What a thread.

OP: I need to put a pushbutton over there
EEVBlog: But what if you actually want gigabit Ethernet over there?
No, 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.
 

Offline phil from seattle

  • Super Contributor
  • ***
  • Posts: 1029
  • Country: us
What a thread.

OP: I need to put a pushbutton over there
EEVBlog: 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.

Here 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.
 

Offline frogblender

  • Regular Contributor
  • *
  • Posts: 124
There is a reason why 4-20mA is predominant:  it doesn't matter if your cable is 6 inches or 6 miles.
 

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2582
  • Country: us
Here are the points some of us are making.:

Oh 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:

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 [connected to the shed by 250' of buried cable]. Anyone see any issues with this approach?
 

The 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.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12807
The trench can be reasonably affordable if you can get your serfs children to dig it for you for $1 per yard instead of hiring a DitchWitch!
 

Offline beanflying

  • Super Contributor
  • ***
  • Posts: 7358
  • Country: au
  • Toys so very many Toys.
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 less eBay auction: #224050033693 HUGE pinch of salt on the 3km claim  :-DD
Coffee, Food, R/C and electronics nerd in no particular order. Also CNC wannabe, 3D printer and Laser Cutter Junkie and just don't mention my TEA addiction....
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3168
  • Country: au
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
« Last Edit: June 13, 2021, 05:41:52 am by Circlotron »
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6173
  • Country: fi
    • My home page and email address
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.
When 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" nonsense :-DD

You, 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 it twice because 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 yourself options is 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 the Arduino Ethernet Shield 2) in the shed to power the microcontroller and communicate with it.  The Raspberry Pi 3/4 PoE adapter is 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.)
« Last Edit: June 13, 2021, 03:53:22 am by Nominal Animal »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12807
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.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
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.
 

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2582
  • Country: us
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.
When 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" nonsense :-DD

You, sir, are an idiot.

lol 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.
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3168
  • Country: au
 
The following users thanked this post: james_s

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6173
  • Country: fi
    • My home page and email address
I honestly find it hilarious, I don't think I've ever been called an idiot so dramatically before.
Probably 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 reason this forum 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.  Their opinions don'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.  I am 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.5mm2 part 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.)
 

Offline JesterTopic starter

  • Frequent Contributor
  • **
  • Posts: 859
  • Country: ca
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.

« Last Edit: July 10, 2021, 07:21:55 pm by Jester »
 
The following users thanked this post: Ian.M

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf