Get a little exercise in while watching TV with this movement controlled TV remote.
What you will need
- A belt
- 2 elastic bands
- blu tac
|Power Station||WiFi/Bluetooth||IMU||IR||Battery pack|
- Connect up all your blocks and secure them to your battery pack with some blu tac.
- Slide on two elastic bands either side of your battery.
- Slide your belt through the elastic bands.
- Secure the belt to your waist.
- Next follow this article on how to record IR signals to record the following signals from your remote:
- Next channel button
- Volume up button
- Volume down button
- Add the IMU block and connect the IR and IMU Blocks in the Workspace.
CHANNEL CHANGE LOGIC
First we will create logic that will change the channel each time you jump.
Do this in your IMU Logic Maker.
Smoothing out the jumps
The graph below shows the raw values coming from the z accelerometer in the IMU as well as the smoothed out output called Jump.
To create the smoothed out graph copy the logic below"
- Change the PARSER Gate to - Absolute Value
- Change the AVERAGE Gate to - 5
By smoothing the graph, it reduces the jaggedness and allows you to more easily see where the jumps are. Now you will be able to plot the smoothed out graph and figure out where to set your thresholds.
Changing the channel
We can see from the smoothed out graph that the peak of each jump comes to around 800. To give ourselves a bit of leeway we will set the threshold slightly lower at 500. To stop the logic from triggering multiple times per jump, we add in a suspend.
For the volume we will use the rz, which measures rate of rotation about the z axis of the blocks.
I strapped on the belt and did a few test turns. The peaks are where I turned clockwise, and the troughs are when i started turning anti-clockwise.
In this case, we can use two thresholds to check whether to turn the volume up or down. To stop too many triggers from happening we add a suspend of 200ms, which will limit it to 5 triggers per second. Finally we trigger the corresponding IR signal to turn the volume up or down.
Strap on your belt and try it out! If you had issues creating logic, please feel to use our recipe for this activity here.