New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing option to add pull up or down to gpio pin #255

Closed
butlermatt opened this Issue Oct 25, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@butlermatt

butlermatt commented Oct 25, 2015

When using a gpio pin for input, particularly with switches, the value may sometimes be floating and may read true when there is no input even connected.

A solution is often to add a pull up or pull down resistor to the circuit and because it's so common, they are integrated into the Pi directly. The python sdk has an optional parameter to indicate if a pull up or down should be applied to the pin when it is set up. This is currently missing in the dart sdk and could greatly simplify circuits.

@sgjesse

This comment has been minimized.

Show comment
Hide comment
@sgjesse

sgjesse Oct 26, 2015

Contributor

If you use the PiMemoryMappedGPIO in the raspberry_pipackage there is a way to use the internal pull up or pull down resistor.

See https://github.com/dart-lang/fletch/blob/master/pkg/raspberry_pi/lib/raspberry_pi.dart#L242.

(looking at the comment I can see it it was not updated after I changed an into to a enum).

It might be that the sysfs driver for the Raspberry Pi also support setting the pull up or pull down resistor.

Contributor

sgjesse commented Oct 26, 2015

If you use the PiMemoryMappedGPIO in the raspberry_pipackage there is a way to use the internal pull up or pull down resistor.

See https://github.com/dart-lang/fletch/blob/master/pkg/raspberry_pi/lib/raspberry_pi.dart#L242.

(looking at the comment I can see it it was not updated after I changed an into to a enum).

It might be that the sysfs driver for the Raspberry Pi also support setting the pull up or pull down resistor.

@sgjesse

This comment has been minimized.

Show comment
Hide comment
@sgjesse

sgjesse Nov 2, 2015

Contributor

Having looked further into this I don't think there is a way to set up the built-in pull up or pull down resistors through the sysfs interface.

If the built-in pull up or pull down resistors are used I think the best solution is to make sure they are configured before actually attaching anything to the pins.

Contributor

sgjesse commented Nov 2, 2015

Having looked further into this I don't think there is a way to set up the built-in pull up or pull down resistors through the sysfs interface.

If the built-in pull up or pull down resistors are used I think the best solution is to make sure they are configured before actually attaching anything to the pins.

@butlermatt

This comment has been minimized.

Show comment
Hide comment
@butlermatt

butlermatt Nov 2, 2015

For using sysfs I found:
To set pull-up
echo 0 > /sys/class/gpio/gpio<pin#>/active_low

butlermatt commented Nov 2, 2015

For using sysfs I found:
To set pull-up
echo 0 > /sys/class/gpio/gpio<pin#>/active_low

@mit-mit mit-mit added this to the 0.3.0 milestone Nov 13, 2015

@mit-mit

This comment has been minimized.

Show comment
Hide comment
@mit-mit

mit-mit Nov 13, 2015

Contributor

tentatively including in 0.3

Contributor

mit-mit commented Nov 13, 2015

tentatively including in 0.3

@mit-mit mit-mit added the FixIt-15Q4 label Dec 7, 2015

@sgjesse

This comment has been minimized.

Show comment
Hide comment
@sgjesse

sgjesse Dec 9, 2015

Contributor

I am pretty sure that /sys/class/gpio/gpio<pin#>/active_low does not affect the internal pull-up/pull-down. The only way to access the pull-up/pull-down are through the memory mapped API.

Contributor

sgjesse commented Dec 9, 2015

I am pretty sure that /sys/class/gpio/gpio<pin#>/active_low does not affect the internal pull-up/pull-down. The only way to access the pull-up/pull-down are through the memory mapped API.

@sgjesse sgjesse closed this Dec 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment