Hi so this is a quick demo of how to use
the micro bit to wirelessly stream accelerometer data to your pc.
First i want to preface this with the fact that i'm using the chrome browser.
The examples we're going to be seeing depend on web bluetooth which is only
available in the recent releases of Microsoft's Edge
and the chrome browser, so be sure you're using either Edge or Chrome
and it's a relatively recent release or it's been updated recently.
So first off i've already written the program that'll that we'll be using
today. There will be a link to this down below
the video so you can just go to the this program open it up and go ahead and
program it onto your micro:bit. So I'm going to go through those steps.
First I thought I'd show you basically how the program works.
So over here we have our simulated micro:bit. Since the program is using
accelerometer data, when I move over here I can tilt the
simulated micro:bit to kind of simulate the
accelerometer data. And it shows me the simulated values over here.
This program also uses the "A" and the "B" buttons.
So the "A" button will be used to show the name of your micro:bit.
So in the simulator the name of the simulated micro:bit is b644.
So anytime i press the A button it'll scroll down across the screen.
If you're working in a room or an area with a lot of people
trying to do this sort of experiment at the same time, you'll need to be sure to
know the name of your specific micro:bit. We'll come back to that in just a second.
Notice that down here there are a couple of buttons "Show Console Simulator"
and "Show Console Device" you'll probably only have the "Show Console Simulator"
initially. Basically this allows us to simulate what we're going to be doing
with our actual micro:bits in just a second.
So I'm going to go ahead and click on this and it will show the data coming
from my simulated micro:bit. Notice as i interact with this
the data down here changes and what's being shown in this graph changes as
well. So remember the "A" button shows us the
name of the micro bit the "B" button will toggle the style of the
graph. So currently it's showing all three axes of data on a single graph.
If i click on this it'll split it up. It'll stop using this merged graph
and start using three separate graphs, one for the X, one for the Y, and one for
the Z. Okay, so right now I'm viewing data from
the simulator. We want to view data from a real micro:bit,
so i'm going to go back to my program. I'm going to go ahead and...(notice now
that's showing just the "Simulator" button) I'm going to go ahead and pair to my
device, so my micro bit is going to be plugged
into my computer. So plug it in with the USB cable.
Um... oh, just showed up. I just plugged it in. I'm going to go ahead and connect to
it. And now I'm going to click on the
download button and if I watch the little yellow light on the back of the
micro:bit while I click that button, I'll see that it's flashing sending the code
over. At this point this code has been sent
over to my micro:bit. Again if you're working with multiple
people this is the point where you'd want to push the "A" button and see the
name of your micro:bit scroll across the screen.
My micro:bit's name begins with a "Z"; it's "zev..".
Okay, so now we need to be able to collect data
wirelessly from the micro:bit. I'm going to first off 1) go up to the gear icon in
the upper right; 2)go down to the about button, and 3)it'll
pop up this little window with details about the the simulator. Here i'm going
to click on "Experiments" and we want to make sure that "Bluetooth
Console" is "Enabled". So that'll basically allow us to collect data from the micro:bit in that little console window that we
just saw from the simulated micro:bit. So make sure this is "Enabled". By the way, this setting depends on the browser and specific
computer you're on, so it's kind of a browser-based setting.
If you use a different computer you'll have to double check and make sure this
is enabled. If you log out of your computer and someone else logs in,
they'll be working with their browser settings and they'll need to check this.
So if you're not seeing if in just a minute you're unable to collect data
double check this setting. Since I see that it's "Enabled", I'm going to go back
to my simulator. I'm now going to click on the gear icon
again and click on "Pair Bluetooth".
At this point my browser will pop up a little window
that shows me the available bluetooth devices to connect to. So it will show me all the bluetooth
micro:bits available for me to connect to. There's my device, the one that begins
with the "zev...", but if we were in a room with other people
doing the same experiment, different micro:bits would show up here
and you'd want to be sure to select your micro:bit,
which you can determine from the name of the micro bit by using the "A" button.
So I'm going to go ahead and click the pair button. After I do that notice that
a second button is popped up that shows "Show Console Device". So the top button
will show us the behavior and data from the simulated micro:bit
the bottom button will show us the data from the actual physical device or
real micro:bit. So I'm going to go ahead and click on that and we can see data
streaming in. And I'm going to pick up and move my micro bit and we can see
that the graph is changing as I interact with the micro:bit.
Okay and that's really all there is to streaming data wirelessly to the micro:bit. I'm going to go ahead and click the "B" button here
and we'll see all the data now separated out into three distinct graphs for the X,
Y, and Z axis. I'm going to go ahead and pause
this. And if I wanted to interact with this
this collected data I could hit the little download button here, which would
export the data into a file format called a CSV file.
So CSV stands for comma separated values, although in this case they're not truly
separated by commas. You just get a file that's in nice distinct columns.
You can import it into either Google Sheets or Excel
okay