Setup and procedure
Setup
- Plan and design the experiments.
- Use the radio and the MakeCode app for the data collection method.
- Plan and design data collection documents.
- Program the micro:bits.
- Experiment with different data collection scenarios.
- Report on the findings and observations in the experiments.
Code and Data Collection
This project will explore 2 different methods of data collection. The first uses a single micro:bit with the Windows 10 MakeCode app to record the data over a serial connection. The second uses the radio on the micro:bit in the nose cone to transmit the acceleration values back to another micro:bit connected to the computer to collect and record data using the Windows 10 MakeCode app.
Option 1: Windows 10 MakeCode app and a USB connection
The Windows 10 MakeCode app allows data to be directly read from the micro:bit when it is attached using USB cable. Data can be sent from the micro:bit to the Windows 10 MakeCode app using a serial data connection. The data collected over the serial connection can be graphed and the data can be downloaded. The data can be downloaded as a data.csv file. This allows the collection of data in real time. This file can be opened in a spreadsheet for further analysis. Many different kinds of experiments can be performed using this data logging technique.
Option 2: Remote collecting unit sending to receiving unit over radio
Two micro:bits can be used to collect and record data using the radio commands. One micro:bit can be setup remotely and the other micro:bit can be used to observe the data. The first micro:bit can send the data it observes to the second micro:bit for the observer to record. Setup 2 micro:bits so they can communicate over the radio they need to be on the same radio group. For additional information see the Data Collection lesson.
Use 2 micro:bits to collect the data on one and send it to another that is connect to the Windows 10 MakeCode app using a USB cable the experiment to collect and record data remotely. This allows the collection of acceleration data at a distance.
Coding the Radios Method
Sender micro:bit Code
The sender micro:bit uses the ||basic:on start||
event to set up the title on the micro:bit when started and the radio group.
- Code the first micro:bit using Windows 10 MakeCode app.
- Name the project, “Rocket Launch Sender”.
- The
||basic:on start||
event will display the title and function of the micro:bit in all caps, “ACCEL Z”. - Add comments to the
||basic:on start||
event: name of the project, creator, and date created. - Set up a radio group by giving it a number, or channel, to work on (group
10
is used in this example).
// Rocket Acceleration z sender
// by C Lyman
// May 2018
basic.showString("Z ACCEL SENDER")
radio.setGroup(10)
Inside the ||basic:forever||
loop, the acceleration of z
is recorded and sent as a number over the radio to the receiver micro:bit.
The ||radio:radio send number||
block is used to send the acceleration sensed in the z
direction. When the micro:bit is face up the z
direction is up and down. The x
direction is right and left. The y
direction is forward and backward. The number is sent to all micro:bits on the same channel or group.
// forever loop to read z acceleration
basic.forever(() => {
radio.sendNumber(input.acceleration(Dimension.Z))
})
Reciever micro:bit Code
This receiver micro:bit uses the ||basic:on start||
event to set up the title on the micro:bit when started, the radio group.
- Code the first micro:bit using Windows 10 MakeCode app for micro:bits.
- Name the project, “Rocket Launch Receiver”.
- The
||basic:on start||
event will display the title and function of the micro:bit in all caps, “ACCEL Z RECEIVER”. - Add comments to the
||basic:on start||
event: Name the project, creator, and date created. - Set up a radio group by giving it a number or channel to work on. (Group 10 is used in this example.)
- A
||serial:serial write line||
is used to send the text"Acceleration"
. This opens up the serial port in the Windows 10 MakeCode app so the purple Show Data Device button shows up below the simulator in the MakeCode app. Clicking this button allows the observation and downloading of the collected data.
basic.showString("ACCEL Z RECEIVER")
radio.setGroup(10)
serial.writeLine("Acceleration")
The ||radio:on received number||
event reads the number value from the sending micro:bit. The number is then stored in the variable receivedNumber
. The last line uses the serial write command to send the text "z"
label and the value of receivedNumber
variable back to the Windows 10 MakeCode app. The data is sampled and send from 10 to 20 times per second.
// onRadio receive & write z value to serial
radio.onReceivedNumber(function (receivedNumber) {
serial.writeValue("z", receivedNumber)
})
Data Analysis
Sample Graphed data in the Windows MakeCode app:
Download the data collected and observed using the purple download button. Sample data from the downloaded data.csv file:
Try graphing the data in different ways in the spreadsheet.
Rocket Launch Video
Watch the demostration rocket launch video.
Questions
- Can you observe relationships between the different forces of acceleration?
- Is there a difference between the
x
,y
, andz
acceleration forces measured by a micro:bit? - When is the strength of the signal stronger?
- What is micro gravity unit of measurement.
- In a spreadsheet, does graphing few seconds compared to several seconds give a different picture of what is happening?
Extensions
Monitoring Freefall
Set up the experiment to collect data when a micro:bit is drown several feet or meters.
Develop Other Hypotheses and Experiments
Research what acceleration on a skateboard at a skatepark or other types of movement as in a car. What about a ride at an amusement park?
radio
Adapted from “Rocket Acceleration z Radios“ by C Lyman |