Hack42, a hackerspace in Arnhem, Netherlands recently moved into some new digs, and they wanted an easy way to let their members know whether they were open or not. Fixed hours of operation typically do not fit this sort of organization, so that was out of the question. Instead, they built a switch into the wall** that will let their members know when they are open for business.
The switch separates the TX and RX pins of two Ethernet ports that reside in an old access point embedded in the wall. When the hackerspace is open, the switch is thrown and the circuit is closed. A cron job checks the state of the eth1 port once a minute, sending the “Open” status message to Twitter and IRC once it notices the status change. When the switch is thrown again and the eth1 port goes down, a “Closed” message is broadcast.
It is a simple but cool hack, and quite befitting of a hackerspace.
**No direct Google Translate link is available, though Chrome will translate it for you without issue.
[Thanks, _Danny_]
ACK! the poor twisted pair!
the kludge! it makes me cringe!
much more respect would be given if they used a GPIO line on the router.
i wonder if this upsets the router on the other end at all. (seems like a huge opportunity for RF interference)
There actually is an English translation on the second half of the page.
Page actually (now at least) has an English translation halfway down…
For those too lazy to scroll, and for those who could correct the link in the article: https://hack42.nl/wiki/index.php/Gebruiker:RickDeckardt/SpaceStateSwitch#English
Also, according to the wiki page:
“Closing the switch connects tx+/rx+ and tx-/rx-, causing eth1 to detect link up.”
And seeing as tx+, tx-, rx+ and rx- all exist within one ethernet cable, I see no reason why they have connected two together as you seem to suggest here:
“The switch separates the TX and RX pins of two Ethernet ports that reside in an old access point embedded in the wall.”
Then again, maybe I’m reading it wrong…
But using the GPIO line would be too orthodox! I think this is a brilliant example of a “hack”. They make use of the ethernet port for something that it’s not intended for, yet it had everything they needed to sense a stimulus change with some code.
Extra kudo’s if they remove the cron job and use the hotplugging hooks! :)
This should be standard equipment on a dungeon door.
Also…. what happens if the ethernet line is disconnected?
@CutThroughStuffGuy This would look like the rx/tx got disconnected. connected = space is open, disconnected = space is closed. We only used 1 switch port.
Added benefit to this config: we can patch the port through to -everywhere- where there is a utp connection with ease and hook up the switch there. It’s just a switch, with a UTP connector :)
GPIO was thought of, but using the existing ethernet port on the outside saved us some time and this works just as well. (Yep, we are lazy hackers)
this is a really dirty hack, just reading about it makes me want to take a shower ;)
@CutThroughStuffGuy: when the cable is unplugged the port will simply detect ‘link down’, and the status will be set to ‘closed’. If the AP’s uplink is unplugged the state changes can’t get sent to the webserver and the displayed state is frozen.
@Mike Nathan: the AP is not in the wall, we’re just using a wall jack to patch the switch through to the access point.
Hey, our hackerspace has one of those too! http://twitter.com/JigTwitch – http://wiki.jigren.org/Twitch
You know what they say: Great thinks, mind alike.
@ZeroCool42 – I must have misread – perhaps it was the Google translation that tripped me up (I swear I didn’t see the English portion at the bottom yesterday).
Either way, after looking at it again, it appears you are correct.
This is a true hack. Glad I didn’t see the dreaded “A” word.
@Mike Nathan: we added the translation this morning (our time).
The switch uses just one ethernet port. When it’s closed, it’s basically a loopback plug
@griffon: I’m now connected through this very access point, and to the AP it’s just another ethernet cable hooked up to it. The switch is about 1.5 meters (5 ft) away, and anyway the baseband frequency of 100bT ethernet doesn’t bother 802.11b/g at all.
Shorting RTS or CTS on a serial port would work just as well and is far easier to code up in bash to do the same thing. Did this years ago to fire off emails to members of a ham radio club that someone was in the shack.
they could’ve gotten a bigger toggle switch… ;-)
@DrDoug: We will, we will. <– insert maniacal laughter here
@fartface easier?
Here’s the code to detect the link state of the eth1 network device, 1 line of bash, uses ethtool and grep
ethtool eth1|grep “Link detected: yes” >/dev/null && currstate=open || currstate=closed
What a switch! It’s like Ghostbusters!
add a big knife switch! :P
Ghostbusers? Don’t cross the streams!… erhm, actually it does, with tx and rx ;)
I figured it would default to “closed” if the plug were erm, unplugged. But that might be a problem if you are, in fact, open.
Static shock to GPIO = Fried processor. Static shock to Ethernet = Nothing happens.
Stray voltage (say, AC power) to GPIO = Fried processor. Stray voltage to Ethernet = Maybe a fried isolation transformer, but probably not even that.
This is really, really smart. It required no special hardware, uses an interface they already had, and doesn’t involve an arduino. A+ would read again!
For over a year, we’ve had a similar setup at our hackerspace, but it uses our network camera’s optoisolated input. (Also uses the relay output to drive an indicator LED, so you know when it’s working.) The camera takes your picture when you throw the switch, which goes on our twitter feed: @i3detroit
I know of a site that uses old Cisco 678 DSL modems to monitor for power outages. The modems are NOT on a UPS and all they do is answer a ping. No ping = no power.
@CutThroughStuffGuy: yeah, wiring problems would cause a wrong indication, but it’s hard to see how one could avoid that with a simple setup like this. Reversing the switch action and the check would just change the problem to a false indication of ‘open’ when we’re in fact closed. Also, people could forget to flip the switch (unlikely though, it’s in a very prominent location, and flipping knife switches has that special attraction that is a reminder in itself); the uplink could be down; the webserver could be wonky and twitter could have gone titsup. In short, for the setup and the effort involved, it does a good enough job.
It’s even harder now for the switch to be ignored as part of the space lighting is controller by it. Our ceiling lighting was connected to a Boring Old Switch in the central hallway, and people from other parts of the building leaving would sometime switch it off. Clearly, this was an unsatisfactory situation, so after an evening of wrestling the spaghetti cabling surrounding the fuseboard we had managed to fit two relays there that switched our lighting independently. Those relays are driven by a 555 each, for delayed switching. Also, the second ethernet port on the AP is now also switched through a double-pole relay, with the knife switch controlling the relay and the 555’s