PowerbarQuadSwitch

From Technologia Incognita
Revision as of 02:05, 26 November 2015 by Ultratux (talk | contribs)
Jump to: navigation, search
Projects
Quadswitch.jpg
Participants The JinX, Ultratux, Wizzup
Skills
Status Active
Niche Electronics
Purpose Infrastructure


Operation

On On On On
Lights East Lights West Power sockets Audio system
Off Off Off Off


Left switch: main space lights on/off

History

With the use of 4x a two-way toggle switch with neutral center rest position, user:The_JinX and user:ultratux are building a simple powerbar frontend with programmable functions. We're suggesting having one switch do lights ON / lights OFF, the second do power ON / power OFF, the third likely do audio ON / audio OFF. Fourth switch still TBD.

Or perhaps more logical, lights West ON/OFF, lights East ON/OFF, Power ON/OFF, Audio ON/OFF.


Currently, the box has been built, work needs to get done on making the electronics, either with an ESP and a circuit to extend that to 8 I/O pins, or <something else>. Project is currently a bit stalled due to lack of time...


A new idea hatched; instead of using an ESP and wifi etc., we are running a direct cable from the switch to the GPIO pins of the ARM board that drives the RS232 of the west space powerbar. Not only is that easier, it takes out the wifi and network as single point of failure. Thanks go out to user:Piele for initiating the irc discussion that, indirectly, led to this new idea.


The switchbox has been wired up, documentation how it is wired:


leftmost switch => green pair

next switch => orange pair

next switch => blue pair

rightmost switch => brown pair

shield (yep, it's STP for a reason): common


In all cases, pushing the switch up connects the white/colour wire to common, pushing the switch down connects the colour wire to common.


Left to do user:ultratux: run the wire up to the arm board (Mars) and put it onto a suitable header.

 n.b. suitable header means: 2mm pitch !! So check what, if any, type header is on the board, and order stuff
 It is likely pullup/pulldown resistors are needed as well, which means you'll have to have room to wire that.

Left to do: Reflash/change the mars board A10 so it can use GPIO pins.

 n.b. In the schematics I saw only 6 pins labeled as GPIO. Does that mean we're 2 pins short or are other pins easily usable too?

Today I took the marsboard and connected the wires: All wires are pulled-up to 3V3 by a 10K resistor. They also have a 1nF cap to ground to try prevent possible spikes and interference. The are connected up to pins 43, 44, 45, 46, 47, 48, 61, 62, which translate to GPIO PH20-PH27.

Left to do by someone more fluent in coding: write code that evaluates the GPIO pins and tells the powerbar daemon what function to perform. user:Wizzup Today did some magic on the marsboard which led to it recognizing 8 GPIO pins. We determined them to be wired up thus:

sw 1 up    = /sys/class/gpio/gpio1_ph20/value
sw 1 down  = /sys/class/gpio/gpio2_ph21/value
sw 2 up    = /sys/class/gpio/gpio3_ph22/value
sw 2 down  = /sys/class/gpio/gpio6_ph25/value
sw 3 up    = /sys/class/gpio/gpio5_ph24/value
sw 3 down  = /sys/class/gpio/gpio7_ph26/value
sw 4 up    = /sys/class/gpio/gpio8_ph27/value
sw 4 down  = /sys/class/gpio/gpio4_ph23/value

We're currently writing the code that -probably- fires off a curl call when it sees one of these change state...

Left to do by user:Wizzup: Test/ascertain/verify that both powerbar daemons still continue working independently when a network outage severs the link between them, ie. not panic but still evaluate the local button-presses and send them to the local powerbar. This to help address the concerns user:Piele raised.