Maker Mind MelD Summit

Simon Monk – micro:bit for Makers

The BBC micro:bit is a versatile microcontroller board that is widely used in education but is often overlooked by Makers. In this presentation, Simon will introduce the micro:bit and demonstrate some of its features such as built-in sensors, a rudimentary display, and radio hardware, that make it useful to Makers. 

Simon will do a live demonstration of writing code for the micro:bit in MakeCode blocks and Python, and present several projects built using the micro:bit.

Simon Monk is a full-time author and maker, mostly writing about electronics for Makers. Some of his better-known books include ‘Programming Arduino: Getting Started with Sketches,’ ‘The Raspberry Pi Cookbook’ and ‘Hacking Electronics.’ He also helps his wife Linda run MonkMakes Ltd, a manufacturer of electronic add-ons and kits for makers and educators. Simon has been an electronics hobbyist since his teens and has a degree in Computer Science and Cybernetics and a Ph.D. in Software Engineering.

Watch full video below

Transcript

Peter Dalmaris: Hi, everyone. And welcome to this Special Master Class Maker Session. In this session, Dr. Simon Monk will show us how to get started with the popular BBC micro:bit microcontroller board.

Peter Dalmaris: I'm Peter Damaris, an Online Educator and Maker, Author of Maker Education Revolution, and Founder at Tech Explorations. My mission is to help people learn electronics, programing, printed circuit board design, and lots more. Most importantly, I want to help as many people as possible to enjoy the technology education adventures.

Peter Dalmaris: In this session, I'm excited to introduce Dr. Simon Monk. Simon is a full-time author and maker, mostly writing about electronics for makers. Some of his better known books include Programing Arduino: Getting Started With Sketches, The Raspberry Pi Cookbook, and Hacking Electronics. He's also the co-author of one of my favorite books, Practical Electronics for Inventors, which I happen to have a copy of here. It's a big book, and I find it extremely helpful in my everyday work with electronics.

Peter Dalmaris: Simon also helps his wife, Linda, run MonkMakes Ltd., a manufacturer of electronic add-ons and kits for makers and educators. Simon has been an electronics hobbyist since his teens, and has a degree in computer science and cybernetics, and a PhD in software engineering.

Peter Dalmaris: In this masterclass, Simon will introduce them micro:bit and look at some of its features, such as building sensors, a simple LED display, and radio hardware that make it useful to makers. He'll give us a live demonstration of programing the micro:bit in MakeCode Blocks and Python, and demonstrate several projects using the micro:bit. So, Simon, thank you very much for joining me. How are you?

Simon Monk: It's a pleasure to be here. I'm very well. Thank you. Good to see you.

Peter Dalmaris: Awesome. It's really an honor for me to have you. As I said, I've been reading your books for a long, long time, and finally be able to talk to you is amazing. So, thank you for accepting my invitation.

Simon Monk: Thanks very much. [Inaudible].

Peter Dalmaris: I know that you've got a lot of interesting content to show us. But before we begin, I have got a question about the micro:bit, of course. So, myself, I've been using the Raspberry Pi and the Arduino and ESP32 for a very long time. And micro:bit is something that I'm familiar with. I've got two.

Peter Dalmaris: But I've got two micro:bits because I've got two kids, and my kids use a micro:bit to learn how to program. And they've started already with Makeblock, the graphical block-based language. And the older one, Leo, is now moving into Python as well and, actually, finds Python better than Makeblock, which is quite good progress.

Peter Dalmaris: But as a maker, I haven't really used that much. And from what I hear from other makers, it's not really in our radar. Are we missing out? Should we perhaps be considering the micro:bit for our next project?

Simon Monk: I think so. I think it's another thing that should be in your toolbox. Because even though you're right, the focus for the micro:bit has been very much towards education, which almost sort of tells as being a bit of a toy. But when it comes down to it, it's a useful microprocessor board that has built onto it a good array of sensors, and a fairly limited five by five display on the front. But you can, you know, use it in projects.

Simon Monk: And it's cheap enough, particularly if you're comparing it with the Arduino boards. It's really a similar price point, but with a lot more capability to it.

Peter Dalmaris: Yeah. And the language situation is also quite interesting because while the Arduino requires typically C++ or good knowledge of C or C++, the micro:bit is more flexible. So, there's a graphical language, there's JavaScript, I believe, that you can use, and, of course, Python, which is a high level language, much easier to learn, isn't it?

Simon Monk: It is. I mean, today, I'll be concentrating on the Block programing language, that you mentioned earlier, and also MicroPython. But you can actually program the micro:bit from the Arduino IDE. It can be on the Arduino IDE as a core. And then, there's sort of more kind of professional tools, like the Mbed tools, if you really want to get a bit closer to the metal and do something a bit more sophisticated, then you can do that too.

Simon Monk: So, you know, I think people see the micro:bit and think, "I've got to use Blocks." And I think anybody who's been programing for a while rapidly gets a little bit frustrated with Blocks when you sort of want to do a fairly simple arithmetic expression. And then, suddenly, you're tracking Blocks, and you're putting Blocks inside Blocks, inside Blocks, inside Blocks. And you're thinking, "There must be an easier way than this if only I could just type out the expression."

Peter Dalmaris: One plus one.

Simon Monk: Exactly. But MicroPython works very well on the micro:bit. And Python does have the advantage that a lot of people know it. And I think it's interesting how Adafruit with their Circuit Playground range of products and their CircuitPython, which is a derivative of the same MicroPython that you use on the micro:bit.

Simon Monk: It's actually getting quite a lot of traction, because if you're using an Arduino Uno and you've got 2K of memory, 2K of RAM to play with, then you're not going to be running Python in it. But if you're running an M0 processor that's got a reasonable amount of memory, you can, you really can.

Simon Monk: So, even though you're not getting as close to metal, you can build projects with rather some ease because you've got a nice high level language to attack them with. And an awful lot of people know Python these days, it's a very good sort of kind of integrating language, I think. So, it shouldn't be discounted.

Peter Dalmaris: Python is something that kids these days tend to learn at school as well.

Simon Monk: Yeah. Exactly. So, it must be one of the most popular languages now, I should think. I imagine it's making quite big gains on Java in terms of being in use and professional terms as well. And, of course, it has some sort of notoriety when you look at it as a sort of integration framework, when you're using things like machine learning, even. A lot of these frameworks are based on Python. So, I wouldn't recommend running them on a micro:bit, but it's there.

Peter Dalmaris: I think what you're saying is that Python is a powerful language. It's got these extensions and libraries. It can take you into all sorts of different domains. You can write games on it, artificial intelligence. One of our presenters coming up, hopefully soon, will show us how to use Python, not MicroPython, but full-fledged Python to do Edge artificial intelligence. And that's like object and face recognition and things like that, just with a few lines of Python code.

Peter Dalmaris: Just a follow up question on that. What about peripherals? So, one of the nice things about the Arduino is that you can go to eBay and you can get pretty much anything to connect to it, and it will work, and there will be a library for it to make it easy. How is the situation with micro:bit?

Simon Monk: It's actually very similar. It doesn't work so well in the Python side of a micro:bit. The whole idea of adding in libraries is not particularly easy in the Python on the micro:bit. But, actually, in the Blocks code, which does actually generate JavaScript behind the scenes and does actually run significantly faster than its Python equivalent quite often, it's adding modules there. It's really quite straightforward.

Simon Monk: So, you'll find ready-made Blocks libraries for things like addressable LED pixels, NeoPixel. And you'll find libraries for various I2C add-ons, you know, little sensors and displays. And it has a I2C and an SPI interface that you can make use of. You have to add kind of an adapter so you can get access to those pins, because they're not one of the three big pins that are kind of broken out on the main board.

Simon Monk: But, yeah, you can do it. And there are an awful lot of people using this. I mean, it had a very big initial boost into the community when they gave away a million of these things. So, I think that's quite a bootstrap into the community. And an incentive even if the kids aren't doing it, if their mums and dads get hold of it, it might well go off and make a bit of code available.

Peter Dalmaris: Well, that's great. Thank you. I think this puts us in a very good grounding or a place to begin with your presentation and get a better understanding of what the micro:bit is. So, take it away, Simon. Let's see what you have.

Simon Monk: Okay. Thanks very much, Peter. Okay. I'll switch over to the slide view. Okay.

