Mario Soranno
Published © MIT

Beach UV meter

It is possible that ultraviolet rays emitted by the sun deactivate the virus in a few seconds. The Beach UV meter measures UV and tweets.

BeginnerFull instructions provided8 hours3,279
Beach UV meter

Things used in this project

Hardware components

Arduino MKR WiFi 1010
Arduino MKR WiFi 1010
×1
Rechargable Li-Po Battery 3.7V 1400mAh with JST connector
×1
ARD2-2062
×1
Slide Switch, SPDT
Slide Switch, SPDT
It's a similar switch because I have used a recovery component.
×1
Heat-shrink tubing
×1
Machine Screw M3x20
×4

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk
Twitter
Twitter

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
3D Printer (generic)
3D Printer (generic)
Hot glue gun (generic)
Hot glue gun (generic)
Drill / Driver, Cordless
Drill / Driver, Cordless

Story

Read more

Custom parts and enclosures

Beach UV meter - lower part of case

Beach UV meter - lower part of case

Beach UV meter - middle part of case

Beach UV meter - middle part of case

Beach UV meter - upper part of case

Beach UV meter - upper part of case

Schematics

Electrical schematic

Electrical schematic of Beach UV meter.

Code

Beach UV meter - Code

Arduino
Code for reading sensor and publish on Twitter with arduino MKR 1010.
/*************************************************************
* Beach UV meter
* Mario Soranno
*************************************************************/
#define BLYNK_PRINT Serial

#include <SPI.h>
#include <WiFiNINA.h>
#include <BlynkSimpleWiFiNINA.h>

int sensorPin = A1;     // select the input pin for the potentiometer
int sensorValue = 0;    // variable to store the value coming from the sensor
String UVIndex = "";     // variable to store the value of UV Index

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "********************************";

// Your WiFi credentials.
//char ssid[] = "*******";
//char pass[] = "**************";


BlynkTimer timer;

void tweetUptime()
{
  sensorValue = analogRead(sensorPin);

  if(sensorValue<=225)
  {
    UVIndex = "0 - Risk Low";
  }
  else if (sensorValue>225 && sensorValue<=325)
  {
    UVIndex = "1 - Risk Low";
  }
  else if (sensorValue>325 && sensorValue<=410)
  {
    UVIndex = "2 - Risk Low";
  }
  else if (sensorValue>410 && sensorValue<=500)
  {
    UVIndex = "3 - Risk Moderate";
  }
  else if (sensorValue>500 && sensorValue<=605)
  {
    UVIndex = "4 - Risk Moderate";
  }
  else if (sensorValue>605 && sensorValue<=695)
  {
    UVIndex = "5 - Risk Moderate";
  }
  else if (sensorValue>695 && sensorValue<=795)
  {
    UVIndex = "6 - Risk High";
  }
  else if (sensorValue>795 && sensorValue<=880)
  {
    UVIndex = "7 - Risk High";
  }
  else if (sensorValue>880 && sensorValue<=975)
  {
    UVIndex = "8 - Risk Very High";
  }
  else if (sensorValue>975 && sensorValue<=1080)
  {
    UVIndex = "9 - Risk Very High";
  }
  else if (sensorValue>1080 && sensorValue<=1170)
  {
    UVIndex = "10 - Risk Very High";
  }
  else if (sensorValue>1170)
  {
    UVIndex = "11 - Risk Extreme";
  }
  
  Serial.print("sensor = ");
  Serial.println(sensorValue);
  Blynk.tweet(String("Value of UV Sensor: ") + sensorValue + String("mV\n\n UV Index: " + UVIndex + " (risk of sunburn, skin cancer and other injury)"));
}

void setup()
{
  Serial.begin(9600); // Debug console

  Blynk.begin(auth, ssid, pass);

  // Tweet immediately on startup
  Blynk.tweet("Beach UV meter - startup!\n");

  // Setup a function to be called every 10 minutes
  timer.setInterval(10L * 60000L, tweetUptime);
}

void loop()
{
  Blynk.run();
  timer.run();  // Initiates BlynkTimer
}

Credits

Mario Soranno

Mario Soranno

9 projects • 24 followers
I have a Bachelor's Degree in Industrial Engineering - Electronics. I am an expert in hardware design, I can program in C/C++,Python and ROS

Comments