This further help resource contains download links for additional code examples and also a walk-through video that covers the experiment in full. The video also has hints and tips to help you complete the experiment.
Inventors Kit Experiment 9 - Capacitor Charge circuit:
In this experiment, we will use the analog input of the BBC microbit to measure the voltage at the positive leg of a capacitor. A circuit will be created that allows the capacitor to be charged through a variable resistor (also known as a potentiometer.) The BBC micro:bit will be programmed to display the charge level of the capacitor both numerically and using external LEDs to create a colour coded display.
Video Walk-Through With Hints & Tips:
Code Downloads:
The code examples below have been individually zipped and can be downloaded by clicking on your preferred option. Once unzipped you can either open the and edit the code in appropriate editor or place the HEX file onto your microbit*.
MakeCode Editor & Python Code Downloads:
- This code was created with the MakeCode Editor, download the HEX file here.
- This code was created with the Python Editor, download the HEX file here.
Legacy Editors Code Downloads:
NOTE: The legacy editors will disappear at some undisclosed point in the future. The code can still be placed on a microbit and will run regardless but you won't be able to use an editor. When that happens, switch to using one of the currently supported editors. We've already made the switch as the new editors are better and more fully featured.- This code was created with the Touch Develop Editor, download the HEX file here.
* - To place the unzipped HEX file onto your microbit, connect your microbit to your computer via USB and then open File Explorer (Windows). Your microbit should show up as a removable drive. Simply drag and drop your HEX file onto the microbit in file explorer and the file will be transferred. The power light on the back of the microbit will start to flash, once the flashing stops the microbit is ready to run your code.
Kitronik Inventors Kit Resources:
Exp No#. | Experiment Name. | Resource Type. |
---|---|---|
1 | Say Hello to the BBC micro:bit. | Further Help. |
2 Pre V1.7 | Using an LDR and analog inputs. | Full Experiment + Further Help. |
2 V1.7 | Using a Light Sensor & analog inputs. | Full Experiment + Further Help. |
3 | Dimming an LED using a potentiometer. | Further Help. |
4 | Using a transistor to drive a motor. | Full Experiment + Further Help. |
5 | Using the accelerometer to control motor speed. | Further Help. |
6 | Setting the tone with a piezo buzzer. | Further Help. |
7 | Wind Power. | Full Experiment + Further Help. |
8 | Making a game using the compass. | Further Help. |
9 | Capacitor charge circuit. | Further Help. |
10 | Using an RGB LED. | Further Help. |
11 | Making a pedestrian crossing. | Full Experiment + Further Help. |
12 | Making a random dice. | Full Experiment + Further Help. |
Get The Kitronik Inventors Kit For The BBC microbit:
We do two versions of the Inventors Kit for the BBC micro:bit, with or without the BBC micro:bit included. Chose the option that is right for you from the links below.©Kitronik Ltd – You may print this page & link to it, but must not copy the page or part thereof without Kitronik's prior written consent.
3 comments
Mark Donnison
Hi Dillon, no this charge time is excessive. I would look to ensuring that the circuit is powered correctly, then triple check your connections and that the breadboard is working correctly. If this doesn't get you to the bottom of the problem, contact support@kitronik.co.uk and one of our team of experts will help you troubleshoot more scientifically.
Dillon
When I tried this experiment, it took over an hour for the orange LED to come on. I had followed all the instructions perfectly and triple checked all connections. Is it supposed to take so long? The video shows it in a few minutes. I never even got to see the yellow and green LED's come on, as it took so long.
Erwin Middelberg
My son and I build experiment 9 (capacitor charging). We made some small changes, you might want to consider as improvements. - we rounded “percentage”, because otherwise a bunch of decimals would be displayed, making it harder to read # percentage = Math.round(cap_voltage / 10) - we gave each “if” section 4 digitalWritePin lines, disabling each LED individually, giving a more clear display during discharge Do you maybe know how to improve the sample rate? Because in its current form, the delay between pushing SW1 and seeing the results on the LED's is a bit long