Simon Monk: So, the title of this presentation is micro:bit for Makers. And what I hope to persuade you of is that the micro:bit is a device that's worth considering when you are thinking about your next project that you're going to make.

Simon Monk: So, my name is Simon Monk. And I write books about Arduino, Raspberry Pi. And I have a couple of books out about the micro:bit, Programing the BBC micro:bit: Getting Started with MicroPython, micro:bit For Mad Scientists, which is more of a project book, really.

Simon Monk: I also have another interest which is developing designing kits and add-on boards, which are sold through a business that I run with my wife called MonkMakes. And over here below the Mad Scientist book, you can see the kind of add-on board we make. So, this is just to allow you to connect servo motors with ease to your micro:bit.

Simon Monk: So, micro:bit for Makers. I'm going to start off with a very quick history, which kind of sets in context where the micro:bits come from and probably answer some of the question as to why it isn't used more in maker projects.

Simon Monk: I'm going to look at the micro:bits and compare its features with the Arduino and the Raspberry Pi, so you get sort of a feel for where it fits in the pantheon of microprocessor boards.

Simon Monk: I'm going to give a little introduction to programing the micro:bit using MakeCode Blocks. So, this is kind of you program by dragging blocks around rather than by actually writing code in an editor.

Simon Monk: I'm also going to touch on programing in micro:python. We're going to have a little example and show you some of the things that you can do with the micro:bit. And then, we'll look at a much more complicated example, which is based on this example you got over to the right, which is an animated head.

Simon Monk: So, the eyeballs swivel about. In this example, it's on a single servo motor. But the one I'm going to show you has two servo motors, which has the massive advantage that you can make it go cross-eyed if you want to.

Simon Monk: And then, finally, we're just going to summarize what I've been talking about and, hopefully, sort of bring up the main points of why the micro:bits are good idea for makers, a useful thing to know about.

Simon Monk: So, the micro:bit history. The original purpose was to teach programing to kids. So, its main design goals was it would be easy to use in the classroom. It should be low cost. And you should be able to use it without additional hardware.

Simon Monk: So, one of the criticisms of the Raspberry Pi - I'm a big fan of the Raspberry Pi, by the way - from teachers is that, when you want to use it, you, first of all, have to dissemble all the computers in your computer room because you're going to have to connect up the monitors, and the keyboard, and the mice to you Raspberry Pi before you can really get started. Or you have to have some kind of case and separate keyboard and monitors for the Raspberry Pi. But either way, not terribly convenient.

Simon Monk: So, the nice thing about the micro:bit is that, all you need is a USB lead and a regular computer, and it can be a Windows machine or a Mac, or it can be a Linux machine. This means that you can just have a big box of these things, and you can get them out at the beginning of a lesson. You haven't got to worry about spending huge amounts of time setting up and things.

Simon Monk: It was launched in 2015, and rolled out to a million school children in the UK in 2016. Basically, every kid in a particular school year got one of these devices through their school. It was the intention. So, hopefully, not too many of them just disappeared off for their parents to use.

Simon Monk: So, it's a very high profile project in the UK. Basically, the BBC led on it. And there were other high profile partners as well, like Samsung, Microsoft, and Nordic Semiconductor, who all contributed both financially and also to the design process in coming up with something.

Simon Monk: And despite having so many partners, it didn't end up with the classic camel being a horse designed by committee. It has actually sort of kept some balance, so it's quite a nicely designed little device. And it has a hardware abstraction level, which basically means that whether you're programing it in Python or your programing it in Blocks, you're going to see much the same kind of functions that you're going to be able to make use of.

Simon Monk: And because the whole thing is designed to be accessible and easy for kids to use. It just makes life easier when you want to make a project because you haven't got to do a lot of tricky programing, most of the time anyway.

Simon Monk: micro:bit versus Arduino and Raspberry Pi. The micro:bit is a microcontroller board. It's not a single board computer, so it's much more like an Arduino than it is like a Raspberry Pi.

Simon Monk: A Raspberry Pi, if you haven't come across these devices, is essentially a single board computer that runs the Linux operating system, and you generally want to be connecting it to a monitor, keyboard, and mouse, at least in the first instance.

Simon Monk: Whereas, the micro:bit and the Arduino are microcontroller boards. They don't have an operating system. You just upload a single program onto them and they run that program until you turn them off. That's kind of all they do. So, they're much simpler devices than something like the Raspberry Pi.

Simon Monk: In fact, you can actually use a Raspberry Pi to program your micro:bit. So, you can connect your micro:bit to your Raspberry Pi by a USB lead. And then, you can use your Raspberry Pi to write and then download programs onto your micro:bit.

Simon Monk: Perhaps the board that micro:bit is most similar to in terms of style is the Adafruit Circuit Playground or more accurately, really, the Adafruit Circuit Playground Express. And they have a very similar processor, it may even be the same one. I'm not quite sure about that.

Simon Monk: But they're both designed as what I'd call a kitchen sink board. And they're not just a microcontroller on a board. They've got lots of peripherals built onto them, lots of sensors, little displays, LEDs, that kind of thing. They both take the same approach for connecting, which is primarily that you're going to use alligator clips and clip things together. Do you call them crocodile clips in Australia?

Peter Dalmaris: Yeah. Yeah.

Simon Monk: Well, you should really, I guess.

Peter Dalmaris: There's a few different terms to refer to the same item. But, yeah, I personally call them crocodile clips for some reason.

Simon Monk: Okay. I think that's most common in the UK. But in America it tends to be alligator clips. It just depends what kind of large reptile you have in your country, really, doesn't it?

Peter Dalmaris: Yeah. Big teeth, [inaudible].

Simon Monk: Yeah. So, you have all these holes, but on the micro:bit, you just have these five holes along the bottom. Two of which are reserved for power, and the other three that can be general purpose input/output pins.

Simon Monk: The Circuit Playground Express has a few more - or quite a lot more, actually - of these connectors in that form. And it also has some extras on it, like a microphone and a little tiny loudspeaker built on it, which the micro:bit doesn't have. It's a more expensive board, so you pay a bit more, but you get a little bit more. But they're both similar concepts. They can be both preprogramed with Block languages, and they can both be programed with a Python variant, and also a C program as well if you want to.

Simon Monk: So, the micro:bit has this little five by five LED display right in the middle of the board. It's just one color. They're all red LEDs. You can't do anything particularly fancy other than scroll text across it, or display single numbers, or rolls of the dice, which is quite a common one.

Simon Monk: Whereas, the Circuit Playground doesn't have any display in that sense, anything that you could display numbers or text on. But it does have these addressable color near pixels all the way around the edge. It has ten of these on it. So, this is probably the most similar board to the micro:bit.

Simon Monk: So, let's have a quick guided tour. As I mentioned before, it's got a five by five LED display. It also has two push buttons. They're for user use. They're not reset buttons or anything. They're for you to press and have something happen when you write a program to do something with it.

Simon Monk: They can be powered either by the USB socket, up at the top of the board, which is also used when you come to program the board. Although, you can also program the boards over Bluetooth, which is quite a nice feature so you can upload something from your phone.

Simon Monk: There's a battery connector for a two AAA battery pack, which is the sort of the recommended battery pack by the micro:bit Foundation, the people who developed this board, and maintained it and keep everything working.

Simon Monk: And then, we've got these connectors at the bottom. So, you can see the big five holes at the bottom. And you can see that there's kind of little connectors in between each of the big connectors. You, obviously, can't connect an alligator clip to one of those little connectors. And so, to make use of them, you have to plug it into a special adapter and then you can get hold of a lot more input/output pins, which is sometimes you'll want to do.

Simon Monk: So, if you flip the micro:bit over and have a look at the back, you'll see actually, quite helpfully, labels on some of its features so you get an idea of what's on there. So, you can see the USB connector a bit more clearly, it's a micro USB. There's a reset button, and then there's the JST style battery connector that you can plug in your 3 volt battery pack.

Simon Monk: You can see down here, it labels a Compass, so it's got a magnetometer that you can do all sorts of fun things with that. It's not just limited to trying to making compasses so that you can work out which direction is north. You can do some really cool projects with magnets. So, you put a magnet nearby it, then you can detect it from your code.

