background image

1

www.keyestudio.com

Smart Home Kit for Micro:bit

Contents

Smart Home Kit for Micro:bit

.....................................................................................

1

1.Introduction:

..............................................................................................................

3

2.Description:

................................................................................................................

4

3.Kit List:

.........................................................................................................................

5

4. Preparations:

.............................................................................................................

10

4.1 Background Information about Micro:bit

..............................................

10

( 1 )What is Micro:bit?

.................................................................................

10

( 2 )Layout

......................................................................................................

11

( 3 ) Pinout

......................................................................................................

13

( 4 )Notes for the application of Micro:bit main board

....................

14

4.2.Install Micro:bit driver

..................................................................................

16

5.Getting Started with Micro:bit

..............................................................................

16

5.1 Write code and program

............................................................................

17

5.2.Makecode:

....................................................................................................

28

5.3 Quick Download

............................................................................................

29

5.4.Makecode extension library:

......................................................................

37

5.4.Resources and test code

.............................................................................

46

5.5.Input test code

...............................................................................................

47

Summary of Contents for KS4028

Page 1: ...round Information about Micro bit 10 1 What is Micro bit 10 2 Layout 11 3 Pinout 13 4 Notes for the application of Micro bit main board 14 4 2 Install Micro bit driver 16 5 Getting Started with Micro...

Page 2: ...etection 128 Project 6 Geomagnetic Sensor 142 Project 7 Accelerometer 156 Project 8 Light Brightness Detection 167 Project 9 Speaker 176 Project 10 Touch sensitive Logo 189 Project 11 Microphone 193 P...

Page 3: ...t 13 Gas Leakage Detector 331 Project 14 DHT11 Temperature and Humidity Sensor 336 Project 15 Temperature and Humidity Display 347 Project 16 Multiple Functions 351 Project 17 BT controlled LED 354 Pr...

Page 4: ...sed on the open source hardware of Micro bit and designed for those who dream of living a more comfortable life with the help of technologies This smart home system with Micro bit as its control board...

Page 5: ...s the most widely used graphical programming environment on the micro bit official website It is based on the graphical programming environment developed by Microsoft s open source project MakeCode Th...

Page 6: ...eyestudio com 1 Micro bit Main Board 1 2 Keyestudio Micro bit Expansion Board with IO Port 1 3 Wooden Board 7 4 Acrylic Board 3 5 6812 RGB Module 1 6 Analog Gas Sensor 1 7 130 Motor Module 1 8 Steam S...

Page 7: ...Humidity Sensor 1 10 PIR Motion Sensor 1 11 Yellow LED Module 1 12 Rechargeable Lithium Battery Power Module with Solar and USB Ports 1 13 Battery Holder 1 14 Micro bit Solar Energy Panel 1 15 Servo 2...

Page 8: ...Wire 2 20 20cm F F DuPont Wire 4 21 20cm 4Pin F F DuPont Wire 1 22 200mm 2Pin DuPont Wire 2 23 M2 8MM Round head Screw 3 24 M1 4 6MM Round head Self tapping Screw 10 25 M3 Nickel plated Self locking N...

Page 9: ...ickel plated Nut 18 31 M3 Nickel plated Nut 6 32 M2 Nickel plated Nut 7 33 M3 8MM Round head Screw 2 34 Wrench 1 35 3 0 40MM Screwdriver Red Black 1 36 2 0 40MM Screwdriver Purple Black 1 37 M3 45MM D...

Page 10: ...he core device is a 32 bit Arm Cortex M4 with FPU micro processing Though it is just the size of a credit card the Micro bit main board is equipped with loads of components including a 5 5 LED dot mat...

Page 11: ...t also supports a variety of codes and graphical programming platforms and is compatible with almost all PCs and mobile devices It has no need to install drivers It is of high integration of electroni...

Page 12: ...ld it tight the red LED will slowly get darker When the power indicator flickers into darkness releasing the button and your Micro Bit board will enter sleep mode for power saving This will make the b...

Page 13: ...w keyestudio com https tech microbit org hardware https microbit org new microbit https www microbit org get started user guide overview https microbit org get started user guide features in depth 3 P...

Page 14: ...6 P7 P8 P9 P11 P12 P13 P14 P15 P16 P19 P20 Occupied P3 LED Col3 P4 LED Col1 P5 Button A P6 LED Col4 P7 LED Col2 P10 LED Col5 P11 Button B Browse the official website for more details https tech microb...

Page 15: ...to power the main board via the USB interface or via the battery of 3V The IO port of this board is 3V so it does not support sensors of 5V If you need to connect sensors of 5 V a Micro Bit expansion...

Page 16: ...t org code which has a graphical MakeCode program easy for use 4 2 Install Micro bit driver Micro bit is free of driver installation However in case your computer fail to recognize the main board you...

Page 17: ...is attached below https microbit org guide quick Step 1 connect the Micro Bit main board with your computer Firstly link the Micro Bit main board with your computer via the USB cable Macs PCs Chromebo...

Page 18: ...ed When your computer communicates with the main board via the USB cable the yellow LED on it will flashes For example it will flicker when you burn a hex file Then Micro bit main board will appear on...

Page 19: ...Create to edit If you are running Windows 10 system it is also viable to edit on the APP MakeCode for micro bit which is exactly like editing in the website And the link to the APP is https www micro...

Page 20: ...20 www keyestudio com...

Page 21: ...area and then run your program in Simulator of MakeCode editor as shown in the picture below which demonstrates how to edit heartbeat program The path to the demonstration video 2 Makecode Tutorial Ma...

Page 22: ...22 www keyestudio com Click the arrow behind JS JavaScript to choose between JavaScript or Python and you will find the corresponding program in JavaScript language or Python language as shown below...

Page 23: ...gram what you will have to do to download the program to your Micro Bit main board is merely clicking the Download button then all is done If you are writing program through the website following thes...

Page 24: ...le is downloaded copy it to your board just like the process that you copy the file to the USB driver If you are running Windows system you can also right click and select Send to MICROBIT E to copy t...

Page 25: ...25 www keyestudio com You can also directly drag the hex file onto the MICROBIT E disk...

Page 26: ...side of the board flashes When the copy is completed the yellow signal light will stop flashing and remain on Step 4 run the program After the program is uploaded to the Micro bit main board you coul...

Page 27: ...ve access to hexadecimal files hex and save no other files Step 5 about other programming languages This chapter has described how to use the Micro bit main board But except for the Makecode graphical...

Page 28: ...go 5 2 Makecode Browse https makecode microbit org and enter Makecode online editor or open the APP MakeCode for micro bit of Windows 10 Click New Project and input heartbeat then click create to ente...

Page 29: ...s once while forever implies that the code runs cyclically 5 3 Quick Download As mentioned before if your computer is Windows 10 and you have downloaded the APP MakeCode for micro bit to write program...

Page 30: ...for Linux macOS and Windows 10 the process can be quicker too We use the webUSB function of Chrome to allow the internet page to access the hardware device connected USB You could refer to the followi...

Page 31: ...31 www keyestudio com Click Next...

Page 32: ...32 www keyestudio com Click another Next...

Page 33: ...or selection please refer to https makecode microbit org device usb webusb troubleshoot And for updating the firmware of the Micro bit https microbit org guide firmware If the links are too troublesom...

Page 34: ...34 www keyestudio com in the folder we provided in the link https fs keyestudio com KS4027 4028 Click Done to finish the pairing...

Page 35: ...35 www keyestudio com...

Page 36: ...36 www keyestudio com Download program After the pairing click download to directly download the program to the board If it is successfully downloaded the icon will shift to...

Page 37: ...have made a makecode extension library for this smart home kit Add smart home extension library Please follow the following steps to add extension files Open Makecode to enter a certain project click...

Page 38: ...38 www keyestudio com Or click Advanced to select Extensions as shown below...

Page 39: ...39 www keyestudio com Input the link https github com keyestudio2019 ks_IoT to search Tap the searching result IoT_keyestudio to download and install it This process may take a few seconds...

Page 40: ...40 www keyestudio com After the installation you can find the extension files DHT11 DHT22 and I2C_LCD1602 on the left side And extension file Neopixel is also installed...

Page 41: ...41 www keyestudio com...

Page 42: ...42 www keyestudio com...

Page 43: ...roject Therefore when you create a new IoT_keyestudio project you will need to add these extension files again Update or delete the IoT_keyestudio extension files Please follow the following steps to...

Page 44: ...44 www keyestudio com Click the Explorer on the left side...

Page 45: ...eyestudio com You can find these added files in the list Click the dustbin icon beside the file to delete the corresponding file Tap the refresh icon to update the corresponding IoT_keyestudio extensi...

Page 46: ...urces and test code We also provide a link https fs keyestudio com KS4027 4028 containing the information of the product from relevant tools to test codes tutorials and troubleshooting methods as well...

Page 47: ...rag the code blocks to complete the program for each project For simple projects dragging a block of code to complete the program is recommended For complex projects it is recommended to conduct the p...

Page 48: ...48 www keyestudio com Click Import File...

Page 49: ...49 www keyestudio com Select Makecode Code Project 1_ Heart beat Project 1_ Heart beat hex Then click Go ahead...

Page 50: ...o importing the test code file provided into the Makecode compiler above you can also drag the the test code file provided into the code editing area of the Makecode compiler as shown in the figure be...

Page 51: ...ome Therefore digital signal or analog signal of sensors and modules cannot be shown on the serial port simulator However you need to read the corresponding digital signal or analog signal So what can...

Page 52: ...serial port Download CoolTerm program https freeware the meiers org After the download we need to install CoolTerm program file below is PC Window system taken as an example 1 Choose win to download t...

Page 53: ...www keyestudio com 3 Double click please make sure that the driver of Micro bit is installed and the main board is connected with the computer The functions of each button on the Toolbar are listed be...

Page 54: ...Open a saved Connection Save the current Connection to disk Open the Serial Connection Close the Serial Connection Clear the Received Data Open the Connection Options Dialog Display the Terminal Data...

Page 55: ...55 www keyestudio com 6 Install the Smart Home Part 1 Component s Needed...

Page 56: ...56 www keyestudio com Installation Diagram Prototype Part 2...

Page 57: ...57 www keyestudio com Component s Needed Installation Diagram...

Page 58: ...58 www keyestudio com Prototype Part 3 Component s Needed...

Page 59: ...59 www keyestudio com Installation Diagram...

Page 60: ...ing windows to 0 Wiring Connect the main board with the shield and with the computer via USB cable Plug them up Turn the slide switch on the board to the ON end and the rocker switch to the 1 end Micr...

Page 61: ...61 www keyestudio com Example code After uploading the example code to Micro bit the angle of the servo is set to 0 Part 4...

Page 62: ...62 www keyestudio com Component s Needed peel the sticker off the gear shaped Acrylic board first Installation Diagram...

Page 63: ...63 www keyestudio com Prototype Part 5 Component s Needed...

Page 64: ...64 www keyestudio com Installation Diagram Prototype...

Page 65: ...65 www keyestudio com Part 6 Component s Needed peel the sticker off the Acrylic board first...

Page 66: ...66 www keyestudio com Installation Diagram The gears of the N Board should be properly jointed with the wooden gear and do not fix the self locking nut tight after installation the door is closed...

Page 67: ...67 www keyestudio com Prototype Part 7...

Page 68: ...68 www keyestudio com Component s Needed Installation Diagram...

Page 69: ...69 www keyestudio com Prototype Part 8...

Page 70: ...70 www keyestudio com Component s Needed Installation Diagram...

Page 71: ...71 www keyestudio com Prototype Part 9 Component s Needed...

Page 72: ...72 www keyestudio com Installation Diagram Prototype Part 10...

Page 73: ...73 www keyestudio com Component s Needed...

Page 74: ...74 www keyestudio com Installation Diagram stick the solar panel along the right side of the line marked in the picture pull the wires on the panel out from the hole in the middle Prototype Part 11...

Page 75: ...75 www keyestudio com Component s Needed Installation Diagram...

Page 76: ...76 www keyestudio com Prototype Part 12 Component s Needed...

Page 77: ...77 www keyestudio com Installation Diagram Prototype Part 13...

Page 78: ...78 www keyestudio com Component s Needed Installation Diagram...

Page 79: ...79 www keyestudio com Prototype Part 14 Component s Needed...

Page 80: ...80 www keyestudio com Installation Diagram Prototype Part 15...

Page 81: ...81 www keyestudio com Component s Needed Installation Diagram...

Page 82: ...82 www keyestudio com Prototype Part 16 Component s Needed...

Page 83: ...83 www keyestudio com Installation Diagram Prototype Part 17...

