Showing posts with label education. Show all posts
Showing posts with label education. Show all posts

Saturday, February 04, 2017

Alarm Clock Hacking by Blocks

A little over two years ago I built an alarm clock intended for hacking by kids, using a web-based Python IDE. When I tested the lessons, I found that kids didn't like messing with Python and only learned enough to get things barely working. Yet, when it came to Scratch Jr or the desktop version of Scratch, they would spend hours at a time. I needed to find a more approachable way to code.

Recently I discovered Blockly, a product from Google for Education. With that framework you can code by blocks and use its transcoder to output JavaScript, Python, Lua, Dart or (ugh) PHP. The transcoder runs entirely client-side, and the output is human-readable - well indented and even commented.

Writing custom blocks turned out to be an easy thing, so I created blocks to modify the LED display, send audio out to a speaker, or react to button presses. Now you can use blocks to program the clock, while retaining all the functionality present in the older Python interface.

If I was going to redo the Hack Clock, this time I wanted to have a presentable site with full hardware and software lessons, for both Python and Blockly. I revamped the Hack Clock website, completed the Python lessons that I left incomplete last time, wrote new Blockly lessons for the new IDE, and completely re-did the hardware how-tos. Lesson writing took up the lion's share of time, since they all needed new images and better testing.

Another bit o' feedback I had received was that installing the Hack Clock software was too much of a pain. I tried to make this a bit easier this time by offering releases within a Debian pkg, although you still needed to use apt to install dependencies. Still, this cuts down installation from over an hour to about ten minutes... and most of those ten minutes is spent twiddling your thumbs while you want for packages to download and install.

The hardware needed tweaking as well. It turns out the Raspberry Pi headphone jack is just a PWM pin hack and it seemed that GStreamer sometimes just couldn't grok it. The headphone jack was never a complete solution either - it required a discrete amplifier to power speakers, and soldering wires onto a 1/8" jack is a GIGANTIC pain. To make the audio hardware easier to cope with, I moved away from the headphone jack to Adafruit's I2S decoder and amplifier. It provided better audio and cleaner installation without increasing my part count or price. It has proven out to be easier for everyone so far.

The old Hack Clock had another embarrassing flaw: it could only handle one button input and couldn't manage output at all. That drove me nuts and was probably the second biggest thing I wanted to fix. With the latest release the Hack Clock can handle as many buttons as you have GPIO pins, and you can also drive output pins as "switches" in code. The code-by-blocks IDE could deal with buttons and switches as simple function blocks - which meant reacting to user input became much easier to code.

Once things were ready, I installed the Hack Clock software in a mission-critical environment: kids' rooms. So far things have gone well; audio has been more reliable than with the headphone jack, and they have been able to tweak the software more easily than with Python. One bit I noticed this round however: kids don't like looking down to read something, then looking back to code it. The next generation Hack Clock should have an interactive demo to guide through the lessons so they never have to glance away from the IDE.

I'd love to hear what other people experience when they try to get the Hack Clock running as well. A hardware list is posted on Hackaday, and all the instructions are at http://hackclock.deckerego.net/. Let me know what you think!

Wednesday, December 17, 2014

Hack Your Alarm Clock

Kids, teens and adults are more inspired to tinker after they learn the basic framework of what they are tinkering with. Electronics and circuit sets are great, but it really helps to jump-start learning with demos or projects that are heavily documented in the box. After you get your bearings on what works and what breaks, you are more free to experiment and add your own ideas.

To that effort I'm working on a hackable alarm clock based on the Raspberry Pi platform along with several Adafruit/Sparkfun components. The idea is that we can build a customized, tricked-out bedroom alarm clock with some general off-the-shelf components to see how hardware and software work in concert to create something useful. After the project is done, I'm hoping its creators will feel inspired to rip it apart or build new features using the pieces.

I've already run these lessons with a few kids between the ages of 5 and 11, and it was pretty interesting to see what they found interesting. They all wanted to start playing music, but they celebrated being able to have whatever number they wished show up on the LED display. To simply type "77," hit "Save" and refresh the display was enough to send them clapping. They also spent a ton of time building their own enclosures out of Lego, designing the perfect case for their clock.

