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 - 11 Crystal Ball

I must be getting near the end of the projects now as I've just got to open the last sub-box within the Arduino Starter Kit Set. The box was marked up Liquid Crystal Display (LCD) and it contains a very neat LCD module complete with the header pins soldered in place. Being able to add one of these to any project can give it that professional look, you can write your own personal messages in response to the states that the Arduino sketch gets to.

photo_2017-08-28_21-22-57.jpg

The Arduino sketch shows a good use for the C switch construct:

// Project 11 - Crystal Ball

#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);

const int switchPin=6;
int switchState=0;
int prevSwitchState=0;
int reply;

void setup() {
  lcd.begin(16,2);
  pinMode(switchPin,INPUT);
}

void loop() {
  switchState=digitalRead(switchPin);

  if (switchState!=prevSwitchState){
      if (switchState==LOW){
        reply=random(8);   
  
        lcd.clear();
        lcd.setCursor(0,0);
        lcd.print("The ball says: ");
        lcd.setCursor(0,1);
   
        switch (reply){
          case 0:
               lcd.print("Yes");
               break; 
          case 1:
               lcd.print("Most likely");
               break; 
          case 2:
               lcd.print("Certainly");
               break; 
          case 3:
               lcd.print("Outlook good");
               break;
          case 4:
               lcd.print("Unsure");
               break; 
          case 5:
               lcd.print("Ask again");
               break; 
          case 6:
               lcd.print("Doubtful");
               break; 
          case 7:
               lcd.print("No");
               break;
        } //switch
      } //switchState==LOW
  } //switchState!=prevSwitchState

prevSwitchState=switchState;
} //main

 

Summary of Project 11 - Crystal Ball

Another nice project with a simple circuit and accompanying sketch. The tilt switch still periodically decided to jump off the breadboard like a startled grass hopper. This would make a fun desktop gadget at work with a different range of replies, or for a camping trip to decide what to do for the day out, evening meal choices ? Obviously it can be modified to more or less than the eight example texts in the project book. The potentiometer on the breadboard controls the viewing angle for the LCD.

 

Project Book - 12 Knock Lock

What is not to like about a project like this...making an electronic lock for a box ? The basic circuit is shown below and the sketch was entered from the book with only one error creeping in. Unfortunately it didn't work even after successfully uploading the sketch....time to check the circuit and connections again. Everything seemed correct to the Project Book so I then searched the issue using Google. I soon found someone discussing the same issue on the Arduino forum, I made the changes and the circuit started to work. However it still didn't seem to perform as I would like and gave false triggers when there was no tapping plus the taps accumulated over time - I'd like them to have to be in a certain space of time. Therefore I amended the code....this is the real fun of Arduino,; taking ideas and modifying/building on them to quickly realise what you want. I used the millis() function from back in Project 08 to time between the first knock and the third. The knock counter is reset if they take longer and the box remains locked.

photo_2017-08-29_22-06-26.jpg

Summary of Project 12 - Knock Lock

The project is fun but, even with my changes, could benefit from some further work. I still see some sporadic flashes of the yellow LED to indicate a valid 'knock' has been made even when I don't touch the piezo (nothing in the way of background noise either). Anyone also following this project might like to perfect their code before using the circuit to unlock a steel safe into which they have placed all their worldly possessions

 

[ Next up - Touchy Feely Lamp Project ]