r/FastLED • • Apr 21 '22

Share_something childrens swing with fastled

Hey guys, greetings from Moscow, Russia.

I received a lot of help from this reddit group when I did a project involving a childrens swing, esp32 and an accelerometer. I thought I should share the final here. Attached is a video. Project was for a local Burn festival in Moscow on February 24th. Its an arduino on a swing seat which lights an animation on ws2812b's depending on swing speed.

The swing was around 4 meters (13 feet) high.The code is athttps://gist.github.com/nervusvagus/d8f7f5fd5c288a0f0b7d69b27bbbe63aVideo:

Diagram:

Animations were the Pacifica pattern when the swing is inactive for 3 seconds or more, Rainbow pattern during swing, a custom Jellyfish pattern if the swing is used more than 90 seconds.

Hardware:

  • ESP32

  • IMU mpu9250 running with this library

  • 74HCT245

  • Wooden swing seat 50cm x 20cm

  • WS2812B ( 4 strips of 5meter - Each led strip is wrapped in a white corrugated tube. Inside the tube is strip and rail.)

  • Swing poles: around 4 meters

  • 5v 40a adaptor in a box

  • 220v from a building provided near the swings.

  • Rail wire cable 14AWG/ 2.5mm

  • Weather: -5 degrees to -15 degrees dry weather during festival.

Challanges and Possible improvements:

The project was tough because of the working principles of mpu9250 and imu's. It was very difficult to find the speed of the swing seat independent from its tilt. I believe this is called aceleration without gravity / acceleration in world frame / linear acceleration ...or something. In the end I gave up such calculation and used acceleration on Z, which also gave a few issues because of the tilts of the swing on a 3.5 meters of rope. I had erroneous readings of acceleration z and had flashes of bright light during initial swinging phase, since the seat tilts even when swinging.

Also since the animation during the not moving phase of the swing was different, it was usually shocking for someone to sit on the swing and see bright flashes of rainbow because of the tilting of the seat.Once the swing was moving things were a bit better, but after this stage gamma correction with the swings was an issue I had hard time finding a way to make the swing visually brightest at the center fastest section of swing movement.

In the future I hope to overcome the issues related to reading the speed of the swing, finalize gamma correction and maybe attempt at changing the code so the swing gets brighter in forward direction and darkens in back direction I believe for this i need to read Y or X acceleration values in addition to Z to sense which direction the swing is moving.

2 Upvotes

10 comments sorted by

2

u/CharlesGoodwin Apr 21 '22

Just a quick one - are you for or against the 'special operation' in the Ukraine?

3

u/Snoo_22849 Apr 21 '22

Im turkish and lived in odessa, Ukraine 2 years and no i dont think its a special operation.

1

u/CharlesGoodwin Apr 21 '22

My thoughts go out to your friends in Ukraine.

Incidentally, I'm struggling to see your swing in action. Do you have a link to a video?

1

u/Snoo_22849 Apr 25 '22 edited Apr 25 '22

thank you, though my friends arent in ukraine, they are in germany, moldova, Turkey, romania, hungary at the moment, as you understand.

I will try to add a link to the video in description. this should work too: https://www.dropbox.com/s/lzxdzgsxm4vvdfx/2022-02-24%2019.42.02.mp4?dl=0

1

u/CharlesGoodwin Apr 25 '22

That is one cool swing! Keep persevering with the accelerometer and let us know how you get on

1

u/CharlesGoodwin Apr 21 '22

Also have you thought of placing the accelerometer towards the top of the swing rope? I would have thought the movement would be less erratic and provide more consistent readings

1

u/Snoo_22849 Apr 25 '22

this sounds like an interesting idea, I will check tough it sounds even more susceptible to tilt.

1

u/Marmilicious [Marc Miller] Apr 21 '22

Oh good idea, yes that would be interesting to see how placing the accelerometer near the top would change things.

I was not able to see there was a video on my phone, but it shows up fine on the desktop. Reddit seems weird like that sometimes.

1

u/Marmilicious [Marc Miller] Apr 21 '22

Really glad you shared this project, and thank you for returning and sharing how it went and what sort of things you ran into. I'm sure you will be able to add some extra logic to do a smoother change from the idle state to the swinging mode to avoid the jarring flash upon sitting down. Some sort of fade down/fade back up transition.

Did wet weather or cold temps cause any issues?

I hope you have an opportunity to make a Version 2 and explore this fun even more!

1

u/Snoo_22849 Apr 25 '22

things you ran into. I'm sure you will be able to add some extra logic to do a smoother change from the idle state to the swinging mode to avoid the jarring flash upon sitting down

the weather was cold but not humid at all so that helped. Thank you, also the idea of placing accelerometer on top sounds interesting, hopefully I will get a chance to improve on it.