Right now we have made it to Lesson 6 (the AM/PM indicator), however I have only published up to Lesson 4. More are to come, and I have already found some refinements that need to be made in the previous lessons. The lessons are available at http://hackclock.deckerego.net/, the hardware project is documented on HackADay at http://hackaday.io/hacker/5116-deckerego, and the Python source code for the clock driver is posted on GitHub via https://github.com/deckerego/hack-clock. I will keep these sites updated as the project grows.

Let me know if you try out the project yourself. We are already making some fun hacks, such as using the LED display to show the answers to math problems. I'd love to hear what other people devise!

Thursday, August 15, 2013

My Electric Slide

I love Hack a Day. I've never actually constructed a featured project, but the site has always been a fantastic read to see what's top on the minds of the hacker front. One particular Hack a Day review caught my eye - "a light following bristlebot as a way to teach science." What I found particularly interesting was how well the build instructions were documented on the Science Buddies site. The background was descriptive without being verbose, the parts were easy to come by from both Fry's & SparkFun, and the component count was nice 'n' low. I wasn't sure if the kids would enjoy it, but I knew that at least I would.

Now bear in mind I attempted to take MIT's 6.002x class before my brain took an enormous sidetrack and instead ended up with a comparative analysis with Stanford's Coursera. While I did find out what a high-voltage pickle looked like, my understanding of Thevenin voltage is limited to indecipherable algebra illustrating the "Thin Mint voltage" of a circuit. I generally don't know what I'm doing, and exploding diodes are not a rare occurrence. It took me considerable research before coming to understand what the three pins of a MOSFET are responsible for. To this day I cannot quite grasp why a pull-down resistor is required for normal operation (even when there is no "bad wiring"). I need simple, otherwise something is going to end up charred and melted.

The project went much better than expected. I performed some initial prototyping to make sure it was easy to teach the kids, and things went surprisingly well out of the gate. We ended up sticking with the project far longer than I expected, and even added our own enhancements to boot. We're now on build #4 and going strong. Directional control is actually quite good, and there was enough room for minor tweaks and improvements on the breadboard.

Conveniently enough, when I placed my initial SparkFun order I also slipped in a Raspberry Pi - Model B as well. In the spirit of teaching electronics while remaining completely selfish, I justified the purchase by teaching Python programming using Minecraft while experimenting with GPIO programming on the sly. I was able to have moderate success teaching Python; I constructed a small lesson plan using Martin O'Hanlon's API tutorial as a reference. That turned into a good weekend software development lesson, however I didn't get as much traction with that project as I did with the bristlebots. Luckily for my ulterior motives, I now had a general purpose postcard computer for more breadboard projects. Several tiny wires later, I was able to get a Python script to blink an LED on a breadboard. Between vibrating toothbrush heads and a $40 miniscule flashing light, I started to brainstorm bigger things.

Now I'm getting back into 6.002x - Circuits & Electronics and starting over again. I'm much more engaged given this new context - and will likely take the class MUCH slower than the real-time course would otherwise allow. Should be fun.

Thursday, March 22, 2012

Contrasting MIT's MITx with Stanford's Coursera

I've been really interested in the user experience of highly interactive sites - webapps where the user must interact directly with the site and stay within it for a good chunk of time. Courseware sites are a great example of such user experiences - web applications that engage students in interactive learning. Some big examples have launched within the past few years; Stanford University began providing open access to not only course materials but actually began to engage the public at large with interactive courses offered entirely online through Coursera. This year MIT has followed suit by creating MITx - and they upped the ante not only in student interaction but in how much content was released to the public. I enrolled in both MIT's 6.002x and Stanford's Game Theory class and gave them a spin for a week.

Screenshot of MITx 6.002x Courseware
MIT's 6.002x has been far more intense in comparison to the pace that Stanford's Coursera classes usually take. The class asks for 10 hours a week for study, lectures, exercises, labs, homework assignments and exams. Some students report that 40 minutes a day is sufficient to get through the lectures and exercises, however there are a fair number who are taking the full two hours a day.

Piotr Mitros was introduced as the lead software designer for MITx, and the user experience provided within the site really shines. The rather voluminous textbook is fully available within the site (apparently rendered as an HTML 5 canvas), and renders beautifully on a laptop as well as tables such as the Kindle Fire. In fact, the textbook was actually easier to read on a Kindle Fire than Amazon's own e-books. Lectures are interspersed with interactive exercises that ask you to submit answers to key concepts presented throughout the hour-long video series.

