is my pyboard broken or am i missing something

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
rhubarbdog
Posts: 168
Joined: Tue Nov 07, 2017 11:45 pm

is my pyboard broken or am i missing something

Post by rhubarbdog » Mon Apr 02, 2018 11:23 am

when i run the following code the light flashes when X5 is connected to 3V3 . the light doesn't flash when disconnected or X5 is connected to GND as expected

Code: Select all

from pyb import Pin, LED, delay

wire=Pin('X5',Pin.IN, Pin.PULL_DOWN)
light=LED(3)

while True:

    if wire.value():
        light.toggle()
    else:
        light.off()

    delay(500)
 
when i change the pin to Y10 the following happens Y10 connected to 3V3 the light is flashing as it is incorrectly when disconnected. it's only when i connect Y10 to GND is it that the light goes out.

it's as though the pull down resistors don't work.

thanks

User avatar
Roberthh
Posts: 3668
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: is my pyboard broken or am i missing something

Post by Roberthh » Mon Apr 02, 2018 1:14 pm

The Pyboard has an Pull-up resistor on the PCB, value 4.7 k. That is made to support its use for I2C, which needs a pullup-resistor of that value. The chip internal PULL_DOWN is less strong, so finally the Y10 is pulled up.
So: It's not a bug. it's a feature (honestly).

rhubarbdog
Posts: 168
Joined: Tue Nov 07, 2017 11:45 pm

Re: is my pyboard broken or am i missing something

Post by rhubarbdog » Mon Apr 02, 2018 1:28 pm

So should i use external pull down resistors on Y10 and friends. If so can you hint at a typically value

User avatar
Roberthh
Posts: 3668
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: is my pyboard broken or am i missing something

Post by Roberthh » Mon Apr 02, 2018 3:12 pm

That would be one option, about 1 k would be required, but not the best. Other options include:
- use a different GPIO port. Only X9, X10, Y9 and Y10 have that pull-up resistor
- change your program logic, in that you connect it to GND instead of 3v3.

chuckbook
Posts: 135
Joined: Fri Oct 30, 2015 11:55 pm

Re: is my pyboard broken or am i missing something

Post by chuckbook » Tue Apr 03, 2018 10:30 am

If your intention is to use a pin as combined input/output you may have to change your logic. If it is just an output, use it in OUT_OD mode.

Post Reply