Page 84: ...84 www keyestudio com Component Needed...

Page 85: ...85 www keyestudio com Installation Diagram Prototype...

Page 86: ...86 www keyestudio com Part 18 Component s Needed...

Page 87: ...87 www keyestudio com Installation Diagram Prototype Part 19...

Page 88: ...88 www keyestudio com Component s Needed peel the sticker off the Acrylic board first...

Page 89: ...89 www keyestudio com Installation Diagram...

Page 90: ...90 www keyestudio com Prototype Part 20 Component s Needed...

Page 91: ...91 www keyestudio com Installation Diagram...

Page 92: ...92 www keyestudio com Prototype Part 21...

Page 93: ...93 www keyestudio com Component s Needed...

Page 94: ...94 www keyestudio com Installation Diagram...

Page 95: ...95 www keyestudio com Prototype Start Wiring...

Page 96: ...96 www keyestudio com The wiring of the battery holder plug its jack to the BAT end of the rechargeabl e power module...

Page 97: ...97 www keyestudio com The wiring of the yellow LED The wiring of the RGB module...

Page 98: ...98 www keyestudio com The wiring of the PIR motion sensor The wiring of the 1602LCD...

Page 99: ...99 www keyestudio com The wiring of the analog gas sensor The wiring of the humidity and temperature sensor...

Page 100: ...100 www keyestudio com The wiring of the servo controlling the door The wiring of the servo controlling the window...

Page 101: ...101 www keyestudio com The wiring of the rechargeabl e lithium battery power module Connect the shield with it attach the red wire to V and the black one to G...

Page 102: ...102 www keyestudio com The wiring of the solar panel...

Page 103: ...103 www keyestudio com The wiring of the motor Please pay attention to the pins and the connection cannot be reversed...

Page 104: ...104 www keyestudio com The wiring of the steam sensor Connect it to the P0 of 3 3V or the analog value can not be read Mount the Roof...

Page 105: ...105 www keyestudio com Component s Needed Installation Diagram...

Page 106: ...106 www keyestudio com Prototype Installation Diagram...

Page 107: ...107 www keyestudio com Prototype...

Page 108: ...108 www keyestudio com Install Micro bit main board Prototype...

Page 109: ...micro bit main board a Micro USB cable and a computer The micro bit LED dot matrix will display a relatively big heart shaped pattern and then a smaller one This alternative change of this pattern is...

Page 110: ...our computer via the USB cable 4 Test Code The route to get test codes How to load File Type Path File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 1 Heart beat Pro...

Page 111: ...t org reference to find more information about micro bit blocks Then this link https makecode micro bit org can help you write code Command blocks can be found on the right Make combinations of these...

Page 112: ...keeping the connection with the computer to power the main board the LED dot matrix shows pattern and then alternatively Please refer to chapter 5 3 to know how to download test code quickly If the do...

Page 113: ...duction In this project we intend to control a certain LED of the micro bit main board to shine 2 Components Needed Micro bit main board 1 USB cable 1 3 Connection Diagram Attach the Micro bit main bo...

Page 114: ...this matrix as a coordinate system and create two aces by marking those in rows from 0 to 4 from top to bottom and the ones in columns from 0 to 4 from the left to the right Therefore the LED sat in...

Page 115: ...Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 2 Light A Single LED Project 2 Light A Single LED hex You can also drag blocks to form code Command blocks can be found on t...

Page 116: ...116 www keyestudio com Make combinations of these blocks...

Page 117: ...ications in LED advertisement screens elevator floor display bus stop announcement and so on The LED dot matrix of Micro Bit main board contains 25 LEDs in a grid Previously we have succeeded in contr...

Page 118: ...Components Needed Micro bit main board 1 USB cable 1 3 Connection Diagram Attach the Micro bit main board to your computer via the Micro USB cable 4 Test Code The route to get test codes How to load F...

Page 119: ...com Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 3 LED Dot Matrix Project 3 LED Dot Matrix hex You can also drag blocks to form code Command blocks can be found on the r...

Page 120: ...120 www keyestudio com Make combinations of these blocks...

Page 121: ...ows a downward arrow word Hello a heart pattern an arrow pointing at northeast then at southeast then at southwest and then at northwest Project 4 Programmable Buttons 1 Project Introduction Buttons c...

Page 122: ...grammable buttons can input three different signals We can press button A or B alone or press them together and the LED dot matrix shows A B and AB respectively Let s get started 2 Components Needed M...

Page 123: ...codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 4 Programmable Buttons Project 4 Code 1 hex You can also drag blocks to form co...

Page 124: ...ode to micro bit main board and powering the main board via the USB cable the 5 5 LED dot matrix shows A if button A is pressed and then released B if button B pressed and released and AB if button A...

Page 125: ...e Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 4 Programmable Buttons Project 4 Code 2 hex You can also drag blocks to form code Command blocks can be fo...

Page 126: ...126 www keyestudio com...

Page 127: ...127 www keyestudio com Make combinations of these blocks...

Page 128: ...duce Project 5 Temperature Detection 1 Project Introduction The Micro bit main board is not equipped with a temperature sensor but uses the temperature sensor built into NFR52833 chip for temperature...

Page 129: ...agram Attach the Micro bit main board to your computer via the USB cable 4 Test Code 1 The route to get test codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makeco...

Page 130: ...130 www keyestudio com You can also drag blocks to form code Command blocks can be found on the right as shown below...

Page 131: ...131 www keyestudio com...

Page 132: ...132 www keyestudio com Make combinations of these blocks...

Page 133: ...com 5 Test Result 1 After uploading test code 1 to micro bit main board powering the main board via the USB cable and clicking Show console Device the data of temperature shows in the serial monitor p...

Page 134: ...hen you touch the processor nNRF52833 on the board for a while its temperature will rise gradually and the CoolTerm serial monitor will show the change of temperature in the current environment as sho...

Page 135: ...l need to use the CoolTerm serial monitor software to read data You could open CoolTerm software click Options select SerialPort set COM port and put baud rate to 115200 after testing the baud rate of...

Page 136: ...136 www keyestudio com temperature in the current environment as shown in the figures below...

Page 137: ...137 www keyestudio com...

Page 138: ...138 www keyestudio com...

Page 139: ...studio com 6 Test Code 2 The route to get test codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 5 Temperature Detection Project 5...

Page 140: ...140 www keyestudio com You can also drag blocks to form code Command blocks can be found on the right as shown below...

Page 141: ...141 www keyestudio com Make combinations of these blocks Please note that the value 35 in the statement below can be changed according to real situation...

Page 142: ...e is equivalent to or greater than 35 the pattern appears Project 6 Geomagnetic Sensor 1 Project Introduction This project aims to explain the use of the Micro bit geomagnetic sensor which can not onl...

Page 143: ...will be checked The main component of a common compass is a magnetic needle which can be rotated by the geomagnetic field and point toward the geomagnetic North Pole which is near the geographic Sout...

Page 144: ...B cable 1 3 Connection Diagram Attach the Micro bit main board to your computer via the USB cable 4 Test Code 1 The route to get test codes How to load File Type Route File Name Hex file KS4027 folder...

Page 145: ...145 www keyestudio com Code Project Code Project 6 Geomagnetic Sensor You can also drag blocks to form code Command blocks can be found on the right as shown below...

Page 146: ...em will make an automatic requirement if it is used for the first time 5 Test Result1 After uploading Test Code 1 to micro bit main board and powering the board via the USB cable and pressing the butt...

Page 147: ...n process is completed pressing the button A will make the magnetometer reading display directly on the screen And the direction north east south and west correspond to 0 90 180 and 270 respectively 6...

Page 148: ...estudio com file Tutorial Makecode Tutorial Project Code Project 6 Geomagnetic Sensor Code 2 hex This module can keep reading data to determine direction so does point to the current magnetic North Po...

Page 149: ...er right when the value ranges from 292 5 to 337 5 Because 0 5 can t be input in the code the values we get are 293 and 338 Then add other statements to make a set of complete code You can also drag b...

Page 150: ...150 www keyestudio com...

Page 151: ...151 www keyestudio com...

Page 152: ...152 www keyestudio com Make combinations of these blocks...

Page 153: ...153 www keyestudio com...

Page 154: ...154 www keyestudio com...

Page 155: ...155 www keyestudio com 7 Test Result 2 Upload code 2 and plug micro bit into power After calibration tilt micro bit board and the LED dot matrix displays the direction signs...

Page 156: ...with a resolution of 8 10 12 bits The code section sets the range to 1g 2g 4g and 8g We often use accelerometer to detect the status of machines In this project we will introduce how to measure the po...

Page 157: ...e USB cable 4 Test Code 1 The route to get test codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 7 Accelerometer Project 7 Code 1...

Page 158: ...158 www keyestudio com Make combinations of these blocks 5 Test Result 1...

Page 159: ...Micro Bit main board no matter at any direction the LED dot matrix displays the digit 1 When it is kept upright make its logo above the LED dot matrix the number 2 shows When it is kept upside down m...

Page 160: ...rd is tilted to the left the LED dot matrix shows the number 6 as shown below When the board is tilted to the right the LED dot matrix displays the number 7 as shown below When the board is knocked to...

Page 161: ...s function you can also set the acceleration to 3g 6g or 8g But still we do not recommend 6 Test Code 2 The route to get test codes How to load File Type Route File Name Hex file KS4027 folder Makecod...

Page 162: ...162 www keyestudio com Command blocks...

Page 163: ...163 www keyestudio com Make combinations of these blocks...

Page 164: ...164 www keyestudio com 7 Test Result 2 Upload test code to micro bit main board power the main board via the USB cable and click Show console Device...

Page 165: ...hardware schematic diagram of the Micro Bit main board the accelerometer coordinate of the Micro Bit are shown in the figure below The following interface shows the decomposition value of acceleration...

Page 166: ...u ll need to use the CoolTerm serial monitor software to read data You could open CoolTerm software click Options select SerialPort set COM port and put baud rate to 115200 after testing the baud rate...

Page 167: ...167 www keyestudio com Project 8 Light Brightness Detection...

Page 168: ...ion In this project we focus on the light detection function of the Micro Bit main board V2 It is achieved by the LED dot matrix And it can be viewed as a photosensor 2 Components Needed Micro bit mai...

Page 169: ...e route to get test codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 8 Light Brightness Detection Project 8 Light Brightness Dete...

Page 170: ...170 www keyestudio com...

Page 171: ...171 www keyestudio com Make combinations of these blocks...

Page 172: ...172 www keyestudio com 5 Test Result Upload the test code to micro bit main board power the board via the USB cable and click Show console Device...

Page 173: ...dio com When the LED dot matrix is covered by hand the light intensity showed is approximately 0 when the LED dot matrix is exposed to light the light intensity displayed gets stronger with the light...

Page 174: ...If the current light level is less than or equal to 20 the icon moon will appear on the LED dot matrix If it s bigger than 20 the sun will appear If you re running Windows 7 or 8 instead of Windows 1...

Page 175: ...oftware click Options select SerialPort set COM port and baud rate to 115200 after testing the baud rate of USB SerialPort communication on Micro Bit main board is 115200 click OK and Connect The Cool...

Page 176: ...grams easier With a speaker all Micro bit board can be used to create sound related projects But the new version that s the version 2 is able to make the speaker utter giggles greetings and yawning an...

Page 177: ...via the USB cable 4 Test Code 1 The route to get test codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 9 Speaker Project 9 Code...

Page 178: ...178 www keyestudio com Make combinations of these blocks...

Page 179: ...esult 1 After uploading the Test Code 1 to micro bit main board and powering the board via the USB cable the speaker utters sound and the LED dot matrix shows the logo of music 6 Test Code 2 The route...

Page 180: ...le Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 9 Speaker Project 9 Code 2 hex You can also drag blocks to form code Command blocks can be found on...

Page 181: ...181 www keyestudio com Make combinations of these blocks...

Page 182: ...182 www keyestudio com...

Page 183: ...183 www keyestudio com...

Page 184: ...184 www keyestudio com...

Page 185: ...185 www keyestudio com...

Page 186: ...186 www keyestudio com...

Page 187: ...187 www keyestudio com The musical score of Ode to Joy is attached below...

Page 188: ...otations via this link https en wikipedia org wiki Numbered_musical_notation 7 Test Result 2 After uploading the Test Code 2 to micro bit main board and powering the board via the USB cable the speake...

Page 189: ...onent and function like an extra button It contains a capacitive touch sensor that senses small changes in the electric field when pressed or touched just like your phone or tablet screen do When you...

Page 190: ...w to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 10 Touch sensitive Logo Project 10 Touch sensitive Logo hex You can also drag blocks to...

