Hannah
Published © GPL3+

IoT Controlled Snow Machine

The most homemade snow machine you've ever seen. Made from a hairdryer, polystyrene and MKR1000. Controllable from anywhere in the world*

BeginnerShowcase (no instructions)2 hours3,267

Things used in this project

Hardware components

Arduino MKR1000
Arduino MKR1000
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
Apple USB Powe Adapter
×1
Jumper wires (generic)
Jumper wires (generic)
×8
3.3V/5V 10A Relay Module
×1
Solid State Relay
×1
240V AC Socket and Plug
×1
Hairdryer
×1
2 Litre bottle (empty)
×1
Magic Snow
Or crumble up polystyrene when you've run out
×1

Software apps and online services

Arduino IDE
Arduino IDE
Sublime Text
Web Hosting

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

IoT SnowMachine Bread Board View

Circuit diagram of the setup I used for my IoT snow machine. It was my first time using Fritzing and couldn't find the exact components so used images instead to give a rough overview

Code

index.php

PHP
Website to control IoT Snow Machine.
MKR1000 looks at switchState.txt - If 0 off, if anything else on
Opening on.php writes 1 to switchState.txt
Opening off.php writes 0 to switchState.txt
<?php 
// Website to control IoT Snow Machine.
// MKR1000 looks at switchState.txt if 0 off, if anything else on 
// Opening on.php writes 1 to switchState.txt
// Opening off.php writes 0 to switchState.txt 

?>


<!DOCTYPE html>
<html>
<head>
	<title>Make it snow</title>
	<!-- Make it look pretty by connecting up bootstrap -->
	<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body style="background-color: #00ccff;">

<main class="page-scroll" id="snow">

<div class="container-fluid text-center">
	<br><br>
</div>

<div class="container-fluid text-center ">
<div class="btn-group btn-group-justified">

<!-- Snow button opens on.php -->
	<a href="on.php" class="btn btn-default btn-lg">Snow</a>
<!-- Stop button opens off.php -->
	<a href="off.php" class="btn btn-default btn-lg">Stop</a>
</div>
</div>

</main>

on.php

PHP
Website to control IoT Snow Machine.
MKR1000 looks at switchState.txt if 0 off, if anything else on
Opening on.php writes 1 to switchState.txt
Opening off.php writes 0 to switchState.txt
<!-- Website to control IoT Snow Machine.
MKR1000 looks at switchState.txt if 0 off, if anything else on 
Opening on.php writes 1 to switchState.txt
Opening off.php writes 0 to switchState.txt -->


<?php 
//Include index file so basic styling is consitant 
include 'index.php';

//Var to open file
$myfile = fopen("switchState.txt", "w") or die("Unable to open file!");

//Text to be written to file. 0 means off. anything else means on
$txt = "1";

//Write to file (file thats been opened, data written to file)
fwrite($myfile, $txt);

//Close file
fclose($myfile);
?>

<footer style="margin-top: 300px">
<div class="container-fluid text-center ">
	<h2>It's snowing!</h2>
</div>
</footer>

</body>
</html> 

<style type="text/css">
/*When the arduino is turned on, the web page will start snowing*/
/*Cheers pal for the snow http://codepen.io/NickyCDK/pen/AIonk*/
#snow{
	background: none;
	background-image: url('http://www.wearewebstars.dk/codepen/img/s1.png'), url('http://www.wearewebstars.dk/codepen/img//s2.png'), url('http://www.wearewebstars.dk/codepen/img//s3.png');
	height: 100%;
	left: 0;
	position: absolute;
	top: 0;
	width: 100%;
	z-index:1;
	-webkit-animation: snow 10s linear infinite;
	-moz-animation: snow 10s linear infinite;
	-ms-animation: snow 10s linear infinite;
	animation: snow 10s linear infinite;
}
@keyframes snow {
  0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
  50% {background-position: 500px 500px, 100px 200px, -100px 150px;}
  100% {background-position: 500px 1000px, 200px 400px, -100px 300px;}
}
@-moz-keyframes snow {
  0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
  50% {background-position: 500px 500px, 100px 200px, -100px 150px;}
  100% {background-position: 400px 1000px, 200px 400px, 100px 300px;}
}
@-webkit-keyframes snow {
  0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
  50% {background-position: 500px 500px, 100px 200px, -100px 150px;}
  100% {background-position: 500px 1000px, 200px 400px, -100px 300px;}
}
@-ms-keyframes snow {
  0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
  50% {background-position: 500px 500px, 100px 200px, -100px 150px;}
  100% {background-position: 500px 1000px, 200px 400px, -100px 300px;}
}	

	
</style>

off.php

PHP
Website to control IoT Snow Machine.
MKR1000 looks at switchState.txt if 0 off, if anything else on
Opening on.php writes 1 to switchState.txt
Opening off.php writes 0 to switchState.txt
<!-- Website to control IoT Snow Machine.
MKR1000 looks at switchState.txt if 0 off, if anything else on 
Opening on.php writes 1 to switchState.txt
Opening off.php writes 0 to switchState.txt -->

<?php 
//Include index file so basic styling is consitant 
include 'index.php';

//Var to open file
$myfile = fopen("switchState.txt", "w") or die("Unable to open file!");

//Text to be written to file. 0 means off. anything else means on
$txt = "0";

//Write to file (file thats been opened, data written to file)
fwrite($myfile, $txt);

//Close file
fclose($myfile);
?>

<footer style="margin-top: 300px">
<div class="container-fluid text-center ">
	<h2>It's not snowing</h2>
</div>
</footer>

</body>
</html> 

IoT_SnowMachine

Based off the Web client in WiFi101 examples, this script is used on the MKR1000 to connect to wifi and check if a file on a server says anything other than 0. This then turns on my connected appliance, in this case my homemade snow machine

Credits

Hannah

Hannah

1 project β€’ 0 followers
Thanks to Nick Kilby.

Comments