Rev 1a.
TABLE OF CONTENTS Parts ..........................................................................................................................3 Making the Projects...................................................................................................4 Getting Started...........................................................................................................6 Project 1. Lighthouse................................................................................................
PARTS micro:bit, AA battery and USB lead are NOT included in this kit. Before you do anything else, check that your kit includes the following items: To make use of this kit, you will also need a BBC micro:bit VERSION 2. This kit is designed for Version 2 of the micro:bit. If the micro:bit logo is gold, and there are indents on alligator clip holes, then it is version 2. Otherwise it's version 1.
MAKING THE PROJECTS Software Before connecting boards to your micro:bit install the program for the project onto the micro:bit. This makes sure that pins are correctly configured as inputs and outputs before you connect up the electronics. This code for this kit uses the Makecode blocks editor. As well as programming by plugging together blocks, you can also view and edit the resulting code as Python or Javascript.
Building a Project The micro:bit and the MonkMakes boards are pretty robust when it comes to connecting things up the wrong way around, but it's a good idea to unplug your micro:bit from your computer while you are wiring things up. Then check it over carefully before connecting your micro:bit to your computer. Each project includes a wiring diagram, like the one below. This shows you what needs to be connected to what. It suggests the colors of lead to be used for each connection.
GETTING STARTED To get you started with your kit, please follow the steps below. This does not use any of the MonkMakes add-on boards, so for now you don't need the alligator clips. If you have already used your micro:bit for other things, you can probably skip this section. Step 1. Plug your micro:bit into your computer. Connect your micro:bit to a free USB port on your computer.
Now, click on the Edit Code button (top right) to open the program in the Blocks editor as shown below. Step 3. Install the Program Next, you are going to send the welcome program to the micro:bit. The easiest way to do that is to pair your micro:bit to your computer. This will only work in the Google Chrome browser. To pair your micro:bit, connect it to your computer and then click on the three dots next to the Download button and then select the option Connect device.
Click on whatever your micro:bit is called in the list that appears (something like BBC micro:bit CMSIS-DAP) and then click Connect. From now on, all you have to do to to put a new program onto your micro:bit is to click on the big Download button in the editor. Now click on that Download button to install the Welcome program. Once you click on the Download button, a yellow LED on the back of your micro:bit will start to flicker furiously as the program is flashed onto the micro:bit.
PROJECT 1. LIGHTHOUSE You will need: • • • • • micro:bit MonkMakes Relay for micro:bit MonkMakes 1V Bulb Single AA battery holder and battery Program: P1 Lighthouse Flash the program P1 Light House onto your micro:bit from the following address: https://makecode.microbit.org/_ft57YJYd7Ky5 Then connect the Relay, battery and light-bulb as shown to the right. This project will make the light bulb blink on and off.
PROJECT 2. MOVEMENT ALARM You will need: • • • micro:bit MonkMakes RGB LED for micro:bit Program: P2 Movement Alarm Flash the program P2 Movement Alarm onto your micro:bit from the following address: https://makecode.microbit.org/_4Ej08FdLFfku Then connect the RGB LED as shown to the right. Try moving your micro:bit. As soon as you do, you should hear a tune start to play to indicate that the alarm has been triggered and the RGB LED color will change from Green to Red.
The forever loop repeatedly reads the accelerometer strength and if it exceeds the baseline reading by 50, the alarm is sounded. The functions red and green set the RGB LED color to red or green, by writing a 1 or a 0 to the appropriate pins controlling the RGB LED red and green channels. Try tweaking the number 50 in the if block, to alter how sensitive the alarm is.
PROJECT 3. COLOR MIXER You will need: • • • micro:bit MonkMakes RGB LED for micro:bit Program: P3 Color Mixer This project uses the same connections as Project 2, plus one extra wire from Pin 2 of the micro:bit to Blue on the RGB LED. So, if you have just done Project 2, you just need to add the extra wire. This extra wire is needed because Project 2 only used the red and green channels of the RGB LED, whereas this project uses the red, green and blue.
LED color, so it will be dim. The more time the pulse is high, the more power is delivered to the LED color and the brighter it will be. The accelerometer measures forces acting on the micro:bit in the x, y and z dimensions. Because gravity is acting on the micro:bit then if the micro:bit is completely flat, then the there will be the gravitational force on the Z dimension (up/down) but no forces in the X (left/right) or Y (front/back).
PROJECT 4. ANEMOMETER The program for this project is here: https://makecode.microbit.org/_5KA4KjFhE6z4 Blow hard on the fan blade so that they rotate and you should see the micro:bit's display lighting up more, the harder you blow. You can also see a graph of the air speed by clicking on the Show console Device button. This button only appears if you have paired your micro:bit with your computer (see Page 7).
Each set of peeks corresponds to a strong blow onto the fan blade. You could use this to measure the maximum speed to see who can blow the hardest. How it Works D.C. Motors like the one in this kit, can act as both motors and generators. They are not very efficient and only generate a small amount of power. The voltage that the motor generates will be higher, the faster the fan blades spin. The forever block uses analog read pin P0 to measure the voltage on pin 0.
PROJECT 5. FAN SPEED CONTROLLER You will need: • • • • • micro:bit MonkMakes Relay for micro:bit AA Battery holder and battery Motor with fan attached Program: P5 Fan Speed In this project you will use the motor again, but this time as a motor rather than a generator. Flash the program P5 Fan Speed onto your micro:bit from the web address below: https://makecode.microbit.org/_UeML9o6bTWhV Connect up the components as shown to the right.
• max_power – This is the maximum power, you can leave this as 1023 • power_step – This is the power range divided by 9 and will be the amount of power change that results from one step more of speed. • Speed – The speed from 0 (off) to 9 (maximum) The forever loop is used to continuously set the power level to match the speed. The case of the speed being 0 is treated as a special case, to set the power to 0, otherwise the motor may buzz without actually turning when the speed is 0.
PROJECT 6. CLAP CONTROLLED FAN You will need: • • • • • micro:bit MonkMakes Relay for micro:bit AA Battery holder and battery Motor with fan attached Program: P6 Clap Controlled Fan This project uses exactly the same wiring as Project 5, but uses the micro:bit 2's built-in microphone to toggle the motor on and off when a loud noise such as a clap is detected. Clap once to start the fan and then clap again to turn it off. Follow this link for the code for this project: https://makecode.microbit.
PROJECT 7. NIGHTLIGHT You will need: • • • • • micro:bit MonkMakes Relay for micro:bit AA Battery holder and battery MonkMakes LED Bulb Program: P7 Nightlight This project uses the micro:bit's built-in light sensor to measure the level of light and when it falls below a certain level, it activates the Relay and turns on the LED lamp. Hold your hand over the micro:bit's display to simulate it going dark. This should cause the LED lamp to turn on.
THE MAKECODE EDITOR One really nice feature of the Blocks editor is that the image of a micro:bit on the left of the screen is a virtual micro:bit that you can run your programs on before flashing them onto the micro:bit. You can press its buttons with your mouse, it will display things and if you used the GPIO pins as digital outputs, it will even highlight them when you write to them. You can also click on GPIO pins to simulate digital and analog inputs.
Now, when you use your mouse to click on button A in the virtual micro:bit it will scroll the message. You could also now try this on a real micro:bit. JavaScript and Python The Blocks editor is primarily for editing your programs as Blocks. But you can also use it to view or edit your programs in JavaScript or Python programming language if you prefer. To try this out, open the code for Project 7 (Nightlight). Here's the blocks view of the code.
You can if you like edit the code in this Python view and then switch back to the blocks view, and as long as your code is correct, the change you made in Python will appear in the blocks version. For example try changing 50 in the Python code to 40 and then switch back to the blocks view. You could if you prefer simply write all your code in the Python (or JavaScript) versions of the editor, and you can even drag blocks from the palette into your code where they will appear as Python code.
TROUBLESHOOTING Problem: I can't flash a program onto my micro:bit Solution: First check that the micro:bit's power LED is lit. If it isn't try a different USB port or USB lead. If the micro:bit is receiving power, but you can't see the micro:bit drive on your computer, then you may be using a 'power only' USB cable. Try a different cable. Problem: The LED isn't lit on the MonkMakes Relay for micro:bit even though I think it's connected correctly. Solution: This is normal.
WHAT NEXT? micro:bit Programming If you want to learn more about programming the micro:bit in Python, then you should consider buying Simon Monk's book 'Programming micro:bit: Getting Started with MicroPython', which is available from all major book sellers. For a micro:bit project book, take a look at micro:bit for Mad Scientists.Both books are available from Amazon and all good book stores. You can find out more about this and other books by Simon Monk (the designer of this kit) at: http://simonmonk.
MONKMAKES For more information on this kit, the product's home page is here: https://monkmakes.com/mb_kit_2 As well as this kit, MonkMakes makes all sorts of kits and gadgets to help with your micro:bit and Raspberry Pi projects. Find out more, as well as where to buy here: https://monkmakes.com you can also follow MonkMakes on Twitter @monkmakes.