Introduction: Alarm Clock With Infrared and Bluetooth Speakers

INTRODUCTION

Hi, my name is Ben Hur Gonçalves, I'm a mechatronic engineer graduated in Universidade de São Paulo, Brazil in 2010. Nowadays I work with real state, but I do these projects with arduino on weekends, just for fun. This was one of my first projects. As I researched here in Instructables, I saw some projects of alarm clocks, and bluetooth speakers, but none like this, so I wanted to share with you guys. Hope you like it. If people find it fun, I'll post some other projects, like a roomba-like robot I made with arduino to clean my house.

In this project I made an alarm clock with a 8 digit display. This clock does not have buttons, and all the configuration is done via IR (infrared), with a TV remote, or any other IR remote. In the early days I put a buzzer, so you could configure two different alarm times (but by changing the code you can put whatever N amount of different alarms you want).

Also I did put a microphone in it, so the display is always off, and just activates when it hears a sound. This is very useful if you don't want all that light upon your face when you are trying to sleep, and just activates when you clap your hands or whatever. I used a humidity sensor to detect this variable and the temperate too.

In the future I plan to put a relay module, so the arduino could activate a humidifier when your bedroom gets too dry (because of the air conditioning). Another thing I did was to use an old Sony Ericsson MPS-60 speaker I had to play musics from my cellphone, via Bluetooth.

Step 1: Components:

THE PARTS YOU WILL NEED:

  • A tube for the box;
  • Sony Ericsson MPS-60 or any other two speakers you may have;
  • Silicon glue;
  • Plenty of wires, electric tape, common drills and a bigger (flat bit for wood) wich you will use to make the bigger holes for the speakers, and two different old cellphone chargers, to transform 110/220V to 5V, one you will use on the amplifier circuit and the other with the arduino, otherwise when the music is on, the arduino will shut down.

Step 2: Soldering and Mounting the PCB

Picture of Soldering and Mounting the PCB

STARTING

Start soldering the prototyping PCB following the connections listed below. I used connectors to plug the components, as seen in one of the images above, but it was a personal choice. This way, in future projects I still can change their configuration, add and remove pieces.

THE PINOUT

Sound detector

  • Pin 0 >>> GND
  • Pin 1 >>> Arduino Pro Mini - Digital input pin 13
  • Pin 2 >>> VCC

Buzzer

  • Pin 0 >>> GND
  • Pin 1 >>> Arduino Pro Mini - Digital input pin 12
  • Pin 2 >>> VCC

Infrared sensor

  • Pin 0 >>> GND
  • Pin 1 >>> VCC (the positive pin is the middle one, watch out)
  • Pin 2 >>> Arduino Pro Mini - Digital input pin 12

DHT11

  • Pin 0 >>> VCC
  • Pin 1 >>> Arduino Pro Mini - Analog input A0
  • Pin 2 >>> Not Used
  • Pin 3 >>>GND

Display

  • Pin 0 >>> VCC
  • Pin 1 >>> GND
  • Pin 2 >>> Arduino Pro Mini - Digital input pin 04
  • Pin 3 >>> Arduino Pro Mini - Digital input pin 05
  • Pin 4 >>> Arduino Pro Mini - Digital input pin 06

Note: the digital pins can be anyone you want, but the DHT11 have to be an analog input pin. You can change the pins inside the code. I suggest you try your assembly on the breadboard first before soldering. At last you just have to connect the 5V fountain on the VCC and GND of the arduino, and that's it.

Step 3: Soldering and Mounting the Speakers

Picture of Soldering and Mounting the Speakers

HOW TO

This part is easy. Just solder the amplifier pins using the image as a guide. The amplifier has positive and negative pins that will come from a different 5V fountain (than the one that goes to the arduino), two pins for each of the speakers you have, and three others that goes on the stereo sound cable: one is the common, one is for left channel and one for right channel.

