Arduino Home

An Open-Source platform to create digital devices and interactive objects that sense and control physical devices.

Arduino Tutorials
Arduino Projects


Arduino Starter Kit Competition INDEX:


Element14's Arduino Starter Kit Competition

Element14's Arduino Starter Kit Competition - Part 1

Element14's Arduino Starter Kit Competition - Part 2

Element14's Arduino Starter Kit Competition - Part 3

Element14's Arduino Starter Kit Competition - Part 4

Element14's Arduino Starter Kit Competition - Part 5 (motor fun)

Element14's Arduino Starter Kit Competition - Part 6

Element14's Arduino Starter Kit Competition - Part 7

Element14's Arduino Starter Kit Competition - Final Part and Conclusions


Project Book - 15 Hacking Buttons


This project is the last in the book and consists of hacking an existing electronic device to enable it to be controlled via the Arduino - the project takes the line of shorting an existing switch on the chosen device to replicate that functionality. I searched the house for a suitable donor device....staying away from the TV remote just in case (I didn't want to have to explain why the TV stopped working and have to buy a new one ). Although there are often all sorts of electronics around the house that are redundant or broken I couldn't find anything suitable and I was thinking I'd have to post this last Project as a failure by me. Then I found a spare clock radio - great, I'd use the Arduino to put it into SLEEP mode, after all those buttons are often too small or poorly located for a half-asleep person to find.


I took the clock radio apart, examined the circuit and could see there was at least a transformer prior to any electronics - so at least the voltage wouldn't be mains. I soldered on two wires (black and red in photo) and brought them out of the case via the PP3 battery holder. Keeping the wires separate I then powered the clock-radio up again and measured voltages between the wires and to the mains voltage wall earth (checking for both AC and DC). There was a 10v DC difference.


I placed the wires into the breadboard across the opto-isolator's transistor (Collector to Emitter). Initially I set the alarm for 1 minute ahead of the actual time and waited for the alarm to activate. When it did I connected the anode of the opto-isolator to +5v via a 220R resistor....and the alarm was hushed up !


Then I decide how I wanted to silence my alarm - I'd already seen many sensors used with the arduino. I could have a simple button, use a Light Dependant Resistor (LDR) to wave my hand over and look for a change, use an LED with the LDR as a beam break sensor, use the piezo as a tap sensor, use the tilt switch ? I was taken with the earlier capacitance touch project and decided that would be the way to go. To take that input to a much larger metal object near the clock - perhaps a metal tray underneath it. My reservation is that unearthed metal near a mains voltage device is not always a good thing should an insulation fault occur. In the longer term an insulated metal tray would be a much better idea. In the photo below the yellow wire will go to the tray.


I also added a simple LED so I could illuminate it in my Arduino Sketch to signify the clock radio was in SNOOZE mode and would again activate in 10 minutes.



That was the hardware sorted and now I just needed to realise my design in the Sketch. I decided to make use of the miilis function to time how long the sleepy individual held the contact for. A quick touch will silence the device upon first alarm and illuminate the LED. Sometime later the alarm goes off again and the person touches again briefly - they don't want to go to that meeting. They silence the alarm again but the LED stays illuminated. Finally the alarm sounds for a third time - they get up, and press ALARM OFF. They hold the touch contact for a few seconds and the Arduino code resets.


//Project Book  No.15 - Hacking Buttons
// by 14rhb, 05 Sept 2017

#include <CapacitiveSensor.h>
CapacitiveSensor capSensor=CapacitiveSensor(4,2);

const int ledPin=7;
const int optoPin=3;
int threshold=1000;
bool snoozeMode=false;
double buttonTime=200;
unsigned long timeStart;
unsigned long timeAfter;
unsigned long timeDelay=2000;

void setup() {

void loop() {

    //first press which is snooze mode
    if (CheckSensor() && !snoozeMode){
    //a short touch will turn alarm off but keep light illuminated
    else if (CheckSensor()&& snoozeMode){
      //see how long they hold the touch waits for the timeDelay and re-tests.
      while(( timeAfter-timeStart)<timeDelay){
      if (CheckSensor()){
      //they held it long time, so LED off and reset variables
  } //while

bool CheckSensor(void){
  long sensorValue=capSensor.capacitiveSensor(30);
  if (sensorValue>threshold) return true; 
  else return false;

NB: the above code has only been tested briefly...please let me know if it fails in some way.


Summary of Project 15 Hacking Buttons

I'm on the fence here between encouraging people to experiment hacking old electronics and the possibility of an accident for novices trying the same thing on a mains device. Apart from that, another good idea to show what can actually be achieved and an introduction to the art of hacking devices.


Overall Conclusions on the Arduino Starter Kit

This has been a fantastic few weeks of learning - I recommend this kit for anyone wanting to learn the basics of Arduino or realising electronic ideas quickly (e.g. the maker movement). Although you could likely obtain the majority of parts separately, this kit makes a really good starter and an ideal techy gift as it contains virtually everything required. The projects in the book cover a great range of topics and quickly show how to interact with a multitude of different sensors and output devices - the reader just then has to realise their own projects into these basic parts/techniques.


On the downside I felt the quality of breadboard affected some of the projects in terms of reliability - the contacts were either not strong enough or are recessed too far to properly grip the thin connection wires or some of the components (potentiometer, tilt switch, push buttons). The project book content was fairly accurate but could fail novices in a few places - I reiterate my earlier advice that if the book doesn't make sense then do an internet search. Chances are the book is wrong !


What has been covered (including but not limited to):

  • Basic Electronics
  • The ArduinoIDE
  • Switches and LEDs
  • Time Delays
  • The Serial Monitor
  • Reading Analog Voltages
  • C Programming Variable Types and Code Constructs
  • Servo Control
  • RGB LED Control
  • Sound Creation
  • Resistance Ladder
  • C Logic Operators and Enumerated Types
  • The Arduino Timer (millis)
  • Pulse Width Modulation (PWM)
  • Driving heavier load currents with MOSFET
  • Using an H-Bridge Motor Drive IC
  • LCD Module Control
  • Capacitance Sensor/Input
  • Serial Transmission from Arduino to Desktop Computer


Thanks again to tariq.ahmad for selecting me on the recent Element14 competition to win the Arduino Starter Kit. And thanks to all the Element14 members who's helpful comments and words of encouragement have spurred me on through the book.


One last thing to do. I need to tidy the Arduino Starter Kit back up into its box and to donate it onwards......maybe I'll even manage to encourage the recipient to join us in Element14 Community