# Teaching a DIY Solar Charger Project, remotely

Along with my math preps, I also taught a venture-project class this quarter. I had planned a very hands-on project and purchased a LOT of supplies for the students to make solar lamps, solar chargers, and solar cars. When we shifted to remote learning, I decided to try and make this project run, if a little scaled down. I split the kids up into groups, and a group of 6 middle-schoolers got assigned to be on the Solar Charger team. I have never built this project with kids before and have spent the past few years trying to get the electrical design nailed down. But I really wanted to do this project. All of our ventures focus on community needs, and we’ve worked with the FoCo Cafe and Homeward Alliance over the years to bring donations to the homeless. They’ve mentioned before how awesome solar chargers would be. At the shelters, people often crowd around outlets so they can charge phones. For people experiencing homelessness, if they have a phone, it’s a crucial communication tool- a connection to the world. But if you don’t have a permanent place to live, having access to electricity can be a challenge.

Over the past year, I settled on a design for a solar charger using 18650 batteries (these can sometimes be found in laptops and vape pens, but I bought them off eBay) and a TP4056 charging circuit. It’s not a perfect solar charger. If you plug the circuit into the wall using the micro-usb port, the batteries hold enough charge to charge your phone more than once. Although the batteries say they’re 3.7v, they can be charged up to 4.2v with a wall charger. However, if you charge the batteries using the solar panels, it seems the current never quite gets high enough to charge the batteries that last little amount. I can get up to 3.95 or 4.05 volts, which is enough to charge a phone about 2/3 of the way. But after experimenting with a bunch of different charging solutions I determined that for a reasonable price, this is as good as we can do for now.

I worked out the electronics with the help of student testers over about 3 school years, but I never had a mechanical case I liked. In the past, I used upcycled food containers, and they were flimsy.

When I met with students this year in our “charger team” meetings, our first task was to design a sturdy case for the solar charger. We discovered you can collaborate in Tinkercad and it turned out to be a great solution! We all logged onto the same Zoom meeting, and then I created a Tinkercad project and clicked the Collaborate button to share it with everyone.

It’s amazing. You can all edit the same project at the same time. And with this group of kids, it turned out ok. We downloaded a couple of charging-port holders from Thingiverse and embedded them into a box, with some walls to hold the battery pack in place. The kids worked with rulers and measured battery packs and solar panels, and we updated the measurements in the file. Our first design had the voltage-in (micro USB) and voltage-out (USB-A) ports on opposite sides, with a flat lid.

This was iteration 1. The box took a really long time to print. I printed one at home, and showed them how it turned out at our next meeting. I asked the kids if we could make it a little smaller to save filament. So we moved both charging ports to the same side, and made the box exactly the same size as two solar panels side by side – and only slightly taller than the battery pack. I printed multiple copies of this version and then had a meetup with the kids to give them cases and electronics to try and build a solar charger. I parked at the school, and the kids pulled up with their parents where I handed off a bag of parts, soldering irons, and other tools.

The students worked with iteration 2, and each one in the team built a charger. I shared video instructions for creating the charger, and we had a zoom session that was a “learn-to-solder” lesson. The next time we met on zoom, they reported back that overall they liked the design, but the slots for the charging circuits needed a little re-designing. They wanted the slots overall wider, with a lip to hold the circuits in place. We made changes together in Tinkercad and then I printed iteration 3 for each student and did another round of supply-swapping. They built another round of chargers and tested them.

I started printing iteration 3 as fast as I could, and I distributed these to the kids so they could make this year’s final version of the solar chargers. I am really pleased with how they’re turning out. I’ve gotten a few back, and they’re sturdy and high quality and work pretty well!

I even had one student that designed his own case that had an angled top, better for collecting sunlight in the winter. He laser-cut it at home, and it’s awesome. I did not take a picture of it yet, but I’ll do that soon. Maybe that’ll be iteration 4 or a separate branch of solar charger cases.

This is an amazing, fulfilling project. We are going to be donating the solar chargers to Homeward Alliance right after Memorial Day, so they can be distributed to people experiencing homelessness who need them. We expect we will have over 20 chargers to donate. We will also put a link to a survey on the chargers so our “clients” can give us feedback on how well they held up. The students really loved feeling like they were making a difference and experiencing what engineering really is.

If you’re interested in making these, I have posted a YouTube video with assembly instructions, and I’ll also share the parts lists and .stl files here.

Video:

Parts List: https://docs.google.com/spreadsheets/d/1X1u6yjNbjAu4dr34XgRzT953KN3b0fzujIJSVDwk_q8/edit#gid=0

Case .stl file: https://drive.google.com/file/d/1NDLWaPoC2yQwzlDsszhTPLA3drJ_VgZZ/view?usp=sharing

Lid .stl file: https://drive.google.com/file/d/1NtLVTKte3fTnh75H0FBPP34LZb973Js4/view?usp=sharing

# Emergency Online Teaching – My Experience

I have not blogged in a while, and it’s hard to be reflective about your own work when you’re in the moment and so unsure WHAT you’re even doing, so you can’t pause to think about why or how. But now that I’ve finished my last day of teaching online content, I think it’s time to look back on what worked and what didn’t – because chances are, we’ll be doing this again before the coronavirus pandemic is over.

I live in Colorado, and as we watched the pandemic unfold on both coasts, we knew by early March that things were going to change for us drastically. We left for spring break on March 13th right after having a big open-house exhibition at my school, and after I attended my own daughters’ spring concerts and celebrations. When we left for spring break, we knew we weren’t coming back. Although our district had only planned for a 2-week break at the time, the writing was on the wall that we’d be out all quarter. We started to plan for it.

Our administrative team did a wonderful job creating a remote-learning plan that was flexible and could accommodate as many kids as possible.

- We did some test-runs with
**Zoom**before spring break started, so teachers and students were familiar with the platform. We created a set of school norms for using Zoom and trained all of the students on these norms. Most teachers were able to run a class or two on Zoom, just as a trial, with kids spread out around the building and teachers conducting class from our office. We continued using Zoom for the duration of remote learning although we were aware of concerns with privacy. It really is a superior platform for online learning, and for a quarter, we decided to make the tradeoff. - We extended our spring break an additional week, to
**give ourselves time**to check computers out to students and write lesson plans. Students came to school early the week of March 23 to pick up their technology. - We used
**Google Classroom**as a central point for all remote learning. We agreed to use a standard structure, where assignments were labeled by day and week, and all assignments could be done asynchronously – with short video lessons where needed. - We
**posted all assignments on Sunday evenings, with due dates a week later.**(I found myself breaking from this slightly, however, posting Monday/Tuesday assignments on Sunday night and Thursday/Friday assignments on Wednesday). - We agreed to hold
**online, live Zoom sessions twice a week for each class**. Intensive classes (the core subjects) were held Monday/Friday, Venture classes (our project-based blocks) were held Tuesday/Thursday, and Wednesday was reserved for Advisory and staff meetings. We agreed the**live sessions would not be required**, but would be set up to provide support or teach the content live that was already accessible in the online videos. - We kept a
**checklist of all of our students**, so teachers could log which students were attending class and/or turning in work. The checklist was used to follow up with kids we didn’t hear from. The checklist was just a normal Google sheet that looked like an attendance roster, and next to each name there are checkboxes to log if we had seen/heard from the student. Through the checklist, we kept track of families dealing with Covid, families that needed food assistance, and some families that other obstacles to attending school – working, taking care of siblings, or lacking any internet except a phone data plan.