Page 191: ...191 www keyestudio com...

Page 192: ...192 www keyestudio com Make combinations of these blocks...

Page 193: ...powering the board via the USB cable the LED dot matrix exhibits the heart pattern when the touch sensitive logo is pressed or touched and displays digit when the logo is released The longer it is pr...

Page 194: ...sity of sound you can make a noise scale or disco lighting changing with music The microphone is placed on the opposite side of the microphone LED indicator and in proximity with holes that lets sound...

Page 195: ...load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 11 Microphone Project 11 Code 1 hex You can also drag blocks to form code Command blocks can...

Page 196: ...splays pattern when you clap and pattern when it is quiet around 6 Test Code 2 The route to get test codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code...

Page 197: ...197 www keyestudio com...

Page 198: ...198 www keyestudio com Make combinations of these blocks...

Page 199: ...199 www keyestudio com 2 Test Result 2 Upload test code to micro bit main board power the board via the USB cable and click Show console Device as shown below...

Page 200: ...200 www keyestudio com When the sound is louder around the sound value shows in the serial port is bigger as shown below...

Page 201: ...D dot matrix displays the value of the biggest volume please note that the biggest volume can be reset via the Reset button on the other side of the board while when clapping the LED dot matrix shows...

Page 202: ...the project we will combine these two components to play music That s the logo will be applied to control the speaker to sing songs 2 Components Needed Micro bit main board 1 USB cable 1 3 Connection...

Page 203: ...ype Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Project Code Project 12 Play Music Project 12 Play Music hex You can also drag blocks to form code Command blocks can be foun...

Page 204: ...keyestudio com Make combinations of these blocks 5 Test Results After uploading test code to micro bit main board and powering the board via the USB cable the speaker plays the song Happy Birthday to...

Page 205: ...ntroduction In the previous projects we have learned about the two programmable buttons button A and B and the LED dot matrix respectively In this one we will combine them to design a game Dodge Bulle...

Page 206: ...and B can be used to control the movement of the role to dodge bullets It moves to the right when A is pressed and to the left when B is pressed The game is over when G is hit and the game can start o...

Page 207: ...207 www keyestudio com You can also drag blocks to form code Command blocks can be found on the right as shown below...

Page 208: ...208 www keyestudio com...

Page 209: ...209 www keyestudio com...

Page 210: ...210 www keyestudio com Make combinations of these blocks...

Page 211: ...211 www keyestudio com...

Page 212: ...Result 1 The game begins when the code is uploaded to the main board The bullets G1 and G2 fall off and the role G is controlled by Button A and B to shun them If the role fail to avert the attacks t...

Page 213: ...and that the game stops when it is hit and the game is over after the display of the scores Like rule1 the game will restart when button A and B pressed together 8 Test Code 2 The route to get test co...

Page 214: ...214 www keyestudio com...

Page 215: ...215 www keyestudio com...

Page 216: ...216 www keyestudio com...

Page 217: ...217 www keyestudio com Make combinations of these blocks...

Page 218: ...218 www keyestudio com...

Page 219: ...aded to the main board The bullets G1 and G2 fall off and the role G is controlled by Button A and B to shun them 1 score will be tallied for each successful dodging If the role fail to avert the atta...

Page 220: ...ion With the help of them the board is able to communicate with a variety of Bluetooth devices including smart phones and tablets In this project we mainly concentrate on the Bluetooth wireless commun...

Page 221: ...main board to your computer via the Micro USB cable 4 Procedures Step 1 For Apple devices enter this link https www microbit org get started user guide ble ios with your computer first and then click...

Page 222: ...222 www keyestudio com Only Apple devices should follow this step Not needed for Android systems...

Page 223: ...223 www keyestudio com...

Page 224: ...r App Store to download the APP micro bit Step 3 Connect your Apple device with Micro Bit main board Firstly turn on the Bluetooth of your Apple device and click icon to open the APP micro bit and sel...

Page 225: ...225 www keyestudio com Secondly click Pair a new micro bit...

Page 226: ...s button A and B at the same time do not release them until you are told to and press Reset Power button for a few seconds Release the Reset Power button you will see a password pattern shows on the L...

Page 227: ...227 www keyestudio com...

Page 228: ...228 www keyestudio com Set the password pattern on your Apple device as the same pattern showed on the matrix and click Next...

Page 229: ...229 www keyestudio com Still click Next and a dialog box props up as shown below Then click Pair A few seconds later the match is done and the LED dot matrix displays the pattern...

Page 230: ...230 www keyestudio com...

Page 231: ...231 www keyestudio com...

Page 232: ...232 www keyestudio com After the match with Bluetooth write and upload code with the App Click Create Code to enter the programming page and write code Click and the box appears and then select Create...

Page 233: ...233 www keyestudio com...

Page 234: ...234 www keyestudio com...

Page 235: ...235 www keyestudio com Name the project as 1 and click to save it...

Page 236: ...keyestudio com Click the third item Flash to enter the uploading page The default code program for uploading is the one saved just now and named 1 and then click the other Flash to upload the code pr...

Page 237: ...237 www keyestudio com...

Page 238: ...238 www keyestudio com...

Page 239: ...239 www keyestudio com If the program 1 is uploaded successfully a few seconds later the App will emerge as below and the LED dot matrix of the Micro Bit main board will exhibit a heart pattern...

Page 240: ...duction of sensors and modules The further lessons are challenging for new starters Note G marked on each sensor and module is the negative pole and connected to G or GND on the sensor shield or contr...

Page 241: ...r materials silicon selenium germanium etc It features unidirectional conductivity that is the positive voltage is applied to the anode long leg and the cathode short leg of the diode when the voltage...

Page 242: ...ged if LED is directly connected to the power supply It s essential that a certain resistor must be connected in series in the LED circuit 2 Yellow LED Working Voltage DC 3 3 5V Working current 20mA M...

Page 243: ...t codes How to load Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Expansion Projects Project 1 LED Blinks Project 1 LED Blinks hex You can also drag blocks to form code C...

Page 244: ...244 www keyestudio com Make combinations of these blocks Micro bit Shield Yellow LED Module GND G 5V V S 16 S...

Page 245: ...oad the test code to the micro bit plug in power dial the DIP switch to ON and press 1 on the rocket switch The micro bit will show smile expression and a yellow LED will flash with an interval of 100...