Simon Monk: It also has an accelerometer, so you can do a lot of fun projects just using the accelerometer, detecting tilt, have that controller wirelessly, a robot or something, all sorts of things. And as I say, it's also got a radio hardware built into it. So, it can do Bluetooth, and it can also do its own proprietary 2.4 gigahertz communication with other micro:bits. So, you can have like a room of micro:bits all talking to each other.

Simon Monk: And because this is designed for kids, the protocol for communicating between the micro:bits is you just send a piece of text from one micro:bit to another, and it has an on received a piece of text block could do something. So, no nasty level, no level picking things out of byte arrays type stuff that you normally have to do with when you get into coms. It's all abstracted out really nicely into a simple to use interface.

Simon Monk: Okay. So, let's have a look. Why is it good for makers? Pros, particularly if you're looking at official Arduino boards, it's cheaper. I think the price in the UK is about £12. What is that? Daily, it changes at the moment in the UK, but I guess that probably makes it about $15, something like that, maybe a bit more.

Peter Dalmaris: Sorry to jump in here. I think the micro:bit Foundation, as it's called, is a not-for-profit organization, just like the Raspberry Pi Foundation, right?

Simon Monk: That's right. They are, yes.

Peter Dalmaris: That explains the price differential as well.

Simon Monk: Yeah. Yeah. I guess it's a significant factor. I know retailers who try and sell it find it difficult because there's not much of a margin because, as you say, it's not for profit. So, they can't get their 40 percent gross margin.

Peter Dalmaris: It's literally bottom price or best possible price, I guess.

Simon Monk: Yeah. It is. I mean, it's good value considering what's on it. I mean, it really is.

Simon Monk: So, it's got more features and a better spec than, say, an Arduino Uno, which will still cost quite a lot more. And I think it's actually easier to get started because it's just kind of designed that way, because its target audience is really kids. So, you're not launching straight into C and worrying about whether you've got enough semicolons or not. It's kind of quite easy to get going.

Peter Dalmaris: Although with Python, you do need to worry about the spaces.

Simon Monk: Oh, yeah. I know. The first time I saw Python, I just couldn't believe they'd actually done that. "You do what? You do delimit blocks by tabbing?" But you get used to it, don't you?

Peter Dalmaris: That was the main reason for me, at some point in my programing life, I wanted to choose between Python or Ruby. And when I heard that Python requires spaces to delineate blocks, I thought, "No. I'm going for Ruby."

Simon Monk: Well, I've done quite a lot Ruby, and I don't blame you. In fact, given the choice, I'd be on Smalltalk rather than Ruby. But Ruby is a good second best.

Peter Dalmaris: Yeah. Yeah. I tried that. One more thing about what I like about the micro:bit as well compared to the Arduino, is, you don't need the breadboard to begin. That's what caused a lot of problems to teach us as well, and beginners too.

Simon Monk: Yeah. That's very true. I mean, the alligator clips do make it very accessible. And what some people do actually is, rather than use alligator clips to connect the boards, some boards, including some of the boards we provide, have all the holes in the right place that you can just bolt the two boards together, and they get connections through the bolts through the big holes. That's another way of doing it.

Simon Monk: I suppose the downside, really, to the micro:bit, you have only got three GPIO pins before you start connecting it to an adapter. But given the fact that it's got so many onboard peripherals, I don't find that a problem too often, I must admit. And, also, alligator clips are not to everyone's taste. They tend to fall off. That is a problem with them. They're not always the most reliable of connection.

Simon Monk: And, I guess, if you're sort of a reasonably advanced maker and you're used to that technology already, then I would guess you would probably migrate to something like one of the ESP32 baseboards, which are ludicrously cheap, they are just a few dollars. And very powerful Wi-Fi and Bluetooth built-in.

Simon Monk: Not as easy to use, obviously. But, still, if you're going to embed something in a project and leave it there rather than kind of experimenting, then that kind of board is probably going to be more appropriate than a micro:bit. But, as I say, more for advanced users.

Simon Monk: Okay. Here's a few example projects that use the micro:bit. I've actually taken all of these from my micro:bit Mad Scientist book. So, up in the top left corner here, we've got a plant and water. So, here we've got the micro:bit connected to a solid state relay board, that is all alligator clickable that we have. And then, that switches on and off a pump from a separate power supply. The pump has a separate power supply.

Simon Monk: And then, the dryness of the soil or the wetness of the soil is detected using a couple of - well, I used six inch nails poked into the plant pot.

Peter Dalmaris: A very sophisticated sensor.

Simon Monk: It is. I mean, it's a strange thing, actually, measuring soil moisture. Because if you leave a DC current voltage across it, then you get electrolysis effect. So, it does gradually sort of corrode the nail - well, the nails tend to corrode anyway. But it's a fun little project to make.

Simon Monk: And it's pretty straightforward and you do learn a bit about just how you can do things with it, like work out how fast plants transpire water, how much water they transpire in a day, for example, because you can see how -

Peter Dalmaris: You can keep statistics, interesting.

Simon Monk: Yeah. You can see how much it's topped it up and you see how often the pump had to run. And I used a metering pump, which are quite nice because you know pretty much exactly how much water you've pumped in without having to look at the reservoir and subtract. So, if it's been running a minute, you know, you've got so many centiliters of water gone in there.

Simon Monk: And then, sort of working our way around anti-clockwise. This is just a fun little sort of - I hesitate to call it a musical instrument because it's really not terribly musical - makes beeping noises that vary when you wave your hand in front of a micro:bit.

Simon Monk: So, the micro:bit can actually be used for sensing light. It does a clever trick with the LEDs on the display. Basically, an LED, when reverse biased, can act a bit like a capacitor. And the charge gets stripped off that faster if there's more light falling on the LED. So, the guys who developed the micro:bit did this really neat trick that they include in the firmware. So, you just ask how light is it.

Peter Dalmaris: Awesome.

Simon Monk: Yeah. It is. Isn't a nice little trick?

Peter Dalmaris: I didn't know about that. That's good.

Simon Monk: Yeah. Down at the bottom, this is where one of my favorite projects are, actually, because it's so simple, really.

Peter Dalmaris: [Inaudible].

Simon Monk: Yeah. You want to be a little bit careful having your micro:bit a bit around water, really. You don't want to destroy too many of them. But the basic idea of is it counts your toothbrushing strokes, so the score goes up as you brush your teeth. And then, when you get to the end, it tells you, you can stop brushing your teeth and you've done enough.

Simon Monk: Over on the top right, we've got a micro:bit alarm, so it's just a door alarm. And this uses the magnetometer on the micro:bit. So, the micro:bit is stuck to the door frame. And then, you can just see at the emerging from the bottom there, there's a speaker attached to it that we use to sound the alarm should somebody enter your room.

Simon Monk: And then, just stuck to the door itself is a little magnet, just by the B switch there. And so, when the magnet moves out of range of the micro:bit's magnetic sensor, then it sounds the alarm so that you know somebody come into the door. Very simple wiring. The speaker just uses one data line and then it's got power lines to it.

Simon Monk: The speaker is actually one of our most popular products at MonkMake. It's just a really handy way of providing a small, amplified speaker. Because people did go through a phase of actually attaching loudspeakers directly to the micro:bit pins. But they're really only supposed to allow you to draw about two or three millionths. So, (A) it's fairly quiet and (B) it's not terribly good for the micro:bit to try and connect much higher current devices like a loud speaker directly to them.

Simon Monk: So, this one that I was just moving about is just a little -

Peter Dalmaris: Sorry, Simon. Just on the topic, I connect little headphones.

Simon Monk: Yes. That works well as well.

Peter Dalmaris: Those simply work. Okay.

Simon Monk: And you can do that with alligator clips, of course, if you're careful how you connect them to the headphones.

Peter Dalmaris: I have to cut and lead in.

Simon Monk: Yeah. You can do that too. But you can connect the alligator leads directly to the plug on the headphones will work okay.

Simon Monk: Okay. Let's have a look at the next thing. So, accessing those extra pins, if you need more than your three GPIO pins, how do you get hold of them?

Simon Monk: There's quite a few different adapters on the market. This is one that the company, Proto-PIC, provide. And it fits onto solderless breadboard, so it's quite handy because it gives you plenty of room to plug your extra components into the breadboard when you're making more sophisticated projects and you need more than the three pins.

