Download as pdf
Download as pdf
You are on page 1of 29
we IE xe a. | QID4 PHYSICAL COMPUTING a OTe ey ie PLLMAKE UBIQUITY Tl make ubiquity is the beginners guide developed and created to assist students to understand and work with technology. It contains a step wise introduction into one of the technology platforms - Genuino 101 We urge you to learn & understand how to work with one platform and then go out and explore further. WHAT'S INSIDE? 1 2 3 <= = acc Getting Started Accelerometer Bluetooth works Controlling LED Gyroscope Pedometer Fairy Lights Visual Programming Push Button, er HANDS ON al ACCELEROMETE we TO Bye ‘The idea is to read the three axes of ‘the accelerometer contained in the IMU (Inertiat Measurement Unit of the ‘Genuino 101 board. Each axis measures the acceleration withina range defined by a specific function and returns a raw value that needs to be con- verted to geta value Inmg. The result of the conversion is print-ed on the Serial monitoras triplets of acceleration values (X,Y and). Hardware "No additonal hardware s required apart from the Genuine board. se SOFTWARE a puniny ES CurieIMU.h is the library that gives access to all the parameters, features and readings of the IMU chip of the Genuino beard ‘This unit contains a three axes accelerometer and a three axes gyroscope. This library is part of the Genuino board core and its loaded together with the core files for Arduino or Genuino 101. In this tutorial we read the raw accelerometer values, ies float convertRawAcceleration(int aRaw) ~ transforms the raw data read from the accelerometer (aRaw) into 2 value expressed in img (thousandths of g). The formula of the function must be adjusted to match the accelerometer range set with setAcceler- ‘ometerRange. aa CODE PCopyight (2013 intl corporation. Allright reserved This ibrar is hee software; you can redistribute it andor modify it under the tems ofthe GNU Lesser General Public License as publshed by the Free Software Foundation ether version 2.1 ofthe License, (2 (atyour option) anyater version, ‘This tibray is disbute inthe hope that it wil be useful, but WITHOUT ANY WARRANTY, without frenthe pled warranty of POSE, See the GNU Lester General Public License for more details ‘ou should have received a copy ofthe GNU Lesser General Public License alongwith his brary; nt, write to the Free Software Foundation, Inc, 51 Franklin Street, ith Flot Boston, MA 2170-1307 USA 4 "This sketch example demonstrates how the BMI160 on the ntl} Cri(TM) module canbe used to readacelerometer data‘ code continue on next page al include “Curein* void setup ( ‘Seria egi(9600% naz Serial communication white Seria // wait {othe seal port to.open | nitaze device Sra print intaling IMU deve. t CuieMUbeeing 1] Sette accelerometer range to 26 Curent setaccelerometerange(2 ) voi oop ( raw aceterometer values ina aya aaa foot axa, a2: 1 ead raw accelerometer measurements from device CuriemUreadaccelerometrnaw aya, ae convert the raw accelerometer data to @s a= ConvertRawhcceertin(asae crwertRawAccelerationay) CBavertRawhcceerationlazkaw 1 Seplay ab separated accelerometer ly valves Stialprint 24% Sera \, ‘Seva prinaz Sera printny ) code continue on next page i float convertRawAccelerationtint aka) ( I since we are using 26 range 1 -2gmaps toa raw value of 32768 1/+2gmaps toa raw value of 32767 floata = (aRaw * 20} / 327680; return a ) re ~~ OE GYROSCOPE re Bye “The idea is to read the gyroscope raw ‘values and convert them intoan angular velocity around each ofthe three axes. This information is useful ‘to measure rotational movement around the three axes, something that ‘acceleration can't measureif the ‘movements continuous. Hardware No addtional hardware is required apart from ‘the Genlno boatd. ee SOFTWARE CurieIMU.h is the library that gives access to all the float convertRawGyro(int gRaw) ~ Genuino board, gyroscope (gRaw) into a value expressed in degrees per second (°/s). The formula of the function must be adjusted to match the gyroscope range set with setGyroRange. ‘This unit contains a three axes accelerometer and a three axes gyroscope. This library is part of the Genuino board core and itis loaded together with the core files for Arduino or Genuino 101. In this tutorial we read the raw gyro values CODE F-copyight (a 2019 intel Corporation, alright reserved. This brary’ free software; you can redistribute andor moc itunder the terms ofthe GNU Lesser General Public License as publshedby the Free Software Foundationether version 2.1 of the License, or (at your option any later version. ‘This rary istibuted in the hope that itil be useful but WITHOUT ANY WARRANTY: without even the imped vraranty of [MERCHANTABILITY or FITNESS FORAPARTICULAR PUR. POSE. Seethe GNU Lesser General Public License for more details, ‘You should have received a copy ofthe GNU Lesser Genera Publ conse along wit hs brag not wrt tothe Free Software Foundation, Ic, 51 Frankin Steet, Fifth Floor Boston, MA (02110-1307 USA Thi sketch example demonstrates how the BMI160 onthe nel) Cue(TM) module can be (ed torend accelerometer data"] code continue on next page oe TOE include “urlenaue void setup Sera begi(9600} nalize Serial communication ‘while (Serial / wait forthe seta port 1o.open inlize device Seal print Wtatzing IMU deve." CuieMUbegin 1) Sethe acelerometr range to 250 degres/second CureiUsetGyroRanget250, ) oid oop ( Int exon. yaw, g2Rawe Jaw gyro values float eK ez: 1] ead raw gyro measurements from device CurUreadcyr olga eyRaw Ran ‘convert te raw gyro data to degrees/second gx convertRaw6yrolRaw y= convertRamcyrolgyRawh gz conwertRawGyrolgRane 1 splay ab separated gyro yt values Seralpra’e rk Sera prings Seratprint Sera printgy Sera print Seal pringz, Sera printing, ) code continue on next page ie" float convertRawGyrotint saw { I] since we are using 250 degrees/seconds range 1-250 maps toa raw value of 32768, I +250 maps toa raw value of 32767 float g = (gRaw* 250.0)/ 32768.0; return g; ) He EXERCISES BLUETOOTH WORKS OVERVIEW One of the coolest things about micro-controllers is their ability to communicate externally, in a sense making them Internet of Things devices. The Genuino 101 board has an inbuilt Bluetooth module, let's explore how to connect it and what you can do! ‘There are many preloaded program ‘examples or sketches within the Arduino IDE this is just one you can 1. 1x LED ‘expand upon, You will need: 2. tx Resistor Click on File >> Examples >> Curielmu 3. 1xPotentiometer >> CurleBLEHeartRateMonitor. 4, 1x Genuino board Because we are working with a physical computer, we some- times need to connect physical elements. Wire up your Genuino 101 board as in the picture below (Access this site to be taken to the larger image bitly/GenuinoBluetooth). Upload this sketch to the board by clicking on the upload button. You will need to wait for the green line to fill completely to know your sketch has been uploaded s DOWNLOAD APP Visit the Apple or Google Play store and download the nF Tool- box for BLE App then: 1. Open the App. 2. Select the ‘heart’ icon. 3, Click ‘Connect 4. Select ‘heart rate sketch’ ‘The red LED should now be on, identifying that you have a Bluetooth connection, Now twist the potentiometer and see what happens! Magic! Then think of the possibilities! A mood ‘sensor, boredom ranker, The worm’ na classroom and so much more! PEDOMETER OVERVIEW Fitness tracking technology, wearables and smart watches are all the rage, but how do they work? This guide will show you how to create your own using the Genuino 101 board, and then the possibilities are infinite! There are many preloaded program Make sure you have selected examples or sketches within the Tools >> Board >> Genuino 101 Arduino IDE this is just one you ean and that a COM port is selected ‘expand upon, Tools >> Port (select the port corresponding to your Genuine 101 board -it should look like >> StepCount "COM" (Genuino 101)" Click on File >> Examples >> Curielmu ie -UploadSketch |_| WatehVour steps) Ea Upload this sketch to the Now open the serial monitor ‘Add a battery pack to board by clicking on the ‘Tools >> Serial Monitor to see make it mobile. Upload button. You will need the number of steps taken, to wait forthe green line to there will be a slight delay. 2, Add an LCD screen to fill completely to know your display the steps in real sketch has been uploaded time. 3, Connect the Pedometer using Bluetooth to your Pc phone. =k — VISUAL PROGRAMMING OVERVIEW For many people making the transition from visual programming languages like Scratch to text based programming languages like Arduino* can be challenging! Ardublock a visual program builder for Arduino might be just the tool you need to bridge the void! 1. You will need an Arduino 1. Visit http/fbitiy/Ardublock and board such as a Genuino download the latest version of 101 board ‘Ardublock 2. You will need to have 2. Open Arduino and click on File >> installed the Arduino IDE Preferences and open the ‘Sketchbook Location’ by clicking on Browse jer “Install Ardublock 1. Click on Arduino 2. Create a folder called tools. (all, lower case) 3. Within the tools folder create a new folder called ArduBlockTool. {case sensitive) 4, Within the ArduBlockTool folder create a new folder called tool. Paste the Ardublock file (Ardublock-xxxxjar) you have ‘down- loaded into the final folder (toot) you created, Open Arduino Click on Tools >> Ardublock Now you are set to create your first Sketch. Let's make the board blink! Click on “Control” and drag the “Program” block asthe base for your code. Using the blocks in the "Control" and “Pin” sections replicate the block structure to your let. 1. Click on Upload (The Arduino IDE should open) 2. Make sure your Arduino board is connected and both your Board and Portis selected in the “tools” menu. 3. Click “upload” and you should be blinking! ee THANK YOU (intel.

You might also like