Page 246: ...l that constantly switches between high and low levels to control the analog output In general the input voltages of ports are 0V and 3V What if the 1 5V is required Or a switch among 1V 1 5V and 3V W...

Page 247: ...The more 0 or 1 output per unit time the more accurate the control In the graphic below the green lines represent a regular time period This duration or period is the inverse of the PWM frequency In...

Page 248: ...w keyestudio com PWM is applied to light brightness adjustment speed adjustment of motor and sound emitting Parameters of PWM pulse width minimum max Pulse cycle insertion of pulse frequency within 1...

Page 249: ...namely P5 P6 P7 P8 P9 P11 P12 P13 P14 P15 P16 P19 and P20 In the experiment we connect the port S of yellow LED Module to the port S 16 of the expansion board And P16 can also be used as a PWM interfa...

Page 250: ...to get test codes How to load Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Expansion Projects Project 2 Breathing LED Project 2 Breathing LED hex You can also drag block...

Page 251: ...251 www keyestudio com...

Page 252: ...252 www keyestudio com Make combinations of these blocks Micro bit Expansion Board Yellow LED Module GND G 5V V S 16 S...

Page 253: ...er dial the DIP switch to ON and press 1 on the rocket switch The micro bit will show a smile expression and LED smoothly changes its brightness from light to dark and back to light continuing to do s...

Page 254: ...12V high voltage programmable current control portion which effectively ensures that the color of the pixel point The data protocol uses a single line zero code communication method After the pixel p...

Page 255: ...A Max Power 1W Working Temperat ure 10 50 Source of light SMD 5050 RGB IC Type 4 pcs WS2811 Gray Scale 256 Illuminati ng Angle 180 Illuminating Color Red yellow blue green and white 3 Add NeoPixel Lib...

Page 256: ...256 www keyestudio com Click the neoPixel library then NeoPixel library is installed You can view it in the blocks list...

Page 257: ...es How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Expansion Projects Project 3 6812 2x2Full colorRGB Project 3 Code 1 hex You can also drag blocks to form...

Page 258: ...258 www keyestudio com Make combinations of these blocks Micro bit Expansion Board 6812 2x2 Full Color RGB Module GND G 5V V S 14 S...

Page 259: ...259 www keyestudio com 5 Test Result 1 Upload the Test Code 1to the micro bit plug in power dial the DIP switch to ON and press 1 on the rocket switch You will view the 6812 RGB...

Page 260: ...d How to quick download 6 Test Code 2 The route to get test codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Expansion Projects Project 3 6812 2x2Full...

Page 261: ...261 www keyestudio com...

Page 262: ...262 www keyestudio com Make combinations of these blocks...

Page 263: ...263 www keyestudio com...

Page 264: ...264 www keyestudio com...

Page 265: ...code 2 to the micro bit plug in power dial the DIP switch to ON and press 1 on the rocket switch You can view four WS2812RGB lights light up like a flowing light How to download How to quick download...

Page 266: ...ute File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Expansion Projects Project 3 6812 2x2Full colorRGB Project 3 Code 3 hex You can also drag blocks to form code Command blocks can be...

Page 267: ...267 www keyestudio com...

Page 268: ...268 www keyestudio com Make combinations of these blocks...

Page 269: ...the test code 3 to the micro bit plug in power dial the DIP switch to ON and press 1 on the rocket switch Then you will see 5 WS2812RGB lights light up with random colors like a flowing light How to d...

Page 270: ...ent of human body Conventional pyroelectric infrared sensors are much more bigger with complex circuit and lower reliability Yet this new pyroelectric infrared motion sensor is more practical It integ...

Page 271: ...Current 50MA Static Current 50uA Control Port Digital output high level is 3 3V low level is 0V Control Signals Digital signal 1 0 Working Temperature 10 50 Max detection distance 4m Sensing Angle 100...

Page 272: ...ng part is parallel to the ground the distance is the best 3 In the test covering the sensor with white lens can sense the distance precisely 4 The distance is best at 25 and the detection distance va...

Page 273: ...load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Expansion Projects Project 4 PIR Motion Sensor Project 4 PIR Motion Sensor hex You can also drag blocks to form co...

Page 274: ...274 www keyestudio com...

Page 275: ...ad the test code to the micro bit plug in power dial the DIP switch to ON and press 1 on the rocket switch The micro bit will show a smile image Then click Show console device How to download How to q...

Page 276: ...be on As shown below If your computer system is Windows7 8 instead of Windows 10 the device can t be paired in Google Chrome as a result the digital and analog signals can t be read Here we need CoolT...

Page 277: ...277 www keyestudio com...

Page 278: ...method In this project we combine it with a yellow LED to control LED s brightness 2 Test Code The route to get test codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutori...

Page 279: ...279 www keyestudio com...

Page 280: ...280 www keyestudio com Make combinations of these blocks Micro bit Expansion Board PIR Motion Sensor Micro bit Expansion Board Yellow LED Module GND G GND G 5V V 5V V S 15 S S 16 S...

Page 281: ...the micro bit plug in power dial the DIP switch to ON and press 1 on the rocket switch The micro bit will show a smile image When the PIR motion sensor detects people the yellow LED will be on otherw...

Page 282: ...al sent by MCU or receiver and produces a reference signal with a period of 20ms and width of 1 5ms then compares the acquired DC bias voltage to the voltage of the potentiometer and obtain the voltag...

Page 283: ...ted between 1ms 2ms but in fact it s between 0 5ms 2 5ms The width corresponds the rotation angle from 0 to 180 But note that for different brand motors the same signal may have different rotation ang...

Page 284: ...oad speed 0 12 0 01 sec 60 DC 4 8V 0 1 0 01 sec 60 DC 6V No load current 200 20mA DC 4 8V 220 20mA DC 6V Stop torque 1 3 0 01kg cm DC 4 8V 1 5 0 1kg cm DC 6V Stop current 850mA DC 4 8V 1000mA DC 6V St...

Page 285: ...load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Expansion Projects Project 6 Adjust angles of servo Project 6 Adjust angles of servo hex You can also drag blocks...

Page 286: ...286 www keyestudio com Make combinations of these blocks Micro bit Expansion Board Servo GND Brown 5V Red S 8 Orange...

Page 287: ...load the test code to the micro bit plug in power dial the DIP switch to ON and press 1 on the rocket switch The micro bit will show smile expression the servo will rotate 0 45 90 135 180 0 in loop wa...

