Christmas Information: Kitronik will be closing 24th Dec December 2024, reopening on 2nd of January 2025. See our delivery schedule for more information.

Inventors Kit Experiment 7 Full Experiment
In this tutorial you will find Experiment 7 Wind Power from the Kitronik Inventors Kit for the BBC microbit. We've included the entire experiment as a free example of the great practical experiments that are contained within the Inventors Kit. Learn how to build the circuit and how to code the BBC micro:bit to control the circuit.

Experiment 7 Wind Power

You can complete this experiment with or without the Inventors Kit. If you do not have the Kitronik Inventors Kit you will have to source all of the required components separately, a full list of the things you will need can be found below.  

This Experiment Requires:

 

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. inventors-kit-experinment-7-code-1000If 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. experiment-7-windpower-breadboard-870

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. experiment-7-windpower-crocodile-870

Circuit Diagram:

experiment-7-windpower-circuit-870

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:

 

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. * - To place the unzipped HEX file onto your microbit, connect your microbit to your computer via USB and then open File Explorer (Windows). Your microbit should show up as a removable drive. Simply drag and drop your HEX file onto the microbit in file explorer and the file will be transferred. The power light on the back of the microbit will start to flash, once the flashing stops the microbit is ready to run your code.  

Booklet Errata:

The current version of the BBC micro:bit booklet is 1.3. If you have version 1.1 then please see below for corrections made to the current version. inventors-kit-experiment-3-errata The current version of the BBC micro:bit booklet is 1.3. If you have version 1.1 then please see below for corrections made to the current version. On page 43, the plus and minus signs on the motor on the circuit diagram are the wrong way round.
   

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.

Project shopping list

For this project you will need the following items, you can adjust the quantities (including setting them to zero if you don't need the item), before pressing the "Buy all items" button.

Kitronik Inventor's Kit for the BBC micro:bit
£21.00
Qty
BBC micro:bit Starter Kit
£12.85
Qty

6 comments

Mark Donnison

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

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

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

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

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

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

Leave a comment

All comments are moderated before being published