Sunday, March 1, 2015

Lesson 66 - Solder Star

Yesterday she asked me if we could now build the magical electric instrument together. The one we discussed in Lesson 65. I said yes.

So we started by recapping on our previous work with electricity. She struggled with terms (voltage etc) but with some help, she was quickly able to construct a circuit that will light up a led with 3.3 volts from the Arduino. And she remembered that you cannot use 5 volts for that. 

Soon we were about to start connecting the speaker element to the board. Whoa! One of the wires soldered to the speaker had gone missing. We concluded that we're gonna have to solder it back. Now this speaker element is heavy-duty and has a magnet so powerful that when it gets stuck to a piece of metal, she can barely drag it free with all her might. Now imagine using a soldering iron on that. It'll do its best to draw the burning-hot iron to the speaker element. So we decided I'll do the soldering but she'll get to practice soldering after that. She helped me by keeping the wire in place with her steady little hands while I applied solder.



After fixing the speaker I let her do some free practice with the soldering iron, under my supervision, of course. She started by almost burning the power line of the soldering iron. After I showed her the burn-marks on the plastic cover, she took good care not to repeat that mistake again. Here are some of here works.


A stickman and a star that is. She wanted to keep on soldering but it was almost bedtime so we had to stop for now. Was fun! I think need a better soldering iron though. Mine's a 5 dollar one from the Internet.


Monday, February 23, 2015

Lesson 65 - Arduino

Yesterday we took a look at electronics and Arduinos. We discussed what electricity is and what voltage roughly means. We tinkered with some wires, leds and resistors to see that you have to make a circuit from the 5 Volt output of the Arduino into GND which stands for ground and is 0 Volts. We draw a lot of stuff on the paper to illustrate how our circuits worked.

