1

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.

enter image description here

The questions I have are:

  1. 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)

  1. 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.

WTony
  • 11
  • 2
  • Welcome to EE.SE. Please post the circuit (schematics as well) for the section of interest. to get a real basic idea of how the setup is. In general, GPIO if it is __input__, it is safer to pullup or pulldown (good practice), but it won't damage the IC, even if it is left floating. 100Kilo ohm as a pullup or pull down should be okay too. unless, there is a reason to use such a high value (RC timing??) – User323693 Feb 18 '20 at 10:20
  • @user323693 Thank you for your comment. I have uploaded a simplified circuit (doesn't show all the pins) to illustrate it better. – WTony Feb 18 '20 at 11:52

1 Answers1

1

The 22MOhm resistor is a pull-up so the GPIO isn't floating. The magnitude of the resistance is significant in this instance as you wish to use the human body to ground the GPIO pin and the human body has a resistance of 5MOhm (according to the video you linked @ 3:50). If you use a 100kOhm resistor the voltage at the pin is 3.23V ( R2/(R1+R2)*V = 5M/(100k+5M)*3.3 ) and the microcontroller can't see any change.

markcra
  • 21
  • 6
  • thank you for your feedback. I am using a bit of insulated copper wire instead of my hands to complete the circuit, which I guess has very little resistance. Do you think there would be any risk that too much current is being sent to the ground pin on the microbit? I don't know how much is too much. – WTony Feb 18 '20 at 11:56
  • @WTony I don't know the specifics of the microbit, but if it uses a common microcontroller as its heart, there should be no problem if you sink up to 20 mA in total and 5 mA per pin. For a definitive answer how much is too much, you need the datasheet of the controller. – Arsenal Feb 18 '20 at 12:11
  • Ah, so you're making a micro:bit stylophone, very cool. I commonly use a 10k resistor as pull-up or pull-down with a push-button or switch on microcontroller inputs. – markcra Feb 18 '20 at 12:29