element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs And then there were bumpers - don't forget the pull-ups!
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: alanmcdonley
  • Date Created: 10 Jun 2016 11:58 AM Date Created
  • Views 583 views
  • Likes 1 like
  • Comments 1 comment
  • negative_logic
  • python
  • robot
  • catching_control_c
  • mcp23s17
  • bumpers
Related
Recommended

And then there were bumpers - don't forget the pull-ups!

alanmcdonley
alanmcdonley
10 Jun 2016
I feel so elated to report I figured out my bumper problem. I had designed the connections to be active low using the internal pull-ups of the MCP23S17 but forgot this during my time away from my bot.

 

I used the (private/unsupported) PDALib.setDioBit(reg, pin) function to set the pull-ups and voila - I've got three working negative logic bumpers (rear, left, right). With the skirt on, this gives the bot 6 usable bump directions:

 

    • front (left + right)
    • left (and left front)
    • right (and right front)
    • left rear (left+rear)
    • right rear (right+rear)
    • rear
and "I'm in real trouble" (left+right+rear)

(The Pi Droid Alpha interface board maps the MCP23S17 DIO Bank A to be DIO 8-15, so Bank A Bits 0,1,2 are channel 8, 9, 10 in the program)

 

https://flic.kr/p/xxU7Hr

Here is my program:
# ############################# BUMPER TEST ################
import PDALib
import time
import sys
import signal

# ################# BUMPER TEST ###########

# Bumpers are on
# DIO 10   Left Front
# DIO 9      Right Front
# DIO 8      Rear
# Wired to use internal pull-ups of the MCP23S17
# Bumper value is negative logic - 0 means bumper activated, normal 1

# Encoders are on DIO 11 and 12

# ##################
# Callback and setup to catch control-C and quit program
def signal_handler(signal, frame):
  print '\n** Control-C Detected'
  PDALib.LibExit()
  sys.exit(0)

# Setup the callback to catch control-C
signal.signal(signal.SIGINT, signal_handler)
# ##################

# Set up all DIO channels as input for now
for pin in range(8,23+1):
  PDALib.pinMode(pin,PDALib.INPUT)

# Set internal pull-ups on bumper channels
PDALib.setDioBit( PDALib.DIO_GPPU, 0 )  # set pin 8 pull-up
PDALib.setDioBit( PDALib.DIO_GPPU, 1 )  # set pin 9 pull-up
PDALib.setDioBit( PDALib.DIO_GPPU, 2 )  # set pin 10 pull-up

# Loop displaying bumpers and encoders
while True:
  for pin in range(8,12+1):
    print "Pin:", pin, PDALib.digitalRead(pin)
  print "\n"
  time.sleep(1)
#end while
http://forums.mikronauts.com/viewtopic.php?f=49&t=63&p=250#wrap
  • Sign in to reply
  • DAB
    DAB over 10 years ago

    Yes, good making involves understanding the hardware and the software.

     

    Without pull up or pull down resisters you can have floating inputs, which can introduce a lot of very nasty signals and potentially kill the chip.

     

    This issue was very critical for some of the old CMOS chips.   ESD would kill them in femtoseconds.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube