Arduino, Programming

Arduino + DS1307 RTC

Another demo for interfacing an Arduino with the DS1307 Real Time Clock. The board I used (see here) also has an integrated 24C32 32K EEPROM which we won’t worry about in this demo.

Here’s a picture of my setup:

IMG_20151121_202254

Materials Used:

  • Arduino Uno R3
  • 16×2 LCD Shield
  • DS1307 board (I used this one) but you could use this one too
  • CR2032 button cell

Wiring details:

(NOTE: If you’re using the same board as me then wire to the side of the board with the pins SQ, DS, SCL, SDA, VCC, GND & BAT)

  1. Uno’s 5V (via LCD Shield) to RTC’s 5V
  2. Uno’s GND (via LCD Shield) to RTC’s GND
  3. Uno’s Analog Pin 4 (via LCD Shield) to RTC’s SDA
  4. Uno’s Analog Pin 5 (via LCD Shield) to RTC’s SCL
  5. Leave the other pins unconnected
  6. Put the button cell in!

You can find the code here. And voila! 🙂

Advertisements
Arduino, Programming

Arduino + HR-SR04 Ultrasonic

I wanted to try an Ultrasonic sensor so I bought the cheapest one I could find, the HR-SR04. I used this tutorial to learn about the ultrasonic. Basically I thought the Ultrasonic would provide an analog signal with the distance…well I was wrong. Distance is calculated based on the time taken for an echo signal to be sent and received.

Here’s a picture of my setup.

IMG_20151121_160922

Materials used:

Wiring is easy:

  1. Uno’s 5V (via LCD Shield) to sensor’s 5V
  2. Uno’s GND (via LCD Shield) to sensor’s GND
  3. Uno’s Digital Pin 0 (via LCD Shield) to sensor’s ECHO
  4. Uno’s Digital Pin 1 (via LCD Shield) to sensor’s TRIG

You can find the code here. And voila! 🙂