Skip to main content

Swell Dials

By January 29, 2014December 30th, 2017Arduino, Electronics, Engineering, Programming, Surfing

This is an arduino project to visualise ocean data wave height/swell period & local wind from any surfing location on magicseaweed

/*
Simple Client Parsing sketch
 Arduino 1.0 version
 */
#include <String.h>
#include <SPI.h>
#include <Ethernet.h>
#include <Servo.h>
Servo swell;
Servo period;
Servo wind;
byte mac[] = { 
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char serverName[] = "festivalnet.co.uk";
EthernetClient client;
int swellval,periodval;
String readString = String(3);
void setup()
{
  Serial.begin(9600);
  
  swell.attach(6);
  period.attach(7);
  wind.attach(8);
  
 
  if(Ethernet.begin(mac) == 0) { // start ethernet using mac & IP address
    while(true) // no point in carrying on, so stay in endless loop:
      ;
  }
  delay(2000); // give the Ethernet shield 2 second to initialize
}
void loop()
{
  client.println("Refresh: 86400");
  
  if (client.connect(serverName, 80)>0) {
    client.println("GET http://magicseaweed.com/syndicate/rss/index.php?id=1&unit=uk ");//If a connection is made get in the desired page
    //client.println("GET http://festivalnet.co.uk/surf.rss");
  }
  
  if (client.connected()) {
    if(client.find("Swell :: ")){//look for first rating and store the result to day1
      swellval = client.parseInt();
      swellval = map(swellval,0,12,0,180);
      swell.write(swellval);
    }
    if(client.find("@ "))
    {//look for second rating and store the result to day2
      periodval = client.parseInt();
      periodval = map(periodval,0,14,0,180);
      period.write(periodval);
    }
    if(client.find("mph"))
    {//look for third rating and store the result to day3
      char c = client.read();
        if(readString.length()<3)
        {
          readString.concat(c);
        }
          if (readString.indexOf("NNE")>=0)
          {
            wind.writeMicroseconds(1062);
          }
          if (readString.indexOf("NE")>=0)
          {
            wind.writeMicroseconds(1125);
          }
          if (readString.indexOf("ENE")>=0)
          {
            wind.writeMicroseconds(1187);
          }
          if (readString.indexOf("E")>=0)
          {
            wind.writeMicroseconds(1250);
          }
          if (readString.indexOf("ESE")>=0)
          {
            wind.writeMicroseconds(1312);
          }
          if (readString.indexOf("SE")>=0)
          {
            wind.writeMicroseconds(1375);
          }
          if (readString.indexOf("SSE")>=0)
          {
            wind.writeMicroseconds(1437);
          }
          if (readString.indexOf("S")>=0)
          {
            wind.writeMicroseconds(1500);
          }
          if (readString.indexOf("SSW")>=0)
          {
            wind.writeMicroseconds(1562);
          }
          if (readString.indexOf("SW")>=0)
          {
            wind.writeMicroseconds(1625);
          }
          if (readString.indexOf("WSW")>=0)
          {
            wind.writeMicroseconds(1687);
          }
          if (readString.indexOf("W")>=0)
          {
            wind.writeMicroseconds(1750);
          }
          if (readString.indexOf("WNW")>=0)
          {
            wind.writeMicroseconds(1812);
          }
          if (readString.indexOf("NW")>=0)
          {
            wind.writeMicroseconds(1875);
          }
          if (readString.indexOf("NNW")>=0)
          {
            wind.writeMicroseconds(1937);
          }
          if (readString.indexOf("N")>=0)
          {
            wind.writeMicroseconds(2000);
          }
    }
    else {
      client.stop();//else disconnect
      delay(1000);
    }
  }else{
    digitalWrite(13,HIGH);
  }
  

  client.stop();//Disconnect
}







Here is the illustrator file for the gauges that im planning to be laser engraved https://www.dropbox.com/s/kqlo390j8pi5dgo/guages.ai?dl=0

To test the design I printed the dials onto t-shirt transfer paper and ironed them on to some 18mm MDF that i had lying around.

surf-dial

I also added a LED to blink once optimum surfing conditions are happening

surf-dial-1

Rear view of the mdf showing cutouts for the 3 x Tower Pro micro 9g servos, the wind direction indicator is a FSR90 continuous servo to allow 360 rotation.

surf-dial-2

It is still in development and ill update progress here

https://github.com/Make-Magazine/DataDialDisplay