Page 288: ...art uses the PMOS and NMOS power tubes of low on resistance In addition the HR1124S chip has the low standby and static current This motor is compatible with all kinds of MCU control boards It comes w...

Page 289: ...289 www keyestudio com Working Voltage 3 3 5V DC Max Current 200mA DC5V Max Power 1W Control port Dual digital port digital input Working Temperature 10 C 50 C Environmental Attribute ROHS...

Page 290: ...te to get test codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Expansion Projects Project 7 130 Motor Project 7 Code 1 hex You can also drag blocks t...

Page 291: ...291 www keyestudio com Make combinations of these blocks Micro bit Expansion Board Motor GND G 5V V S 13 IN S 12 IN...

Page 292: ...292 www keyestudio com Code Explanation IN digital port P12 IN digital port P13 Fan high level 1 low level 0 Rotate clockwise...

Page 293: ...tP12 IN digital port P13 fan low level 0 high level 1 Rotate anticlockwise IN digital portP12 IN digital port P13 fan low level 0 low level 0 Not rotating IN digital portP12 IN digital port P13 fan hi...

Page 294: ...2 PWM Speed control The route to get test codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Expansion Projects Project 7 130 Motor Project 7 Code 2 hex...

Page 295: ...295 www keyestudio com Make combinations of these blocks...

Page 296: ...n IN digital portP12 IN digital portP13 fan high level 1 PWM 600 Rotate clockwise IN digital portP12 IN digital portP13 Fan low level 0 PWM 400 Rotate anticlockwise IN digital portP12 IN digital portP...

Page 297: ...n power dial the DIP switch to ON and press 1 on the rocket switch The fan will rotate clockwise for 5s stop 1 rotate anticlockwise for 5s and stop for 1s in loop way How to download How to quick down...

Page 298: ...and a charging port for solar panels which can supply power for an external lithium battery In addition this module has a boost module which can increase the voltage of batteries to 6 6V The DIP switc...

Page 299: ...www keyestudio com 3 Schematic Diagram Max Charging Current 800mA Output Port 3 P 2 54mm Pins Input Voltage 6 6V Max Output Current 800mA Batteries Single cell Lithium Battery Environmental Attribute...

Page 300: ...300 www keyestudio com 4 Features SOLAR4 8 6 0V the input port of power is connected to polar panels The solar energy is converted into electric energy via solar panels...

Page 301: ...ttery holder rechargeable batteries and saves the electric energy into batteries This is the switch Slid to ON end then the external lithium battery will be connected supplying to the expansion board...

Page 302: ...anel and an LED we provide together as shown below Disconnect the power after a while you will see the LED light up Project 9 1602 LCD 1 Project Introduction With I2C communication module this is a di...

Page 303: ...ours is built with Arduino IIC I2C interface saving 5 IO ports Alternatively the module comes with 4 positioning holes with a diameter of 3mm which is convenient for you to fix on other devices Notic...

Page 304: ...ication SCL a pin interfaced with SCL or A5 used for IIC communication Backlight Adjustable contrast 3 Add I2C LCD 1602 Library Set code by the library and click Extensions to add the library file Tap...

Page 305: ...305 www keyestudio com In addition the I2C LCD 1602 library is included in the IoT_keyestudio You can check the I2C LCD 1602 library in the block list...

Page 306: ...t codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Expansion Projects Project 9 1602 LCD Project 9 1602 LCD hex You can also drag blocks to form code...

Page 307: ...307 www keyestudio com...

Page 308: ...308 www keyestudio com Make combinations of these blocks Micro bit Expansion Board I2C 1602 LCD Module GND GND 5V 5V SDA SDA SCL SCL...

Page 309: ...The micro bit board will show a smile image Then rotate the knob of the potentiometer at the back of the LCD module you will see Keyestudio at one row and numbers at the second row In addition the nu...

Page 310: ...e contact coverage increases the output voltage will gradually rise It can detect water vapor in the air as well The steam sensor can be used as a rain water detector and level switch When the humidit...

Page 311: ...2 Parameters Working Voltage DC 3 3 5V Working Temperature Range 10 70 Max Working Current 5uA DC5V when the two pins of the steam sensor are in short circuit Control Port Analog output 3 Test Code T...

Page 312: ...oute File Name Hex file KS4027 folder Makecode Tutorial Makecode Code Expansion Projects Project 10 Steam Sensor Project 10 Steam Sensor hex You can also drag blocks to form code Command blocks can be...

Page 313: ...313 www keyestudio com...

Page 314: ...blocks 4 Test Results Upload the test code and plug in power with micro USB cable Then the micro bit will show At same time click the Show console Device How to download How to quick download Micro b...

Page 315: ...yestudio com The more the immersed area of the module the larger the analog value As shown below The serial monitor will show the output data and the steam sensor will read the analog signals at the s...

Page 316: ...and analog signals can t be read Here we need CoolTerm software to read data Open CoolTerm click Options to select SerialPort Set COM port and 115200 baud rate the baud rate of USB serial communicati...

Page 317: ...7 www keyestudio com Project 11 Rains Alarm 1 Project Introduction Steam Sensor is a wide range of applications such as raining alarm automotive automatic scraping system intelligent lighting system a...

Page 318: ...ombine Steam Sensor Micro bit and yellow LEDs making a simple rain alarm 2 Test Code The route to get test codes How to load File Type Route File Name Hex file KS4027 folder Makecode Tutorial Makecode...

Page 319: ...319 www keyestudio com...

Page 320: ...320 www keyestudio com Make combinations of these blocks Micro bit Expansion Board Steam Sensor Micro bit Expansion Board Yellow LED Module GND G GND G 3V3 V 5V V S 0 S S 16 S...

Page 321: ...estudio com 3 Test Results Upload the test code to the micro bit plug in power dial the DIP switch to ON and press 1 on the rocket switch The micro bit will show smile expression When the detected ana...

Page 322: ...as alarms and portable gas detection instruments Also it is suitable for the detection of liquefied gas benzene alkane alcohol hydrogen etc The MQ 2 smoke sensor can be accurately a multi gas detector...

Page 323: ...oxygen reducing the electron density in the semiconductor thereby increasing its resistance value When in contact with flammable gas in the air and smog and the potential barrier at the grain boundary...

Page 324: ...3 5V Working Current 160mA DC5V Working Temperatu re 0 C 40 C Control Port Digital and analog output Detection concentrat ion 300 10000ppm combustible gas Rake Ratio 0 6 R3000ppm R100 0ppm C3H8 Sensi...

Page 325: ...signal light will be on 4 The analog output is 0 5V voltage The higher the concentration the higher the voltage 5 a good sensitivity to liquefied gas natural gas and urban gas 6 Have long term life ex...

Page 326: ...326 www keyestudio com 12 Analog Gas MQ 2 Sensor You can also drag blocks to form code Command blocks can be found on the right as shown below...

Page 327: ...327 www keyestudio com...

Page 328: ...1 D 4 Test Results Upload the test code to the micro bit plug in power and dial the DIP switch to ON Then the micro bit will show smile expression and a green indicator will be on You can adjust the...

Page 329: ...meter and click Show Console Device How to download How to quick download The serial monitor will show 1 if the sensor doesn t detect any gas however if you make the firelighter close to it number 0 w...

Page 330: ...Here we need CoolTerm software to read data Open CoolTerm click Options to select SerialPort Set COM port and 115200 baud rate the baud rate of USB serial communication of micro bit V2 is 115200 throu...

Page 331: ...This MQ 2 gas sensor is used for household gas leak alarms industrial combustible gas alarms and portable gas detection instruments And it is suitable for the detection of liquefied gas benzene alkane...

Page 332: ...al gas liquefied petroleum gas and other smoke especially to alkanes smoke We will make a gas leakage detector with a MQ 2 gas sensor a yellow LED and a 1602 LCD 2 Add the 1602 LCD library Library lin...

Page 333: ...333 www keyestudio com You can also drag blocks to form code Command blocks can be found on the right as shown below...

Page 334: ...udio com Make combinations of these blocks Micro bit Expansion Board Analog Gas MQ 2 Sensor Micro bit Expansion Board Yellow LED Module Micro bit Expansion Board 1602 LCD Module GND G GND G GND GND 5V...

Page 335: ...335 www keyestudio com S 1 D S 16 S SDA SDA SCL SCL 4 Test Results Upload the test code to the micro bit plug in power dial the DIP switch to...

Page 336: ...sound and LED will flash How to download How to quick download Project 14 DHT11 Temperature and Humidity Sensor 1 Project Introduction This DHT11 temperature and humidity sensor is a composite sensor...

Page 337: ...emperature measuring device 2 Parameters Working Voltage 3 3V 5V DC Max Working Current 50mA Max Power 0 25W Control Port Digital two way single bus Temperature Range 0 50 2 Humidity Range 20 90 RH 5...

Page 338: ...ature high bit is the temperature integer part of the data the temperature low bit is the temperature fractional part of the data And the temperature low bit8 is 1 which indicates the negative tempera...

Page 339: ...nical Data Sheet T ranslated Version 1143054 pdf 4 Add the DHT11 library Set code by the library and click Extensions to add the library file Copy the link https github com keyestudio2019 ks_IoT in th...

Page 340: ...340 www keyestudio com You can find it in the blocks list 5 Test Code The route to get test codes How to load...

Page 341: ...S4027 folder Makecode Tutorial Makecode Code Expansion Projects Project 14 DHT11 Temperature and Humidity Sensor Project 14 DHT11 Temperature and Humidity Sensor hex You can also drag blocks to form c...

Page 342: ...342 www keyestudio com...

Page 343: ...e blocks Micro bit Expansion Board DHT11 Temperature and Humidity Sensor GND G 5V V S 2 S 6 Test Results Upload the test code to the micro bit plug in power dial the DIP switch to ON and press 1 on th...

Page 344: ...344 www keyestudio com image Then click Show console Device How to download How to quick download The detected temperature and humidity value is shown as below...

Page 345: ...ital and analog signals can t be read Here we need CoolTerm software to read data Open CoolTerm click Options to select SerialPort Set COM port and 115200 baud rate the baud rate of USB serial communi...

Page 346: ...346 www keyestudio com as shown below...

Page 347: ...th it and a 1602 LCD 2 Add the 1602 LCD and DHT11 library The link to add libraries https github com keyestudio2019 ks_IoT You can refer to project 9 and 14 3 Test Code The route to get test codes How...

Page 348: ...348 www keyestudio com Command blocks can be found on the right as shown below...

Page 349: ...ww keyestudio com Make combinations of these blocks Micro bit Expansion Board DHT11 Temperature and Humidity Sensor Micro bit Expansion Board 1602 LCD Module GND G GND GND 5V V 5V 5V S 2 S SDA SDA SCL...

Page 350: ...code to the micro bit plug in power dial the DIP switch to ON and press 1 on the rocket switch The micro bit will show smile image The 1602 LCD will show the temperature and humidity value in the curr...

Page 351: ...The final lesson is the combination of all modules and sensors It is an analog smart home 2 Preparation A micro bit and the smart home model Interface the micro bit with a computer with a micro USB c...

Page 352: ...ou are close to the PIR motion sensor the yellow LED will be on otherwise the yellow LED will be off When dropping water onto the steam sensor and analog signal is more than 300 the window will be clo...

Page 353: ...2LCD will display Successful and Open the door the 6812 2x2 RGB will show purple color However if the password is wrong error will pop up on the LCD module and show Enter password Touch the logo area...

Page 354: ...ect 17 BT controlled LED 1 Project Introduction We control LED on and off via app 2 Preparation Install App Android system Search on Google play or install the app package we provide in the Android AP...

Page 355: ...355 www keyestudio com Add the BT library file as shown below 3 Test Code...

Page 356: ...dio com Note after finishing code you need to enable No paring Required Anyone can connect via Bluetooth 4 Test Results Upload code to the micro bit open the switch of the smart home enable the App an...

Page 357: ...357 www keyestudio com Search the Bluetooth name of micro bit board After connecting well click LED icon...

Page 358: ...com Then you will see LED on If you click this icon again LED will be off Project 18 Smart Home 1 Project Introduction In this section we will control the smart home via Bluetooth 2 Preparation Downl...

Page 359: ...359 www keyestudio com Add the Bluetooth library file Add the libraries https github com keyestudio2019 ks_IoT 3 Test Code Seen in the folder...

Page 360: ...n the micro bit board Pressing A and B respectively means and Pressing A and B simultaneously indicates confirm The 5 5 LED lights will show picture and the I2C1602LCD will display Successful and Open...

Page 361: ...361 www keyestudio com 9 Resources https fs keyestudio com KS4027 4028...

Reviews: