Evolution of a Blog

This blog has evolved as I have as a maker. It starts at the beginning of my journey where I began to re-tread my tires in the useful lore of micro electronics and the open-source software that can drive them. While building solutions around micro-electronics are still an occasional topic my more recent focus has been on the 3D Printing side of making.

Friday, February 22, 2013

Robot Kill Switch - GPIO

Now that the robot starts auto magically it seemed like it would be a nice idea to have a way to abort that auto start or to stop the robot...without a terminal or web session.  Since I have already exposed the GPIO bus it was easy to implement this desire.  

The picture shows the hardware.   The push button is wired to pin 14 of the GPIO bus (blue wire).  A 10k resistor connects that lead to ground (brown wire).   The 3v power supply is connected to the other side of the push button.  If the button is depressed during start-up the 'Bot will abort prior to starting any of it's modules.   If it is pressed any time while the 'Bot is running it will shutdown cleanly.

Here is the code for the abort of start-up:
# *****
# Abort startup if the kill switch is pressed
# *****
GPIO.setmode(GPIO.BCM)
GPIO.setup(intercom["pins"]["startRobot"], GPIO.IN)
GPIO.setwarnings(False)
if GPIO.input(intercom["pins"]["startRobot"]):
    logger.critical("Aborting startup - kill switch pressed")
    sys.exit(1)

No comments:

Post a Comment