It was fun to use the 5 Volt and 3.3 Volt outputs of Arduino to run some motors (voltage affects run speed!) and then leds (you cannot feed 5 volts to a led or you'll break it!).




She got really excited and told me she wants to build a robot that moves and talks. I used my consulting skills to talk this down to a single blinking led. We almost got that far in the end.





So, from a talking robot down to a single lit led we went. But we had fun all the way.

Today I build a simple instrument with a push button and a potentiometer for controlling output frequency. The speaker is actually the tweeter part of my 350W Hartke Bass Combo that got spectacularly destroyed on the stage some 20 years ago.



And that was super fun to play with. We agreed to build an electric piano-like keyboard instrument together. I think that's a really nice exercise really, as there's electronics, coding and even mechanics / woodwork involved. I'm planning to make casing out of wood. Let's see if we can do this...

Friday, February 20, 2015

Lesson 64 - Back To Turtle

Every now and then she asks for a computer lesson. Today that happened again and there we went. After a brief discussion we decided to try Turtle Roy again. It had been a while since the last time, but she remembered at least some of the basic stuff. She laid out grandiose plans of what she wants to achieve today and I told her it involves recursive algorithms. We decided to start with basics and try to draw a rectangle first.

After some practice, we started formulating the one-liner. Meanwhile, here little sister

"eleaaaaehooooooonoöhgr05dvhrrrrrwwwwwqqqqqqqqqqcvnmjhgfdsaww2qqqwpiesödakglggggggggggggmmmmmmmmffffffmmmmmmmmmmmmkkkkkkkkkkkbbbbbbbbbbbbbbbbbbbbbbbbbtttttttuopåofsäiåptoöfccccccbbyx178uidbgfgdfhäifkgkjnbnmmknbnbvbchchdseh
eleku"

And then I got my computer back.

After discussing how the algorithm should be constructed, she started editing it inline. I taught her one of my coding tricks.

"Always type both opening and closing parentheses first and then add content between"

Maybe this is the lesson she'll always remember and will teach it to her own children later. After some editing, she had this.

    r 4 (s [fd 121, rt 90])

It draws a perfect rectangle! Now it was time to give a name to this algorithm and move to the next steps. Her patience was running out though. So we saved the work to continue later...

    save "neliö"

Nothing new this time really. But we had a good time and maybe we'll get to some new stuff next time, if we continue the saved program.

Sunday, January 25, 2015

Lesson 63 - Raspberry

A Raspberry Pi came from the mail and has been lying on the kitchen table for a while. 

It's essentially a little, dirt-cheap computer that can run Linux and has HDMI output, LAN connector and a couple of USBs. The interesting part for me is that you can easily plug in a Wifi adapter and you can use the GPIO pins to control electronics like LEDs and motors. And when I say motors I mean ROBOTS. Autonomous, Internet-connected ROBOTS.

I guess I was nibbling this skeletal little computer when my daughter asked me to have a "computer lesson" again. We discussed the Raspberry a little, but then went to draw the computer on a whiteboard. This is what it became. 



It's 95% drawn and written by her.

We started from CPU and its central role as the part that runs her programs. Then to RAM from where the CPU reads its instructions. And then, what do you think happens to the stuff in RAM when you unplug the power cords (drawn in the diagram). Her answer was funny, but I unfortunately forgot it already. Then we went on to persistent storage, or "hard disk", display, keyboards, USB connectors and stuff. She enjoyed drawing a lot!

Then we took a look at the Raspberry that looked like this.


All the parts are neatly exposed on this computer, ain't they! We identified the parts in her diagram that were currently missing in the Raspberry and marked them with red magnets. Then we added an SD card as the "hard drive" of the computer.

I installed a Wifi dongle (took me a while, I admit), created her an user accound. Later I told her that even though we don't yet have a keyboard and a display for the Raspberry, she can use it via network. She was quite enthusiastic to try it so we logged in using SSH using her own computer.



Once there, we decided to create a file using vim (which I pre-installed of course). As usually it took quite a while to select a suitable name for this new file, especially when she had to negotiate it with her baby sister. Eventually she kinda pulled rank and decided to name the file after herself. The naming debate had exhausted her though and she quit before even starting to think about what the file should contain.

Fun day! I especially recommend the drawing part. Afterwards I wrote a little Python program that blinks a led. Maybe we'll create a Raspberry robot soon. I have motors and stuff you know.

Tuesday, January 6, 2015

Frozen Dragons

Yesterday we had a Movie Night with our family. We watched the film Frozen featuring the princesses Anna and Elsa who seem to be the current idols of our daughters.

Today my bigger girl made yet another Christmas card with Scratch and then went on to code.org to discover that Anna and Elsa are now featured as the first tutorial! So now she's drawing beautiful drawings on the ice by coding. It's a very nice tutorial indeed, but depends very much on angles. Like, you need to do an 120 degree angle there and a 90 degree angle there. Fortunately you can pick the angles from a dropdown...

Another nice thing we've been playing lately is Dragonbox that's not directly related to programming, but teaches algebra instead. Even our 3-year old is able to solve simple math equations!



While the 3-year old was solving equations, the 5-year old built a robot out of Lego Mindstorms bricks. I guess we'll have to do some robot programming soon.

Monday, November 24, 2014

Go Candy Robot!

Today I visited the Koodikerho (Code Club) at a local school in Espoo, Finland, hosted by Marko Klemetti from Eficode. Marko has been doing these code clubs for some time already and it shows! He has a really nice relationship and a laid-back attitude with the 3rd to 6th graders attending the club.

There were two 45 minute sessions, one for the 3rd / 4th graders and one for the 5th / 6th graders. For the younger ones we did a Candy Robot exercise, where the kids write down instructions for the Candy Robot that has to pick and sort candies from a bag into 4 cups. If it succeeds to place 2 candies in each cup, the kids get the candy. The challenge is that the robot only understands a very limited number of commands and takes everything literally.




The Candy Robot exercise worked extremely well. It took 2-5 iteration for each team of kids to get to the correct solution so that they can eat candy and play with iPads. It was fun and taught the basics of programming quite well.

With the 5th / 6th graders we started the Codecademy Javascript program on which I have mixed feelings. On the other hand, it teaches a language that's really relevant today; it's the language of the Web. However, the Javascript program on Codecademy is in English only and has quite verbose text sections that are tough especially for the 5th graders. Also, I think it's a bit boring. Nevertheless, the kids did surprisingly fine. It was really tough, but they mostly kept focused and asked a lot of good questions. I hope this builds their skills faster than it kills the joy in programming :) Soon enough, they should be able to build their own programs in Javascript.

Later today, I tried the Candy Robot exercise with my 5-year-old at home. Not surprisingly it was a lot tougher for her and she required a lot more help than the kids at school. For a while she got frustrated but eventually, with enough help, she came up with a working program. Maybe I should have used real candy with her too, instead of the Hama beads...

Her program looked like this, before we gave up on actually writing everything down.




But what really made the night for us was the exciting game of Go, which was the first one for her. I only gave her easy time for the very beginning of the game until I discovered that she'll kick my ass. She was brilliant and ruthless and took no prisoners.

Sunday, November 9, 2014

Lesson 62 - Basic Basic

Today I refreshed my Commodore 64 programming skills by reading the C64 Wiki. Meanwhile my daughter was playing some games on the net. It took just a little while to for her attention to switch to what I was doing. I guess the animated bird was the selling point. 

A fun thing about the Commodore Basic is that if you want a delay, you do it with a for-loop:

    FOR X=1 TO 300:NEXT

Anyway, she wanted to change my "waves" program to one that would print her name all around the screen. It took a sec to get used to the way programs are edited on this old machine. 

For instance, you always edit in the overwrite mode. And you have only 2 arrow keys, so that you have to the SHIFT key to be able to move to all directions.

Yet, she made it! So her first BASIC program looks like this.



In case you wonder what the semicolon does, it prevents the otherwise automatic line-feed.

And managed to save it too. Now she's looking for the disc that says "Bubble Bubble".