(Sections Under Construction) in Wiki
Issue #212
resolved
Hey there,
under the MicroBlocks Wiki there is a headline “(Sections Under Construction)” showing off different topics currently worked on.
As I am quite interested into these, especially “6 - Using a capacitor to measure time” or “8 - Measuring battery voltages up to 9v” I would like to ask you if you already know how long it will take until these are released?
Regards
Comments (2)
-
repo owner -
repo owner - changed status to resolved
- Log in to comment
Thanks for your interest in our electronics series!
We’re working on those sections more or less in sequence as time allows . Unfortunately, the two that you mentioned are at the end of the sequence, so it will be a while before we get to them.
However, Katie Henry plans to blog about the capacitor experiment (https://katiedays.com/blog/) sometime soon.
I am having some doubts about the wisdom of working with 9v batteries and the micro:bit in the context of this series, which is aimed at beginners, since making a mistake with a 9v battery (e.g. connecting the battery directly to one of the micro:bit pins) could damage the micro:bit. I’d hate to see a teacher lose a couple of precious micro:bits doing this experiment.
However, if you want to make a 9v battery tester, I’ll explain how. The idea is to use two resistors to create a voltage divider. One resistor should have a resistance of about twice the other. For example, you might use a 22k and 10k resistor. You’d connect the resistors in series with the 9v battery like this:
+9v - 22k - 10k - Ground
You would then connect the micro:bit GND to the ground (-) of the 9v batter and micro:bit pin 0 to the point where the two resistors are connected to each other:
+9v - 22k - (micro:bit P0) - 10k - Ground (micro:bit GND)
You’d then use the “read analog pin 0” block to take an Analog Reading. For 22k and 10k resistors, you can compute the approximate battery voltage like this:
Battery Volts = Analog Reading / 100
That is, a reading of 900 would be 9v. (Note that a fresh 9v battery will be over 9v.)
For other resistor values R1 and R2, where R2 is the smaller resistor (the one connected to GND), the general equation is:
Battery Volts = (Analog Reading * 3.2 * ((R1 + R2) / R2)) / 1023
The 3.2 is the micro:bit power supply voltage. That voltage gives an analog reading of 1023. For 22k and 10k resistors, the math above works out to:
Battery Volts = (Analog Reading * 0.0100098
Very conveniently, 0.0100098 is very close to 0.01, which is 1/100th, so we can just divide the analog reading by 100 to get volts.