Iteration 1 Jack - Mapping Accelerometer to Servo Movement
Introduction:
This iteration for the steampunk hat, similarly to the sound, uses a Microbit and also uses a Kitronic Robotics board for its easy to use servo outputs and microbit code extension to move a servo once the accelerometer value exceeds a certain point.This would then be used down the line to add cool movements to gears on the hat which would be triggered alongside the sounds to create a cool effect.
The serial port plotter was used throughout this testing to check accelerometer outputs and any delays or interruptions in values.
Hardware:
Microbit
Kitronic Robotics Board for Microbit
Servos
Software:
Serial Port Plotter: https://github.com/CieNTi/serial_port_plotter
MakeCode with Kitronic Board Library
Steps Taken for Iteration:
1 - Beep microbit on "step" (whenever it detected an accelrometer value over a certain threshold). The values were readwith the serial port plotter, and this was used to check delays and values.
2 - Move servo a few degrees on accelrometer value. This was done with a Kitronic Robotics board for its servo outputs and easy to use microbit library. I ran into some hardware issues while working on this part, but using
the Serial Port Plotter and many software iterations it was determined
to be an issue with the microbit itself. Once this was cheanged out everything workd as expected.
3 - Add a second "tick" to the servo. It was decided that the sonification with the train sounds would be done with 2 per trigger (or step) and this would be mimicked by the servos. I originally tried adding a run in background to the system so that the pause nbetween the ticks wouldn't cause any extra latency, but unfortunately that would cause the microbit to just freeze up immediately when exported. Instead it was just done inside the main "forever" loop.
4 - Playing around with values, timing and servos. This is pretty self explanatory. In the video below I have 2 servos with one being triggered twice with a 400ms delay in between and another being triggered 300ms after the trigger. This gives an offset 1 - 2 - 1 sound which I really like. This can be modified easily.
Microbit Code:
https://makecode.microbit.org/_C9YgyHJ9DbKv
Reflection:
There is still problems to fix and ironing to do from this iteration, especially regarding timing and servo configuration. I think implementing it with the timing done by Dominik for the train
sounds would be the best course of action, as what he has done is much
more dynamic than what was done here, and both the gears and sonification should be synced up too. Getting this attached to gears and a hat for testing will look really cool.
Comments
Post a Comment