{"product_id":"relay-for-microbit","title":"Relay for micro:bit","description":"\u003cp\u003eThe MonkMakes Relay for micro:bit is a solid-state (no moving parts) relay that allows an output of a micro:bit to turn things on and off.\u003c\/p\u003e\n\u003cp\u003eA micro:bit can turn an LED on and off directly, but anything more powerful requires something like a relay or a transistor. Using a transistor to switch something on and off requires a shared ground connection with the micro:bit and a knowledge electronics that you or your students may not be ready for. The MonkMakes Relay for micro:bit is much easier to use, acting like a simple micro:bit controlled switch.\u003c\/p\u003e\n\u003cp\u003eThis relay can be used to switch low voltage devices such as light bulbs, a motor, a small heating element or even a string of 12V LED lighting. The voltage needs to be kept under 16V, but the relay will automatically protect itself against too much current.\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0174\/1800\/files\/connected-copy-1024x656.jpg?v=1512399592\u0026amp;width=700\" alt=\"\"\u003e\u003c\/p\u003e\n\u003ch2\u003eFEATURES\u003c\/h2\u003e\n\u003cul\u003e\n\u003cli\u003eSolid-sate relay (up to 2 Amps)\u003c\/li\u003e\n\u003cli\u003eActive LED indicator\u003c\/li\u003e\n\u003cli\u003eResettable ‘polyfuse’ to protect against over-current\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003ch2\u003eGetting Started\u003c\/h2\u003e\n\u003cp\u003eConnecting your micro:bit\u003c\/p\u003e\n\u003cp\u003eThe Relay requires just two connections to the micro:bit. One to GND (ground) and one to whatever pin is to be used to control the relay’s switching action.\u003c\/p\u003e\n\u003cp\u003eWhen attaching the alligator clips to the micro:bit, make sure that the clips are perpendicular to the board so that they are not touching any of the neighbouring connectors on the micro:Bit edge connector.\u003c\/p\u003e\n\u003cp\u003eHere’s an example of how you could wire up a MonkMakes Relay for micro:bit to turn an old fashioned light bulb on and off.\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0174\/1800\/files\/wiring_relay-929x1024.png?v=1512399623\u0026amp;width=700\" alt=\"\"\u003e\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eHEX File\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp\u003eThe quickest way to try out your relay is to\u003cspan\u003e \u003c\/span\u003eDOWNLOAD THIS HEX FILE \u0026gt;and then copy it onto your micro:bit. The program will turn the relay on and off once a second.\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eJavaScript Blocks Editor\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp\u003eSet the controlling pin to 1 and the relay contacts will close, set it to 0 and the contacts will open again. Its as simple as that. So, to make your relay turn on and off once a second,\u003cspan\u003e \u003c\/span\u003eopen the Blocks Editor, add a\u003cspan\u003e \u003c\/span\u003e\u003cem\u003eforever\u003c\/em\u003e\u003cspan\u003e \u003c\/span\u003eblock and then the\u003cspan\u003e \u003c\/span\u003e\u003cem\u003edigital write\u003c\/em\u003e\u003cspan\u003e \u003c\/span\u003eblocks from the\u003cspan\u003e \u003c\/span\u003e\u003cem\u003epins\u003c\/em\u003e\u003cspan\u003e \u003c\/span\u003ecategory and the\u003cspan\u003e \u003c\/span\u003e\u003cem\u003epauses\u003c\/em\u003e\u003cspan\u003e \u003c\/span\u003efrom the\u003cspan\u003e \u003c\/span\u003e\u003cem\u003ebasic \u003c\/em\u003ecategory.\u003c\/p\u003e\n\u003cp\u003eYou can also click on the image of the blocks below to open up the Blocks Editor on this project.\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0174\/1800\/files\/blocks.png?v=1512399662\u0026amp;width=700\" alt=\"\"\u003e\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eMicroPython\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp\u003ePaste the following code into the Python window and then Download the file and copy it onto your your micro:bit.\u003c\/p\u003e\n\u003cp\u003e\u003ccode\u003efrom microbit import *\u003cbr\u003e\u003cbr\u003ewhile True:\u003cbr\u003e pin0.write_digital(True)\u003cbr\u003e sleep(500)\u003cbr\u003e pin0.write_digital(False)\u003cbr\u003e sleep(500)\u003c\/code\u003e\u003c\/p\u003e\n\u003cp\u003e\u003ciframe width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/XllaZ1yo260\" frameborder=\"0\" allowfullscreen=\"\"\u003e\u003c\/iframe\u003e\u003c\/p\u003e\n\u003ch2\u003eAnalog Outputs\u003c\/h2\u003e\n\u003cp\u003eThe latest MonkMakes Relay for micro:bit can do more than just switch things on and off. It can also be used with micro:bit analog outputs. Look closely at your Relay for micro:bit and is it has the version number\u003cspan\u003e \u003c\/span\u003e\u003cstrong\u003ev1ev\u003c\/strong\u003e (under the word ‘Board’) then it can be used with the ‘analog write’ block in the blocks editor or the ‘write_analog’ function in MicroPython. If your board has the version number\u003cspan\u003e \u003c\/span\u003e\u003cstrong\u003ev1e\u003c\/strong\u003e\u003cspan\u003e \u003c\/span\u003ethen it is not suitable for use with analog outputs – sorry you were unlucky to get one of the small batch of first boards to be sold.\u003c\/p\u003e\n\u003cp\u003eThe output of the Relay for micro:bit is not linear at low PWM and high PWM values as the following chart illustrates.\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0174\/1800\/files\/graph.png?v=1512399750\u0026amp;width=700\" alt=\"\"\u003e\u003c\/p\u003e\n\u003cp\u003eThe y-axis shows the current in mA for a test load resistor supplied from a constant voltage source. The x-axis is the analog write value (0 to 1023). As you can see, there is a dead zone up to a analog output value of about 100, followed by a relatively good linear region right up to about 1000, after which the output effectively becomes ‘on’.\u003c\/p\u003e\n\u003cp\u003eThe tests were carried out at the default PWM frequency of 50Hz for the micro:bit. Lower frequency PWM is expected to produce more linear results.\u003c\/p\u003e","brand":"Monk Makes","offers":[{"title":"Default Title","offer_id":56199991886146,"sku":"lhk1789700477235","price":7.28,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/1013\/4392\/0450\/files\/relay-for-microbit_1.jpg?v=1789700483","url":"https:\/\/bouclebox.shop\/products\/relay-for-microbit","provider":"My Store","version":"1.0","type":"link"}