Clock and Sensor Box

by Hackin7 in Circuits > Arduino

355 Views, 0 Favorites, 0 Comments

Clock and Sensor Box

DSC_0092.JPG
DSC_0091.JPG
DSC_0090.JPG
DSC_0066.JPG
Clock and Sensor Box Demo

This is a simple multi purpose device using multiple sensors. It has a

  1. Alarm Clock, Stopwatch, Timer
  2. Temperature, Humidity and Heat Index Readings
  3. Ultrasonic Distance Sensor Readings
  4. IR Sensor Reading and Visualiser
  5. Music Keyboard

It is also portable, with a built in battery to power everything.

Electronics

IMG-20190107-WA0000.jpeg
DSC_0049.JPG
DSC_0050.JPG
IMG-20190105-WA0010.jpeg
DSC_0043.JPG
DSC_0044.JPG

The Device includes

  1. Maker UNO (Arduino UNO Compatible Board)
  2. 1.8 inch ST7735 LCD Display
    • (SPI Bus, CS on pin 10, RST on pin 7, DC on pin 6)
  3. Adafruit 12-Key Capacitive Touch Sensor Breakout - MPR121
    • I2C Bus
  4. RTC_DS1307
    • I2C Bus
  5. Ultrasonic Distance Sensor HC-SR04
    • (Trigger on pin A0, Echo on pin A1)
  6. IR sensor (on pin 5) and IR LED (on pin 3)
    1. A normal LED connected in parallel to the IR LED to visualise the codes to be sent
  7. DHT11 Temperature and Humidity Sensor
    • (on pin 4)
  8. Buzzer (built into Maker UNO) and Headphone Jack connected to Potentialmeter (as a voltage divider)
    • (both on pin 8)
  9. 1200mah (From a Samsung Phone) Battery and

    Power Bank Circuit (Extracted from spare Power Bank)

    • Connected in series with a Switch (turn it on and off) to the 5V and GNC pins on the Arduino

I used jumper wires to connect the components together (with the help of a DIY prototyping shield). I also soldered the Power Bank Circuit, Battery and switch together, and added headers to connect to the 5V and GND pins of the Arduino (to power it). Occasionally, I soldered wires directly to the components (Like IR LED and Sensor) to the Arduino.

Case

DSC_0055.JPG
DSC_0056.JPG
DSC_0057.JPG
DSC_0053.JPG
DSC_0052.JPG
DSC_0051.JPG
DSC_0061.JPG
DSC_0062.JPG
DSC_0063.JPG
DSC_0065.JPG
DSC_0060.JPG
DSC_0059.JPG
DSC_0058.JPG
DSC_0064.JPG
DSC_0070.JPG
DSC_0069.JPG
DSC_0068.JPG

The Case is mainly made up of MDF.

Holes are drilled and cut into the top piece to make room for the arcade button and wires. There are also cutouts in the side piece for a micro USB connector (to reprogram the Maker UNO inside), and a switch to turn the built in buzzer in the Maker UNO on or off.

The touch pads are cut out from a piece of aluminium (using scissors). An exposed copper jumper wire (connected to the capacitive touch sensor) is placed under each touch pad/shape.

The front would just be covered by a piece of clear plastic (Book Wrapping Plastic)

The whole case would be Hot Glued shut.

Software

DSC_0071.JPG
DSC_0072.JPG
DSC_0073.JPG
DSC_0075.JPG
DSC_0076.JPG
DSC_0077.JPG
Screenshot from 2019-01-14 10-14-29.png
Screenshot from 2019-01-14 10-14-24.png

The Software has

  1. Alarm Clock, Stopwatch, Timer
  2. Temperature, Humidity and Heat Index Readings
  3. Ultrasonic Distance Sensor Readings
  4. IR Sensor Reading and Remote
  5. Music Keyboard

It uses the following additional ibraries

  1. Adafruit GFX and ST7735
  2. Adafruit MPR121
  3. IRremote
  4. DHT sensor library by Adafruit
  5. RTClib by Adafruit
  6. NewTone (cannot install from library manager)
    1. Used instead of the built in tone library to prevent conflict with IRremote library (something to do with Timers)

This is all coded in the Arduino IDE. The code is on Github Gists. (It already takes up about 89% of memory so no additional features could be added)

Potential Flaws

  1. The built in battery may sometimes not have enough power to supply to the Ultrasonic Distance Sensor and Real Time Clock.
    1. The Battery Could be made bigger or the Power bank circuit could be changed to be more efficient
    2. Or you could just power it from a 5V charger
  2. I do not have a working IR LED with me now , so it cannot act as an IR remote yet
    1. This also means that the IR LED code may not work.
    2. For now, even if the IR remote code does not work, the normal LED means that it is still useful to visualise the IR remote codes sent
  3. The code has used up about 89% of the internal memory of the ATMega328 Chip in the Arduino
    1. If the code used up too much internal memory, there would be stability issues. The DHT11 Sensor may not be read properly by the arduino. Some other programs like the Music Keyboard could also be affected.
    2. Could modify the code to be more compact and efficient
    3. I had to remove a spamgame program I was planning to include, just to make sure most of the other functions of the code work properly. (With the spamgame, about 95-96% of the arduino memory is used up)
  4. The case could be constructed better (Like using wood glue instead of hot glue, or making a better box with finger joints and such)
    1. This may also cause the touch pads to not be sensitive sometimes. The aluminium pad could not be soldered to the wires, and so the wires and the pads may not be in great contact (sometimes). However, this is a nitpick, as most of the times, the pads do work properly.
    2. The pads may be too close to each other for the user to accidentaly press another pad, but this is another nitpick
    3. The case could be covered (in veneer or something else) or painted to look nicer.

Overall, this project was done to use up some of my excess sensors and microcontrollers. Considering that I finished this in about a week (actually 9 days), with little to no planning, I am quite satisfied with the result.

Making It Look Nicer

DSC_0089.JPG
DSC_0086.JPG
DSC_0087.JPG
DSC_0088.JPG
DSC_0093.JPG

Basically, get some Wood Wallpaper / Covering / Veneer and cut it to size. Moreover, make some cutouts for the (Micro USB) ports, and components (like the distance sensor). Finally, glue it on the wood (I used superglue).