This is what my Google Classroom looked like, and every teacher in our school uses the same setup.

Zoom links are always posted at the top of the page. As you scroll down, weeks are in reverse-chronological order and all assignments are grouped under the week in which they were assigned. The consistency was helpful to everyone and I am so glad our admin just set the structure up for us.

I teach Algebra/Geometry (Integrated math, sort of), and had planned to teach quadratic functions, systems of equations, and data analysis. I had gotten a week into teaching quadratic functions when the semester ended, and I know my students that wanted to move on to Algebra II next year would need to know these topics. So I had to do the best I could teaching new content in this format. For each lesson, I made a video which I posted to **YouTube**, created some structured notes that went with the video, and then curated some **Khan Academy** exercises for practice. I assigned 1-3 practice sets for each lesson, so it wasn’t an overwhelming amount of work. If we had been in the classroom, the structured notes would have been set up as group activities – I just adapted them to be individual notes instead.

I think a huge part of the value of the video is for the students to connect with me by hearing my voice and seeing my face, so the videos are probably not as meaningful for you. I know there are tons of videos out there that teach the exact same content I’m teaching – but I made these anyway, because I believe there’s value in the students hearing directly from me and knowing I care and believe in them. You can use them if you like, but I really do think your students benefit from videos you make yourself too.

Each day, I asked the students to **do the Khan Academy exercises**, **mark the assignment as “done”** in Google Classroom, and **write a short reflection** on how it went. For the units on Quadratics and Systems, I included a **small end-of-unit assessment**. For the Quadratics unit, it was a packet of problems I curated from an SAT test prep book. For the Systems unit, I assigned the students a computer programming project as an assessment.

Our grading system is a **competency-based** system, with marks of “Not yet”, “Basic Understanding”, and “Exemplary Understanding” for content. There really is not a good and fair way to check students’ competency levels in this kind of system. So if a student did most of the assignments and put in a solid effort on the assessment with reasoning I could understand, I gave him or her a mark of “Basic Understanding”. A few standout students received marks of Exemplary Understanding, but I reserved this for when I could tell it was really warranted. When in doubt, I used the “Basic” mark. If students did not participate at all and did not do assignments, I left the grade blank as if they didn’t take the class. They’ll get a chance to learn it in the future when learning is purposeful and planned, not emergency.

So that’s what I decided to do. Here are my reflections on how it went.

From my perspective – I felt like this was a decent first attempt at online teaching. I actually do like Khan Academy as a resource for practice problems. The students can get feedback right away, they can use the hints and videos, and I could screen-share with students during my office hours to help them with the practice. It was super useful. I probably will use Khan’s exercise sets next year when we have to go remote again. A little more than half of my students completed work regularly. About a third showed up consistently to our synchronous Zoom sessions. I enjoyed the online zoom sessions, and after I got about a month into the schedule, I really liked it. I did do some repetitive work – creating the videos and resources for the lesson, and then teaching the exact same lesson live twice, then teaching it again during office hours – but my days were so much more flexible and easy to manage. I had to carve out a couple of hours for online classes each day and then I could finish the rest of the work on my own time. At 3pm or 2am or whenever it was a good time for me. By the time May rolled around, I was very comfortable managing my time this way, taking care of my house and family and balancing the school needs. And really, I’m far less stressed right now than I usually am in May. MUCH less stressed. I’m kind of thriving on this flexible online schedule. I get outside a little every day, tinker and create, play with the pets, make a variety of food, and enjoy spending time with my husband and kids. I was really sad and stressed when the quarter started, but now that it’s mid-May I’m doing pretty well.

From the kids’ perspective, it’s more complicated. I gave an end-of-year survey to my students today and was surprised at some of the results. The first question was about student motivation levels. Less than half of my students responded to the survey, so the results may yet change if I get more.

The bars correspond to these prompts:

Students could check multiple boxes. The most popular answer was: “I didn’t try as hard as I could have”. Second most popular was a three-way tie: I was motivated because I really enjoy math, I was motivated because I’m used to trying hard in school, and I tried my best every day. It seems, though, a majority of students are disappointed in their effort.

I asked students what they thought of Khan Academy as a practice tool. This surprised me.

1 corresponds with “It’s terrible, please don’t use it anymore” and 5 corresponds with “It’s a good way to practice and you should use it next year too”. Generally students are OK with Khan as a practice tool. They don’t love it but don’t hate it. Some helpful comments included “It’s good for practice, but I don’t learn new content well from it”, “I like that I know right away if I got it right and can get help if not”, and “It was only a few questions so it wasn’t overwhelming.”

I asked the students how they felt about the feedback they got during online learning, with 1 being “Not Nearly Enough Feedback” and 5 being “I am satisfied with the feedback I got”.

I almost did a spit-take because I got REALLY behind on grading – not just summative assessments and comments, but the daily work of doing into Google Classroom and just checking off assignments and writing “Good job”. I certainly didn’t give them this feedback, unless they asked for it in office hours or zoom sessions. Strange perception. I expected them to rake me over the coals and hold me accountable for getting behind on feedback. I don’t know why they didn’t. Maybe because they practiced on Khan they knew what progress they were making? Maybe because I sent emails reminding them about stuff?

I asked students if they felt ready to move on to the next math class. This graph also surprised me.

A vast majority of the students wants some review and some new stuff next year. Huh. I would say the kids in the “I feel like I mastered it” category are also the ones I would have pegged as fully ready to move on, but some of the other kids in the 86% are ready but don’t perceive themselves as ready.

I asked students what topics they’re interested in learning more about when it comes to math. This is what they said.

Some of the labels disappeared so this is a list of the choices.

The most popular answers were: Puzzles and Logic, Computer Programming, Physics and Mechanics, Data Analysis and Statistics, Finance and Spreadsheets, and Measurement/Design/Engineering/Construction. The least popular were: Advanced Functions/Polynomials/Calculus, Probability, Solving more and more difficult equations, and careers that use math.

I brought this question up just in case standardized testing gets postponed, cancelled, or has a lower priority placed on it, maybe freeing up a little more math time for the things kids would like to learn. We do SO much with functions in high school math. It’s a bit much, in my opinion, when there’s so much math out there that kids like.

