The Perfect Alarm Clock for Surf Buddies

by NadavMo in Circuits > Arduino

80 Views, 0 Favorites, 0 Comments

The Perfect Alarm Clock for Surf Buddies

Alarm Clock for Surf Buddies
No Stars.jpeg
1 Star.jpeg
2 Stars.jpeg
3 Stars.jpeg

Hello, we are Eyal and Nadav

Two surfers who have hard time waking on mornings.

We found a solution that would help us do it using the friendship power and some help from Arduino,Blynk and Integromat (Make)

  Nothing is more painful then waking up in the morning, not knowing if the surf is good and if your surf partner is still sleeping.

 For that reason we made the Wave Prediction Alarm Clock.

The program uses connections with Blynk and Make to make an Alarm clock which uses the friendship power through Telegram!

Once you set the Alarm in Blynk, it will send a telegram message to your friend to let him know.

Once the Alarm clock turns on, you will have to shout at it and touch A1,A2,A3 while your feet are on the ground (to make sure you woke up (; )

Untill you wake up, your friend gets telegram messages to let him know you are trying to wake up and need help.

After you completed the tasks, we use again the integration with telegram to let your friend know you are up, wave prediction and water temperature.

As a bonus for your dedication to waking up, the CPX will indicate if the surf is good using it's leds. Green LED - no surf.

1 Blue LED - surf might be proper, 2 Blue LEDS - surf is good, 3 Blue LEDS - high waves!

Good Luck!

Supplies

CPX Photo.jpeg
  • 1 Arduino Playground Express
  • 1 USB Cable
  • 1 Computer with Wifi

Create a Blynk Account

Follow this link to sign up:

https://blynk.io/getting-started


Create a Template As Follow

Blynk datastreams.jpg
Blynk datastreams2.jpg
Blynk Screen.jpg
Blynk dashboard with pins.jpg

Add a new device with Blynk guidelines

Add virtual pins in the datastreams like in the pictures, make sure you add min max values as in the pictures.

In the dashboard, just copy my dashboard, make sure you connect the right pins.

Create Account in Make

link here:

https://www.make.com/en/register?

In Make(Integromat), Add New Scenario

import blueprint.jpg

Now press the Import button and import the file "blue print for make"

I'll give you an explanation of whats going on:

  1. When you put the alarm clock on on Blynk, Blynk sends a message to make. After that Make sends the current time to Blynk, and a telegram message that you put the alarm clock.
  2. If you cancel the alarm clock, Blynk sends a message to Make, and Make sends a telegram message to your desired friend that you canceled the alarm clock and you dont need help.
  3. When the alarm clock Rings, Blynk sends a message to Make about it, and Make sends a message to your friend in telegram, that the alarm is on and you need backup.
  4. When you manage to shout at the device and touch its pins properly, Blynk would send a message to Make that you woke up, Make gets the wave forecast for the day from meteoblue, and both sends it to your friend,and updates Blynk app with the wave height and temperature.


Edit the Webhook in Make and Create in Blynk

Make webhook.jpg
Webhook page.jpg
webhook settings.jpg

In make, click the webhook, copy the link.

Now go to Blynk settings, Webhooks, like in the picture, paste the link in the WEBHOOK URL section, and do like i did in the last picture.

Create a Telegram Bot

Create a Telegram bot with BotFather before connecting your bot to Telegram.

  1. Start a new conversation with the BotFather.
  2. Send /newbot to create a new Telegram bot.
  3. When asked, enter a name for the bot.
  4. Give the Telegram bot a unique username. Note that the bot name must end with the word "bot" (case-insensitive).
  5. Copy and save the Telegram bot's access token.
  6. in each telegram node of make, change the "Connection" to your telegram bot using your access token.


Create a Channel With Your Surf Buddy and Telegram Bot

telegram web.jpg
make telegram change.jpg

Straight forward, add your bot to the channel and your friend, make your bot an admin and save the group link for later use.

here it is @NadavMake.

Now go back to make, and change each telegram node's Chat ID from @NadavMake to your link

That would allow yout to send messages to your friend through that channel

Arduino Files

Now create a new folder, call it "New Folder" put the file "Waves.ino" inside.

In "New Folder" create a file called "ArduinoExpension.h" and put the following code inside:


#include <Adafruit_CircuitPlayground.h>


void arduinoSetup() {

 CircuitPlayground.begin();

 pinMode(A1,OUTPUT);

 pinMode(A2,OUTPUT);

 pinMode(A3,OUTPUT);

 pinMode(A4,OUTPUT);

 pinMode(A5,OUTPUT);

 pinMode(13,OUTPUT);

 int pinArray[] = {6,9,10,3,2,0};

 for(int i = 0; i < 6; i++){

   pinMode(pinArray[i],INPUT);


 }

}

int sound = 0;

int pinArray[] = {6,9,10,3,2,0};

bool allWereTouched = false;

void arduinoLoop() {

 sound = CircuitPlayground.mic.soundPressureLevel(10);

}

void alarmSound(){

  CircuitPlayground.playTone(1000, 20);

  sound = CircuitPlayground.mic.soundPressureLevel(10);

  if(CircuitPlayground.readCap(6) > 600){

   if(CircuitPlayground.readCap(9) > 600){

    if(CircuitPlayground.readCap(10) > 600){

    allWereTouched = true;

   }

  }

 }

}


void WaveHandler(double pinValue){

 if(pinValue<=0.5){

  CircuitPlayground.setPixelColor(0, 5, 255, 0);

 }

  if(pinValue>0.5){

  CircuitPlayground.setPixelColor(0, 0, 0, 255);

 }

  if(pinValue>1){

  CircuitPlayground.setPixelColor(1, 0, 0, 255);

  }

  if(pinValue>1.5){

  CircuitPlayground.setPixelColor(2, 0, 0, 255);

 }

  if(pinValue>2){

  CircuitPlayground.setPixelColor(3, 0, 0, 255);

 }


}


Downloads

Final Setups

Device Info Blynk.jpg

Now go to your blynk account, press devices, and copy the marked code.

Open file "waves.ino" and replace lines 27-29 with the copied marked code.

And you are ready to use the Alarm Clock!