The IMU (Inertial Measurement Unit) Block contains an array of sensors (accelerometer, magnetometer, gyroscope) that combined can be used to track the position of the block in 3D space. In this guide, we will start with the basics and show how to read the data from the IMU and how to trigger an action when a condition is met.
Before starting, make sure you have a Power Station properly powered and a WiFi Block already activated and paired with your computer. If you are not sure how to do this, please refer to the section Activating Your WiFi Block.
- First, snap your IMU Block to your WIFI or Power Station blocks, the order does not matter. Within the Kitsi Creator, Click on the menu item labelled IMU. A new icon should appear on the canvas:
- Make the Data Feed visible to see the data coming from the IMU. To do so just click on the newly created canvas icon:
The Data Feed displays the readings from all 3 sensors inside the IMU. The first 3 correspond to the Accelerometer data, the next 3 to the Magnetometer and the last 3 the Gyroscope readings:
NOTE: If you want to know more about what these readings mean, please read about it in the IMU Characteristics article.
- Add a Sound Player Virtual Block and connect it as a child of the IMU:
- Enter the IMU’s Logic Maker by clicking on the middle icon or double-clicking on the IMU’s canvas icon.
- Inside the Logic Maker, add an INPUT, CHANGE BY and ACTION Gates:
- From the INPUT Gate select ‘x’, from the ACTION Gate select ‘Siren’ and inside the CHANGE BY Gate type ‘45’. Save your changes by pressing Apply. The INPUT and CHANGE BY Gates should start lighting up in blue if everything went well, this indicates the INPUT Gate is producing data and the CHANGE BY Gate is receiving it.
- Finally, move the IMU sideways towards its ‘x’ axis. This causes the x values to change, when the acceleration changes by at least 35 mg, the CHANGE BY Gate allows the event to pass through and activate the Sound Player’s action ‘Siren’. If your computer’s volume is up, you should hear a siren sound every time you move your IMU Block.
You can always trigger any number of actions from as many Virtual Blocks as you wish. For instance, you could create an ‘Intruder Alarm’ that plays a sound and sends an email when someone opens a door!