This Experiment Requires:
- BBC micro:bit. x 1
- Terminal connector. x 1
- Low Inertia Solar DC Mini Motor. x 1
- 2.2kΩ Resistor. x 2
- Fan blade. x 1
- M/F Jumper Wires (if using the Prototyping System ). x 2
- M/M Jumper Wires (if using the Prototyping System ). x 1
- Crocodile Leads (if not using the Prototyping System ). x 5
The Aims Of This Experiment Are:
- To generate a voltage by blowing on a fan blade to spin a motor.
- To measure this voltage by using an analog input pin on the BBC micro:bit.
Experiment 7 Video Walk Through:
Experiment 7 Wind Power:
Wind turbines convert the kinetic energy of air into electrical power. In this experiment, the motor and fan are used in reverse to generate a voltage which can be measured and displayed by the BBC micro:bit.Create The Following MakeCode Editor JavaScript:
Below is an example of how to write the code for the experiment in JavaScript. If you're having difficulty producing your own code for this experiment, we've created the code for you, you can find links to the code towards the end of this article.Building This Circuit On The Prototyping System:
It is possible to build this circuit using the Prototyping System for the BBC micro:bit and the components listed at the top of the page, you can follow the diagram below.Building This Circuit With Crocodile Leads:
If you don't have the Kitronik Inventors Kit for the BBC micro:bit or the Prototyping System you can still build this circuit using the circuit diagram for reference and Crocodile Leads to join the components together. You can see an example of this in the picture below.Circuit Diagram:
What Will Happen:
Once the code is uploaded to the BBC micro:bit press button A and it should display a low number in the range of 1 - 5. This is the voltage read from P0. The reason it does not display 0 in this configuration is that P0 is very sensitive so will likely pick up some small voltage. Try blowing gently on the fan until it just begins to spin then press the A button again. This time it should display a reading of between 200 - 300. Finally try taking a deep breath and blowing hard on the fan, this should give a reading of close to 1000!What's Going On (How Does It work)?:
When electrical current passes through a wire inside the magnetic field it produces torque (turning force) that turns a motor. The opposite is also true if torque is applied to a motor, a current is generated. The torque is supplied by blowing the fan. Although the current generated by blowing on the fan is very small, the voltage can reach 8V, R1 and R2 together form a potential divider which halves the voltage from the motor keeping it mostly in the measurable range. This halved voltage is read by the BBC micro:bit and converted into a number between 0 and 1023. This value is then compared to the value currently stored in the variable 'Highest'. If this value is higher than the currently stored value then it replaces the old value. When button A is pressed the highest recorded value is scrolled on the screen. Resetting the BBC micro:bit by using its reset button will clear this value.Code Downloads:
The code examples below have been individually zipped and can be downloaded by clicking on your preferred option. Once unzipped you can either open the and edit the code in the appropriate editor or place the HEX file onto your microbit*.MakeCode Editor & Python Code Downloads:
- This code was created with the MakeCode Editor, download the HEX file here.
- This code was created with the Python Editor, download the HEX file here.
Legacy Editors Code Downloads:
NOTE: The legacy editors will disappear at some undisclosed point in the future. The code can still be placed on a microbit and will run regardless but you won't be able to use an editor. When that happens, switch to using one of the currently supported editors. We've already made the switch as the new editors are better and more fully-featured.- This code was created with the Touch Develop Editor, download the HEX file here.
Booklet Errata:
Kitronik Inventors Kit Resources:
Exp No#. | Experiment Name. | Resource Type. |
---|---|---|
1 | Say Hello to the BBC micro:bit. | Further Help. |
2 Pre V1.7 | Using an LDR and analog inputs. | Full Experiment + Further Help. |
2 V1.7 | Using a Light Sensor & analog inputs. | Full Experiment + Further Help. |
3 | Dimming an LED using a potentiometer. | Further Help. |
4 | Using a transistor to drive a motor. | Full Experiment + Further Help. |
5 | Using the accelerometer to control motor speed. | Further Help. |
6 | Setting the tone with a piezo buzzer. | Further Help. |
7 | Wind Power. | Full Experiment + Further Help. |
8 | Making a game using the compass. | Further Help. |
9 | Capacitor charge circuit. | Further Help. |
10 | Using an RGB LED. | Further Help. |
11 | Making a pedestrian crossing. | Full Experiment + Further Help. |
12 | Making a random dice. | Full Experiment + Further Help. |
©Kitronik Ltd – You may print this page & link to it, but must not copy the page or part thereof without Kitronik's prior written consent.
6 comments
Mark Donnison
Hi Rhys, I've checked it over and there was a missing line of code in the loop. Sorry about that! The download should now feature code that works. Thanks for the feedback and sorry for any inconvenience that this may have caused.
Rhys
Hello, I am trying to get this experiment to work using the microbit inventor kit, however the downloaded java for makecode does not seem to be working. The initial A button gives a reading of 0, but nothing changes after blowing the fan and pressing A for a second time.Please HELP?!
Mark Donnison
Hi Tony, The explanations were written when the previous editors were the editors of choice and there was only one version of the code for each. We have now updated the code with further options, including Python for Experiments 1 – 10. If you download the code you can import it into the MU Editor using the “Load” button. This will open the code in the Editor, allowing you to see what's going on under the hood. You can compare the code in the book to the code you have in MU to see the differences.
Tony Goodhew
I gave up on the Touch Develop Editor and switched to Python. Where is the python listing as you cannot learn anything about coding from the .hex file, only run it? I've been using Mu as the REPL greatly helps those new to Python and you do not need an internet connection.
Mark Donnison
Hi Jonathan, Thank you for reading. We haven't looked into this yet but I now have it on my list of possible projects, as a kinder egg eather station is quite appealing. Thanks again and keep half an eye out, just in case.
Jonathan
Hello, Thanks for putting these experiments online. Have you turned this into an anemometer, either with the current small fan, or with some egg cup like objects (thinking half of a kinder egg)? Do you have specs for the motor to work out a calibration from the output voltage and size of fan? Thanks, Jonathan