Peter Dalmaris: What kind of pins can we get out of that, Simon? Like, apart from the general purpose pins, other communications - you've got something coming up.

Simon Monk: That's coming up on the next slide, actually. But yeah, there's quite a lot of options on there. Before I move on to that, I'll just point out one other thing, is that, one of these adapters - I can't remember who makes it - also has the added benefit, as well as providing pins, they also sort of break out all the extra pins to more alligator clickable sockets, which is quite a nice way if you want to get hold of everything.

Simon Monk: So, what do these extra pins give you? What can you use from them? A lot of them are already in use, some of them are used for the display for the rows and the columns of the display. Some are in use for the buttons and things. But, basically, by the time you discounted those, you can still use them. But you might have to turn the display off or lose certain features of the micro:bit in order to get access to those extra pins. If you're not using that feature, then it doesn't really matter.

Simon Monk: So, twelve of the pins are free for you to, basically, use for whatever you like. And of those, 12, two can be used to provide an I2C interface. This is an interface standard that's quite often used in different types of sensor. So, things like the onboard accelerometer and the magnetometer will be I2C devices. And you can get other things and you can get displays and various types of sensor.

Simon Monk: And then, another different three set of pins can be used to provide what's called an SPI interface. So, yeah, I don't need the second interface today, do I? Serial programing interface, but this is another standard for connecting peripherals to microcontrollers. And it's quite typically used in a lot of displays. So, little OLED displays, that kind of thing.

Simon Monk: You can get some various add-on boards for your micro:bit. So, you can do a lot with the micro:bit on its own. But then, if you want to attach it to a robot and you need to be able to control two motors in two different directions so that the motors can go forwards and backwards and things, you need more than the three pins to be able to do that. And so, this little board, which I think is probably a Kitronic motor controller board, is great for that kind of project. You just plug your micro:bit in the top.

Simon Monk: So, if you're teaching programing, that's great. That's fine. If you're trying to teach a bit of electronics along with what you're doing, then you're kind of lost a bit in a way because, for all of these peripherals, particularly for these for the LED display over on the right and the amplifier, you kind of turned your micro:bit into an appliance straight away. Which is not a problem if you're teaching programing, but I think you lose something if you're trying to learn something about the electronics of the situation.

Simon Monk: So, the approach that MonkMakes we've always tried to stick to is to avoid the use of a connector like that and just use the alligator clips. So, it's a bit clearer what's going on when you're trying to wire things up.

Simon Monk: So, for example, over here, we show how we can use our relay. This is a solid state relay, 16 volts. It can switch up to 16 volts at 2 amps, which is enough to turn a fairly reasonable motor on and off, or turn a good old fashioned light bulb on and off.

Simon Monk: And so, the way it works is the micro:bit is at the top here, it shares of ground connection with the relay board, and then it has a single control wire that just tells the relay to turn on or off. So, the relay is like an electronic switch. And once it's turned on, then that completes the circuit here and the light bulb lights. And it's all kind of transparent how it works.

Simon Monk: We also have boards that are a little bit more sophisticated. So, over on the right hand side, we've got a four digit LED display. So, in this case, to be able to get the information onto the display, what we do is we send serial commands from the micro:bit to here. And the micro:bit has a built-in, both, Block codes and and Python functions that allow you to, first of all, redirect serial to one of the pins of the micro:bit and then to just send a string of text over across to the display.

Simon Monk: So, it's not quite as nice as actually having some proper wiring like we have over on the left, but at least there's something for you to do, for the kids to do wiring things up.

Simon Monk: And then, we have our amplified speaker board that we used on quite a lot of projects, really. And we also have a sensor board which has a little microphone on it so that you can capture sounds, and detect people clapping, and things like that. And then, it has a temperature sensor and also a light sensor. Which, the light sensor is a little bit redundant and the micro:bit can sense light.

Simon Monk: But the interface to allow you to sense light using this LED trick is only actually available on the Blocks version of code. It's not available for the Python version. And I think that's because of the way that the display is driven. I did have a little look at the code to see if I could actually work something up that would do it, but it actually proved quite tricky.

Peter Dalmaris: [Inaudible].

Simon Monk: Somebody cleverer than me will no doubt do it at one point, but it's not there just at the moment, as far as I'm aware.

Peter Dalmaris: Just on these boards, the two features are really like the silk screen. The symbols that you use and the information that you provide is really good. Like, you've got a microphone symbol for the microphone. It's just straightforward. Universal language is the the icons. But another thing that I really like is how you've done your logo there. You've got an LED on the light bulb.

Simon Monk: I was very pleased with that.

Peter Dalmaris: Yeah. I haven't seen that before. I thought this is so clever.

Simon Monk: There are [inaudible] and they do actually look like a tungsten light bulb a little bit. And I keep them fairly dim so that they look like they glow and they don't dazzle you.

Peter Dalmaris: But you've also followed the design feature of the micro:bit with the alligator or crocodile clips. So, you kept the [inaudible] I think is also really good. It really fits well.

Simon Monk: I mean, we've really tried to stick to that. And sort of talking to the micro:bit Foundation, that was their original intention. You know, particularly for kids, you're going to learn a lot more by connecting things up than you are just plugging it in. That's kind of assay command in terms of the electronics side of things anyway.

Simon Monk: And it's fun to learn the electronics. It's not just about coding. I mean, an awful lot of people who write software for embedded devices and not just makers for fun, you know, it's a real job as well. So, it's good to know. Thank you.

Peter Dalmaris: I think you'd become a better programmer if you have a better understanding of the hardware as well.

Simon Monk: I think that's true. You do. Yeah, that's definitely true. So, if you've seen any of out products that I've been talking about today - and I'm sorry if you get all promotional - have a look on our website and we've got a list of retailers who sell them. We don't actually do any selling. We don't do retail. We just sell to our sort of network of suppliers and then they sell them. So, we got most countries covered, I think, now. We've got lots of people in Australia, by the way. We've got about four customers in Australia. Really popular over there.

Peter Dalmaris: No, the micro:bit is really big here. As I said, it's very popular, I suppose.

Simon Monk: Is that part of a national curriculum that's made it so popular or is it just individual teachers?

Peter Dalmaris: Programing is part of the national curriculum, and so teachers are trying to figure out how to best teach programing, and micro:bit is just one of the best options available.

Simon Monk: Okay. Yeah. That's good. Okay. Let's have a look at some programing options. So, the Make Code Blocks, which does have this rather for kids reputation, but, actually, whatever your age, if you've hadn't done programing before, it's a very gentle introduction. It's a good way to get started without having to worry too much about the syntax of the language.

Simon Monk: Because the thing that Blocks really does is it ties down the syntax. You can't put in the double quotes for a string. They're just there. You just write what you want it to display. And you don't have to worry about getting spaces and underscores in the right place and all that sort of stuff. So, it is a good way to get started. And then, at some point you're quite likely to want to switch over to a more conventional programing language.

Simon Monk: And if you're a programmer as a day job, as so many makers are, then you'll find that actually you probably just go straight to the proper code. The Blocks Code actually generates Javascript in the background. And from the development environment - well, I call it a development environment. I think, it's really an editor, they call it - you can see the JavaScript that gets developed. So, you can flip backwards and forwards between the JavaScript and the Blocks view if you want to.

Simon Monk: It sort of does a complete round trip, but then if you break it in the JavaScript, you run the risk of Blocks disappearing and then you have to kind of try and remember what you did. So, generally speaking, if you're doing it in Blocks, it's better sticking in Blocks. And the only time I tend to jump out of blocks is if I want to put in an arithmetic expression and then I'll probably just put it in the JavaScript code because it's a lot easier.

Peter Dalmaris: Simon, a quick question. Can you make your own Blocks? So, can you say that I want to draw my Block or you can name it with whatever you like? And then, on the JavaScript side, write in your own JavaScript code that runs when the Block is invoked, is it possible?

Simon Monk: You can indeed. You can. And what's more, if you switch over to the JavaScript View, there's a couple of buttons you need to press, and then it gives you a template that puts in three example Blocks, and then you can just put your own code behind those Blocks in JavaScript. And what's more, it actually integrates with Git and GitHub. And you can actually write an extension that you can then share quite directly from the web-based development environment. So, it's quite powerful.

