Community discussions

MikroTik App
 
User avatar
TomjNorthIdaho
Forum Guru
Forum Guru
Topic Author
Posts: 1520
Joined: Mon Oct 04, 2010 11:25 pm
Location: North Idaho
Contact:

Sensors - How to make a door or other type of a sensor to monitor things such as open doors ...

Fri Jan 29, 2021 6:53 pm

Sensors - How to make a door or other type of a sensor to monitor things such as open doors ...

I recently posted this information in a WISP related Facebook group. I figure I should also post this information here to help give Mikrotik network administrators some ideas.

My first post ( part 1 of 2 ):
Tom Jones
* Here is an almost zero cost for a network monitor *
1'st , you need to know what an Ethernet loop-back cable is. An Ethernet loop-back cable is a single ended Ethernet cable with a single RJ-45 connector on it. The pinout is changed so that the one pair is wired/connected to the other pair. Thus - when you plug in into an Ethernet interface , the interface will show a link.
2'nd , now take your loop-back cable and cut 1 or two wires , have thouse wires go through a toggle switch. When the switch is on-closed ( switch contacts closed ) you will see an Ethernet link. When the switch is off-open ( switch contacts open ) the Ethernet link will drop.
3'rd , now replace your switch with something else such as any of the following:
- Mechanical thermostat
- Magnetic door sensor
- A spring button switch ( button pushed in and held is on-closed ) and ( button releases is off/open
4'th , now install your multiple sensors and connect them to Ethernet ports on your Ethernet switch.
5'th , optional - configure SNMP traps on your switch to give you alerts. Of , configure your network monitor to alert you ( using SNMP reads ) to alert you when an Ethernet port goes down.
*** This is a cheap easy way to save hundreds or thousands on environmental monitors.
I've used this for 20 plus years and it works great
North Idaho Tom Jones
EDIT - be sure to also read my Part 2 post below on making zero cost network monitors/sensors.





My second post ( part 2 of 2 ):
Part 2
* Here is an almost zero cost for a network monitor *

OK - After reading my first post on creating an almost zero cost network sensor monitor , I thought I would explain to to use "PING" instead of SNMP or SNMP-Traps to monitor a sensor.

Most routers and switches have the ability to assign an IP address directly to an Ethernet interface. And that IP address will only ping when the interface is up ( link-up ). When that Ethernet interface is in a down ( no-link ) state , the IP address on that interface will not ping.

So here is an example of something you can do with a Mikrotik route/switch ( or most other routers & switches ):
- 1'st , you need to make sure the IP addresses you use will be reachable/routable from your network to the router/switch you will be adding your on/off ( link/no-link ethernet loopback sensors to ).
- 2'nd , add a door sensor to ether5
- 3'rd . put IP address 192.168.100.1 ( /32 or 255.255.255.255 ) on ether5
- 4'th , rename the interface from ether5 to "Door-Sensor"
- 5'th , Now when the door sensor on ether5 ( renamed Door-Sensore " is closed , the IP address 192.168.100.1 will be pingable from anywhere inside your network. When you can not ping 192.168.100.1 , then the door is open and the ethernet port sensor had dropped the link.
- 6'th, repeat the process of adding sensors , adding IP addresses and renaming ports until you have all the sensors you want ( door , temp low , temp high , ... ).
- 7'th , configure your network monitor to PING the ip addresses on your interfaces to your sensors. If an IP address to a sensor will not ping , then that sensor is down/open. Modify your network monitor to generate alerts and notifications as you want.
-8'th , optional ... If you don't have a network monitor , then you can use an old Mikrotik router and configure Tools-Netwatch to ping-poll your interface sensor IP addresses and generate your alerts.
- 9'th , optional information ... It is possible to create the following types of sensors for almost zero cost.
-- Utility Power available
-- Generator running
-- Door open/closed
-- Building hot or cold
-- Battery low
-- Motion sensor ( flood light motion sensor connected to a relay to make dry-contact on/off open/closed relay.
-- The list goes on and on and on , I have even created sensors to alert me when a propane tank is low.

I love making things that are much needed/wanted at almost zero cost  

North Idaho Tom Jones
 
User avatar
bpwl
Forum Guru
Forum Guru
Posts: 3052
Joined: Mon Apr 08, 2019 1:16 am

Re: Sensors - How to make a door or other type of a sensor to monitor things such as open doors ...

Thu Feb 04, 2021 11:42 am

Nice hack to make a sensor out of network hardware. But saving hundreds or thousands on environmental monitors is not valid anymore in 2021.
Your UTP cable could cost more than the modern 5$ monitors which handle tens of contacts and environment sensors (cost less than 1 $).
And programming is as difficult as using WinBox.(PictoBlox, MakeBlock, Scratch, Arduino IDE, ...)
So, no, today I would not make an ethernet port switch into a monitor for some I/O state, but an ESP32 (or even ESP8266) would be the wireless controller for 5$ (4,96€)
https://randomnerdtutorials.com/
Could also be done with Arduino, Micro:bit, Raspberry Pi Pico, if network shield added.

Who is online

Users browsing this forum: aleab, alexys95, Bing [Bot], Google [Bot], lurker888, sepalab and 40 guests