Adding analog input to the Pi using the Digispark

What's Next?

A next obvious step is to limit the number of times the user can try to guess the combination – say, to three tries. If the combination isn't guessed in the number of tries allocated, the system should send a message to the owner and lock up, for example, for 15 minutes. It should, however, continue giving the impression that it is letting the would-be intruder guess combinations until the cavalry arrives).

Additionally, once the combination has been guessed, the program should not just exit as it does now. It should allow the user either to reset or reprogram a new combination.

As far as hardware goes, you will almost certainly want to link the Pi up to a servomotor that drives a sliding bolt and screw everything to the doorjamb. Note that you should not connect a servo or any other kind of motor directly to your Raspberry Pi. If you do, you will most certainly fry your device.

If you want to be more aggressive, you could hook up the Pi to the air vents and flood the chamber occupied by the intruders with knock-out gas or wire it to a trapdoor at their feet and have them drop into the pool of ravenous sharks previously installed under your house. Some extra assembly may be necessary.


  1. MCP3008 analog-to-digital converter:
  2. Digispark development board:
  3. Adafruit:
  4. Digispark Arduino setup:
  5. Fritzing:

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Get your Pi to read analog data

    The Raspberry Pi still lacks analog GPIOs that would allow it to read directly from temperature and light sensors, or even humble potentiometers. With an inexpensive chip and some software-fu you can grant the Pi the gift of analog sensing.

  • A home intrusion detection setup (sort of)

    At least part of the popularity of the Raspberry Pi can be attributed to its high maker value; that is, a skilled maker with a Pi can build marvelous and beautiful things. Me? Not so much, but I was willing to try to build a home security system with the stuff in my junk box. Here's what happened …

  • A new way of no-solder prototyping

    The Grove system's standardized connector and multitude of devices allow quick and easy project prototyping with your favorite small-board computers.

  • Write your own drivers for Arduino

    So, you have some new kit for your Arduino – maybe some sensors or ICs – but programming them is clumsy and painful. Don't despair: You can make your life easier by writing your own drivers!

  • Use an analog sensor as a video game controller

    We put our Analog-to-Digital converter to work reading positions from an analog sensor (a potentiometer) and control a bat in a simple implementation of the classic Breakout game.