Introduction: SmartClock

The SmartClock, is not just a clock, its also an easy way to see social media statistics, and the weather.

You can connect to facebook, and get your likes, or connect to soundcloud and get your followers displayed live! The only thing you need to do, to see this, is press the mode button.

There are multiple sensors on this device, which constantly gather information and keep that information in a database. You can view this data, on a nice graph on the website.

You can also play music, which you select on the unit, or on the website.

Supplies

- Raspberri Pi

- Arduino Uno

- Speakers with ampilifier

- 4*7 segment display

- DHT 11

- LM35 (optional)

- LDR

- MCP3008

- 16x2 LCD Display

- 5 Normal Open Monostable switches

- Resistors 100k, 220,1k and 5k

- Power supply

- A lot of jumper cables, male/female and female/female

Step 1: DHT 11 Pinout

There are 2 types of DHT11.
Depending on the version you bought, you will either have 3 or 4 pins.

Vcc goes to 3.3V, signal goes to GPIO4
If you got a 4pin version, you need to place a 4k7 resistor in between the vcc and signal pin.
If you got a 3pin version, you are good to go.

Step 2: MCP3008 With LDR, LM35 and Pulldown Switches

  • VDD - 3.3V
  • Vref - 3.3V
  • AGND - Ground
  • CLK - GPIO9
  • DOUT - GPIO MISO
  • DIN - GPIO MOSI
  • CS - CS0
  • DGND - Ground

CH0 goes in between a 10k Resistor and a ldr

CH1 goes to the middle pin of the Lm35

Step 3: LCD Display

To get your LCD display working, connect the first pin to Ground, and the second to +5V.
Third pin should be connected trough a 5k resistor to ground, or a potentiometer if you want to change brightness.

RS pin goes to GPIO22, RW goes straight to gnd aswell. At this point, you should see a line of black rectangles on your display. now just connect the 8 data pins to GPIO pins you have free and connect LED+ to 5v, LED- to ground.

Step 4: 4*7 Segment Display

Your display can be a common anode / common cathode. This does not matter for how you connect it, but it is good to know what type you have. Make sure to keep the RX0 pin free, as we will need to connect this to TX0 on the RPI. The rest of the connections do not matter, as code is written afterwards.

Step 5: Construction

To create this setup on a breadboard, you wil need a lot of space. I would recommend to, solder the MCP with LM35 and al resistors on a testprint, and add some headers. This way, you can just connect it with a few female/female jumper wires. Make sure to connect raspberri and arduino grounds. Be careful not to mix up 3.3V with 5V

Step 6: Software

I used Python, with flask for backend. Html, css/less & javascript as frontend and arduino code for arduino.

There is also a database running on the Raspberry pi which saves the sensor data, as well as alarms you've set and user information. This database is ran on a MariaDB server. Queries to get data out of this are written in my backen, in python. This converts data to json on custom endpoints. We can get that data in our front-end by sending a GET request to our backend. Here we can do whatever we want with the data. I chose for graphs, made by chart.js, which is a javascript extension.