This year I am teaching pre-calculus for the first time, and I am committed to doing projects with my students as much as possible. Last semester we created a parabolic trough solar oven and made holiday cookies for students. This semester I decided to start with a unit on trigonometry, and I happened upon an interesting project via Twitter that showed someone sighting a distant object and using a micro:bit’s accelerometer to calculate tilt and thus how tall the object was. What a cool application of computing and trig. I decided to try and create the project for my class.
I decided to spend some time actually creating the thing. I started by attaching the micro:bit to a cardstock tube. The tube could be used to sight the top of a tree or building. We would try to keep the micro:bit on the same side and simply adjust the tilt until an object was sighted through the tube.
I played with different programming languages and decided to use Python, because it had a robust library of math functions. I started with a simple program to just fetch the accelerometer readings when you push a button.
I found that if the tube is held level, the “x” reading was close to 0, the “y” reading was close to a maximum of 1024, and the “z” was close to 0. If I held the tube pointing straight up (90 degrees), “x” was -1024 and “y” was close to 0. “z” remained close to 0. So as you tilt the micro:bit, the “x” accelerometer goes from 0 to -1024 while the “y” accelerometer mirrors it and goes from 1024 to 0.
I did a little searching to figure out how to convert accelerometer readings into an angle of inclination. There are a lot of different formulas out there – probably all correct. One source I found had a very simple equation:
So basically the angle of inclination is the inverse sine of the ratio of the “x” accelerometer to 1g. I had a hard time visualizing why the ratio x/1g would be equivalent to an opposite / hypotenuse, but it started to make sense when I realized the forces at work are really similar to the kinds of forces on an object that slides down an inclined plane.
In the diagram, the parallel force is analogous to the reading on the “x” accelerometer. The perpendicular force or “normal” force is analogous to the reading on the “y” accelerometer. Fgrav is basically 1024, the reading you get when there is a full 1g on an accelerometer.
This triangle is similar to the triangle made by the inclined plane. I made a little sketch that maybe shows this more clearly?
So basically the formula above, the simple inverse-sine operation, works because your angle of inclination is congruent to the angle opposite the “x” acceleration vector. You can find that angle by finding inverse-sine of “x” to “force of gravity”, 1024.
I wrote another Python program that did this math and reported out the angle, and it seems to be reasonably accurate.
Once you know the angle, if you know how far away you are from your object, its height can be found this way.
tan(theta) = height / distance
distance * tan(theta) = height
Easy peasy! This assumes you’re sighting from the ground. We may find we have to adjust for eye height. We can do that. Time to create the student-facing activity.
I put together this packet for the students. My class is super tiny so the kids can go through it as one group. For a larger class I would make groups and do lots of catch and release.
Here’s how it went.
We watched the video on the biltmore stick. Students gave me hypotheses around why it worked, and we talked about potential sources of error.
I told the students that with modern technology, we should be able to make a decent height-finding tool. I introduced the micro:bits to them and told them about some of the features. They’re the first kids in my school to use the micro:bits, and they were ENCHANTED by them. You turn them on and they show messages and images, they play a game, and then they tell you to get coding. How fun! The students had a zillion questions about what else the micro:bits can do and how they worked. After the excitement faded just a little, we talked about accelerometers and how they worked, and the students started working through the packet.
I hoped they would be able to struggle through most of it up until they had to write their procedure in Python, but of course that isn’t how it went. We ran up against several big conceptual roadblocks.
- The idea of the x, y, and z-axis accelerometers BLEW THEIR MINDS. It was really tough to visualize which axis was which, and the students twisted and turned the micro:bits every which way. They had a very tough time being systematic about turning the micro:bit on just one axis to narrow down which accelerometers were changing. I hoped they would be able to sort out which axis was which on their own. They could not, and they got frustrated really quickly. I broke down. I just told them which axis was which and what the max and min values were. I have to admit this has been a struggle for me as well. Visualizing the three accelerometers is a challenge and I probably would have felt the same way in this activity.
- The accelerometers are really sensitive. One moment you set the micro:bit level and get a reading of 0. Another moment the micro:bit seems to be in the same position but your reading is -92. Another moment it’s 16. The text scrolls slowly so you don’t really appreciate what those readings look like in the moment. It was hard, then, to ferret out what the max and min values were. They floated around.
- I really thought with their geometry background the students would visualize the similar triangles really quickly. They did not. Looking back, I remember feeling frustrated and like my mind was a little blown when I learned about forces on an inclined plane. So I should have been ready for this. But the whole idea that a force of 1g directed toward the ground could be broken up into the x and y components on the accelerometers, and that they didn’t add up but rather made legs of a right triangle… WHOA. There was yelling. There was almost crying. Emotions were high. Eventually they did seem to understand but I am going to have to do some good formative assessment next class to see what they actually got.
I have a TINY class, only 5 students, and so the yelling and the emotion was totally manageable, but I am SO glad I did not go through this with a bigger class. I would have done a lot more pre-work on gravity, inclined plane forces, and similar triangles.
Today, after all of our drama, the students wrote programs to calculate the angle of inclination and strapped the micro:bits to paper tubes. Next class, we’ll go outside and take measurements. One of my students found an alternate method of measuring the angle that was something similar to this.
It seems to use a distance-formula calculation instead of the force of gravity and it’s interesting how it uses all three axes. I’ll let her try it and see if her results are similar.
I’ll take some pictures of the results of the experiment and hope I get to do this again with a future group! I feel like with better pedagogy this would be a really great activity!
This spring, I tried something I’ve never done before – I tried my hand at curriculum writing! I had a great opportunity to work with Launch CS to create a 10-lesson curriculum for the BBC micro:bit. It’s not perfect, no product ever is, but I did end up happy with what came out of the effort. The package is aligned to CSTA standards and covers a variety of them in ways that are not typical of most coding curricula. There are a ton of lesson packages out there that introduce algorithms and programming, and I did include these but also worked to introduce networking, data, and the design cycle. The curriculum is intended for students in grades 5-8.
The highlights are:
- Events, Variables, Conditionals, and Looping (via mini-projects and pair programming using the micro:bit)
- Data modeling and analysis using micro:bit, electronics, and spreadsheets
- Networking using videos, a computer and the micro:bit radio feature
- Design Cycle via a micro:bit “Shark Tank” style project
I would have loved to see teachers at the CSTA conference, but alas, duties for my new job interfered this year. It’s on my bucket list to attend – hopefully next year.
Until then let me know if the micro:bit resources are helpful!
Edited later because I neglected to give credit where credit is due. Grant Smith and Cheri Bortleson are amazing to work with – they gave thoughtful feedback and edits, and they formatted the curriculum beautifully with lovely graphics and a consistent theme. I can share this proudly because they did such a nice job with the vision and final project! Thank you Grant, Cheri and LaunchCS!
A few years ago, I wrote this post about my struggles to have middle-schoolers do a computer take-apart and meet the high expectations I had in mind for them. I am happy to report I didn’t quit doing computer take-aparts. I did try to learn from those hard lessons and continue improving on it. Hardware Week now runs pretty smoothly and kids report it’s their favorite unit. I do this set of lessons in my 7th/8th grade Computer Science Explorations class. It’s a great one for the week right before spring break, or whenever you need a little something different to mix things up.
Prior to the lesson, I ask parents if they have any old computers they have been wanting to get rid of but didn’t want to hassle with recycling them. I have a small budget I can use for hardware recycling, so I have workplace services come and take the computers away for recycling when the take-apart is done. I accept laptops as well as desktops, and it’s fun when I have a mix of both. I stock up on tools, especially small phillips screwdrivers, flathead screwdrivers, a few small Torx screwdrivers, some pliers and a few wire cutters.
First, we learn about the basic structure of computers (I also relate this structure to micro:bits, since my CS students learn to program them in Python). We do several card sorts in which I give students a sheet with pictures and descriptions of computer hardware, and they have to sort them into categories: input, output, processing, storage. Sometimes I include Power in one of the categories. Although pieces of hardware like the battery and fan don’t have anything to do with the flow of information, they are visible inside a computer and really important to its operation. You can find the card sort at the link below!
Next, I have the students watch a movie and fill out an organizer with it. The movie is wonderful – it’s called Lifting the Lid and although it’s from the early 2000’s, the information is still relevant and it’s very entertaining and informative. The movie is expensive to buy, but I was able to reserve it from our public library. I had to get it from Prospector as it was at a local university.
Here’s the link for the movie. The instructor’s guide, linked on the same page, is the organizer I used. I circled the most important questions for the students to fill out, and paused the movie at certain points to work with the kids on filling out the organizer.
We then have a quick safety and procedure talk about the computer take-apart. I have learned to keep the rules really short and simple.
- If you have a laptop, take the battery out first and bring it directly to me. Don’t take anything else apart until the battery is out.
- Wash your hands well afterward to avoid getting lead in your eyes, nose, and mouth.
- Do not break any screens.
- Many computers are meant to be taken apart. Look for the places where the computer has seams, screws, levers or tabs.
- As you remove pieces, label them. Each group will get a sheet of labels and some tape. Sometimes you may find more than one piece in a category.
I give each group a sheet with labels of computer parts, plus a couple of blank labels in case they find things that aren’t on the originals.
I circulate around as the groups are taking their computers apart and help them identify parts as they remove them. Sometimes they’re tricky even for me! When opening laptops, sometimes the easiest way to access the motherboard is to take the keyboard apart and come in through the top – which of course kids love and requires a little extra time cleaning up at the end because keys get all over the floor.
When the computers are dissected, we begin a group show -and- tell for their computers. I put prompts up on the board and ask groups to hold up a part that matches the prompt. We go around the room and every group explains what they’re holding. They rotate group members for each part. Example prompts:
- Hold up something that stores data.
- Hold up your CPU.
- Hold up something that is for input.
- Hold up something that is for output.
- Hold up something that’s used for cooling your computer.
- Hold up something used to power the computer.
- Hold up something used to connect to a network.
- Hold up the motherboard.
At the end, I do allow kids to take home a souvenir as long as it’s not a hard drive, solid-state drive, or a battery. I keep those and make sure they get recycled properly. We spend quite a bit of time placing parts in big moving boxes, which I tape up and label for recycling.
I could do a formal assessment. I choose not to. The show-and-tell is a helpful wrap-up and taking a computer part home is something the kids really enjoy as a reward for cleaning up well. I had a student tell me the other day that he took his motherboard home, set it in a frame, filled it with resin and hung it on a wall!
It has ended up being a fun set of lessons that are also great for learning. I’m glad I didn’t give up on it.
The start of a new calendar year is a traditional time of reflection and anticipation. I’ve been an inconsistent blogger this year, which wasn’t intentional, but if I had to clear some things off my plate, this was an easy sacrifice. It’s been a full year. Along with constantly learning and changing in my job, I have two daughters who are in 9th and 5th grade and a busy husband too. When my children were little, I thought to myself “It will be so nice when they’re older. They won’t need us as much!” While it’s true that we can leave the house without calling a babysitter now, it is NOT true that your kids need you less. They need you more! You need to be more present, for everything from driving to emotional support to helping them make sense of the world. It’s been a joy being with the girls as they grow into interesting, independent people – but it definitely keeps you moving.
The job has been interesting as well. I don’t always know what to expect next, but here are some highlights from 2017 and what I expect from 2018.
- The CS for All and #csk8 movement.
“Coding” is gaining more traction in my suburban public school district, and this year for the first time we started some high level discussions on how to introduce computer science as a core subject for every learner. Several colleagues and I have been working on suggested paths for a K-12 computer science sequence. We are looking for sites to pilot ideas over the next couple of years and investigating grants for professional development offered by Colorado’s Department of Education. It feels like a painfully slow process, but there is definite progress here and I’m excited to see where it goes.
I started using these cute little devices in both my required 6th-grade class and in the elective upper-middle-school class. The younger kids learned cs concepts using the block-based MakeCode environment, and the older kids learned using the text-based Python environment. It’s such an interesting tradeoff. I didn’t feel that we covered as much material as I had in previous years, but I perceived that the kids were VERY engaged in their learning and took their learning in divergent paths. Introducing the micro:bits meant that some kids did not learn as much about coding structures such as variables and boolean expressions. But they learned more about the design cycle, and got really excited about testing and iteration. They generated questions themselves like “will it still work if I’m on the opposite side of the room? Will it work if I push the buttons at the same time? Will it work if I shake and push at the same time?” And then they answered their own questions and improved on their designs, on their own. I love the excitement. I want to keep that. And I also want the kids to be well prepared for high school work and to understand important concepts in computer programming, so having it both ways is hard!
- Virtual Reality.
I have a nice gaming system with an Oculus Rift controller in my classroom, and we have a variety of VR devices in the media center. Kids have access to technology at school that they don’t necessarily have at home, and so it gives them something exciting to use at school that they are very curious about. I’ve integrated a VR unit in my upper-level CS class, and our building tech coordinator and I teach a quarterly enrichment class called VR Exploration. We work with the kids to make 3-D models in Blender and little exploration worlds in Unity. We’ve had a few students that have gone above and beyond with their work in VR and that’s been fun to see. Toward the end of this semester, we received a $5000 grant to expand our VR program and so now we’re faced with the question of: how do we grow the program? We have some thinking to do about how we make this a more inclusive and interesting and cross-disciplinary experience for kids.
- Engineering for Others.
Our media specialist runs a pretty awesome after-school program called Engineering Brightness, and I love the premise of engineering with a purpose – to help others and to help students have empathy for the human experience. I’ve been working on the technical side of the program for quite some time and incorporated a lot of the engineering ideas into my Electronics elective, and this semester for the first time we were able to produce some finished products and send solar lights out to residents of Puerto Rico who were still living without electricity. It was a fantastic experience and I definitely hope to keep the project and improve on it this coming semester.Those are the main things cooking for 2018! What’s coming up for you?