Tuesday, May 26, 2015

The Milatron

We haven't coded much lately. Seems that she's interested in hardware at the moment :) And stuff like sports and music. With regard to music, we've been building a thing I call Milatron.

It's a custom electric instrument that we designed earlier (see my previous post). The idea is that we use an Arduino microcontroller to produce different sounds through a speaker, when you press one of the 8 colored buttons. Simple enough. We found a suitable cookie box to use as the chassis and decided to use a 4 inch speaker element which is way too heavy for our use but later on proved to be a good choice.

First, we had to measure, draw and cut a hole to the chassis for the speaker, and install the speaker with bolts. She did most of the hard work, of course.



Then it was time to drill holes for the keys. At this point you could already see that this thing is gonna look awesome. 

She installed the keys mostly by herself and did all the soldering too. She just loves soldering!  

We added the Arduino and a breadboard inside. The breadboard had a sticker surface on its bottom so it could be nicely fitted on top of the speaker. At first I added a resistor between the Arduino and the speaker to turn down the volume a bit. Later we replaced the resistor with a potentiometer so that you can adjust the volume to your liking.



We installed a 9 volt battery which is held in place by the huge magnet of the speaker. So the big speaker turned out quite handy in many ways. It also gives the gadget a considerable weight, so it doesn't feel like your average children's toy.

Here's the Milatron now. It's tuned in D major and makes terrible noise. It even has kind of a polyphony. 





We did some experiments with software-generated sound before we started working on the actual instrument though. But I decided writing the actual Milatron software myself, because generating waveforms with different, accurate pitches isn't actually trivial. A bit too much for a 6 year old, I'm afraid. I think the main thing is that she knows it can be done.

All in all, we spent something like 3 nights working on this. Good times! And the monstrosity is still in active use, a few weeks after its birth. We are planning on adding extra features like pitch bending later... 

Maybe I should post a video of how it sounds?

Saturday, March 21, 2015

Lesson 67 - Modding Switches

Today I got a shipment of electronics. Me and my little girl were both excited to open a bunch of envelopes to see what's inside; we have been waiting for some more Arduinos and mechanical switches for our upcoming Electronic Instrument. She immediately recognized the Arduinos, of which I was kinda proud.

The switches were a disappointment though. Colorful and all, but unfortunately of the "latching" type, meaning a switch that stays down when you press it, and comes back up when you press it again. And that just won't do if you're planning to build a keyboard for a musical instrument, will it?

So, we started "modding" the switches be removing certain parts from inside. We had 15 switches to mod in total so there was some real work to do! You'd thing this would be tedious and boring for a 6-year old girl? Nope, not at all. Even the 3-year old helped the best she can. In the end, I was the only one (not counting the 3-year old in) unable to open the plastic casing of a switch without breaking it. 




So the 6-year old can now mod a switch without any adult help, and does it better than me... And here they are, all 15 switched, modded by willing child labor!




Then we did some design on how the instrument would look like.




Next up: woodwork. We need to build a casing for our thingie. And maybe we need to visit the local "recycling center" to scavenge some parts, including a little speaker element. The Hartke element might be a bit too heavy-duty for our use case, weighing 1 kg or so. You can see it in the picture too. Quite a monster, ain't she?

Friday, March 6, 2015

Soldering school

Today her older cousins were visiting. She organized a Soldering School where she explained how to solder and had them all do some basic soldering. Was fun.

Thursday, March 5, 2015

Solder On!

Yesterday she was sick and I got to spend the whole day at home with her. Guess what we did? Well, she slept and watched Netflix while I was working. For a while. But when she got her energy back, guess what she wanted to do. Solder. So we did some serious soldering. Behold the METAL HORSE!






And today, I asked her to do her violin homework. Guess what she wanted to do. Solder. So solder we did. She soldered a resistor on the perfboard perfectly!

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.