Skip to content
aaahaaap edited this page Nov 4, 2012 · 19 revisions

The HexaBus Plug is a socket that can be switched. In addition, there is also the HexaBus Plug+, which has a metering chip included - you can measure the power consumption of attached devices. The plug looks like this:

The plug.

If you open it, you see this:

The plug.

Actually, this is a development hardware with a different microcontroller - but you get the idea. Apart from changing the microcontroller, this is the real thing. The LED can glow red and green and signals different states. Each plug comes with a bootloader and can be updated using a small commandline utility.

LED Status Signals

LEDs off: no power supply

LED glowing green: normal operation, relay in position "power on"

LED glowing red: normal operation, relay in position "power off"

LED flashing red (slow): in provisioning state

LED flashing red (fast): in bootloader

LED flashing green (3x slow): provisioning successfully completed

Schematic

The latest schematic of the HexaBus Plug can be found in the HexaBus git repository:

https://github.com/mysmartgrid/hexabus/tree/master/schematics

The schematics for the plug consist of two parts: a low-voltage microcontroller control board and a high-voltage power supply/relay board. The microcontroller control board runs at 2.5V in order to reduce the power consumption. If you want to interface other hardware, it might be easier to work with 3.3V. The necessary modifications are described here: Supply modification the Low Voltage board

Pairing a Plug with an USB stick

Each plug must be paired with the usb stick. To do so, push the button on the usb stick for 2 seconds (± 10%) - the LED will start to flash red. Now you have 30 seconds to pair the socket with the usb stick. To do so, push the button on the plug for another 2 seconds (± 10%). As soon as the two devices are paired, both switch the LED to green. You can now access the plug.

Calibrating a Plug+

All Plug+ came precalibrated with precission of approx. ±1%. Due to aging of components it may be necessary to recalibrate the metering for measuring the correct power consumption. In order to prevent misuse, calibration is disabled by default. You can enable calibration by setting EEPROM value 0x43 to 0xFF or by using the 6switch command set_default

./6switch socket.local set_default

After doing so, the calibration with a 100 W load can be carried out. It is started by pushing the button for 5 seconds - the red and green LED will light up. Calibration will stop after approx. 25 seconds. At the end of calibration the red led turns off and the calibration is disabled again.

Note: By using the set_default 6switch command other variables are also reseted which necessitates a new paring with the usb stick.

Software architecture - a few hints

The UDP handler is defined here: https://github.com/mysmartgrid/hexabus/blob/master/firmware/contiki-2.x/platform/Hexabus-Socket/apps/udp_handler/udp_handler.c This is where the behavior of the plug is defined with regard to incoming network messages via 6switch.

If you want to define a new Contiki process, please look at the existing ones in firmware/contiki-2.x/platform/Hexabus-Socket/apps. The typical way of writing an application is:

  1. Copy an existing application, i.e. use metering as a template for temperature. You should have a separate directory now.

  2. Hack away the Makefile.temperature.

  3. In firmware/Hexabus-Socket/Makefile, make sure that you new application is listed in the apps list - this will ensure that your application is linked in the firmware, and also adds the right include path for the compiler.

Related pages

Clone this wiki locally