# Wireless Light to Sound

1,610

6

1

Published

## Introduction: Wireless Light to Sound

This is a simple project I used with a class of students several years ago, the idea was to demonstrate how energy produced in one state could be transformed, transmitted and decoded.

This will be submitted for the STEM competition and covers the areas of Science (for the energy transfer section), & technology for the inclusion of Arduino and solar panels.

## Step 1: What Will You Need?

For this instructable you will need:

• 1 Arduino (any kind) or similar, what is important is that it has a digital output available
• A power supply
• A solar panel, almost any size will do
• A piezo buzzer
• An LED, trial, and error resulted in me settling on a blue ultra bright as it produced the best result

## Step 2: The Code

I have used the tone setting on Arduino but I wanted this to play something familiar.

I chose the theme music from Starwars as I knew that would catch the attention of my young engineers.

I must give credit here as I did not write out the program, instead, I got a prewritten one on GitHub, here

I will explain some of the code as it is relevant to how the whole concept works:

The code opens by defining each of the notes in the tune:

e.g. const int c = 261;

The note C (low C in this case) is defined as a constant integer, the 261 is the frequency that will be written to the PWM pin on the Arduino. By altering the frequency the pin turns on and off at, the pitch of the note will change. There are tonnes of pages out there that will provide a comprehensive list of frequencies for all kinds of basic scales, including all of your flats and sharps as defined in the attached file.

Pin 8 is defined as the buzzer pin: const int buzzerPin = 8;

This is a digital pin set as an output, the code intended that a piezo buzzer is fitted directly but we instead will install our LED at this point.

In the code, the author has defined a function called "beep" in order to simplify writing the rest of the code:

void beep(int note, int duration)
{ //Play tone on buzzerPin

tone(buzzerPin, note, duration);

}

The function calls "tone" from the Arduino and passes in the variable for buzzerPin, defined earlier as pin8.

The beep function passes in the note and duration values and tThe tune then starts to play out:

beep(f, 250);

beep(gS, 500);

beep(f, 350);

beep(a, 125);

beep(cH, 500);

beep(a, 375);

beep(cH, 125);

beep(eH, 650);

The beep

## Step 3: Why Does It Work?

As stated previously this project is all about the reconfiguration of a wavefrom.

The tone to be transmitted is defined inside the Arduino in terms of frequency.

This frequency is produced on the output pin by pulsing electricity on and off very quickly.

If the buzzer were fitted here, we would hear the tune played out.

When the LED is fitted we do see it turning on and off but this is not the tone frequency, we are seeing the space between the notes.

The light does appear to get slightly brighter and dimmer but it is not very noticeable, the frequencies we are using range from 261 to 880 Hz, the best a human eye can detect is about 60Hz.

The light travels from the LED to the solar panel. Solar panels convert light energy to electrical energy but this energy output follows the frequency pattern of the flashing LED. This is then reflected in the excitation of the piezo buzzer, producing the melody. The output volume is quite low as the LED does not generate a huge voltage on the solar panel but if an active (powered) speaker were used then the volume would be controllable.

A note, if you are using an active speaker, you must use a mono jack, stereo plugs will not work with this kind of application.

## Recommendations

• ### Arduino Class

69,795 Enrolled

• ### Casting Contest

We have a be nice policy.