Both quizzes, homeworks and exercises are presented as forms submitted to the site, validated in JavaScript. There appears to be a rather nice algebraic interpreter behind the courses, as it takes a flexible set of inputs (e.g. V1, 1/3, 0.33333, 0.33) and evaluates them to a uniform solution solved within x decimal places. At times it refuses to acknowledge parenthesis or variables and throws syntax or evaluation exceptions, but for the most part it works surprisingly well.

Learning is provided through a number of facets. "Tutorials" are given in laboratory format, where one of the MIT professors walks through a live-action example of things such as the KCL rule or Ohm's Law. This hands-on style serves to underscore the series of lectures, given two per week, in a format that mirrors a classroom. Unlike the classroom however, you must respond to the open questions the prof asks of the class. A video lecture segment may proceed for 90 seconds and then halt until you respond to an open question that builds upon preceding concepts. The web application itself was built to have a natural flow of textbook -> lecture -> examples, however often links for the text pointed to a wildly incorrect chapter. Links are also provided to the open (albeit loosely moderated) discussion forum where students posit solutions and questions amongst themselves.

For as many ways to learn the material as MITx offers, it is often difficult to navigate the course itself. I was often lost trying to understand the sequence professors wished us to follow - should we read Chapter 2 first, then the lectures, then the labs? Often I would be deep in a lecture series, get completely lost and only later find we were halfway through a chapter within the text. I didn't even discover the importance of the poorly named "tutorials" (they're more akin to lab lectures) until very late in the game. There were also several algebraic errors made throughout the lecture and even within the text... and for someone such as myself who already had a fragile grasp of the subject matter, it could get frustrating to find out the error only later in the discussion forums.

The MITx platform is amazing - I can easily see it becoming the standard for online courseware going forward. If they open-sourced the stack, it could very well lead to an explosion of education opportunities to the lay audience. As far as MIT's 6.002x... the pace was just far too intense for me. I already work 60+ hour days, and the extra 10 wasn't feasible.

Screenshot of Coursera's Game Theory Lectures
Stanford's Coursera is an entrant that many are already familiar with - it seems last year's Artificial Intelligence class was a HUGE hit with everyone I talk to. I can't throw a pumpkin without hitting an engineer that raves about Stanford's online courses last year... and trust me, I've tried.

Coursera is a bit more low-key than MITx. A simple list of video lectures are provided, a discussion forum, quizzes / problem sets and... that's about it. A 90-ish page textbook is available for $5 from a separate publisher, but is not key to completing the assignments. Contrast that to 6.002x where there was generally 100-150 pages of reading a week, and you get an idea of how different the scope is. If 6.002x requires 1-2 hours a day, Game Theory requires 15-30 minutes a day.

There are some similarities between MIT and Stanford's approaches. Just like MITx, Coursera injects comprehension exercises within the video lecture stream. However, instead of being an HTML form the exercises are displayed as Flash forms within the video player itself. On one hand this is a bit more streamlined an experience, on the other hand you lose a lot of interactivity and features. One major annoyance was that exercises can sneak up... and often I want to rewind 30 seconds to make sure I understood the key concepts being asked. However, backing up from an exercise causes a 30-60 delay in the player while it re-buffers video (or somethin'). Backing up often takes the entire lecture off the rails.

One thing Stanford is doing well is that there are weekly Screenside (read: Fireside) Chats where the professors provide an open forum to ask questions. This shows a great level of dedication by the professors offering the class, and I applaud that level of interactivity especially when there are so many students enrolled for a free course. On occasion associate instructors for MITx would answer questions, but there was no regular schedule.

The very fact that I'm contrasting freely available, online courses I'm taking from both Stanford and MIT is enough to make me flip my lid. To have such staples of industry like MIT 6.002 or Stanford's vast catalog of courses open to the general public can make you excited about what the future holds. If MIT were to open their courseware platform and if stellar CompSci foundations like Stanford continued to offer a battery of courses on such interactive foundations we would have an entirely new workforce of software engineers on our hands.