Setup and procedure
Setup
- Plan and design the experiments.
- Connect the wires to the microbit with connections at pin 0 and the ground pin (GND). Pin 0 will detect any electrical current flowing between it and the ground. The human body is always sending out electrical current from the nervous system to the muscles.
- Coil the stripped ends of the copper wires and tape them to the skin in different areas of the body with the painters tape.
- Plan and design data collection documents.
- Program the micro:bits.
- Experiment with different data collections scenarios (this experiment could try several different areas of the body. It could also monitor the body sitting or during movements or exercise to observe any differences).
- Report on the findings and observations in the experiments.
Code and data collection
This project will use to microbits to collect and record data using the Windows 10 MakeCode app as described in the Data Collection lesson.
Option 2 — Microbit Windows 10 MakeCode app and a USB connection
The Windows 10 MakeCode app allows data to be directly read from the microbit when it is attached using USB cable. Data can be sent from the microbit to the Windows 10 MakeCode app using serial data connection. The data collected over the serial connection can be graphed and the data can be downloaded. A limit of only about the last 20 seconds of 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.
on Start event
- Code the first micro:bit using Windows 10 MakeCode app for micro:bit.
- Name the project, “Body Electricity Sender”.
- The
||basic:on start||
event will display the title and function of the micro:bit in all caps,"BODY ELECTRICAL"
. - Set up a variable
ekg
orbodyElectricity
and initialize its starting value to0
.
forever event
- Set the
ekg
orbodyElectricity
variable to get its value from the “analog read pin (0)”. This detects and electrical current that is sent through the body between the 2 taped wires connected to the body and the microbit. This is an analog reading that gets converted to a digital number between 0 - 1024. - The next line uses a
||basic:serial write value||
("EKG"
and the value stored in theekg
variable) to send the value back to the Windows 10 MakeCode app through the USB connection to the computer and micro:bit.
// Body Electricity
let ekg = 0
basic.showString("EKG")
// forever loop reading data on pin(0)
basic.forever(() => {
ekg = pins.analogReadPin(AnalogPin.P0)
serial.writeValue("EKG", ekg)
})
Analyze
Here’s a sample of some of the graphed data:
Download the data collected and observed using the purple Download button.
The same data from the "data.csv"
file might look like this in a spreadsheet:
Do some more meaurements:
- Try graphic the data in different ways in the spreadsheet.
- Try collecting data for another area on the body.
Option 3 — Remote radio collecting to receiving radio displaying
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. To set up 2 micro:bits so they can communicate over the radio they need to be on the same radio group. For additional information look at the Data Collection lesson.
By using 2 micro:bit to collect the data on one and send it to the second micro:bit which is connect to the Windows 10 MakeCode app using a USB cable the experiment can collect and record data remotely. This would allow the collection of body electrical data while a person is exercising or moving.
micro:bit radio sending code
This sender micro:bit uses the ||basic:on start||
event to set up the title on the micro:bit when started, the radio group, and the bodyElectricity
variable so it can collect and store the data received from the pin 0.
The ||basic:forever||
event read the electricity on pin 0 and stores it in the variable bodyElectricity
. It’s then sent over the radio to the receiver micro:bit.
// Body Electricity Project
basic.showString("EKG")
let bodyElectricty = 0
radio.setGroup(99)
// forever loop that collects body electricity and send it over the radio
basic.forever(() => {
bodyElectricty = pins.analogReadPin(AnalogPin.P0)
radio.sendNumber(bodyElectricty)
})
micro:bit radio receiving code
This receiver micro:bit uses the “on start” event to set up the title on the micro:bit when started, the radio group, and the bodyElectricity
variable to collect and store the data received.
The ||radio:on radio received||
event reads the number value sent from the sending micro:bit. The number is then stored in the bodyElectricity
variable. the electricity on pin 0 and stores it in the variable bodyElectricity
. The last line uses the serial write command to send the text "Body Electricity"
label and the value of bodyElectricity
variable back to the Windows 10 MakeCode app. The data is sampled and send from 10 to 20 times per second.
// Body Electricity Receiver
basic.showString("BODY ELEC")
let bodyElectricty = 0
radio.setGroup(99)
// Radio Receiver event
radio.onDataPacketReceived( ({ receivedNumber }) => {
bodyElectricty = receivedNumber
serial.writeValue("Body Electricty", bodyElectricty)
})
Questions
- Can you observe relationships with a heart rate? With breathing?
- Is there a difference when connected to muscle and skin with limited muscles underneath?
- When is the strength of the signal stronger?
- What is the relationship between the analog reading and the digital output?
- In a spreadsheet, does graphing few seconds compared to several seconds give a different picture of what is happening?
Extensions
Monitoring Exercise
Set up the experiment to collect data while someone is exercising.
Develop other hypotheses and experiments
Research what about EKG and other body electrical signals.
Adapted from “Body Electrical & Waves“ by C Lyman |
radio