활동

# Energy cost calculator

고급 | MakeCode, Python | LED, 버튼, 빛 센서 | 13 날씨, 변수, 불 논리, 센서, 입력/출력

## 1단계: 만들어 보세요.

### 프로젝트 소개

The third of three projects to help you gather data about your energy use. Learn how to work out the cost of energy and make a timer that measures how much electric lights cost to run.

이 프로젝트는 전세계 지속가능발전 문제들에 대한 해결 방법 중 하나로서, 컴퓨터과학기술을 탐색하고 활용해서 새로운 물건들을 만들어 내는 문제해결 과정을 경험할 수 있도록 만들어진 프로젝트들 중 하나 입니다.

### 학습 내용

• How to use mathematics to convert units: watts to kilowatts and minutes to hours
• How to calculate energy used in kilowatt hours (kWh) from power measured in watts (W) and time.
• How variables can be used to store values for a user to configure a system prior to use.

### 사용방법

The previous project, the Energy light timer, measured how long a light is switched on. This special version of the same project works in a similar way, but it calculates and displays the cost of the energy used by a light bulb rather than the time.
To use it, you need to know 3 numbers:

• The light reading when the light is switched on. This is the number you found using the first project, the Energy light meter and used in the Energy light timer project
• What wattage your lighting is. This is usually printed on the lightbulb.
• And how much you pay for your electricity, the unit cost per kWh

The program stores these three numbers in variables which you need to edit before using this project.

Use the Light meter project as before to get a number to put in to the LIGHT variable.

Look at the light bulb to find out how many watts it uses. Remember light bulbs can get very hot and are usually connected to mains electricity, so ask an adult to do this for you. Put that number in the WATTS variable.

Finally put in the cost per kWh in the COSTPERKWH variable. You may need to ask an adult to find this number for you, or find out who supplies your energy and research their unit cost online.

Flash this program onto a micro:bit and attach a battery pack. Place this timer near a light source, and the micro:bit will use the information you gave it about light intensity, light bulb wattage and the cost of your electricity combined with readings from its built-in light sensor and the processor’s timer to monitor the cost of the electricity used over a period of time.

You can take cost readings at the same time every day or every week by pressing button B. Re-set it by pressing the reset button on the back of the micro:bit and check it’s gone back to zero by pressing button B again.

Remember this is just one lightbulb, so consider the cost across a whole building for a year.
Now you have some data about energy use, how would you go about changing people’s behaviour to save energy and money, and perhaps help combat climate change?

### 설명

• The program times how long a light is left switched on using the micro:bit's light sensor.
• The amount of energy you use is calculated by multiplying the power of the lightbulb by the time. This is measured in kilowatt hours (kWh). Because a lightbulb's power is usually measured in watts, not kilowatts, the program converts from watts to kilowatts by dividing by 1000:
watts ÷ 1000 = kilowatts
So for example, a 60 watt lightbulb uses 0.06 kilowatts of power:
60 W ÷ 1000 = 0.06 kW
• The program also converts the time units. To convert time from seconds to hours divide the time in seconds by 60. So:
600 minutes ÷ 60 = 10 hours
• To work out the cost of energy used in a given period of time, the program multiplies the energy use in kilowatt hours by the unit cost per kilowatt hour.
• If my energy costs £0.16p per kWh, leaving a 60 watt lightbulb on for 10 hours will cost me ten pence:
0.6 kWh × 16p = 9.6p

## 준비물

• micro:bit
• MakeCode 또는 Python 편집기
• battery pack (recommended)