Example patterns using 3-axis accelerometer

I’m looking to get two projects finished for Burning Man (yeah, me and probably half this forum) – and I’m trying to figure out which, if any, of the patterns in the library use the accelerometer to do cool things for a wearable.

I have a completed coat (that I’ve talked about in the past in this forum) and would like to adjust it to show fluid movement when I dance wearing it, and I also am working on a fairly elaborate “belt”* design which would really benefit from the same, but searching this forum for “accelerometer” didn’t come up with much, and obviously right now there’s no search or tagging capability within https://electromage.com/patterns .

(The belt is a 2d matrix of 4 wide / 70 long pixels [280 total], attached to a literal 2" wide leather belt, with the LEDs diffused by… TBD… some form of open-cell foam I’m trying to get right.)

1 Like

I was trying to get something going on my sword, but never quite got anything useful before someone tried to use it as a sword and it broke.

Apparently the angle between 2 3-vectors is acos(((x*nx)+(y*ny)+(z*nz))/(sqrt(x*x+y*y+z*z)*sqrt(nx*nx+ny*ny+nz*nz))) … maybe that will help :slight_smile:

The only ones I can think of in the library are “Accelerometer Bouncing Balls”, “Glow Flow” and “Upward Waves 3D Using Accelerometer”.

You might get some ideas from Neopixel LED Skirt | Hackaday.io too.

1 Like

Thanks @sorceror – but given Burning Man starts in three weeks, and I’m not a programmer by training, I’d need to have a really strong starting library and pattern to pull this off. @pixie – I literally can’t find those patterns you just named – I search all 11 pages of patterns for the name “glow flow” and didn’t get any hits for it. Help?

If anyone was feeling extremely generous with helping make one – something with flow and motion when you dance, either on a coat that’s a 10 wide / 13 tall 2D grid, or a (first choice) belt that’s a 3D circle (I’m thinking of just treating it as a 2D rectangle) that’s 4 wide / 70 around… I’ll figure out some way to thank you profusely either on-Playa or as a thank you after.

Musing further, for a future “task” or “challenge” – @Scruffynerf and @jeff – using an idea like this could spur some really interesting thoughts in the community.

And @wizard – it really speaks to the need to re-do the pattern library, because even just a tagging system that said “show me all patterns that work for 2D layouts, and use the accelerometer (or microphone, or whatever)” would be massively valuable.

Thanks for all you do!

On the patterns library look for:
Page 2: “GlowFlow (3D coord transform API port)”
Page 2: “Upward wave 3D using accelerometer”
Page 3: “Bouncing Balls 2D”

Even if you’re not a programmer, those patterns are all well commented and you can probably get some interesting results just by copying the patterns and changing a few of the numbers in them to get different variations on the movement and colours. Try it and see how you go, you might surprise yourself :grinning:

1 Like

Thanks @ChrisNZ ! I tried searching for “Glow Flow” not “GlowFlow” and, well, that’s not how search works. Found that one – this pattern is both (1) really good, (2) solidly documented, and (3) the sound reactive and light reactive bonus features in it are also slick. Thank you for your efforts @Regorlas and @wizard ! Given that so few things actually use the accelerometer or light meter and this does both, this could be an interesting “default” pattern as well.

I’m not a programmer, but I’m at least comfortable with editing and modifying code, like you suggested – there’s a big difference between “start with a working pattern, and change things” and “truly start from a blank canvas and write a program”.

I’m still certainly interested in other ideas or patterns around this theme of make something look different great when dancing, based on the accelerometer, since that’s a very broad solution space.

For anyone else finding this thread later – the second one is actually titled “Upward waves 3D using accelerometer” (plural “waves”). I still need to put it on my hardware and test it.

1 Like

Sounds like an exciting project! Thank you for letting me know my efforts to document Glow Flow pattern was useful.

I think the pattern will look pretty cool as-is on a coat or belt. But given that a piece of clothing is different from a handheld interactive sculpture, some tweaks may be in order. Two ideas off the cuff, feel free to experiment with them or ignore me:

  1. A piece of clothing usually has a reduced range of motion relative to a handheld object. To reclaim the “lost” range of effects, you may choose to exaggerate the polar angle component. Current code: rotateX(-pa) experiment idea: rotateX(-pa * some_value_greater_than_1) If your dance style leads to the occasional handstand or cartwheel, a clamp would be useful. rotateX(clamp(-pa*some_value_greater_than_1, 0, PI))
  2. Glow Flow intended to resemble illusion of liquid sloshing around, which “lags behind” movement. Reversing the effect of azimuth angle will make the colors “shoot ahead” which didn’t make sense for my project but might look cool on yours.

That’s massively valuable, @Regorlas – any other suggestions for how to adjust your code would absolutely make my day; as you indicated, the motion of dancing , with a sensor mounted to a belt, is fundamentally different than inverting a “bucket” upside down, and in a few minutes of playing around, I know this is going to take some real adjustments, since most of the big effects come from inverting, not acceleration or radial motion, it seems, and I’m trying to figure out how to change that.

(I don’t plan for this to be inverted at any point in the project, whereas TURNING is going to be more interesting – for example, if I’m wearing the bike or coat while on a bicycle or spinning around on a dance floor)

Detecting turning motion would require a gyroscopic sensor, I don’t believe that’s among the current repertoire of data from a Pixelblaze sensor board.

If I am wrong, or if a future sensor board incorporates a gyroscope, that would be cool! I’m sure I can come up with something interesting for such motion data.

I was more thinking about angular acceleration — you’re right, no gyroscope!

It won’t help you for this year’s event, but I’ve logged our interest for gyroscope under the feature request topic: Gyroscope on Sensor Board

Some thoughts…

For dancing, where you place the sensor can make a big difference! On my coat I put the sensor board in the cuff of the arm, the idea is that my arm motions could be more expressive. I haven’t got around to actually implementing anything, but that was the idea.

Using the accelerometer as a way to find the direction of gravity is fairly easy, and magnitude of movement as well. Good for tilt/lean type detection.

It can be used to detect certain moves, like a step to the side or a hop or something.

Rotation only so far as the change in angle relative to gravity. Spinning in place won’t produce much on the accelerometer unless it was far enough away from the center of mass to produce centripetal force. A bit easier to detect at arms length! In that case you’d have the sum of both vectors, it would point diagonally and have a total force g > 1.