I’ve been having fun getting to know the micro:bit with my students this year. I often plan lessons based on what they tell me they’d like to learn, and they were really intrigued by the idea of radio communication between micro:bits. So I decided to learn about it. There is a “firefly” tutorial on the documentation page here:
But I felt what I wanted to learn was even simpler than that. I just wanted to know how to send simple messages, like numbers and text, between micro:bits. I ended up making my own little tutorial and maybe someone else will find it useful.
First, I had the students copy this program and download it to their own micro:bit.
from microbit import * # must include these two lines to use the radio import radio radio.on() # any channel from 0 to 100 can be used for privacy. radio.config(channel=99) while True: if button_a.was_pressed(): # send this message over the radio. Up to 32 bytes OK. radio.send('HAPPY') sleep(200) if button_b.was_pressed(): radio.send('SAD') sleep(200) # if there's a message in the queue, retrieve it. Up to 3 messages # can be in the queue at once, and if it's full, messages are dropped. msg = radio.receive() # ALWAYS CHECK for None.. if msg != None: # as long as there is a message, display something if msg == 'HAPPY': display.show(Image.HAPPY) sleep(200) display.clear() elif msg == 'SAD': display.show(Image.SAD) sleep(200) display.clear()
After the students downloaded the program, of course they started fiddling with the buttons to see if anything would happen. The buttons don’t seem to do anything on their own device, but they would notice their device would randomly show smiley faces and sad faces. Eventually a pattern starts to emerge and students realize their button-presses are affecting the other micro:bits in the room. After a few minutes I ask the students to try and make my micro:bit happy, and they all press button A. They make my micro:bit sad by pressing button B. If a student or two can make inferences from the code, they change the code and make it send messages other than “HAPPY” or “SAD” and then my micro:bit, and the others, start scrolling strange messages. It’s hilarious and chaotic.
So next we look at the example code and dig into how the radio works. We analyze the program that’s already on their micro:bits and then, I help the kids write a very basic skeleton program that just selects a channel, sends a message and scrolls all received messages on the display. Students could use it with friends to send secret messages during class. They had fun making their skeleton programs and sending messages to me and each other.
Some students took it farther and started setting up a protocol for their micro:bits – a little agreed-upon system of communication between them. If one message is received, play a tune. If another is received, sparkle the LED’s and send a message back. This is a great direction to take future lessons – to chat about how we can make computers communicate with each other so the communication is efficient, flexible and free from errors in different situations.
I envision using the radio commands when we learn about looping and iteration. I’ve seen fun examples of games that use multiple micro:bits and think there is a lot of potential there!
I made a video with the basics of the lesson – maybe someone else will find it useful if you’re using Python with your micro:bit.
My dear colleague Tracey Winey (you can find her on Twitter at @winey02 ) introduced me to the idea of philanthropic engineering – that students can make projects in class that can be useful in real-life for a good cause. Years ago, she and some other educator colleagues came up with the idea that kids could genuinely tackle light poverty – the lack of artificial light sources after darkness falls. In areas where electricity isn’t available or isn’t reliable, a nice light source can make a huge difference when it comes to studying, cooking, doing chores or staying safe. Our school and others around the world have already sent dozens of little lanterns to people in Guatemala, Honduras, Nicaragua, Uganda and other locations. You can find out more about the effort at http://e-b.io
This is normally an after-school program and my after-school hours are really limited with a busy family. This year I am getting my whole electronics class involved by having them create lanterns for Engineering Brightness. After some tweaking of the process this is where I am with it now.
- I provide the electrical design and all of the parts, and the students pay a small class fee to cover costs.
- Students solder the circuit together by following instructions I provide.
- Students design some kind of case or enclosure for the lantern, by prototyping with cardboard and other household materials.
- We will present and share the lanterns with their enclosures, and 3-D print a handful of the best designs.
- As a class we’ll assemble the final projects and then put them in a box with some cards and photos. We will send them to either Liberia or Guatemala where Tracey has some contacts through her church.
I will share plans on how to make these if you’d like to have your class try it out as well. After we have a couple of enclosure designs, I can also share the 3-D models of those so you can print them and assemble the whole thing.
Before I get to the how-to’s, of course the big question here is what are we trying to teach the students? What do I hope they learn and how will I know they have learned it?
We’re working a little outside Colorado’s state science standards, but I don’t think every worthwhile learning experience has to be linked to standards. I also believe it’s OK if every kid’s learning is different. Here are some of the areas in which I want to see growth from the kids.
- Understand that electrical circuits require a closed path, a load, and a voltage source, and identifying those in a real-life circuit.
- Identify some basic electrical components, what they do and how they work.
- After working with a design, identify ways it can be improved such as cost, size, durability and quality. Know what a tradeoff is and make smart tradeoffs when improving a design.
- Consider a purpose of a product and improve it for that purpose.
- Identify common electrical problems or mistakes and describe how to fix them.
- Solder safely. Produce work that improves in quality over time.
- Make something that will be meaningful to another person.
I based my little lantern design on a “Joule Thief”. Normally, a white LED takes around 3 volts to light up brightly – so you need two or three AA batteries for the purpose. Three are better than two, because once the batteries drain even a little bit, two won’t work well anymore. Rechargeable batteries are important because it is difficult to replace batteries in light-poor areas. The Joule Thief conserves cost and battery life by using a transistor and a ferrite toroid to make a single 1.2 volt rechargeable battery create a pulsing voltage that is enough to light an LED. It does this by making a magnetic field oscillate and it adds to the battery voltage. I go through some basic circuitry lessons with the kids, and we learn about LED’s and resistors, series and parallel circuits and what they do, and then we watch the joule thief video and compare/contrast it to a plain DC parallel circuit.
The students learn how to solder first by watching videos, and we take a soldering safety quiz before they are allowed to solder. Then students make their project bags and start assembling lanterns. I have had parent volunteers come in to help supervise the soldering and that has been a huge help.
I made this YouTube tutorial that shows you how to assemble the Joule Thief project. The students watch this video and pause it in spots to assemble their lanterns.
In the video description, I’ve included a parts list and the instructions for making the circuit boards. I’ll also include it here. You just have to order some cheap electronics online, like wire, transistors, solar panels and ferrite toroids. The lanterns take one of everything, execpt LED’s. I used ten LED’s for each lantern. It’s all in this spreadsheet. You can make them for around $5 each if you shop around a little. I use eBay, Jameco and Amazon for my purchasing.
The circuit boards are really fun to make. A couple of years ago, one of my former students came to visit me and showed me some custom circuit boards he created. He taught me how to design and upload my own… sometimes you’re the student, sometimes the teacher. The basic process is:
- You lay out all of your components and the wiring using a program called Fritzing.
- You export your Fritzing circuit to Gerber format. This gives you a bunch of files in a folder. If you want to use mine, you can download them here. GERBER FILES
- You zip the folder using something like WinZip.
- Go to Seeed studio at http://seeedstudio.com/
- Select their Fusion PCB service.
- Upload your zipped Gerber folder. You can use their Gerber Viewer to see the circuit board and make sure it looks OK.
- Choose your options. I prefer a 2-layer board because the students get a solder pad on the top and bottom of the circuit board. My board’s measurements are 42.8mm*67.2mm and sometimes it doesn’t update correctly.
- Decide how many you want. Place the order and it will be shipped to you!
Some of the first students finished soldering their circuits after about 3 classes, and they’re making little enclosures as well. I’m asking them to prototype enclosures using household items – and we’ll 3-D print the best ones. Here are some of the ideas so far.
I really love literal “light bulb moments” when the students finish soldering, flip the switch and the lights come on. It makes me proud every time I finish one, and I’ve done this a few times by now. It’s exciting for a first-timer.
We’ve watched some videos about Liberia and will be learning about Guatemala as well. I want the kids to start to get to know the people who will be receiving their little solar lights. Fingers crossed for a successful finish to the lanterns, and I really think if nothing else, they feel more competent and confident when it comes to working with circuits.
I want to send a huge thank you to Shreya Shankar, a CS student at Stanford, for putting together a really well-written blog post about one of the ways in which being a woman in tech is a strange and sometimes isolating experience. In this article, Shreya talks about the complex feelings associated with being hired into a diversity program. There’s the resentment and blame cast on you by your male peers. The feelings of self-doubt about your qualifications. A little guilt, maybe you aren’t even sure about your level of passion for engineering. The annoying voice that creeps into your head when you introduce yourself as an engineer – the one that says “they are looking at you right now and casting you as the token diversity hire who doesn’t know what she’s doing.”
Shreya, I felt all of this and more when I was an engineering student. After my sophomore year in 1994, I applied for an internship at AT&T. It was a diversity program specifically geared toward women and minorities in tech. I spent the summer writing Unix shell scripts to run the system backups, and plugging tapes into drives to test the backup system. AT&T, at the time, ran a really good summer program. We attended lunch talks with speakers who talked about everything from negotiations between men and women to AT&T’s outreach to the gay and lesbian community. We went on outings to theme parks and restaurants to get to know each other better. It was the first time I’d ever worked with such a diverse group of young people and I learned so much beyond the technical skills. My older co-workers said they liked the backup scripts I wrote and would continue to use them. I thought it was a successful summer.
The following year, I applied for, and got, a second internship with Hewlett-Packard. I was over the moon excited, because I’d get to move to Colorado for the internship and HP was going to pay me a moving allowance. HP’s program wasn’t exclusive to women and minorities, but diverse hires were a priority and we all knew it. I was going to write a configuration utility for some test and measurement equipment. It would be a great adventure working for a really cool company and I was stoked.
I ran into one of my friends on campus one spring day before the end of the semester – and I’ll never forget the conversation we had. I asked him about his plans for the summer and he said he would probably be going back home to work for his dad because he didn’t get an internship. I said Oh. He had already heard about my opportunity through mutual friends. He had no cheerful words for me. He pointed out that he had a 4.0 grade point average, and I only had a 3.6 and we were both involved in a lot of activities and then he practically spit out the words when he said “And I don’t have a summer internship and the only reason you have one and I don’t is BECAUSE YOU’RE A GIRL.”
It stung! It stung then and those words stayed with me and they STILL sting. We’ve stayed in touch from time to time and I’ve never brought up that conversation again. He did get a nice job at a big tech company later and has done well for himself, so whatever happened that summer didn’t ruin his life. I assume he was upset and angry and it made him feel better to bring me down a notch. I’m sure he was resentful that a student he perceived as less qualified got an internship he wanted. That awkward moment was terrible and I don’t even remember how I ended the conversation. I knew at that moment he was angry and I just wanted to get away.
And Shreya, and any other women out there who have had those moments, I want to give you some perspective as someone who did end up in a good career as an engineer and somewhat successfully finished that gauntlet. (I did change careers after a decade; I’m now a schoolteacher. I have no regrets about either career.)
- You can really enjoy being an engineer if you work for a good company with a good support system and culture. In my careers at AT&T and Hewlett Packard in the 1990’s, they did a lot of things right. The leadership was committed to making the workplace welcoming for everyone. They held lunch talks and events geared toward bringing out diverse voices and problem-solving together. They created a culture that welcomed different, even opposing, perspectives. They had employee groups that helped you network with other people with the same background. They believed in listening. Watch for this when you apply for, and accept, a job. Ask questions of your interviewer about the company’s support of diversity. If you get a chance to shadow an employee for a day or take an internship, do it and keep your antenna up. Don’t be afraid to change course even after you’ve accepted a job. There’s no reason to work for a company that makes you feel like you’re not respected or heard. There are plenty of good workplaces out there.
- People who seem less qualified on paper get opportunities over “more qualified” people ALL THE TIME. Sometimes it’s because the people interviewing perceive a good fit in something that’s harder to measure. The new hire has a great temperament. The new hire has networked well and has a contact that can vouch for them. The new hire has a skill in an area the company really wants. If this new hire is a white man, nobody will ever complain that they’re less qualified and they only got hired as a token diversity hire. Resentment comes out differently when the new hire is a woman or minority, and it’s an uncomfortable truth. You don’t have to do anything to justify your presence to others who didn’t get the job. You have a great opportunity – just try your best to hold the door open for those who follow you.
- Understand that companies hire for a “good cultural fit” all the time. When you got hired, the company made a decision that your skills and grades were what they were looking for, and your background and perspective is something they value and they wanted you on board. You’re a good cultural fit. You’re going to make that workplace even better by being part of it.
- Seek out mentors who are like you, even if they don’t work in the same company. Talk to them often. It helps if your mentors are in leadership positions – the section manager or vice-president won’t mind one bit if you invite her out to coffee just to talk about how work is going and how you like it, or you want to pick her brain about what it’s like to have a leadership role at a tech company. You might need an advocate later on, so try not to be shy about reaching out to other women. We need each other. I have had some very good mentors who were male as well, but I *needed* my female mentors when I had those moments of insecurity or self doubt. I would not have stayed in tech without them.
- You’re going to be subjected to sexism or racism from time to time. This is a fact of working in an environment in which you stand out as different. It’s going to happen. If you have plenty of good experiences to fall back on, it builds up your resilient core and the negative experiences don’t bother you as much – but they do happen. This is where having female mentors is so helpful. Process it with them. It’ll give you good perspective. You’ll start to know when to stand up firmly for yourself and when to just let it go and pick your battles.
- You’re also going to have experiences in which you just aren’t sure of yourself, in which your co-workers aren’t being explicitly sexist, but since you come from different cultures, neither is sure how to act around the other. Lunches, happy hours, golf outings, video game competitions, going to the gym – or work-related gatherings like a debugging session or breakfast meeting or an impromptu teleconference – you might feel like you’re not welcome, and it’s very likely that you are totally welcome, but the men didn’t think to explicitly invite you because they didn’t realize you felt you needed an invitation. Anytime you stand out as different, you tend to sit back and wait for an invitation. Try not to sit back. Ask “I’d love to attend. Mind if I join you?” Go, make an appearance and use it as an opportunity for everyone to learn.
Lastly, this is an awkward topic to bring up, but I have some pretty good evidence that during my time as an engineer, I was gradually paid less than less-experienced, male coworkers. I only have a couple of pieces of data and a lot of suspicions. But understand a merit-based pay system is not really merit-based. Everybody in your leadership chain has some discretion, and individual discretion is biased in ways we don’t always see. It would be very reasonable to track down more information in whatever way makes sense for the company you’re in. I never rocked the boat, but I look back and know I should have used the guidance of my female mentors to help me navigate the pay system better.
You matter. The career you’re entering is a good one, full of interesting opportunities, cool problems to solve, people who are smart and creative and fun, and a global workforce and customer base that is very diverse and that your skills will impact positively. It has its challenges but it’s very worthwhile. If you enjoy creative problem-solving, you will like engineering even with its issues. It’s a great field. I look back with awe at how I got to be part of technologies that changed the world without even realizing it at the time. Engineers make history!
Reach out to me or other women engineers anytime. We have your back!!
This is such a big year for middle school computer science. I think that finally, for grades 6-8, there is a whole menu of really high quality teaching resources – from hardware tools to lessons and tutorials to standards to whole curricula. I’m pretty much changing how I do EVERYTHING, which is exhausting but exhilarating at the same time.
In the standards area, there is a new set of standards released by the Computer Science Teachers’ Association, or CSTA, located here. They are very good overall, building from grade level to grade level, organized by concept and very clear. I think it gives a nice progression for students. Many states, my own included, are involved in efforts to develop statewide standards, curricula and resources. It’s been great to see CS education move forward and the middle-years progression is really coming together.
As far as curricular resources, there are a few great new options. Code.org has a middle school course called CS Discoveries. I didn’t get to attend the training this summer, but one of my co-workers went and although she’s not a programmer by background, she came out feeling excited and confident that she could teach the curriculum and do a good job. It’s very well done so that pretty much anyone can take it and run with it.
The middle years are a great time to introduce kids to physical computing, the idea that you use algorithms and code to program devices in the world around us. It’s such an important tech literacy concept! The CS Discoveries course uses a platform called the Circuit Playground from Adafruit. For a long time, I’ve enjoyed the Sparkfun Inventor’s Kit and its little curriculum. I’ve also noticed a lot of buzz around the UK’s platform for introducing kids to physical computing – the BBC micro:bit. They are cheap and very engaging. I ordered a class pack of them, and from Sparkfun the price is really reasonable.
I teach block-based programming to the sixth-graders and then work with the older middle schoolers on transitioning to text-based programming. For the younger kids, I was thrilled to find an entire CS curriculum for the micro:bit published by Microsoft. It is so good! I love its emphasis on “making” and creativity, and I enjoy the little unplugged activities. I was skeptical of them at first, but every time I try one of the unplugged activities I find the kids really enjoy it and it does help the concepts stick better. The curriculum is easy to follow, and I find the kids love finishing the lesson and then just playing with what they can do on the micro:bit.
I’m finding I can’t do some of the “invention” activities, because I only have one class set of micro:bits and they’re shared throughout the day. I can’t have kids mount the micro:bit in a pet or wearable, for example, because the next class needs them. That’s really a bummer – being a maker involves more than just code. I might try to do an invention project with the kids with the caveat that the enclosure has to let you insert and remove the micro:bit easily. We will see how things go this semester.
As you can see from the title of this post, one of the things I’m playing with is teaching text-based programming via Python to the seventh- and eighth- graders. I was not lucky enough to locate an entire curriculum for this, but there are some good resources out there. I am using the micro:bit python editor. You have to save your files locally instead of in the cloud, and actually this really beneficial. The students I have this year have had laptops in their classrooms since 2012, so they’re “digital natives”. But they’re so used to Google Docs and such that they sometimes don’t have a concept of what a file is or where it is actually stored. So we’re learning about local storage, networked storage, removable storage and cloud storage and figuring out how to access a file from different locations.
There are a lot of tutorials and a good reference at this site: micro:bit Python documentation. It gives a nice introduction to the different features of the micro:bit, but it doesn’t really teach Python. So I’m stitching together my own curriculum and put together these exercises.
In Lesson 1, we just wrote the normal Hello World program and the students were tasked with writing a program that displayed text and images, using some of what they found in the documentation. This task also involved uploading a program to the micro:bit and saving the file in local and networked storage.
# Add your Python code here. E.g. from microbit import * display.scroll('Hi!') while True: display.show(Image.HAPPY) sleep(1000) display.show(Image.HEART) sleep(1000)
In Lesson 2, we reviewed Python syntax and common mistakes and troubleshooting. We introduced the terms “function” and “parameter” and saved some notes on these. We talked about the “while True:” loop and why the indentation is important. It’s not just picky – the indentation communicates important things to the computer! How will it know which steps to repeat without some way of blocking them off? Then we introduced variables by making a little program that displays text that changes. Students guessed at what it might do, and then we ran it and tested the hypotheses.
from microbit import * name = 'Dawn' while True: display.scroll(name) name = 'Tyrone'
Next in Lesson 3 we made a little counter program and demonstrated the difference between the string and text data types. Students could modify it by adjusting the starting value, displaying only evens, only odds, etc.
from microbit import * # declare a variable and assign it to a value. counter = 0 while True: display.scroll(str(counter), 50) counter = counter + 1
By the end of this lesson, some students were feeling frustrated at how hard it was to load files, save files, upload to the micro:bit, figure out where the errors were and so on. But these are short programs and the debugging isn’t hard once you’re used to it. Students have to read the error on the micro:bit and it tells them which line the problem is on. They need to pay attention to little details and that can be exhausting, but it’s so important to give clear instructions to a machine. The machine can’t guess what you mean! We talked about how hard it was for them to write their names when they were children. If you think about it, it’s a long process! There can be dozens of little steps involved in writing your name and they were pretty bad at it when they first learned. But over time the steps became automatic and they got better, and now writing their name is a very simple task. Same with coding and debugging.
I could tell students were jonesing to make something that looked like a game. I decided to introduce random numbers as our next concept. So in Lesson 4 I had student volunteers pretend to be human variables, and we modeled what it would look like to write a program that multiplied random numbers together. First a random number is assigned to variable a. Then a random number is assigned to variable b. Then a and b report out what they are, and they are multiplied together and the result is stored in variable c. We report the result from variable c. Kids acted this part out.
Then we wrote the program together.
from microbit import * import random bob = random.randint(1,10) jeffrey = random.randint(1,10) display.scroll(str(bob)) display.scroll("*") display.scroll(str(jeffrey)) display.scroll("=") wilma = bob * jeffrey display.scroll(str(wilma))
Many kids wanted to adapt their program to include a “forever” loop and keep producing random math problems as long as the power was switched on. By now they understood why the indentation worked, so when I suggested a “while True:” loop with everything indented after it, they were able to add it on their own.
Lastly, I wanted to introduce them to the coordinate plane on the pixel grid. For Lesson 5 I set out 25 pieces of paper in a 5×5 grid shape. I asked for one student to be a “pixel” and another to give directions. The student giving directions had to pick a random piece of paper, and in as few instructions as possible, tell the pixel where to go. We did this a few times and then I suggested that we make the paper in the top-left corner be (0,0). Then we realized we needed a sensible order for the row/column coordinates, so we defined “x” and “y”. We found out quickly that the pixels could only go from 0 to 4 and that 5 was off the grid. Lastly we introduced a “brightness” parameter, so when the instructor student commanded a pixel, they could tell the pixel student to go to an x coordinate, y coordinate, and to squat or stand according to a brightness level. So then we wrote this simple program and I reinforced the terms “function” and “parameter”.
from microbit import * import random while True: display.set_pixel(2, 3, 9) sleep(200) display.set_pixel(2, 3, 0) sleep(200)
And then we modified it to use variables instead of fixed numbers and the kids really liked the pixel dancing around on the grid.
from microbit import * import random while True: x = random.randint(0,4) y = random.randint(0,4) display.set_pixel(x,y,9) sleep(100) display.set_pixel(x,y,0)
Note I haven’t done much in the way of assessment other than conversations and verbal questions.. so we’ll have our first quiz task sometime next week to see how this is coming along. I don’t regret the direct instruction, though. The kids are finding it valuable, and they’re enjoying the micro:bits and learning what they can do with them. They want to make games such as pong and snake, and I think once we understand how to use the buttons, radio and accelerometer, they’re going to have a really good time making things they haven’t yet envisioned. I’m learning right along with them. They ask me a ton of questions and my stock response is “I just haven’t learned that yet. I guess we will learn it together.”
It’s fun though. It keeps you young.