Skip to content
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

Try internal pull-up resistors instead of the external ones. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

honnet
Copy link

@honnet honnet commented Apr 2, 2016

The internal pull-up resistors are about 20-50 kOhms, seek for "I/O Pin Pull-up Resistor" on page 384 of the datasheet:
http://www.atmel.com/Images/Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Datasheet.pdf
It's probably more than what was in the original circuit but it should work.

If it doesn't, you might have to change the value of CFG_SENSOR_THRESHOLD, those lines should help to understand how it's used:
https://github.com/honnet/punchcard_reader/blob/master/ReadSensors/ReadSensors.ino#L23
https://github.com/honnet/punchcard_reader/blob/master/ReadSensors/ReadSensors.ino#L281

The way to set the internal pull-up resistors can also be done differently, see the comment in the commit.
More about pullup resistors and analog pins in the "Pullup resistors" section:
https://www.arduino.cc/en/Reference/AnalogPins

@GemmaMayLatham
Copy link
Collaborator

Hi Cedric,

Hope you've had a good day. Ive been chatting to David who developed the
original code for the punchcard reader and he explained why we need the
resistors.....We plan to do a version for the Raspberry Pi as well as the
arduino, going straight into GPIO pins, and a Micro:Bit version.

Make sure that the voltage supplied to the arduino pins swings way above
and way below the 1.5V pin threshold. Remember that on the Arduino we use
analog inputs so we can set the threshold voltage but on the pi we only
have digital GPIO's so the inputs to the Pi must swing way above and
below the digital pin threshold in order to be accurately sensed.

(the arduino code senses a voltage threshold, the pi code will just
interpret the voltage as a 1 or a 0 so the actual voltage sensed is
critical for the pi so that it senses 1 and 0.

Does that makes sense, its a bit over my head. I need to have a think about
this and whether the RPi version will use the same circuit.

Thanks
Gemma

On Sun, Apr 3, 2016 at 12:54 AM, honnet [email protected] wrote:

The internal pull-up resistors are about 20-50 kOhms, seek for "I/O Pin
Pull-up Resistor" on page 384 of the datasheet:

http://www.atmel.com/Images/Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Datasheet.pdf
It's probably more than what was in the original circuit but it should
work.

If it doesn't, you might have to change the value of CFG_SENSOR_THRESHOLD,
those lines should help to understand how it's used:

https://github.com/honnet/punchcard_reader/blob/master/ReadSensors/ReadSensors.ino#L23

https://github.com/honnet/punchcard_reader/blob/master/ReadSensors/ReadSensors.ino#L281

The way to set the internal pull-up resistors can also be done
differently, see the comment in the commit.
More about pullup resistors and analog pins in the "Pullup resistors"
section:

https://www.arduino.cc/en/Reference/AnalogPins

You can view, comment on, or merge this pull request online at:

#1
Commit Summary

  • Try internal pull-up resistors instead of the external ones.

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#1

Gemma May Latham
www.gemmamaylatham.co.uk
@GemmaMayLatham https://twitter.com/gemmamaylatham
about.me/gemmamaylatham
tel: 07786076483

@honnet
Copy link
Author

honnet commented Apr 3, 2016

Well, the Raspberry Pi has internal pull-up and pull-down resistors that can be set when the pin declarations are made, here is an example* of how to use it:
GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)
Maybe you should try it too ;p

*Source:
http://makezine.com/projects/tutorial-raspberry-pi-gpio-pins-and-python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants