Organize and Share your Electronics the way you want. Sign-Up for a free account now. It takes only 30 seconds!

Here’s how to play the Star Wars song with electronics

Today is the last day.

I’m teaching a course at betahaus in Berlin.

And tonight is our last session.

It’s also my last day in Berlin (for now) — but more on that some other time.

We’ve had a lot of fun in the course.

One thing I taught was how to play a melody using an Arduino.

…and I thought that might be interesting for you too.

(If you don’t know what Arduino is, you can learn about it here: http://www.build-electronic-circuits.com/what-is-arduino/ )

Here’s how to create a melody player:

In the last session, they (the students) learned to play a tone with a piezo speaker, using the tone() function.

By combining many tone() commands, you can create a melody.

Just find the notes of the song you want to play (easy to do with Google).

There’s also a function called noTone() to stop the tone from being played. By combining these two functions with the delay() function, you can play melodies.

Here’s an example:
http://youtu.be/cye_wiaqybk

The tone function needs the frequency of the note you want to play. To find the frequencies of musical notes, you can check out the table on this page:
http://www.intmath.com/trigonometric-graphs/music.php

If you have an Arduino and a piezo speaker, I would highly recommend you to try it out. It’s a fun exercise, and it gives you something cool to show off to your friends.

No idea what Arduino is, or how to get started?

I have a guide — “Get started with Arduino in less than a day” — that you’ll receive as a bonus if you get one of my eBook bundles here:

http://www.build-electronic-circuits.com/products/ebook-2nd-edition/

Keep on Soldering!
Oyvind

PS! It’s soon time to launch the next round of my online course. I just need to finish some of my projects before taking on something new. I’ll keep you posted.

Single-Sided USB Charger
A FPGA controlled RGB LED MATRIX for Incredible Effects – the Hardware
Using Nanotimers to Reduce IoT System Power Consumption by an Order of Magnitude
Replace a microwave’s beeping with the Windows XP startup sound
A DIY Laser Scanning Microscope
Reverse-engineering the surprisingly advanced ALU of the 8008 microprocessor
ESP8266 LED lighting: QuinLED v2.6 PCB
Switching LVDS Graphics in a Laptop Computer
Teleknitting: TV-based string art
DIY Bubble Machine
Start your day with Nerf target practice!
Teardown of a Peaktech 6225A

Top