... | ... | @@ -87,54 +87,59 @@ def capture_data(): |
|
|
If you don't remember how to flash code to your Micro::Bit, see the instructions [here](how-to-flash).
|
|
|
|
|
|
## Step 6: Programming!
|
|
|
1) Read through the links under the prerequisite skills section. This will enable you to understand the basics of the lab. You want to be able to answer the following questions:
|
|
|
1. Read through the links under the prerequisite skills section. This will enable you to understand the basics of the lab. You want to be able to answer the following questions:
|
|
|
* If someone sends a message over radio waves, who can access that message?
|
|
|
* What method do you use to send data over radio on a Micro::Bit?
|
|
|
* What method do you use to run a block of code every time data is received?
|
|
|
* How do you find the total acceleration from the x-acceleration, y-acceleration, and z-acceleration?
|
|
|
|
|
|
* If someone sends a message over radio waves, who can access that message?
|
|
|
* What method do you use to send data over radio on a Micro::Bit?
|
|
|
* What method do you use to run a block of code every time data is received?
|
|
|
* How do you find the total acceleration from the x-acceleration, y-acceleration, and z-acceleration?
|
|
|
2. Complete the base code. You will program the LED's to provide feedback as to what is happening with the fitTracker. You will also grab the acceleration from the Micro::Bit to send over the radio. Follow the comments in the code as well
|
|
|
* Get the Micro::Bit's x, y, and z acceleration values
|
|
|
* Send the acceleration values over the radio to the receiver
|
|
|
* Display a happy face when ready to start measuring data
|
|
|
* Display a heart when measuring data
|
|
|
* Dispaly a check mark when finished measuring data
|
|
|
|
|
|
3) Follow the instructions in the Python or Javascript fitTrack_base file to complete the program
|
|
|
### Run The Program
|
|
|
1. Flash your code base! If you don't remember how to flash code to your Micro::Bit, see the instructions [here](how-to-flash).
|
|
|
1. Find a partner that programmed their Micro::Bit in the same language as you (so if you used JavaScript, find someone who also used JavaScript).
|
|
|
|
|
|
4) Find a partner that programmed their Micro::Bit in the same language as you (so if you used JavaScript, find someone who also used JavaScript).
|
|
|
2. Begin by choosing who will be the tracker and who will be the hacker. The tracker will be the user of a fitness tracker. They will use their Micro::Bit to collect data about their movements. The other partner, the hacker, will obtain their data.
|
|
|
|
|
|
5) Begin by choosing who will be the tracker and who will be the hacker. The tracker will be the user of a fitness tracker. They will use their Micro::Bit to collect data about their movements. The other partner, the hacker, will obtain their data.
|
|
|
3. Load your code onto your Micro::Bits. A check mark will appear to show the Micro::Bits are ready.
|
|
|
|
|
|
6) Load your code onto your Micro::Bits. A check mark will appear to show the Micro::Bits are ready.
|
|
|
|
|
|
7) Run the program and analyze the data. The instructions below will explain how to graph the data. From the graph, the hacker should make a guess about the activities that the tracker was doing (walking, running, jumping, and so on).
|
|
|
4. Run the program and analyze the data. The instructions below will explain how to graph the data. From the graph, the hacker should make a guess about the activities that the tracker was doing (walking, running, jumping, and so on).
|
|
|
|
|
|
* Double click on serial_reader.py in the code directory (recommended) or use the chrome extension: [here](https://chrome.google.com/webstore/detail/serial-monitor/ohncdkkhephpakbbecnkclhjkmbjnmlo?hl=en).
|
|
|
|
|
|
* If you are using the chrome extension, launch the application and select the appropriate COM port (if you only have one device plugged in there will only be one option). Select a Baud Rate of 115200 and click on connect.
|
|
|
* Double click on serial_reader.py in the code directory (recommended) or use the chrome extension: [here](https://chrome.google.com/webstore/detail/serial-monitor/ohncdkkhephpakbbecnkclhjkmbjnmlo?hl=en).
|
|
|
|
|
|
* To start gathering data, hit the A button on the fitness tracker and a heart will appear.
|
|
|
* If you are using the chrome extension, launch the application and select the appropriate COM port (if you only have one device plugged in there will only be one option). Select a Baud Rate of 115200 and click on connect.
|
|
|
|
|
|
* To stop gathering data, hit the B button on the fitness tracker and the check mark will reappear.
|
|
|
* To start gathering data, hit the A button on the fitness tracker and a heart will appear.
|
|
|
|
|
|
* When you are done sending data, hit the A and B buttons at the same time to finish and a happy face will appear.
|
|
|
* To stop gathering data, hit the B button on the fitness tracker and the check mark will reappear.
|
|
|
|
|
|
* If you used serial_reader.py, a graph of the data will automatically plot. If you used the chrome extension, continue to step 8.
|
|
|
* When you are done sending data, hit the A and B buttons at the same time to finish and a happy face will appear.
|
|
|
|
|
|
* Copy and paste the data from chrome to Excel or Google Spreadsheets (select comma-separated when you paste the numbers).
|
|
|
* If you used serial_reader.py, a graph of the data will automatically plot. If you used the chrome extension, continue to step 8.
|
|
|
|
|
|
* Obtain the total acceleration for each row. This is calculated by squaring each value and taking the square root of the sum. In other words, in cell D1, paste this:
|
|
|
* Copy and paste the data from chrome to Excel or Google Spreadsheets (select comma-separated when you paste the numbers).
|
|
|
|
|
|
```
|
|
|
=SQRT((A1)^2+(B1)^2+(C1)^2)
|
|
|
```
|
|
|
* Obtain the total acceleration for each row. This is calculated by squaring each value and taking the square root of the sum. In other words, in cell D1, paste this:
|
|
|
|
|
|
* Click on the bottom right corner of D1 and drag down to the bottom of your data. This will make the same calculation for each row.
|
|
|
```
|
|
|
=SQRT((A1)^2+(B1)^2+(C1)^2)
|
|
|
```
|
|
|
|
|
|
* To graph the data, highlight the D column and click on the graph button. Some adjustments can be made to make the data easier to read, but the default is simply the total acceleration, ideal for showing different activities.
|
|
|
* Click on the bottom right corner of D1 and drag down to the bottom of your data. This will make the same calculation for each row.
|
|
|
|
|
|
* To graph the data, highlight the D column and click on the graph button. Some adjustments can be made to make the data easier to read, but the default is simply the total acceleration, ideal for showing different activities.
|
|
|
|
|
|
8) Switch hacker and tracker roles and run again. After analyzing the data, have the new hacker make a guess about the activities of the new tracker.
|
|
|
|
|
|
9) Chat with your partner about the issues with wireless data transmission. What are some potential solutions to these problems? Can you think of a simple encryption solution that allows you to mask the data being sent? Can you reverse the encryption to use the data?
|
|
|
5. Switch hacker and tracker roles and run again. After analyzing the data, have the new hacker make a guess about the activities of the new tracker.
|
|
|
|
|
|
10) With your partner, employ a solution in your code. Run the experiment one last time and to see if your solution worked. What worked well in your solution? How could your solution be improved?
|
|
|
6. Chat with your partner about the issues with wireless data transmission. What are some potential solutions to these problems? Can you think of a simple encryption solution that allows you to mask the data being sent? Can you reverse the encryption to use the data?
|
|
|
|
|
|
7. With your partner, employ a solution in your code. Run the experiment one last time and to see if your solution worked. What worked well in your solution? How could your solution be improved?
|
|
|
|
|
|
## Step 7: Further Exploration
|
|
|
* Can you think of a way to track steps instead of acceleration? Maybe the fitness Tracker could also detect temperature? What else can be deduced from knowing someone's acceleration throughout the day? Spend some time exploring with your Micro::Bit and see what kind of improvements you can make. Try to steal data from other group's fitness Trackers.
|
... | ... | |