Simon Monk: Another level I was kind of sharing of encapsulating code, you can also define functions within the Block language, so it's a little bit clunky, but you can kind of create a function, and then that function contains a load of blocks. It's doable. It does work.

Simon Monk: And then, the next step, really, for most people will probably be to use MicroPython. It's a full implementation of Python 3. It's not cut down. This is Python but I think there are a few things missing. But I think a few of the sort of reflection type things that are not there but, by and large, it's Python 3. But it's designed for running on microcontrollers and it's pretty good. You don't get too many surprises. You might find that your program gets too big if you're quite ambitious.

Peter Dalmaris: It takes a bit more memory space compared to JavaScript, right?

Simon Monk: It does. Yes, it does. It does take some more. Then, the other option is, if you're into Arduino boards, the Arduino IDE is probably one of the principal reasons for the success of the Arduino, because it's a nice editor, it's a good development environment. And it's just complicated enough to be useful without being daunting, as it were. So, you can use the Arduino IDE to program your micro:bit in the C programing language as well.

Simon Monk: Actually, if you look at the Adafruit Learning System, there's some tutorials on there on using Arduino with the micro:bit, I believe.

Simon Monk: And then, the most advanced option, really, is using the Mbed environment, which is sort of advanced C programing options. So, the developers of the micro:bit abstraction layer would have been using this tool to actually write the code.

Simon Monk: So, if you really want to get close to the metal and write your own - I don't know - maybe you want to do sort of real time walkie talkies or something, sending voice from one micro:bit to another, or something, you're not going to be able to do that in Block code. You're not going to be able to do fancy circular buffers and all sorts of things like that. You're going to want something quite powerful. And in that case, that's the sort of situation where you might step out and use something like the Mbed.

Simon Monk: So, even though the micro:bit kind of has this reputation that it's for kids and use Blocks, well, it doesn't have to be. You can use pretty much whatever takes your fancy when it comes to embedded software development tools. It's pretty powerful.

Simon Monk: Okay. So, I'd like to give a little demonstration now on Blocks programing. So, programing the micro:bit in the Blocks environment is done from your web browser. So, if we go to Make Code - it's probably enough - Microsoft MakeCode for micro:bits, we can create a new project. So, if we click on this now, so that's created a project for us.

Simon Monk: And we've got two container blocks sitting here ready for us to put something into. So, we got then these categories here that give us some options. So, let's go in the basic category and we'll start with a show string. So, we got to start with the traditional "Hello, world," haven't we? So then, we can drag that block on start and you get a satisfying little click when they connect. So then, we can change that simulator.

Peter Dalmaris: A simulator.

Simon Monk: Yes. This is really nice.

Peter Dalmaris: On the left, you've got the simulator. You haven't uploaded anything yet.

Simon Monk: No. I think it'll kick in, in a moment. There you go, it's kicking in.

Peter Dalmaris: I noticed as soon as you put that block, they show string Block in the on start Block. The simulator started automatically. It showed what the program was doing.

Simon Monk: Yeah. That's right.

Peter Dalmaris: I don't think you've pressed on the play button or anything.

Simon Monk: No. And what's more, the simulator can also be aware of things like servo motors. So, if we look down, there's lots of various different things. So, we look at pins. We've got servo right pin to a certain angle. And let's say, we put one of those, we'll put it in a forever Block out, no particularly good reason. And I see the simulator is updated. It showed us how to connect up our servo motor, and we could swap that to a different pin.

Simon Monk: So, you could actually do quite a lot without even doing any -

Peter Dalmaris: It shows you had to wire the thing in real life.

Simon Monk: Yeah. It's showing you how it's expecting it to be wired. And then, if you do music and you can play a tone. Okay. If it updates in a moment, it's doing exactly your trick there of connecting your headphone to your micro:bit. You can place that. And it even plays a sound. Okay. Good. So, yeah, that's the essence of the Block programing.

Simon Monk: So, I'm going to actually delete a few of these because they're just distracting, really. So, let's take that out there and we can get rid of that and we'll get rid of the forever Block as well. And what we'll do is we'll just add in a handler so we can put an on button A pressed. For example, we can say, show string, "Hello, Peter". So, now nothing happens until I click on a button A and then it will display the message.

Simon Monk: So, when it comes to actually putting this onto the micro:bit - and I'm just going to switch over to my other camera now - I'll show you the uploading. So, basically, you click on download and then what happens is it generates - that's interesting. I think I have a fairly poor internet, and I think it's being somewhat overloaded. It's thinking about it. It's normally instant. But, I mean, I think this is probably just unfortunate sharing of bandwidth.

Simon Monk: So, in a moment, it'll hopefully prompt me to say [inaudible].

Peter Dalmaris: Simon, as it's doing that, as far as you know, is there a Block editor that sits on the computers that is not running in the browser? I'm thinking a school situation where bandwidth, again, is problematic.

Simon Monk: Yes. I've never used it. I believe there is. I believe there's a way of running this Blocks editor offline. And I think you can also do things with scratch as well. Again, I haven't tried it, but the Scratch Block language, I think that may be more a matter of commanding the micro:bit rather than actually running programs on the micro:bit. For some reason this page isn't - I'm just going to reload this page.

Peter Dalmaris: Refresh. It's the equivalent of turning it off and on again.

Simon Monk: Exactly. Yeah.

Peter Dalmaris: And while that's happening, are you able to save your work on the editor, on the micro:bit, or GU website so it can -

Simon Monk: Yeah. This is interesting because I haven't really sort of exactly how this works, but it seems to associate all the projects you make with a cookie on your machine.

Peter Dalmaris: Right. So, that's how it works. Because you haven't logged on.

Simon Monk: No. I haven't logged on, and you don't need to log on. But what you can do is, once you've got a project how you want it, you can click on the Share button up on the top left here. And when you click on that, it gives you a short URL for your project.

Simon Monk: So then, if you want to give your Block code to somebody else, you can just give them that URL. They put that into their browser or address bar, and then that takes them to their own version of the project. It doesn't edit your version. It gives them a copy. But they're then free to sort of modify that and do what they want with it. So, that's how we sort of share the projects, and how I share the projects in my book, and how we share the projects that go with our various kits.

Peter Dalmaris: Right. Yeah. Well, another question is, once you download this program, what kind of file do you get? Is that a file that contains JavaScript or some kind of compiled code like a bytecode? Or it's the micro:bit?

Simon Monk: You know, I really ought to know, but I don't.

Peter Dalmaris: You don't need to know.

Simon Monk: No. I haven't needed to know, actually. Wat you get is a HEX file, which I assume is some kind of binary that's encoded in a text file, that then gets uncompressed by some kind of bootloader and executed. But, to be honest, I really don't know the exact details of that. I think, actually, Google Chrome is the recommended browser, but here I'm using Safari. And so, let me just close that and let's change this because that's not quite what we had.

Peter Dalmaris: Simon, just so to give a bit of context, just a few seconds ago, you tried to download the program from Chrome and it wouldn't download. And it seems like there was a browser issue, so you switched to Safari. And you are going to attempt to download the same program.

Simon Monk: Yes. Let's give it a go. So, we'll click on download. Okay. That's more like it. So, pretty much instant. And it's given us this HEX file that is called Untitled. You can give your project names, which is a more sensible thing to do by using this field at the bottom of the screen.

Simon Monk: But, now, if we click on the download button, what we can do - this is a side effect of using Safari. When you're using Chrome, what it does is it prompts you or you can set it to prompt you where you want to save it. And then, you can immediately just save it directly onto the micro:bit, which is the most convenient way of doing it. So, I'm actually going to have to do is find what - I'm guessing it's putting it -

Peter Dalmaris: So, the moment you have connected your micro:bit to your computer via USB?

Simon Monk: Yes. Exactly.

Peter Dalmaris: And it appears as a file or as a drive.

Simon Monk: It masks as a drive. And then, it's just a case of copying the file over. This may or may not be the right program. But this HEX file gets saved to your downloads area or, more conveniently, you just save it directly onto the micro:bit. So, in this case, I'm just going to have to flip the share again to show you the finder.