I asked one final question which was: If math is online again next year, what do you think you need to be successful? The responses were all over the map, some hopeful, some disappointed. They’re important to read. There are a lot of kids beating themselves up for not feeling more motivated and I think they’re being a little hard on themselves, considering.

So there it is, my first emergency-remote-learning quarter of Algebra in the bag. Lots to think about as we head into next fall and have to continue keeping kids safe and somehow figuring out how to help them learn.

How did it go for you? What would you do differently and what did you like about your system?

# Perpendicular Lines and Coding a Tartan

Linear functions are at the heart of 8th grade math and Algebra I, and I enjoy finding those ways we engage with functions in real-life situations… including creative coding!

As we learn about slope, it’s an interesting challenge for students to explore what kind of line would be perpendicular to a given line, and I like to use that challenge to deepen their understanding of what slope is. We start with some lines and without showing them how, I challenge them to find a line that makes a perfect 90 degree angle to the given line.

We have a discussion about when this understanding would be important. Architects or designers might use the concept, for example, if they have to design right-angles that are not perfectly aligned to their grid. Video-game designers may use the concept if a shooter is facing an enemy, and you have to strafe at 90 degrees from the angle you expect their projectile to come from.

Or, you might use the idea of perpendicular lines to just make pretty art, which is what we did with this mini-project.

I reminded the students about Tartans and how groups in Scotland use a Tartan as part of their identity – whether region, occupation, clan, or something else.

https://www.scotlandshop.com/us/tartan-finder

My family and I hiked in Scotland this past summer and noticed tartans of the MacDonald and Campbell clans everywhere!

For math projects, I’ve written before about how much I like coding in Khan Academy’s Javascript interface, so here’s the pitch again: it’s great for mini-projects. It’s easy to push a sample project out to students, easy to debug and run, fun and engaging to color and animate, easy to save and share as long as you have a KA account.

We start by going over how to color the background and stroke and fill colors, and how to place points on the coordinate grid. We first discuss where (0,0) might be and then discover together it’s in the upper left (!) and I challenge students to place points in all four corners and in the center. This is what they end up with.

Then we add in the draw() loop and get the points moving.

That’s day 1. On day 2, we can introduce the project. Students have to make a personalized, unique Tartan with colors and stripe widths they choose. The tartan must have at least 8 lines on a colorful background. The lines must be perpendicular, but can’t be perfectly horizontal or vertical, or at a 45 degree angle. Lines must start at an edge.

It gives some interesting challenges as students figure out what coordinates would start a line at the edge they want, and then how to create slopes that are perpendicular. In an example video, I show how a slope of +4 in the x direction and +5 in the y direction is exactly perpendicular to a slope of -4 in the y direction and +5 in the x direction. Make one value negative, and swap x and y.

Perpendicular Lines video

My last class made some very nice tartans.

It’s a quick, 2 or 3 day mini project that gives students some context for slopes and intercepts and allows them to get a little creative.

Enjoy!

# VR and Empathy: A Journey

At my PBL school, students generally start a new venture project every quarter. This quarter, I’m facilitating a venture project class called “Virtual Reality, Real Feelings” – about the crossroads of VR and empathy. The purpose of this venture is to explore how VR technology can immerse someone in a world so much that it changes their perception of the world. The students will select an inquiry question and create a VR mini-game or experience designed to change someone’s perspective.

It’s a really ambitious project and I’m more than a little terrified. We’ve essentially got 8 weeks to pull this off.

As part of our school opening, we got quite a lot of grant money for new technology. I lobbied hard for VR equipment. I have noticed how this technology inspires curiosity, engagement, and wonder. Those emotions are powerful catalysts for learning and so I see tremendous potential for using VR as an educational tool. We secured 3 powerful gaming computers with Oculus Rift S headsets, and I also purchased 12 Oculus Quest headsets and 20 decent laptops to do software development. My class has 23 students, so we have enough computers for every kid to have one and students can share headsets with a partner.

We set up the Rift systems first, and set them up in our school gallery so students could play VR games after school such as Beat Saber. I believe in using the tech for fun, because again, emotions and curiosity. 🙂 It also builds a sense of community and a shared sense of taking care of the equipment and fairness.

Before the venture started, I had to get all of the Quests set up. We have a school account on the Oculus store, so I used that along with my own phone at home to charge, update, and install apps on all 12 of the Oculus Quests. It took 2 entire evenings to do.

I brought the Quests back to school, and as luck would have it, there was an empty cabinet that exactly fit 4 Quest boxes side by side on each shelf. We drilled a hole in the back and put powerstrips in the bottom, and zip-tied the chargers to the cabinet in bundles. Each Quest box, headset, and touch controllers are labeled with their corresponding numbers, using silver Sharpie. A couple of students helped me set up our charging cabinet and get the Quests on the school wifi. We got some containers of sanitizing wipes to clean the headsets off at the end of every class. We need to work hard to keep them clean and in good condition!

It is very helpful that when you want an app on all 12 Quests, it only needs to be bought once on the school account and then all headsets can install it. The Oculus Store, unlike Steam, does not limit you to play a game on one headset at a time. All 12 can be running the same experience. It makes the software part of the setup very affordable. However, it means we can’t play multiplayer experiences unless we get more Oculus accounts and pay for the apps again.

All of this happened the day before class started. We still don’t have the development laptops, so I’m having the students empathize and design in the meantime. This is an important part of the design cycle and it’s actually convenient that we don’t have the computers, so we can focus on doing our planning well.

For the first week, this is what we did.

Before the class: several students and I attended Colorado State University’s XR Symposium over a weekend, to connect with our local university and get some ideas and inspiration.

Day 1: We introduced the class with getting-to-know-you activities, a slide presentation about the history, technical specs, and impact of Virtual Realty. We discussed the XR Symposium, and we created a class charter.

The slide presentation I used is below. You are welcome to use any of the information if you want. Here’s the link to it:

Day 2: We reviewed the learnings from yesterday, and then I gave the students a sort-of scavenger hunt I created. I called it a Questival. The goal was for students to try out 10 different VR experiences, articles, or videos, and journal about what they learned along the way. I curated some experiences that would either evoke curiosity or emotion. The VR apps I included were:

Becoming Homeless: A Human Experience by the Stanford Virtual Human Interaction Lab. This experience only works on the PC-based headsets, not on the Quest. In a disappointing twist, I could get this app to work at my house but not on our school PC’s and I don’t know why. On the school Rift S machines, the app would show up on the monitor but we never could get it to display right in the headset. I tried for a couple of days, and eventually we just demoed it for the entire class, on a big smart monitor, by holding the headset and having a student use the touch controllers. It worked, but wasn’t as immersive as actually being in it. The point of this experience, however, could still be fulfilled. In this VR Empathy app, a couple of aspects make it really powerful and interesting. One is that the programming and game design is not that complicated. You point and click at objects, and simple things happen like a sound plays, or an animation runs. It is an app in the style that a student could easily create. The other powerful aspect is that it’s not just a video, it’s interactive. I wondered if the simple choices you had made it more powerful than just an immersive video. Does the act of having to choose which items to sell create more empathy than just watching someone else do it? Does it matter that you get to choose the color of your hands?

Traveling While Black is an anti-racism experience. It is not interactive, it’s an immersive video – but it has some touches that make it more powerful than just a video. The perspective of sitting in Ben’s Chili Bowl listening to a crowd having a conversation is a powerful one, and I liked how images were embedded into the scenery to make the stories come to life. It’s a very good storytelling experience and the students thought it was powerful. Especially the white students.

6×9: A Solitary Confinement Experience is one the students have to navigate to on YouTubeVR. I did have to go in and unblock it, since the content is flagged as “restricted”, so test it at school first before you try it with students. It is intense, but not inappropriate. I liked it because it’s an immersive animation rather than just a video made with a 360 camera. The models of the cell and furniture, the paint animations, etc are all created and not photographed. And again, it’s something the students could create, not technically challenging, but powerful storytelling anyway. It’s about the experience rather than the realism. Students had no idea this was something that happened in the US, and before I watched the video, I didn’t know it was so widespread. It opened our eyes to one of the ways the criminal justice system has overstepped its bounds.

Job Simulator was an experience I curated because it evokes emotions of surprise and joy, and it’s an example of good game design that’s specific to VR. You could not create the same experience on a flat computer screen and get the same emotions. In VR, you need to design your experience with caution about movement – otherwise you’ll make your users sick! Standing or teleporting experiences are fine. Anything that involves walking or flying needs to be approached with extreme caution or you run the risk that many, many people will not use your app because they get queasy. We also discussed that although people love realistic video games, a VR experience doesn’t have to be realistic to make you feel totally immersed in it. Low-poly graphics are sometimes just what you need. They highlight the interaction rather than the object itself.

These were some of the best VR apps and experiences I had found that really get at the empathy and VR connection. I put other articles and videos in the Questival worksheet, and students worked on this on and off for the entire week. Here’s the worksheet:

I got a lot of joy from watching the kids work on this and seeing their surprise, curiosity and engagement.

Day 3: We continued working on the Questival assignment, and I gave students the prompt of considering a curiosity question (or a few candidates) for their research project. As they explored different applications and uses of VR, I wanted them to hold in their minds the questions that were coming up they wanted to dig into more. They will take one of those questions and turn it into their solo research project. Some examples of curiosity questions:

What are haptics and where will they go in the future?

How is VR used in Military / Defense situations?

How can people explore identity or body image using VR?

What are the impacts of deforestation?

What is the history of 3D animation?

Can VR be used to eliminate racism?

How can we get people to accept and care for refugees from other countries?

The students came up with some great questions on their own and I’m excited to see where their explorations take them.

Day 4: Some students, because of absences or working slowly or not knowing what was expected, were still working on the questival. For students that were finished, I wanted them to start exploring creation tools in VR. They could use Tilt Brush, Medium, SculptrVR, or Sketchup to participate in a build challenge with the theme of: Halloween. We’ll review everyone’s halloween artwork on Monday and award a prize to the best halloween designs. Artwork made in any of these media can be imported into Unity and built into an app, and I have some students who are incredible artists – unlike me!

As we continue into the coming week, I just had a couple of observations about working with class sets of VR equipment.

- Space is such a tough problem to solve. One classroom with furniture in it is a tough space for a dozen groups of students working in VR. I generally had 6-7 VR users in the classroom and then others would use the public spaces outside of the classroom. This created some conflicts when students were noisy, or were perceived as being out of class/goofing off. I had some colleagues frustrated with me because they felt their classes were disturbed. So I need to set some clear boundaries and expectations for space that help the students work while not disturbing other classes. It’s a hard problem. VR takes a bigger footprint than a school desk.
- Overall, I am very, very pleased with how easy the Oculus Quest headsets are to use. The students were able to figure them out with very little instruction. They used the sanitizing wipes and our homemade charging station very responsibly, and the ratio of 1 headset per pair of students seems just about right. It’s easy for me to manage the apps on them as well. If I purchase an app, the students can load it on a headset with no intervention from me.
- We re-norm OFTEN about expectations when using VR equipment. I boil it down to 3 basic principles:
- Be Safe.
- Be Kind and Respectful.
- Take Care of the Equipment.

Being safe involves using the wrist straps and making sure your play area is secure and nobody walks through an active play area. Being kind and respectful involves honoring time limits and making sure everyone gets a turn. Taking care of the equipment means we always play on carpeted areas, we hand off equipment carefully, and we take care to power down, wipe, and plug in everything when done.

We discuss these several times a week. You really can’t do this too much.

This coming week, we’ll take a field trip to our local science and technology museum, work on our research projects, and start choosing themes for the student-made apps. After this week, I think our computers will be in and we can start learning how to create apps in Unity and animations in Tvori.

# Systems of Equations and Context

Disclaimer: not a coding lesson! Just a reflection on teaching a notoriously tricky Algebra I concept.

In my Algebra I class, we’re learning about systems of equations. I had a career as a software engineer before teaching, and as I tell the students often, systems are actually a concept I used every so often as an engineer. Sometimes you have multiple variables or constraints that you have to meet at the same time, and modeling them as an algebraic system is helpful. I found, however, that knowing systems are useful doesn’t translate to easy teaching or learning.

I spent 5 or so lessons going through the usual order of solving-by-graphing, solving-by-substitution, solving-by-elimination. I used the Illustrative Mathematics lessons available online. They are decent lessons, but I could tell the pace was leaving some students behind. By the time I assigned practice problems, maybe a third of the class had a decent grasp of an algebraic way to solve a linear system and the other 2/3 were struggling. And, as you can imagine, the kids who didn’t understand showed me by misbehaving – fun.

What do you normally do in this situation? Over time I have learned the best approach is to back up without making it seem like you’re backing up. Increase the problem-solving load while you decrease the procedural load. Lesson planning is creative problem solving.

Sometimes my friends post math memes on Facebook – picture puzzles that are actually systems of equations. They’re fun. I did some searching for “algebra picture puzzles math” and followed the rabbit hole to pinterest boards that hosted lots of them. One site you can mine for picture puzzles is brainfans.com which is where I captured the ones I used in my lesson.

I gave the students a couple of picture puzzles to work through in small groups, along with a couple of word problems I made up about purchasing food. Here are the ones I used. I purposefully chose puzzles that always had 2 or more variables in each equation, so you needed to use the concept of elimination or substitution, you couldn’t just solve for one variable in a single equation.

