I asked this question on StackOverflow and was told it was more suited to here...
I am getting started using the micro:bit and have just built the micro:bit piano mentioned here: https://www.youtube.com/watch?v=ulKq5To9dmA
I want to get my students to make it in school as a project but I have a few questions about how the circuit works.
The power-supply and earth are both taken off the micro:bit. The 3.3v passes through a 22mOhm resistance in the circuit on the video (and a 100kOhm resistance in my circuit). A wire is inserted between the resistance on the breadboard and the pin from the micro:bit . When this wire is connected to ground (the Piano key and Earth on the diagram), depending on which pin it interrupts, the micro:bit plays a sound.
The questions I have are:
- In the code, the GPIO pins are set to a floating state at the start. Would it be safer to set the pins to 1 at the start or would this stop the circuit from working? I don’t know if there is a risk of a stray voltage damaging the board if the pins are in a floating state?
pins.setPull(DigitalPin.P8, PinPullMode.PullNone)
pins.setPull(DigitalPin.P12, PinPullMode.PullNone)
pins.setPull(DigitalPin.P13, PinPullMode.PullNone)
pins.setPull(DigitalPin.P14, PinPullMode.PullNone)
pins.setPull(DigitalPin.P15, PinPullMode.PullNone)
pins.setPull(DigitalPin.P16, PinPullMode.PullNone)
- I don’t have a 22megaohm resistor so I used a 100 kilohm resistor, and a stick made of some insulated copper wire in place of my hands to connect the piano key to the ground. I know that you should not connect the 3.3 volt directly to ground on the micro:bit as it my damage it. Is a 100kilohm resistance enough to have between the 3.3 volt supply and the input pins or is there a risk this could also damage the micro:bit? It is putting 33 microamps into the pins.
Thanks for your help.