Simon Monk: Okay. So, we got a HEX file. And to install it on the micro:bit, you just pick it up and you drop it on there and it copies it. And I'm going to do that again in a moment, because I just want to show you the micro:bit. So, I'm going to show my screen as well. I want to show you what goes on, on the micro:bit. So, let me just stop the share. And I'm just going to switch over cameras to an overhead camera I've got pointing at the real micro:bit. There we go.

Simon Monk: So, what happens when you drag that HEX file onto your micro:bit, you see a little light flickering. I don't know if you can see this, a bit of a reflection.

Peter Dalmaris: Yeah. It's coming through.

Simon Monk: That shows that it's flashing the program onto there. And then, once it's finished, there you go, your code is then on the micro:bit.

Peter Dalmaris: Reset.

Simon Monk: I'm not entirely sure what program ended up on there. It's not terribly accessible. There we go, "Hello." So, you get this scrolling text. And it's surprising, you have to kind of watch the text going past fairly attentively. And not have it going too fast and then you can read it quite well.

Peter Dalmaris: It can only show one character at a time because it's a small array.

Simon Monk: Yeah. Five by five isn't very much at all. And they're quite widely spaced apart as well. But funny enough, I think the scrolling movement almost makes it clearer to see the text actually big, so that your eyes sort of adjust to the movement, I think.

Peter Dalmaris: I find that it's good for little icons. So, if you want to say, for example, attention or reset or something like that, like a keyword, it's better to express that with an icon because then it stays there.

Simon Monk: Well, that's true. Yes, that's very true.

Simon Monk: So, yeah, you can do all sorts of things. And going back to using icons, you can actually make up your icons. So, this little box here on button A pressed, you can click on those little cells, the five by five cells, and design your own pattern to display. And there's also a load of predefined patterns that you can make use of as well, smiley faces and frowning faces and that sort of thing.

Simon Monk: Okay. So, the other main option that people use most commonly is MicroPython, as we were talking about before. And there is, actually, an online editor that takes a very similar approach to the Blocks code available for MicroPython.

Simon Monk: But going back to your comment earlier about using offline tools when you haven't got an internet connection, then actually what most people do is use the Mu programing environment, the Mu editor for micro:bit. Again, it goes back to the sort of Arduino IDE style of integrated development environments. If you're used to using Eclipse or IntelliJ IDEA or whatever you thing is, a ludicrously simple integrated development environment.

Simon Monk: But, actually, it gives you most of what you need, and it's very easy to use, very easy to get started with, and has a number of features specific to the micro:bit that make it really nice, actually, and very good.

Peter Dalmaris: It's important for the editor assignment to be friendly to the programmer, right?

Simon Monk: Yeah, very much so. And Mu, although, we're using it for the micro:bit, you can use it for writing Python programs on your Raspberry Pi or your laptop. It's quite a sort of universal simple to use Python editor that comes in a few different flavors. And we're looking at the micro:bit flavor of it, which is pretty nice.

Simon Monk: So, let's have a quick demonstration of using Mu. So, this is Mu, and you can see it's basically driven by these buttons along the top. There is no menu system. These are basically the options you got. You can load and save files, as you'd expect. You can create a new file or program. And then, you can flush them onto the micro:bit when you're ready.

Peter Dalmaris: Directly.

Simon Monk: Yeah. Directly. So, again, because it's a piece of software running on your laptop, it's kind of easier for it to integrate directly with the micro:bit and just send the code down there. So, we can just put in a bit of code here. It also has what's called a REPL, a read–eval–print loop, which is basically the Python command line, but actually running on your micro:bit, which is quite something, really, isn't it?

Peter Dalmaris: So, essentially get onto the micro:bit and program it directly on the fly.

Simon Monk: Exactly. Yeah. So, for now, we'll write a little program. We'll just go back to scrolling a message here.

Peter Dalmaris: So, documentation just flies as you're typing in.

Simon Monk: It does. And you can also get completions, so once you do it -

Peter Dalmaris: Your construction, you get documentation, you get a bubble.

Simon Monk: Yeah. And if this methods available on that object, they appear, and you get some quite nice help with writing the code. So, if you're used to using a normal text editor, you'll find a lot of the features that you'd hope to find there. So, having written that, we can then flash that onto the micro:bit and the yellow light will flicker and then it'll display "Hello".

Simon Monk: Unfortunately, you don't get an emulator with this like you do with the Blocks code, which is a shame, really. But if we turn it over - and I'll press the reset button on the back and we got "Hello" scrolling through there.

Simon Monk: Okay. So, I'm going to actually show you the REPL, this is a nice feature. I need to share the code again, don't I? Okay. So, now, if I click on the REPL thing, we'll see the flashes become grayed out because you can't upload something at the same time as you're connected to the micro:bit. So, this is the micro:bit running a Python interpreter. So, I can type things on here like 2+2, and it'll evaluate it for me there and then.

Simon Monk: So, this is a loaded up program that just displayed "Hello". And then, after it's done that, it's then fallen off the bottom of the program and it starts, and then I can have access to the program through the REPL.

Simon Monk: If I was to start the REPL while the program is still running, it would just kind of interrupt the program and allow me to run commands.

Peter Dalmaris: So, on the program that you uploaded, the one that displays "Hello" is still on the micro:bit and you can invoke it now via REPL, Right?

Simon Monk: I can't invoke it in the sense of saying run yourself. What I can do is think I could do something like display.scroll.

Peter Dalmaris: Essentially, you program it on the fly now. And this way, you can also access its sensors so you can check for the magnetometer values, for example, via the command line interface.

Simon Monk: Exactly. Yeah. Can you see that on the screen? It's scrolling across a new message.

Peter Dalmaris: Yeah, yeah, yeah. Yes, I can.

Simon Monk: So, I think, actually, it's Compass.

Peter Dalmaris: It was just an example.

Simon Monk: I mean, yes, you can. Or I could if I could remember the syntax. I can't remember the command. But, yeah, you have access to everything on there. And actually going back to the sensors, you can write a program that displays numbers. So, let's very quickly just have it. So, you get a nice indentation with Mu. It takes care of most of the indentation that you need to do when you're writing Python automatically.

Peter Dalmaris: Thank goodness.

Simon Monk: Yeah. And then, if you want to, you can plot data. So, let's just have x=1. But when you're plotting data, because you like to be plotting sets of data, you actually have to include it. The thing you plot has to be a list. And the way you tell Python that something is a list is you put this comma on the end. So, I think if we stop the REPL, flash it onto the board, and it's flashing. There we go. It did it quite quickly.

Simon Monk: Now, if we switch over to the plus view, you can see that our value is gradually going up. So, that's not particularly useful. It'd be far more useful, in fact, to remember the syntax for reading a sensor value. But you get the basic idea. That's catching quite quickly, isn't it? We're up to 12,800 already.

Peter Dalmaris: A very quick counter. That's another labor. I guess it's a few nanoseconds for each loop.

Simon Monk: Yeah. So, I mean, this data is coming over the USB connection between the micro:bit and your computer. So, you can do some really nice little sort of science experiment type things like that.

Simon Monk: Okay. Good. I was going to say Python has pretty much all the same stuff replicated that you have in the Blocks code. And, generally speaking, using a very similar type commands to it. So, once you've learned one of them, you can just go looking for the same command in the other environment.

Simon Monk: So, let's jump back to my presentation.

Peter Dalmaris: And, Simon, you are correct. A class name in Python, is Compass. So, you'd say something like compass.calibrate to start it.

Simon Monk: Yeah. It is a bit strange. The first time you use the compass, you have to calibrate it. Do you remember the thing where you got an iPhone and you had to sort of, like, wave it around and then you finished doing all that, and it still has no idea which direction you're facing? Well, you do the same thing with the micro:bit. It's just a ritual. It means nothing. It sort of helps.

Peter Dalmaris: It's just interesting to see that, at least, it knows that you have moved. It may not be very accurate, so you wouldn't bet your life on it.

Simon Monk: You wouldn't. I include compass projects in the book that basically points left and right, to tell you to turn. And so, when it's pointing straight ahead, you're facing north type thing. And it's not bad. It's roughly right. You do have problems if you're sort of - well, it didn't work very well indoors. But normal compasses don't work very well indoors.

Peter Dalmaris: That's right. You need [inaudible] for that.

Simon Monk: Exactly. Or a sense of direction, if I had one.

Peter Dalmaris: Ability to navigate by the stars if it's night.

Simon Monk: Yeah. That's always useful. This is a little example that is one of the projects. It's based on one of the projects in the book, but we're now selling it as a kit. And it just uses a micro:bit and a servo interface board that just makes it easier to connect the servos. In theory, you can connect them directly to the alligator clip sockets.

Simon Monk: But then, with what? I mean, you can't get an alligator clip or crocodile clip to male header pin leads that you could use to directly connect it. But then, you've got to kind of share the power connections. So then, how do you split it out? And then, you end up with loads of crocodile clips on top of each other, and then the whole thing becomes a mess.

Simon Monk: So, our little servo breakout board also allows you to provide external power to the servos quite easily, and provides polarity protection, and a big capacitor to try to keep things working well. And then, there's a loud speaker at the back so that you can make beeping noises or you can use the micro:bit, MicroPython has a library for doing speech, which is really, really crude. It requires quite a lot of imagination. But then, if it's a robot speaking, you don't want it to be speaking too eloquently, do you? You want it to sound like a robot.

Peter Dalmaris: I have played with this. It does have a lot of different aspects of the sound is coming out that you can control programmatically. So, I spent way too much time increasing the page, the speed, the various other settings, I can remember. It does get a bit of a waste of time very quickly because it doesn't get any better. It's just different.

Simon Monk: You can make it sing, I think. You can kind of choose the pitch, it makes the sound out.

Peter Dalmaris: But it's really fun for kids. I can spend a lot of time just changing and tweaking those parameters to make it sound different.

Simon Monk: Yeah. Absolutely. I mean, it's a lot of fun for that sort of thing. Okay. So, I'm going to switch cameras again, I'm afraid. So, I'm going to turn this around so we can have a look at this project.

Simon Monk: So, this is the project in real life. And I'll just turn the battery pack on. I'm going to move the microphone a bit closer to the speaker so you can hear the wonderful sounds it's making. Did you get that? It was supposed to be exterminate. It's doing it's [inaudible] impression of exterminate.

Simon Monk: So, going back to how this is put together, we got the servo motors on the top. It's surprisingly difficult to attach a ping pong ball to a servo motor. So, we ended up having these little mounts 3D printed so that it fits onto the top of the servo arm. And then, we got the micro:bit here, which is kind of sandwiched with the servo control board. So, it's connected to the servo control board through these screws [inaudible] that go through.

Peter Dalmaris: How simple is that?

Simon Monk: Yeah, it is. And then, the speaker on the other side uses the alligator clips, but it then connects off to the micro:bit. So, we're actually using all of the three accessible pins of the micro:bit in this project, which, you know, does tax it a fair bit.

Peter Dalmaris: It sounds a bit agitated.

Simon Monk: It is.

Peter Dalmaris: It won't stop threatening us.

Simon Monk: Yeah. It is a bit threatening. Occasionally, it goes a bit cross-eyed as well. I think we can turn it off now.

Peter Dalmaris: So, that's a little kid. Then, I guess, can you connect things like sensors, let's say, an ultrasonic distance sensor so that it can detect people and then threaten you? It can do things like that?

Simon Monk: It would be very nice to, but we sort of run out of pins, so you'd have to sacrifice something. You'd have to make it one eyed, then you could.

Peter Dalmaris: I guess you can change the eye for a laser or something like that.

Simon Monk: Well, yeah. I mean, there's tricks you can do. Because I use the accelerometer, so when you nudge it, it makes a noise. And it also makes a noise at random every so often is the idea. And in the kit, we have sort of three or four projects that you can build, a mixture of MakeCode and Python that you can then use. And you can completely do your own thing with it.

Simon Monk: And I've seen some very nice sort of similar things where people kind of dress it up so they'll get sort of fur you use for making soft toys, you know, the sort of fake fur that you can put it around. And so, you could make it look like an animal or something if you wanted to get away slightly from the robot theme. Well, it still sounds like a robot, wouldn't it?

Peter Dalmaris: Yeah. I'm thinking another possibility would be, because there is a wireless interface that is fairly simple, maybe interface two micro:bits together. One could be connected to sensors. The other one could be controlling the voice and the eyes. And then, they can work together.

Simon Monk: Yeah. Or you even just use it as a remote control. So, you could actually use the accelerometer to change the eye positions, couldn't you? So, as you tilt the second micro:bit, the eyes move on the first one. So, you'd have like a controlling one and then a used one.

Simon Monk: And then, I think putting the radio on it was a stroke of genius by the designers. Because if you're using this in a classroom where you've got a whole load of kids, then making projects that can interact with each other just makes it so much more fun than just working on your own.

Peter Dalmaris: It gets the [inaudible].

Simon Monk: Yeah. So, let me go back to the maker theme, you've got all of this on one board, and it's not a particularly expensive board. I mean, I did make a bird scarer thing for the garden, actually, with two micro:bits using the wireless thing. So, it will have the wireless thing on the receiving end as it were. I had one of our relays to drive a motor to move something to scare birds. So, you could just kind of wait until they settled and press a button and scare them away. That's the sort of project you could do with it quite easily.

Peter Dalmaris: And I believe there is a library that allows you to create a mesh of micro:bits so that they can -

Simon Monk: Yes. I haven't used that. I mean, the built-in wireless stuff is easy enough to use, And, essentially, each micro:bit, when it transmits, it broadcasts. But you can kind of associate an IDE with it so that if you only want one person to take notice of it, then if the message is not for you, you ignore it type approach. So, you can use it really to sort of teach a little bit about networks and how machines communicate as well. I know it's been done for that sort of thing.

Peter Dalmaris: Or, you know, the Internet of Things is all the rage these days. How can you connect the micro:bit to an Internet of Things or, actually, cloud application to data log or control via the internet?

Simon Monk: I think there are WiFi boards designed to connect the micro:bit. And once you've got one micro:bit connected to the internet, then there's no stopping you because your other micro:bits can use that micro:bit as a kind of a gateway and then send things.

Simon Monk: I'm probably wrong or I'm maybe just ignorant. I don't know of any actual sort of nice to use gateways that are available and provide code at the right sort of level of abstraction. [Inaudible].

Peter Dalmaris: That's an interesting question because I guess one of the big successes of the ESP32 was the WiFi integrated capabilities, and that really brought it to its own, I guess, category of product, the price.

Simon Monk: Yeah. Yeah. Absolutely. And I guess for makers, that's probably something they're going to be interested in. But I think there is a lot you can do without that facility. And I think by the time you're adding on extra boards.

Peter Dalmaris: Somebody made a project where they connected the micro:bit to an ESP8266 for WiFi. And from there onto the internet.

Simon Monk: Yeah. Well, you can, of course, because the micro:bit will do serial through any of its pins. So, the ESP8266 and, I think, DSP32, if they got kind of their default firmware on, you can just send serial commands to them and then they will do things like connect to an access point, and send data, and things. They're probably pretty straightforward.

Peter Dalmaris: Great. So, yeah, I'm not sure if you have concluded your presentation because, if yes, I've got questions.

Simon Monk: Okay. Yeah. No. That was the last slide apart a few sort of information slides.

Peter Dalmaris: Thank you. What I take personally from your presentation is that, the micro:bit is very versatile and really quick at prototyping things. I'd say because of the tools that you showed us, the online and the offline and the Mu editor, at prototyping, it's really quick. And working with the Python or MicroPython language, again, that makes it a very good platform for people that are not really keen to learn C.

Peter Dalmaris: If you do want to be a programmer, many of us want to build things. We have to learn how to do a bit of programing because our objective is to build something that moves, and make sounds, or something like that. So, it's just an easier way to program these types of behaviors, then I think Python is a good choice.

Simon Monk: I think that's true. And I think as well the default micro:bit libraries that support the hardware for Python are actually very nice. They're very easy to use. And kind of you have the advantage that they've all been designed by one person. So, they fit the same style and it's all consistent.

Simon Monk: And one of the things you find with Arduino library, particularly as a beginner, you'll find all sorts of different styles for the libraries. Some of them will create instances of objects. Some of them will have a single object that you then access class methods on.

Simon Monk: And, no, there is no kind of one way that people do these things. And some of them will be horrible low level interfaces that you need to change registered addresses and all sorts of stuff you really don't really want to do. And then, other ones will provide a high level interface.

