smart device that perform a certain function or solve a problem: program Arduino UNO to read signals from multiple input components to control multiple action components using Arduino C .
I've got my inspiration from my smart watch, here is my favorite feature in it which is called raise to wake addition to that i intend to add some adjusting buttons to help me customize clock.
raise to wake
use to design the circuit and simulate
cardboard from any old device container
bread board
jumpers wire
Arduino uno
red LED
LCD I2C
3 push buttons
tilt sensor
adapter 5v
okay as usually first step should surprise me 😅
i thought that it is possible to get real time by using just Arduino UNO but by searching i figure out that, this circuit needs a real time module like (DS3231 RTC) for example it is used to accurately provide the day of the week, date (DD/MM/YYYY), time, Unix time, and even temperature.
old an experience by Plouc in 2018
so i accept this challenge which mean that i will run this project without using any real time module, while searching i found someone who has faced this challenge before so i get his experience and his code from here.
so i got his code and his wiring and i start adjusting them step by step as below ⬇️
so first edit in wiring cause i have LCD screen I2C type so i change wiring to this diagram
then edit code for normal LCD screen to I2C screen which i have, to make it easier i use library which called
#include <LiquidCrystal_I2C.h>
in arduino IDE file then example i chose Hello World
so after i make sure that screen is running well and push buttons i move to tilt sensor so first i test his circuit alone as shown ⬇️
my wiring for LCD I2C screen
then i start to marge his code to my code by delete those lines in his code which call normal lcd to run and back ground led to turn on or off replaced with easy function in library like
lcd.backlight();
lcd.setCursor(1, 0);
here some of code lines with comments to understand function of them
finial step is that i have to integrate two simple circuit together by using this wiring and coding.
here is the code i put into full code to add raise to wake feature ➡️
in Tinkercad site i didn't find tilt sensor so easily i have tried to replace it with slider switch then i write this code to make sure it works.
first i try tilt sensor in simple circuit with led to make sure it works well
then i have to integrate two simple circuit together by using this wiring and coding
after i have run the code i found that it has big delay between the time i raise sensor and the background led to turn on or off around 5 seconds.
so as you can see it is impossible to be neglected so i go throwing the code to find solution
after some tries i figure out this problem where my commend is that turn push button when the tilt sensor sense LOW the problem is it delay until run push button and then start running for lcd screen.
so i solve it easy way by rewrite correct code to turn on or off LCD led at the same time directly after sensor had sensed.
first try = first failure 😅
enclosure
i cut 6 parts of cardboard as shown in this picture
then attach strap
quick and easy 😉
then i glow them together
i found this problem in capture code which causes that PM change to AM at 1 o'clck and it should be 12.
so i solve this mistake by easy lines of coding where i divide this process to two parts one of them which increase flag once the hour = 12 and when hour = 13 it will change to hour = 1.
finial the project works perfectly 💥
it will the power of comments (//) in the code which it makes reading so easier for other people so i appreciate every one who usually use them to help his pairs understanding his code and adjust it.
i got my banner for this week from Bing image creator (Copilot ), just i write "smart watch beside Arduino and wiring" in generating bar then i chose one of them.