Rubik's Mood Cube / Magic Cube

i made a mysensors node replicating this functionality;

  • Arduino pro mini
  • ADXL345 accelerometer by adafruit (but any adxl345 will do i think).
  • 2 AA battery (3.3 step-up is in the mail).

The node sleeps until interrupted on digital pin 2 by the adxl345 activity detection, waits for 2 seconds and translates the X-Y-Z coordinates from the adxl345 into a ‘Z+’ or ‘X-’ or whatever orientation the cube ended up in after being woken up.
In hass i made some automations that trigger based on the state:
Z+ means turn on ‘scene all livingroom lights’ , Y- means scene livingroom lights dimmed etc.

With the adxl345 tap and double tap is also possible. I implemented the single tap as a binary switch (tap once is on, secondtap is off), but get mixed results as handling the cube sometimes results in a tap being registered while i was actually only turning it around…I’m hoping this can be fixed with the tap treshhold settings of the adxl345.

Am planning to get a cube lasercut with different icons on all 6 sides that represent the corresponding scenes, but first al blank cube with x+, z+ etc. will be made.

Power consumption is not yet really tested, but the pro-mini is running for 4 days now on the 2AA’s with powerled and regulator intact and the adxl345 in low power mode.
volt measured by the arduino internals went from 3.143 to 3.074 during this period.
I hope with the step-up module, powerled and regulator removed it will run for several months on the 2 AA’s as it will be enclosed in the lasercut cube. …

FYI: i looked at doing this with an esp8266 but it seems deepsleeping and being interrupted on an external pin is not possible (at least on a wemos d1 mini that i have).If this however is possibe i would like to hear how :slight_smile:

1 Like