Centripetal Force Experiment With Micro:bit and Microsoft Excel

by Narongporn in Teachers > 9

5143 Views, 37 Favorites, 0 Comments

Centripetal Force Experiment With Micro:bit and Microsoft Excel

20220531_151023.jpg
20220531_151126.jpg

When I was asked to demonstrate computer use in science experiments for school, I gathered what I already had in my home and set up this experiment. The experiment is about centripetal and centrifuge forces. Spinning the ball on a string, playing Merry Go Round, or astronauts in the High-g training machine are related to centripetal and centrifuge forces. There are many resources that explain about these forces. I recommend Lectures by Walter Lewin about Circular Motion, Centripetal Forces, Perceived Gravity.

In my experiment, I applied micro-controller and sensors to measure rotation speed and acceleration in 3 dimensions and then sent the data to Microsoft Excel for further calculation and data visualization.

Supplies

20220530_152628.jpg
20220530_150313.jpg
20220530_150259.jpg
20220530_150246.jpg
20220530_154838.jpg
20220530_150324.jpg
20220530_130533.jpg
20220530_130902.jpg
8b9bd5cd8cd6024905e92ffe9e5c283f.jpg
20220530_131530.jpg
20220530_154926.jpg
  1. micro:bit x 2
  2. Hall-effect sensor KY-003 (sensor chip 3144 series)
  3. IObit V2.0 Expansion board or other board with 5V power supply
  4. USB Cable x 2
  5. 3 Female-Female jumper wire 20cm
  6. 2 x AA (AAA) battery case with connector
  7. Ikea Tokig, salad spinner
  8. Cable tie
  9. General-purpose double-sided adhesive tape
  10. Neodymium magnet 1-2 pieces
  11. Power Bank

Design an Experiment

Presentation1.jpg

To design this experiment, I need 2 sensors. The first sensor is an accelerometer sensor for measuring acceleration of the object while the second one is a sensor to measure rotation speed. I prefer to use micro:bit because it is small and already has the accelerometer sensor.

Besides, micro:bit also have other advantages as follows:

  • Writing code for micro:bit by using Makecode platform is easy.
  • Data can be wirelessly transferred from one micro:bit to others with Radio
  • micro:bit can stream live data to Microsoft Excel.

As a rotation mechanism, I choose Ikea Tokig (a salad spinner), which I already have in my kitchen. This salad spinner can rotate at the speed of 700 rpm. To start spinning, I rotate a knob on the lid then internal basket will start spinning.

I plan to use magnetic and Hall effect sensors to measure rotation speed. Place the neodymium magnet in the basket and install the Hall effect sensor on the outer bowl. Once the magnet (in the basket) rotates to face Hall effect sensor, sensor will output high pulse to micro:bit. The period between 2 pulses is the time basket rotate 1 revolution.

Since 1 micro:bit is placed inside the basket and spins continuously, I will need one more micro:bit at the outside to measure speed. The first micro:bit send acceleration data via Radio to the second micro:bit, then the second micro:bit will send rotation speed and acceleration data to Microsoft Excel for further calculation and data visualization.

Accelerometer Sensor in Micro:bit

microbit-drawing-back.jpg
acc1.png
setRange.png

On the backside of the micro:bit is a motion sensor chip that integrate accelerometer and magnetometer sensors into a single chip.

We will use the accelerometer sensor to measure acceleration along 3 axes (x, y, and z). The measurement unit is milli-g (where g = 9.8 m/s2). This sensor is set to measure up to 2g by default. You can use "set accelerometer range" to alter the measurement range to 8g.

Write the Code With Makecode Multi

multi.png
TX.png
RX.png

If you're working on a project that involves more than one micro:bit, I recommend Makecode Multi Editor as a tool to write the code. Makecode Multi Editor has 2 separated Makecode windows side by side. In this case, I will write program for the transmitter on the left side and receiver on the right side.

  1. Go to https://makecode.microbit.org/---multi#.
  2. On the left window, click New Project and name it "TX-centripetal".
  3. On the right window, click New Project and name it "RX-centripetal".

I have attached both codes here.

TX https://makecode.microbit.org/_R9vJxd2XMeeC

RX https://makecode.microbit.org/_5C3c3pRCKHRJ

Download and flash to your micro:bit.

Install Micro:bit to Salad Spinner

20220530_130533.jpg
20220530_130638.jpg
20220530_130713.jpg
20220530_131253.jpg
20220530_131305.jpg
20220530_131402.jpg
20220530_131436.jpg

After you have flashed TX-centripetal hex file to micro:bit, we are ready to install micro:bit to the salad spinner.

  1. Insert 2 AA (or AAA) into a battery case.
  2. Insert battery connector to the micro:bit.
  3. Firmly attach micro:bit to the basket using 2 cable ties.
  4. Attach battery case to the center of the basket with a double-side adhesive tap.

Connect Hall-effect Sensor to Micro:bit

20220530_150641.jpg
20220530_154811.jpg

