Things used in this project

Hardware components:
Chip%20v1
C.H.I.P.
×1
DC motor (generic)
×1
Omron b3f 1000 image 75px
SparkFun Pushbutton switch 12mm
×1
09590 01
LED (generic)
×1
Fairchild semiconductor fqu13n06ltu image 75px
Power MOSFET N-Channel
I used an IRF510
×1
Fairchild semiconductor pn2222abu. image
General Purpose Transistor NPN
I used an 2N3904
×1
Mfr 25fbf52 4k75 sml
Resistor 4.75k ohm
×2
12002 04
Breadboard (generic)
×1
Male/Male Jumper Wires
Some wires...
×10

Schematics

The Circuit Diagram
Wire it up carefully.
Circuit diagram.jpg

Code

MotorOnSw.pyPython
Press the button to switch the motor and LED on.

You need to install the AdaFruit C.H.I.P. GPIO library first of all. See here for instructions, usage guides and tips and other stuff: https://bbs.nextthing.co/t/adafruit-gpio-library-for-chip/2696
#!/usr/bin/python
#
# Nick Pettefar - 14th July 2016
#
import CHIP_IO.GPIO as GPIO
from time import sleep
#
delay=0.01
Motor = "XIO-P2"
LED = "XIO-P4"
Switch = "XIO-P0"
GPIO.setup(Motor, GPIO.OUT)
GPIO.setup(LED, GPIO.OUT)
GPIO.setup(Switch, GPIO.IN, pull_up_down=GPIO.PUD_UP)
#
GPIO.output(Motor, GPIO.LOW)
GPIO.output(LED, GPIO.LOW)

try:
    while True:
        while GPIO.input(Switch)==1:
            sleep(delay)
        GPIO.output(Motor, GPIO.HIGH)
        GPIO.output(LED, GPIO.HIGH)
        sleep(delay)
        GPIO.output(Motor, GPIO.LOW)
        GPIO.output(LED, GPIO.LOW)

except KeyboardInterrupt:
    GPIO.output(Motor, GPIO.LOW)
    GPIO.output(LED, GPIO.LOW)

Credits

Nick head
Nick Pettefar

Unix biker Radio Ham bad Ukulele player.

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Sigfox Forest Fire Detector
Intermediate
  • 524
  • 4

Full instructions

How to prevent forest from burning? A small Sigfox signal can prevent natural disasters. We will use an Arduino MKRFOX + a flame detector

Control the Injection of a Liquid
Intermediate
  • 283
  • 2

Protip

Control the injection of a liquid with GOBLIN 2 from anywhere via Ubidots platform.

How to build a text to speech IOT speaker
Intermediate
  • 115
  • 1

Full instructions

In this project we'll be building a speaker that has text to speech ability and will expose a secure API for remote control.

Otto DIY+ Arduino Bluetooth robot easy to 3dprint
Intermediate
  • 12,223
  • 58

Work in progress

"Otto DIY with steroids" + Bluetooth + APP + switch + sensors + strength +...

C.H.I.P.py Ruxpin ʕ•ᴥ•ʔ
Intermediate
  • 48,565
  • 73

Full instructions

Bring Teddy Ruxpin back to life, but on your own terms! Make him say whatever you want, or have him search twitter to read tweets!

Spideruino
Intermediate
  • 12,334
  • 54

A Lego arachnid controlled by your smartphone.

Add projectSign up / Login