———————————

Dawn went to a burger stand on Saturday and bought 5 cheeseburgers and 2 fries. She spent $21.24. On Sunday, she was still hungry and she went back to the same burger stand. This time she bought 2 cheeseburgers and 2 orders of fries for $16.14. How much are the cheeseburgers and fries?

CCCCC + FF = $21.24

CC + FF = $16.14

Dawn went to a smoothie shop on Monday and bought 6 large smoothies and 2 small smoothies for $61.64. They were so delicious, on Tuesday she went back and bought 7 large smoothies and 4 small smoothies for $82.33. How much are the large and small smoothies?

LLLLLL + SS = $61.64

LLLLLLL + SSSS = $82.33

These were VERY accessible to the kids. The students that already had a good concept of solving systems modeled the picture puzzles as equations and solved them formally. The students that were having a tough time with it used less-formal approaches that still used the idea of substitution or elimination.

For example, from the first two equations using the cars, they could tell the yellow race car was worth 2 more than the blue race car, using the concept of elimination. Then, in the third equation using the cars, they could reason out that “x + 2 + x” was equal to 32 and decide the final value of the blue race car – basically using the concept of substitution.

I could tell students got the “cheeseburger” problem correct when they shouted across the room “Why are your cheeseburgers so cheap and why do the fries cost so much?” Ha! I love gourmet fries!

In the “smoothie” word problem, most groups struggled with it at first – even those that understood symbolic equation solving so far. So I gave them a tiny hint – I asked them what would happen if they doubled the first order. How many large smoothies would that be? How many small smoothies? And the price now? And how is this new order different from the 2nd order? And every single group of students said “oh” and finished independently. Context matters!

To finish the day, we did the Noah’s Ark problem which I found a long time ago on Julie Reulbach’s blog. It uses the same concepts, substitution and elimination, and it’s just as much fun with 9th graders as it is with young kids!

The students’ assessment is to write their own picture puzzle and word problem, complete with solution, for others to solve. We’ll swap them next week!

I enjoyed this SO much more than teaching systems the old fashioned way, and the students had fun problem-solving instead of continuing to learn procedures. Math class was fun, and avoidance / bad behavior was almost completely absent today.

# Linear Functions and Missile Command: A coding mini-project

Hi everyone – if you’re still hanging in there with me, and I haven’t lost you due to my long absences from engaging with the blogging world, I’d love to share a little mini-project I did with my algebra class. I gotta say, I really enjoy doing coding mini-projects in math class. I like putting the projects together, the kids find them really engaging and fun, the problem-solving is interesting and surprising.

We started out the year as many algebra classes do, studying linear equation-solving and the properties of linear functions. Things have been going reasonably well, but I knew some students were irritated not knowing “when will we ever use this?” – It’s one of my ongoing pet peeves with the high school math curriculum, that the way it is expected to be learned and the way it shows up in standardized tests doesn’t really match how these concepts are used in real life. Including linear functions. These are SUPER useful in real life – in all kinds of situations where you have to make predictions involving a constant rate. But the kind of problem-solving you normally do with linear functions doesn’t always look like what we do in math class, converting functions to slope-intercept form or point-slope form, graphing on a 4-quadrant plane, etc.

I started by giving the students that basic speech. These concepts are incredibly useful, but in the real world they don’t often look like what we see in math class. So today we’ll explore one possible application of linear functions.

And I introduced them to the retro game of Missile Command.

We watched a YouTube video of someone playing the game (the screen captures were fetched from this video too):

The students were in awe. Back in the early 1980’s, we were in the end stages of the Cold War, and the threat of a nuclear apocalypse was a low-level stress always present in our lives. In the game, missiles rain down on your cities and your job is to shoot them down before they destroy your nation. You even get a little 8-bit mushroom cloud when a city is nuked. It really was a dark, terrifying video game and I remember feeling super tense while playing it. There’s no way to win. The missiles just fall down faster and faster until you lose all of your cities and the world ends.

The missiles always start at the top of the screen and rain down in a straight line. In the game, if you could predict where those missiles would land, you could prioritize which ones you needed to shoot down. As the game got faster, for example, it didn’t make sense to shoot down a missile heading for a city that was already destroyed. Focus on the ones heading for your still-standing cities.

We watched for a bit and some students insisted, “Those aren’t straight lines!” But they were, they just didn’t look straight when rendered in 8-bit. For example, these missiles below go down 2, over 1, down 2, over 1, down 2 once more, over 1, then down 1, over 1. Repeat the pattern – 2, 2, 2, 1. 2, 2, 2,1. The slope is a net -7/3. We could identify missiles with a slope of -5/2 (down 3, over 1, then down 2, over 1) and -8/3 (2, 3, 3. 2, 3, 3).

I made the students a little mini-game starter in Khan Academy. In this starter, the missile is at the top of the screen, and a house is at the bottom, but the missile doesn’t move. We did have to start with a little discussion about how the coordinate plane in many programming languages is different than the one we use in math class. Often, a computer game’s coordinate grid has (0,0) in the top left. X increases as you go right, which is what you’d expect. However, Y increases as you go DOWN the screen. It’s intuitive if you think of the way spreadsheet cells work, or the way you read text. Start in the top left, work over, then down.

The key is to change lines 31 and 32, which currently read:

x = x + 0;

y = y + 0;

If you modify the amount added to X and Y, the missile starts moving. The trick is to make the missile make a straight line and hit the house. If you hit the house, the screen turns red. Decimal amounts can be used.

Students found that if they tweaked the velocities such that the Y velocity is a *little* more than the x velocity, they can hit the house. For example, these combinations worked:

x = x + 10;

y = y + 12;

x = x + 0.5;

y = y + 0.6;

A y/x ratio of *about* 6/5 was ideal, and there was some wiggle room since the house has a hitbox about 20 pixels wide and tall. We made some predictions about other combinations before trying them.

Next, I challenged the students to move the starting location of the missile, on lines 2-3, and the starting location of the house, on line 6, and find a new y-x velocity pair that would let the missile hit the house. Some students, of course, thought of putting the house directly below the missile and using a y-velocity only, setting up a “no-slope” situation.

On line 8, there’s a line of code specifying “FrameRate”. This is the number of times the draw() function is called in one second. It’s 60 by default, so the missile will move 60 times each second. For the final challenge, students had to tweak the frameRate() and also the velocity so the missile would hit the house in *exactly* five seconds. Students got timers out and spent quite a while trying to get the missile to hit in exactly five seconds. Many figured out that if the missile moves roughly 80 pixels each second, it takes five seconds to get to the bottom of the screen… so it was a matter of finding combinations of frameRate * y-velocity that would equal about 80.

I just want to finish with a plug for Khan Academy’s computer programming interface, especially when it comes to little math mini-projects like these.

Khan Academy’s Computer Programming courses

Create a new Javascript Program

It’s my go-to resource when I want to create a quick little math activity. I don’t necessarily need my students to create a program from scratch all the time – often I’ll create a little starter program that needs fixed or modified. With this interface, I can save the program and push a link out to Google Classroom. Students click on the link, and then click “Spin-off” to get their own copy to modify. They can also see other students’ spin-offs, so if they get stuck, it’s helpful to see what someone else did. The program runs right away and needs no compiling time, so the students see the impacts of their changes instantly. The number scrubber and color picker make programming changes super easy and fun. The documentation tab is wonderful. If you’ve got students who are interested in taking the task beyond what you set up initially, just refer them to the documentation tab and there will be examples they can copy and paste.

It’s a fantastic coding environment for little activities like these, and I use it in math all the time!

# How to make a Mini Wind Turbine from a Dollar Store Pinwheel

I’m teaching a Renewable Energy venture this quarter, and I wanted to make activities for the students involving wind, solar, and hydroelectric power. Purchasing mini-wind farm kits online is really expensive, so I experimented with making my own wind farm. After a few experiments I found a fairly easy way to make a wind turbine! Here’s how to do it.

Supplies:

- Pinwheels from the Dollar Tree
- DC Motors (preferably with a motor mount. We have THIS PACK that was sitting around school, so we repurposed them for our wind farm. The motor mounts work perfectly.)
- Gears. I modified some gears found Here , changed the hole diameter and made an .svg file for laser cutting. Use this .svg file if you have access to a laser cutter. Otherwise you will need one large gear with a 7mm hole and one wee little gear with a 2mm hole.
- Wire cutters, alligator clips, and a hot glue gun.

Step 1: Clip the end off the pinwheel hub with your wire cutters. You need to remove the pinwheel.

Step 2: Hot-glue the big gear to the pinwheel so it’s centered over the hole. Depending on the thickness of your material, consider hot-gluing the medium gear to the pinwheel and then the big gear to the medium gear. The medium gear will just be a spacer so the motor doesn’t rub against the pinwheel petals.

Step 3: Hot-glue the small gear to the shaft of your DC motor.

Step 4: Insert the motor into the motor mount and place the pinwheel on the hub with the gears facing in. Find the spot where the motor gear meshes with the pinwheel gears. Hot-glue the motor mount to the pinwheel shaft so it stays in place.

Step 5. The pinwheel now has nothing keeping it from falling off the hub, so what worked best for me was adding a TINY dot of hot glue to the end of the hub and then when that dried, add a little more and then a little more until I had a button of hot glue preventing the pinwheel from falling off. The pinwheel should still spin freely. If not, scrape off the hot glue and try again.

That’s it! I clipped a multimeter to my DC motor and was able to get 0.75 volts in a stiff breeze. If you chain several together in series, you can get enough voltage to charge a battery, perhaps. A little lubricant on the pinwheel hub seemed to help.

A student and I chained several together and ran around the parking lot with them. We got up to 5 volts. We clipped a USB charger to the circuit but it did not seem to be enough to charge a phone. For students, phone charging seems to be the gold standard of “is it a good circuit”, so that feels like a good goal. Stay tuned. Let me know if you are able to stitch together a wind-powered phone charger or you find something more efficient than these Dollar Tree pinwheels.

# Unit Rates and Scratch

I’m back to teaching pre-algebra after a long time off – and the more things change, the more they stay the same! A key staple of middle school math is learning about rates – how they work, how to calculate unit rates, how to predict with rates, and different representations of rates – including tables, graphs, equations, and story problems. I love to make the connection between the story problem and the equation by doing a coding activity. For our final project on unit rates, I assigned the students a pair programming project in Scratch. The structure of the activity is really similar to what I’ve done in my 6th grade computer science classes.

- The background knowledge. We have a discussion about a specific situation involving rates – I chose “toilet paper math”, because what is a more confounding consumer decision than buying toilet paper? I picked a couple of examples of toilet paper packages from the weekly grocery ad and put them into a Google Doc for the kids here. https://docs.google.com/document/d/1zM4wwf2GDSEEaB31IWDeJPTqibtPsG1zLN_XA_k35uM/edit We had a class discussion about what clues on the package might help me figure out what toilet paper to buy. One class mentioned that I could figure out the number of squares / sheets of toilet paper in each package, and another class wanted to go by the number of square feet in the package. Together, we wrote a Scratch program that would help me figure out what toilet paper to buy. For the class example, I showed them how to use the “ask” block to get input, the “set” block to set variables to values, and operators to do math. We created variables for the price of the toilet paper, the number of square feet in the package, and the number of square feet you can get for a dollar. The main character would then report out the square feet per dollar unit rate to help us figure out our purchasing decision. Our class program is here: https://scratch.mit.edu/projects/291422012/editor
- The norms before the worktime launch. I explained to the students that when I was an engineer, we often used a protocol called “Pair Programming” to solve problems. As an adult, this meant I prairie-dogged my head up above the cubicle walls and shouted to my friend Jerry: “Jerry! Can you help me solve a coding problem? I can’t figure it out.” Then I would type at the computer while Jerry stood behind me and read over my shoulder, and we talked together about what the code did – line by line. It was really helpful to have a partner talk it over with me. I explained that in middle school, we can also use Pair Programming and some of the norms are pretty much the same. Then I showed the Code.org pair programming video on YouTube.

https://www.youtube.com/watch?v=vgkahOzFH2Q After the video, we went over the do’s and don’t’s. - I gave the students a choice of word problems having to do with Unit Rates, and their task was to solve one of them with a partner using the Pair Programming protocol. The choices are in this document: https://docs.google.com/document/d/1h8r2z0o2FtOr8N4IjqGaiNrhn_DGAJLIyNREeg9iR0g/edit I change up the celebrities in the document every so often. Students love Marshmello and also Ariana Grande this year and I got some cute programs with these characters.I swear the Pair Programming video is magic. Students for the most part peacefully navigate partner work after watching and processing the video. I only had a couple of groups that had any trouble at all. This activity took a whole class period for most classes, and a little longer for one group. All of the students were engaged and trying hard, and most groups enjoyed the creative storytelling part of the project. I wish I had introduced Scratch sooner in this year’s math cohort, but we had a lot of manual math to do and so we’re just now starting to automate things. Now that the kids are on board with it, I can’t wait for the next project.Here are a few example programs the students made for the word problems.

Marshmello’s road trip: https://scratch.mit.edu/projects/293136380/editor/

Hagrid’s Animals (these students modified the prompt a little bit, but I really enjoyed how theirs turned out and they had fun with the creative storytelling): https://scratch.mit.edu/projects/292456078/editor/

Ariana’s Carpet (this group of kids decided to include their favorite K-Pop star and I’m embarrassed to say I don’t know who this guy is): https://scratch.mit.edu/projects/293139904/editor/I really believe in computer programming as a modeling tool for math expressions. Students love the instant feedback and the creative storytelling, and I love that they can test many inputs and it is a check on their number sense. Often I see students modify their model when they try plugging in a few numbers and then they say “Wait a minute! That gas mileage doesn’t make sense!”

Other programming languages work just as well. I’ve had older middle schoolers do a similar task in Processing and it really stretches their brains!

# A class on engineering, electronics, and the Maker Mindset

At my school, rather than pass through grade levels, students have levels of autonomy – from “Explorers” who do mostly teacher-directed projects and products, to “Pathfinders” who do almost completely student-created projects and products, and job internships. I’m teaching an “Explorer” level class, so I’m introducing new learners to things they might not have known they would like but we’re asking them to try it. Other teachers with Explorer classes are doing things like creating pollinator boxes, producing a play, and studying floodplains. My venture project is called “Whimsical Inventions” and it’s a class about learning how to be a maker and a tinkerer. I began by presenting content about coding, electronics and circuitry, 3-D design, and doing research… but also teaching about the mindset of an inventor. Inventors solve problems, true, but inventors also make things because making things is joyful. We make stuff that is a little over-engineered because it makes us and others happy. We take everyday things and make them more beautiful, musical, entertaining, weird, or funny. If you’re making a thing to be happy, you’re more likely to take risks, to try something that might not work, to iterate on your design and make it better. This is the premise behind the class. To learn about coding, electronics, design, and engineering for the smiles.

As students finish with their final projects I am just feeling so blessed with the circumstances I got to teach in. The kids have come a long way with coding and Arduino. My makerspace is buzzing with 3-D printers and the laser cutter. Kids solder skillfully and safely. And they are doing a great job cleaning up and putting things away. I was lucky to get a class in which many kids were interested in the topic but many others just got placed there to try something new. My class is evenly split between boys and girls. It’s mixed-age with kids ranging from 6th grade to 10th grade. And I have gifted kids, kids with IEP’s, second-language learners, kids from all areas of town. It is just awesome. When I have a diverse group of learners I am a very happy teacher and this has been a phenomenal group.

And look at some of the fun stuff they’re making! One child is making a 3-D printed ferris wheel with a stepper motor and some LED’s. It’s coming along well! She downloaded the Ferris wheel design from Thingiverse.

Another student is making a motion-activated Moo machine. You know those cylinders that you tip upside down and it moos? He’s going to attach it to a servo and mount it in a stand with a motion sensor on it. When you walk by it will moo at you! Here’s the base beginning to print. He designed it himself!

A pair of students is making a light-up holder for your Instax photos. They’ve learned to solder and program these RGB LED strips and they’re going to mount some clips here to show off their photos. Another girl is using the same idea to make a light-up phone case. She has printed several iterations of the perfect phone case to make sparkly with the LED strips.

I have one pair of students that decided to make their own battery-powered car. They designed the car chassis themselves and soldered together the battery packs and switch and motors, and they’re doing to attach wheels and I’m just so excited to see how it turns out.

It’s just been fun. Part of our requirement for the project is that kids have to do a research project as well, and I’ve found that they really are engaged in their research which I didn’t expect. Early on in the class we did readings and watched videos on the value of tinkering and inventing useless things – we watched videos from Simone Giertz, Adam Savage, Ayah Bdeir and others. One of my favorites is this TED Talk from Steven Johnson which tells the story of how seemingly useless inventions can change the world. I’ve taught electronics classes before, but this is the first time I’ve really focused on teaching the mindset of an inventor, and I really think it has positively shaped the culture of the class. When I reflected on the times I learned the most and grew the most as a maker, those times tended to happen when I was making something I personally cared about but was just a fun side job, a useless invention. I hoped to give my students that same experience. I really believe most of them are, and it’s a very happy class to teach.

Sometimes when I’ve taught engineering classes before, the classes would end up being not very diverse (kids tend to sign up who already know they will like it, and I tended to have mostly boys in those classes), and I never felt like I had time to teach about maker culture. With a diverse class and making the culture/mindset front and center in the learning, it’s been a very fun experience and I can’t wait to show you how the exhibition products turn out.

# Pre-calc, Trig, Physics, and Planetary Motion – a coding project

I mentioned earlier that I get the privilege of teaching pre-calc for the first time this year. As a capstone project for our unit on trig, I created a project on planetary motion. It had been on my radar since we studied conic sections and learned about how planetary motion is a real-world example of an ellipse. I browsed around for some examples of planetary motion simulators, and found this one written in Python.

https://fiftyexamples.readthedocs.io/en/latest/gravity.html

The link above uses real-world values for masses of planets and the value of big G, but I thought the students would enjoy “playing God” and creating their own planets and velocities and creating the big G constant for their little universe. In the process we would learn about the physics of planetary motion and about how trigonometric functions can be used to model periodic motion in a coordinate plane. Yay math!

My pre-calc students have not yet had high school physics, so I had the opportunity to set the groundwork for some basic mechanics. I know I gained a lot by watching these little videos from Crash Course and PBS. I had the students watch them both, and we processed them afterward.

After this first video, the main mind-blowing concepts were: a) centrifugal force is kind of a “fake force”, it’s just the balancing force to centripetal force that pulls you inward, b) in a circular path, your velocity is tangent to the circle, and c) students knew that force could be described by the equation: F=ma, but after the video we talked about a special version of the formula that describes circular motion, F=mv²/r.

Together we wrote, earlier in the unit, a basic computer program on Khan Academy that made a little planet orbit around a bigger sun using trig functions to find the x and y coordinates. Fun but not an accurate planetary model. I’m not sure if the computer program playback will work here, but here’s the basic model.

## animate

Made using: Khan Academy Computer Science

Since we had briefly learned about Kepler’s laws during our unit on ellipses, I told the kids I wanted the model to change so it actually modeled planetary motion – faster when close to the planet, slower when farther away, making an ellipse with the “sun” at one focus. And to do that, we’d have to learn a little about how planets exert force on each other and how that impacts their motion. So we watched the next video.

So from this video, we learned many more mind-blowing things. Among them, there is ANOTHER formula for force: F=GMm/r². These formulas are all related to each other. We would now modify our computer simulation to show how they all work.

Ok so here are the basics of programming an animation. This structure is common to pretty much all game programming as well. You have setup code and then an animation loop, that runs over and over again. Most of the time, the animation loop runs around 60x per second.

In the setup code, we initialize all of our variables. In the animation loop, we’ll calculate all of the forces and accelerations and velocities and positions, and once everything is updated, we’ll re-draw the scene. You always re-draw the whole scene from the objects in the “back” (such as the background) to the objects in the “front” (such as the moving planets). For simplicity, my model doesn’t take into account the planet’s effect on the sun… just the sun’s effect on the planet.

Step 1: In the animation loop, draw the background and the sun. In the Khan Academy programming environment, (200,200) is the center of the canvas since the canvas is a 400×400 grid. This code places a circle, 40 pixels in diameter, right at the center. The fill() and background() commands are used for colors.

var draw = function() {

background(0,0,0); fill(164, 244, 245); ellipse(200,200,40,40); };

Step 2: In the setup code, create variables for the sun’s mass and the planet’s mass. I just told the kids to make up numbers, one a LOT bigger than the other, like 100 times bigger or more. I just made these up on the fly. The units are totally fake. Just have fun making up weird numbers.

var smass = 34782; var pmass = 7.2;

Step 3: We need to place a planet. We’ll create variables for the planet’s x and y positions and draw a smaller circle at that position. I recommended to the students that they place the planet so that it is directly above, below, or to the left or right of the sun. In other words, the x or y coordinate is the same as the sun’s, but the other coordinate is different. My planet starts out 170 pixels ABOVE the sun (because the y axis is upside down).

Setup code:

var px = 200; var py = 30;

Animation loop (at the end of the var draw function, before the last curly brace)

fill(153, 242, 126); ellipse(px, py, 10, 10);

Step 4: You’ll need to calculate how far away you are from the sun at any time in order to correctly calculate the force. So make a variable to store this distance, and then re-calculate the distance every frame. Normally you would use the distance formula, sqrt((x2 – x1)² + (y2 – y1)²) however Khan’s math library has a function called “dist” that simply takes the parameters x1, y1, x2, y2 and returns the distance between them.

Setup code:

`var pdist;`

Animation loop (before you draw the planet. I added a comment above this to show where we are doing all of the math)

```
//MATH
pdist = dist(px, py, 200, 200);
```

Step 5: Now we have *almost* all of the information needed to calculate the force on our planet. We know the masses of the two planets and we know how far away they are at any time. We do NOT know big G, our gravitational constant. For now we’re going to make up a number. It’ll be wildly wrong. We will fix it in a bit. We’ll calculate force using our wrong constant for now. The students enjoyed thinking about how when you create your own universe you get to decide things like how big the universal gravitational constant is.

Setup code:

```
var G = 10; // just make something up
var pforce;
```

Animation loop (after you calculate distance but before you draw the planet)

```
pforce = G * smass * pmass / (pdist * pdist);
```

Step 6: Now we need to explore the relationship between position, velocity, acceleration, and time. We already have variables for the planet’s x and y position. We will need to break velocity and acceleration down the same way. Velocity is how much the planet’s position changes with each time interval. Acceleration is how much the *velocity* changes with each time interval. If our object starts at the top of the circular path, it begins with a fairly large x-velocity and a zero y-velocity. As it moves around the circle clockwise, the x-velocity and y-velocity change so that by the time it gets around 90 degrees, the x-velocity has slowed to zero and the y-velocity is at a maximum. And the cycle repeats around the circle. A periodic function!

So after position is established we will give our planet a starting velocity. Since my planet started at the “top” of its circular path, I will give it an x-velocity but no y-velocity. A student that put their planet to the side would give their planet a y-velocity but no x-velocity. When you run this code now, you will see the planet move in a straight line tangent to its circular path. It follows Newton’s first law – no force, no change in velocity. Bye!

Setup code:

var vx = 4; var vy = 0;

Animation loop (put this code right before you draw the planet):

px = px + vx; py = py + vy;

Step 7: We need to calculate the acceleration in the x- and y- direction every frame. This is where the trig comes in. This step really consists of three substeps. First, we need to find the angle of rotation between the planet and sun. Second, we find the x- and y- components of the acceleration. Third, we add the acceleration to the velocity (remember acceleration is the change in velocity every frame). For the first substep, we can calculate the angle of rotation easily – the planet’s position is a certain y-distance and a certain x-distance away from the planet, so if we use inverse-tangent, we can find the angle. Khan’s math library has a function “atan2” that calculates an angle given the y-distance and x-distance. Note the sun is at (200,200) so that’s why those numbers are hard-coded. Substep 1:

Startup code:

`var ptheta;`

In animation loop:

`ptheta = atan2(200-py, 200-px);`

Substep 2. Calculate acceleration components. Here we use our original force formula: F = ma. We calculated force, we know mass, so acceleration is easy – just Force / mass. Then we have to multiply that acceleration times sin(theta) for the y-component and times cos(theta) for the x-component. These use the definitions of sin and cos as you relate them to a unit circle. The code!

Setup code:

var ax; var ay;

Animation Loop (after you calculate ptheta):

ax = (pforce / pmass) * cos(ptheta); ay = (pforce / pmass) * sin(ptheta);

Substep 3. This part is easy. Add the acceleration to the velocity every frame. Do this before you re-calculate position in the animation loop.

vx = vx + ax; vy = vy + ay;

You’ll run your code. The planet will either fly off into the unknown or crash into the sun. I encouraged the kids to play with the value of G, but sometimes the animation runs so quickly that it’s hard to even tell if you should dial up G or dial it down. So we had to come up with a better way to find a universal gravitational constant that would make our little solar system dance instead of fall apart.

Here’s where our other formulas for Force come in. For uniform circular motion, the centripetal force that keeps a body in a stable circular path is: F=mv²/r. For planetary motion, the force affecting the planet and sun can be modeled as: F=GMm/r². We know all of the variables in both equations EXCEPT a value for G that makes the orbit stable. So set one equal to the other and solve for G. I used some contrived numbers in my model and all of my students had different contrived numbers. Mine were:

M = 34782

m = 7.2

r = 170 (since my planet started at y = 30 and my sun was at y=200 and the x-coordinates were the same)

v = 4 (I just made up a velocity of 4 pixels per frame)

When I solved for G, I got a value of 0.078. So I modified my program and plugged in this value for G and guess what happened? Uniform circular motion and the feeling that I AM GOD of my own little universe.

You can make tiny changes to the planet’s initial velocity, for example change it to 2 instead of 4, and see the planet travel in an elliptical comet-like path instead of a circular path.

Here is the entire working program.

## PLANETS

Made using: Khan Academy Computer Science

When I taught this lesson, we went through the steps as a class just as I went through them in this blog, discussing them along the way. For a final product, the students will write an essay (!) describing their understanding of the physics of planetary motion. I will also give them a brief quiz. I have not yet written a rubric but will share it when I do.

I really enjoyed working on this little coding project and was so pleased that I could connect periodic functions and the physics of motion. If you make any modifications or try this with your students, please let me know.

## Recent Comments