Connecting hall-effect sensor to the micro:bit is easy.

  1. Connect S (signal) pin of the sensor to P1 of micro:bit.
  2. Connect + pin of the sensor to 5V pin on expansion board.
  3. Connect - pin of the sensor to GND pin on expansion board.
  4. Insert micro:bit into expansion slot.
  5. Supply power to expansion board with power bank via USB cable.

Install Magnet and Hall-Effect Sensor

20220531_151253.jpg
20220531_150741.jpg
20220531_150753.jpg

To measure rotational speed, I install many neodymium magnets to the basket and install Hall-effect sensor outside the basket so that they can detect the magnetic field. I recommend you using a magnet with diameter around 1cm, and you can stack them to 7-8mm so that the sensor can detect the magnetic field properly.

Try to spin the basket and check whether the sensor can detect the magnet. If the sensor can detect enough magnetic field LED on sensor board will light up. In my case, LED is dimmed until it can detect the magnetic field, LED is getting brighter.

Enable the Data Streamer Add-in

streamer1.png
streamer2.png
streamer3.png
streamer4.png
streamer5.png

What is Data Streamer?

Data Streamer is an add-in that enables Excel to receive data from a microcontroller in real time. We can connect microcontroller (such as Arduino or micro:bit) via USB cable, then stream live data to Excel for complicated computation and data visualization.

To use Data Streamer add-in, you first need to enable the add-in by following these steps:

  1. Click File menu.
  2. Click Options.
  3. When Excel Options dialog appears, click Add-Ins.
  4. Select COM Add-ins, then click Go.
  5. Select Microsoft Data Streamer for Excel in the COM add-Ins dialog, then click OK.
  6. You will see Data Streamer tab in the Excel ribbon.

Note

  1. Data Streamer is available for free to all Microsoft 365 subscribers.
  2. Data streamer is not supported by Excel for the Mac.

Install Windows Serial Driver

This step is for Windows7 only!

For Windows 8 or newer, Linux and macOS, skip this step. (serial ports work out of the box with these versions.)

  1. Download the Arm Mbed Windows serial port driver (Windows 7 only).
  2. Plug in your Arm Mbed device over USB. It mounts as an Mbed drive.
  3. Close all Explorer windows showing the Mbed drive.
  4. Run the installer. This may take some time or display a few "unsigned driver" warnings.

Note: this instruction is from https://os.mbed.com/docs/mbed-os/v6.15/program-setup/windows-serial-driver.html

Connect Micro:bit to Excel

connect0.png
connect.png
connect2.png
connect3.png
connect4.png
connect5.png
connect6.png
  1. Connect micro:bit (receiver side) to your computer via USB cable.
  2. Launch Microsoft Excel with new blank workbook.
  3. Click Data Streamer tab.
  4. Click Connect a Device.
  5. Select mbed Serial Port.
  6. Excel will create 4 new sheets: Data In, Data Out, Settings, and Manifest. Open the Settings sheet.
  7. Change workbook setting to following value (Data interval = 10ms, Data row = 100 or more, Data channels = 4 and Data orientation = Newest last.
  8. Open the "Manifest" sheet, then define each data channel's Name, Description, and Unit of Measure.
  9. Switch back to the Data in sheet. According to the Manifest sheet, you will notice that the channel name has been changed.
  10. Click Advanced.
  11. Open Settings tab.
  12. Set COM Port to following value (Data bits =8, Parity = None, Baud Rate = 11520, and Handshake = None) then click OK.

Visualize Data With Scatter Chart

chart1.png
chart2.png
chart3.png

To help you see the data more interestingly, I will use a scatter chart to show the relation between period of revolution and acceleration on 3 axes.

  1. Select data range to include channel name and all data rows.
  2. Click Insert menu, then select Scatter Chart.
  3. Re-position and scale the chart as you wish.

Start the Experiment

20220530_130738.jpg
data1.png

When you are ready to do the experiment

  1. Switch on the battery case to supply power to micro:bit in salad spinner.
  2. Turn-on expansion board by pressing switch to supply power to micro:bit and hall effect sensor in case you forget to turn-on then no 5V to hall effect sensor.
  3. On the Data Streamer ribbon, click “Connect Device” and “Start Data” to begin receiving data from the micro:bit
  4. Start rotating the spinner and see the result.
  5. Click “Stop Data” to stop receiving data from micro:bit and click “Reset Data” to clear all data.

Conclusion

chart4.png

After the experiment, I have to remove some outliers from the data. These outliers are caused by an error during data transfer via USB. You may notice some large numbers which are 2 numbers concatenate.

As you can see in the scatter chart,

  • X-axis is period of one revolution (millisecond) and Y-axis is acceleration (milli-g)
  • The grey dots represent acceleration on z axis (Az).
  • The negative measurement means that Az move away from the center
  • Az decreases when rotation speed is increased.
  • Az reaches sensor limit at -8g when rotation period is about 200ms or 5Hz or 300 rpm
  • The orange dots represent acceleration on Y axis (Ay).
  • During slow spinning, the sensor report Ay about 1g, which is acceleration caused by gravity
  • When spin faster, Ay decreases and reports -5g at 100ms, which is opposite to gravity.