Simon Monk: Whereas, the micro:bit, because it has this data abstraction layer where they clearly thought very carefully about exactly everything that should be in there, that 90 percent of what you're going to want is already there with a nice, easy to use function immediately at your fingertips, without too much to worry about. So, you're right, it does make it easy to program.

Peter Dalmaris: It's very interesting, the design philosophies behind those projects, so the people that made the micro:bit had children, students of a specific age, who most of them had never programed before. So, they built this technology for that specific target audience, that was the avatar.

Peter Dalmaris: But when I or somebody else, an Arduino maker, releases a library, typically, we write the library for us first. It works for me perfect. If anybody else wants to use it, you can. And that's pretty much how the Arduino ecosystem came about, primarily, for whoever coded the library. I think I understand what it's doing, so I'll use it. So, that can be a problem when you're new in this sort of environment. Too much choice sometimes is a bad thing.

Simon Monk: Yeah. Exactly. I mean, yes, it's designed for kids, but being designed for kids is also what you need if you're new to a technology. You don't want to have to wrestle with a horrible first experience of trying to get your board to work. You want to be able to make things, as you say, with as little resistance as possible, really. And the micro:bit does that.

Peter Dalmaris: I agree. I think that's a very good feature of the micro:bit ecosystem because it was designed for kids. But hardware-wise and software-wise is fully capable to do a lot of advanced projects like what you showed us. The fact that its user interface and its programing interface is well thought of. And it's easy to learn. It's a very good way for people to create those things that they want to create without the complexity of a more chaotic ecosystem like the Arduino.

Simon Monk: Yeah. I agree completely, yeah.

Peter Dalmaris: So, just a couple of concluding questions. Could you summarize your presentation to a few key learning points that we should take away?

Simon Monk: Yes. So, I think, really, we kind of discussed a lot of it. I mean, yes, it is good for makers. It's a board you should consider more so if you're just getting into making. If you're new to making, then really the software will help you out a lot. The built-in peripherals will probably help you out as well, because you don't have too much initial pain trying to connect up some tricky piece of hardware to it.

Simon Monk: It's flexible. You've got lots of programing options. You can start simple and use the Block approach. And then, as you get more familiar with coding and the technology, then you can kind of step up to more advanced features that will become the quicker way of doing it for you, once you get used to them.

Simon Monk: The built-in radio is excellent because, I mean, it just allows all sorts of applications open up when you've got that. And if you tried doing packet radio with an Arduino - I think I've written one library to try and simplify it for one particular packet radio chipset - there's lots of options available. They're all different. Some of them are really quite difficult to program. You've got to understand hexadecimal. You've got to understand registers and have the I2C communication protocol works.

Simon Monk: And if you just want a sense of reading from one device to another device, you shouldn't have to go through that pain. And the micro:bit because it's got this nice radio interface, you don't have to. It's a really good way of making wireless projects.

Simon Monk: And as I was saying before, enough on board peripherals to get you started. So, you've got a little display that you can use for debugging, if nothing else. So, at least you can see what's going on in your program because you can just display little messages on it when you get to certain points in your program, if you want, for debugging it.

Simon Monk: If you're using it in the Python environment, then being able to have the REPL, the read-eval-print loop, where you can run Python commands directly on your micro:bit and see the full error messages and interact with it. Again, it's very powerful debugging tool and helps you get a hang of what's actually happening on the hardware, I think, is another benefit of that.

Simon Monk: So, it's a good device. Get one and have a play with it.

Peter Dalmaris: It's so cheap, really, just one or two. It's cheap. But also it's a learning curve to get started with the user peripherals onboard is close to zero. Seriously, it's amazing.

Simon Monk: And, literally, you need a USB lead on a micro:bit. You don't need anything else.

Peter Dalmaris: And I think it comes with those in the box.

Simon Monk: Yeah.

Peter Dalmaris: Great. Okay. Now, resources. So, yes, I do want to learn more, what can I do? What's my next step?

Simon Monk: Okay. Well, I mean, the micro:bit official website is a very good place to start, actually, microbit.org. Because as well as that being the place where you'll find the Blocks editor, if you click on a few links, you can also find example projects there, you can find tutorials, and a lot of stuff to get you started.

Simon Monk: I mean, I have a couple of books about the micro:bit, and there are plenty of good books. Project books are quite good because I think they give you inspiration. And they'll give you a little sort of coding tricks to get you going. And if you want to know how to connect to a particular piece of hard way, you might as well have let the author have the pain of discovering how to do that and then you can just copy the code.

Simon Monk: So, there's project books and there's coding books aimed at different audiences, some are aimed at kids, some are a little bit more advanced.

Simon Monk: So, my two books in this area, the Programing the micro:bit is as much about learning Python as it is about learning the micro:bit. It really is kind of learning Python using the micro:bit, might have been a better title for it in many ways. So, if you want to get into micro:bit for its original purpose, which was kind of teach coding mostly, then I hope you'd find that quite useful.

Simon Monk: And then, the micro:bit for Mad Scientists is a project book with the old science experiment in it. So, I do a few things with the magnetometer and the accelerometer and things just to give it a bit of a science-y edge. So, moving a magnet closer and further away from the micro:bit and looking at the readings and discovering the inverse square law, all that kind of thing.

Peter Dalmaris: So, I've got to say that anything that blends disciplines together, like electronics, programing, science, I really like that stuff. Like, you want to include multiple aspects of capabilities with a learning tool like the micro:bit. So, you want to borrow from science, from engineering, from aquaponics, perhaps, I think with your plan.

Simon Monk: Well, I mean, in education, for topic-based learning, where you're looking across different disciplines, then you can do a lot with a micro:bit. There's some very interesting experiments out there using it. One of our Canadian customers, they actually commissioned us to design a board for sensing CO2 levels. And this was in collaboration with the Canadian Space Agency.

Simon Monk: So, the idea is that the schoolkids can have discussions with the astronauts about CO2 buildup and that kind of thing, and they can log their own readings in the classroom and see how it gradually increases.

Simon Monk: And they can take that away and do different kinds of science experiments. Putting the CO2 sensor in with a plant in a pot in an enclosed environment, seeing what happens to CO2 levels in light and day.

Simon Monk: And, of course, using things like the data logger that you have on Mu, then you can plot these results. The micro:bit has a very rudimentary file system, so you can actually save a fairly small amount of data onto it, if you want to create data logging type experiments as well.

Peter Dalmaris: It takes you to a whole different dimension. It's one thing to read in a textbook that plants produce CO2 at night, but another thing to actually read it and see how it fluctuates day and night. That's amazing.

Simon Monk: My last question, Simon, because I know it's getting quite late there, is, contact details. So, how can people get in touch with you?

Simon Monk: Yeah. If you go to monkmakes.com, there's a contact page on there. And, similarly, I think I've got one on simonmonk.org. And Twitter is probably, most of the time, the best way to get in touch with me. So, if you message me on there, then I'm probably, most likely, to see that one most soon.

Peter Dalmaris: Awesome. Yeah. I'm on Twitter as well, but I haven't been very good at it.

Simon Monk: I'm not very good at it either, to be perfectly honest. But it is a useful tool, actually. That's the thing. And it is a good way for people to communicate, especially when your email system becomes so overloaded that you end up missing.

Peter Dalmaris: Yeah. It becomes uncontrollable after a while. So, just short messages. That's what I like at Twitter, short question to the point. Click together the message, of course.

Peter Dalmaris: Well, thank you very much, Simon. It was a real pleasure. Your presentation was excellent. I learned a lot. So, thank you for taking the time to develop that for us.

Simon Monk: Yeah. You're most welcome. I enjoyed it. Thank you.

Get life time access to all Maker Mind-Meld masterclasses

Watch each masterclass from the comfort of your own home and learn about their tools, techniques, and thinking processes so that you can become the best maker you can be, at your own pace.


Get audio downloads of all 22 session, the Maker Mind Meld "Playbook" session notes.

We publish fresh content each week. Read how-to's on Arduino, ESP32, KiCad, Node-RED, drones and more. Listen to interviews. Learn about new tech with our comprehensive reviews. Get discount offers for our courses and books. Interact with our community. One email per week, no spam; unsubscribe at any time

Image
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}