Use the drills to make the holes for the speakers and one for the microphone, and one for the buzzer. Glue everything with silicon. Plug the bluetooth receiver on the audio cable that goes to the amplifier and at last solder positive and negative wires on the USB pins of the receiver (you cant dismount the receiver and solder directly on the board, it's easy).

Step 4: The Code

Just download the code and install the libraries.

#include "dht.h"

https://github.com/RobTillaart/Arduino/tree/master...

#include "LedControl.h"

https://github.com/wayoda/LedControl

#include "Time.h"

https://github.com/PaulStoffregen/Time

#include "IRremote.h"

https://github.com/shirriff/Arduino-IRremote

EXPLAINING THE CODE

One the #define section, I named the code from the infrared remote for each of the numbers pressed. In case you have a different remote, from a different manufacturer, you just open the serial monitor and look for which code the remote sends on each button pressed. The numbers are named in Portuguese - sorry for that :p. The names "BOT_OK", "BOT_MENU" and "BOT_VOLTAR" are for the buttons "enter", the right arrow, and the left arrow respectively. These last two are responsible for changing what is displayed, forward and backward. The display's instances are:

  • Nothing to be displayed;
  • Time (hours.minutes.seconds);
  • Humidity and temperature;
  • Alarm 01;
  • Alarm 02;

I configured two different alarm times, however the code can be adjusted to fit as many alarms as you want. When you set on and off the alarm, the buzzer makes a sound with two beeps. When the alarm rings, it will stay ringing for 30 seconds (annoying seconds) or you have to press the "enter" button in order to set it off. You can put new functions on the buttons. Also, when ringing, the display will show the word "Acorda", which is the Brazilian term for "Wake up". I guess you can adapt that for you own language.

Step 5: Final Words

Picture of Final Words

ROOM FOR IMPROVEMENTS

In the future, if one wants to control the humidity inside the room, you can buy this relay module (Ebay) and create a situation that if the humidity falls below, let's say, 40%, it activates a humidifier, so you can have a glorious nap time, with the air conditioner turned on, without waking up with your throat dry.

There are several ports of the Arduino which weren't used. You can have many ideas to take advantage of that and from the fact that you already use a sound sensor. For example, one can put leds inside it to blink as the music plays on the speakers. Or to intensify their light according to the time (hour) of the day, brighter during day and darker during the night. If you used an RGB led, you could change its color via remote control, how cool would it be that?

Well, that's it guys. Hope you guys liked, please comment. If you like it, I will make instructions for building a roomba-like robot controlled via bluetooth from the cellphone, but also autonomous. Sorry for the bad English guys. If you liked, please follow my channel. See you in the comments section! Bye.

Comments

Nanopan (author)2015-12-14

hi, i would like to ask why is the buzzer and infrared sensor are both connect to Arduino Pro Mini digital input pin 12? as stated in 'Step 2 pin out' above.

smandal13 (author)2015-08-22

this is awesome!

JGUZMANO (author)2015-08-11

gracias por compartir.

obrigado por compartilhar!!

GabrielS22 (author)2015-06-12

Muito Bom!

Só fiquei na duvida quanto a fonte de alimentação, eu vou usar as baterias de celular, certo?! Pra carrega-las, como vou fazer? fiquei meio confuso nessa parte, e peço perdão se a pergunta for meio tola.

Você pode usar baterias de celular, mas garanto que elas vão acabar bem rápido. Questão de minutos. Mas pra carregar elas compra no mercadolivre um CI de carregar baterias de lítio usb, que é uma pecinha que você pode plugar em qualquer porta ou fonte usb e carrega bateria na outra saída.

Certo, dai e só eu ligar em paralelo a saída desse CI carregador com a bateria e a entrada de alimentação do Arduino, certo? E como são 2 baterias eu vou precisar de 2 carregadores desse também né? Eu posso usar o mesmo carregador de celular pra alimentar os carregadores das baterias pelo USB, ou vai ficar uma carga muito alta pro carregador do celular?

Não tenho certeza mas acho q se ligar as baterias em paralelo no carregador elas vão carregar normal, so vai demorar o dobro do tempo. Pode ser que sobrecarregue o carregador, mas acho que não, que um so deve carregar normal. Faz o teste e me avisa. Fica interessante porque você pode tirar da tomada por algum período de tempo sem perder a configuração dele ne. Legal.

Ahh cara, dá uma olhada no link da IRemote.h, acho que tá errado

Verdade, estava errado o link. Já arrumei. Obrigado.

Isso, eu quero implementar um contado de dias, e não queria que a contagem de perdesse facilmente. Vou tentar, se der certo, posto aqui. Valeu pela ajuda, cara ;)

Eu usei uma fonte de alimentação de celular mesmo, então o relógio tem um cabo que vai na parede.

ehakansoy (author)2015-05-29

nice job man! where did you get the tube from?

It was a "t-shirt cointainer", from a t-shirt I bought.

thank you! and oh happy birthday! :D

Yeah thanks, it's indeed my birthday!

ok thanks!

msmith225 (author)2015-04-11

This is awesome. I just ordered my first Arduino and looking forward to making one of these once i've got a few easier projects under my belt. Thanks for sharing!

Thanks, you're welcome. Any questions, I'm here to help! Let me know if you make one.

molarplanet4710 (author)2015-04-08

keep up the awesome work

molarplanet4710 (author)2015-04-08

it looks like a bomb but that makes it 10 times cooler

I was thinking of spray painting the tube, but a friend of mine said this same thing and convinced me otherwise.

jrapp2 (author)2015-04-08

Some food for thought if u put in a snooze button and I went to press it, it would roll off the table

benhur.goncalves (author)jrapp22015-04-08

Yeah, you have to snooze the alarm via remote control, or wait 30 annoying seconds to go off. Haha :P

tomatoskins (author)2015-04-05

That turned out looking great! Thanks for sharing and welcome to the community!

Yeah, thanks. There's plenty of room for improvements here.