Instructions
Table Of Contents
- Introduction
- Parts
- Using Alligator Clips
- Solar Board Reference
- Project 1 – Sun Finder
- Project 2 – Garden Light
- Project 3 – Self Charging Cooling Fan
- The BBC micro:bit
- Getting Code to Run on the micro:bit
- Project 4 – Adding an Energy Meter
- Project 5 – Energy Logger
- Connecting Up
- Code for the Energy Logger (MakeCode)
- How it works
- Connecting to Your PC
- Pairing Your micro:bit With MakeCode
- Showing the Device Console Graph
- Capturing Data From a Charge and Discharge Cycle
- Downloading Data
- Getting Data into a Spreadsheet Program
- Analysing the Data
- Graphing the Data
- Results
- Understanding the Data
- Understanding Duty Cycle
- How the Solar Store Works
- Project 6 – Intelligent Cooling Fan
- Troubleshooting
- About the Author
- Learning
- Monk Makes Kits
# main program
while True:
# sensing
stored = pin0.read_analog()
if button_a.was_pressed():
override = True
if button_b.was_pressed():
override = False
read_temp()
# control
if fan_needed():
fan_on()
elif fan_not_needed():
fan_off()
# display
digits(remaining(stored))
print(stored, temp)
sleep(500)
How it Works
This is a really simple estimator that makes a number of quite broad assumptions
about the system, but it is good enough as a rough indicator to the user of how long
they can use the fan for.
To understand how the estimator works, we need to look at a bit of school math,
namely the equation of a straight line. A graph will help to explain all the key parts
of the estimator.
TOC
BOC
now
discharge
time
time
stored
charge
c
m
y
x
The equation of a straight line is:
y = mx + c
y = stored charge (read from P0)
m = slope of line (rate of use of charge)
x = time fan has been on for
c = TOC (charge when fully charged)
Page 36