Find the Best Place to Put a Solar Panel
Abstract
Imagine trying to put a solar panel on your roof or outside your home to generate clean, renewable energy. Where would you put it so it generates as much power as possible throughout the day? What direction should it face? Is there a way to take measurements to find the best location before you install the panel? In this project, you will use a tiny programmable device called a micro:bit to record light data and find the best place to put your panel.
Summary
None
See Materials section for details
No issues
Objective
Use a micro:bit's light sensor to find the best location for a solar panel.
Introduction
Solar panels generate clean, renewable energy from sunlight. They generate the most power when the sun's rays are perpendicular to the panel. They make very little power in the shade and no power at all at night. This means that to generate the most power, a solar panel should be placed and tilted so that it will get the most total sunlight exposure throughout the day.
That might be easy to do if you can place a solar panel in the middle of a field or on top of a building, with no tall trees or other buildings nearby to cast shade on the panel. If you live in the northern hemisphere, the solar panel should point south, since the sun is usually in the southern part of the sky throughout the year. If you live in the southern hemisphere, it's the opposite, and your solar panel should face north.
But what if that isn't the best option? For example, maybe you live in the northern hemisphere, but there is a tall building or tree directly south of your house that blocks the sun for part of the day. Or maybe you live in the southern hemisphere and want to put a solar panel on the roof of your house, but your roof is at an angle that doesn't face directly north (Figure 1). How do you figure out the best place to put your solar panel?
One way to do this is to use a device with a light sensor to record data. You can put the device somewhere and measure the amount of light exposure throughout the day. If you record data in different locations, you can figure out the best place to put the panel so it will get the most light. To do this, you will need to measure the area under the curve on a graph of light level vs time. Sometimes, it might be obvious which graph has more area under the curve (Figure 2). Other times, it might be a little trickier to figure out, and you will need to measure the area carefully (Figure 3). The project procedure will explain how to do this.


In this project, you will use a tiny programmable device called a micro:bit. The micro:bit has a built-in light sensor and can record data that you can view on your computer. By placing the micro:bit in different locations and recording data, you can figure out the best place to put a solar panel near your home!
Terms and Concepts
- Solar panel
- Renewable energy
- Perpendicular
- Northern hemisphere
- Southern hemisphere
- Light sensor
- Area under the curve
Questions
- How do solar panels produce power?
- What makes a solar panel produce the most power?
- What can reduce a solar panel's power output?
- What is a general rule for the best direction for a solar panel to face? Does it depend on where you live?
Bibliography
- Micro:bit Educational Foundation (n.d.). Solar panel experiment. Retrieved February 3rd, 2026
- Finio, B. (n.d.). How to Use a micro:bit. Science Buddies. Retrieved February 3rd, 2026
Materials and Equipment
- micro:bit Go Bundle, available from our partner Home Science Tools®. The kit contains:
- micro:bit board
- USB cable
- Battery holder
- AAA batteries (2)
- Computer with USB port.
- Note: the micro:bit kit comes with a USB-A to micro-USB cable. If your computer only has USB-C ports, you will need a USB-C (male) to USB-A (female) adapter.
- Multiple locations where you can leave your micro:bit undisturbed to collect data throughout the day:
- For testing outdoors, locations near your home, such as a deck, porch, steps, outdoor table or chair, exterior windowsill, etc.
- If you cannot test outdoors, you can test indoors by placing your micro:bit on an interior windowsill
- Materials to secure your micro:bit if collecting data outside:
- Clear, resealable/zipper plastic bag to keep your micro:bit from getting wet
- Rock or other small object to prop the micro:bit up at a 45-degree angle
- Tape to hold everything in place if it is windy
Experimental Procedure

- If you have never used a micro:bit before, watch our micro:bit setup video before you continue. You should also watch the light sensor and data logging videos.
- Open the sunlight data logger program from the Micro:bit Educational Foundation. Click "Edit code" in the top right and then "Download" in the lower left to download the program to your micro:bit. The program is also shown in Figure 4 if you would like to write it yourself. Here is how the program works:
- The program will display an X on the screen when it first starts and is not logging data.
- Data logging starts when you press button A on the micro:bit. A check mark will display on the screen for two seconds to indicate that logging has started.
- After that, a single LED will stay lit on the screen to show that the micro:bit is logging data.
- Once per hour (every 3,600 seconds, or 3,600,000 milliseconds), the micro:bit will record the elapsed time (in hours) since it started recording data and the light level on a scale of 0 to 100.
- A heart will briefly display on the screen each time the micro:bit records a data point.
- You can change the number in the
everyblock if you would like to record data more frequently. - The micro:bit will stop recording data when you press button B.
- The micro:bit will delete the stored data when you press buttons A and B at the same time. Be careful not to do this before you download the data to your computer!
- Prepare a data table to record your data. See Table 1 for an example.
- Enter a description for each location you plan to test. Include information about the micro:bit's location, the direction it will face (for example, north, south, east, or west), and any obstacles that may block the sun for this location.
- Add more rows if you plan to test more locations.
- Note: for all trials, keep the tilt angle (the angle between the micro:bit and the ground) constant at about 45 degrees. You can change this variable for a separate experiment (see Variations section).
| Location # | Description | Trial 1 | Trial 2 | Trial 3 | Average |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | |||||
| 3 |
- Look at a weather forecast to plan your testing. You should plan to collect data on sunny or mostly-sunny days. Do not collect data on overcast or mostly cloudy days. Avoid collecting data on all sunny days at one location and all partly cloudy days at another location, as that will skew your results. Conducting more trials for each location will help if you have partial cloud cover on some days. If needed, have an adult help you look at a weather forecast and plan your experiment.
- Prepare your micro:bit for data collection. Figures 5 and 6 show example indoor and outdoor testing locations, respectively.
- Connect the battery pack.
- If you will be testing your micro:bit outside, place it in a clear resealable plastic bag to protect it from water.
- Prop your micro:bit up so it is tilted 45 degrees relative to the ground.
- Press the A button to start collecting data.


- Do not disturb your micro:bit for 24 hours. After 24 hours, press the B button to stop collecting data.
- Download the data from your micro:bit and save it on your computer.
- Disconnect the battery pack and plug the micro:bit into your computer with the USB cable.
- Open your computer's file explorer and navigate to the micro:bit. It should show up like an external flash drive or hard drive.
- Double click MY_DATA.HTM to open it in a web browser.
- Click Visual Preview to see a graph of your data.
- Click Download to download a comma-separated value (CSV) file of your data.
- Give the file a name that makes sense so it will be easy to identify later, such as "Location1_Trial1.csv."
- Once you are sure the data has been saved to your computer, press buttons A and B on your micro:bit at the same time to delete the data stored on it.
- Repeat steps 5-8 for at least two more trials at your first location.
- Repeat steps 5-9 for each of your remaining locations.
- Once you are done collecting data, you will need to calculate the area under the curve for each trial.
- Open your CSV file in a spreadsheet program like Microsoft Excel or Google Sheets.
- Make a graph of the data with "time in hours" on the x-axis and "light level from 0-100" on the y-axis.
- Calculate or measure the area under the curve for the graph. There are several ways to do this:
- Print the graph on graph paper. Count the number of squares that fit completely under the curve (do not worry about squares that only fit partially under the curve), as shown in Figure 7. If you take this approach, make sure you print each graph at the exact same size for each trial.
- Calculate the area of each rectangle that fits under the curve, as shown in Figure 8. The area of each rectangle is its width (1 hour, unless you changed the frequency of data collection) times its height (the light level at the top of the rectangle). Add up the areas of all the rectangles to get the total area under the curve.
- Both of these methods will slightly under-estimate the area under the curve, since they do not include the areas of the partial squares or triangles at the top. That is OK and should still provide a reasonable comparison between your different trials. For more accurate results, you can measure or calculate the area of the partial squares or triangles and include them in your total area.


- For each trial, enter the area under the curve in your data table.
- For each location, calculate an average area under the curve and enter it in your data table.
- Compare the results for each location you tested. Which location has the highest total sun exposure throughout the day on average? Where is the best place to put your solar panel?
Ask an Expert
Global Goals
The United Nations Sustainable Development Goals (UNSDGs) are a blueprint to achieve a better and more sustainable future for all.
Variations
- Keep your micro:bit in a consistent location and facing the same direction (north, south, east, or west), but change the tilt angle relative to the ground. Which angle receives the most sun exposure throughout the day?
- Can you repeat this experiment at different times of the year? Is the same location always the best? Where and how should you place your panel to maximize the amount of power generated over the entire year?
- What if you could make your solar panel rotate so it always points right at the sun? Check out our micro:bit solar tracker project.
Careers
If you like this project, you might enjoy exploring these related careers:












