Weather Controller

by PJSuchanek in Circuits > Arduino

255 Views, 0 Favorites, 0 Comments

Weather Controller

Snapchat-995774803~2.jpg

In this project, I created a physical controller that is able to be used within the program P5. My potentiometers and a button are used as inputs, and the led is used as an output. I wanted to create a fun interactive system. After playing around with the P5 program, I decided to create an interactive weather system, where the weather switches between rainy and sunny. This isn't like a super advanced game or anything but is more just a fun, easy going controller project for beginners.

Supplies

(1) Breadboard

(1) Arduino Nano

(1) Button

(2) Potentiometers

(1) LED

(1) Micro USB to USB

Jumper Wires

Cardboard

Tape/Hot Glue

Schematic

Snapchat-2007861991_2.jpg

This step shows the circuit and thought process associated with building this controller. In this circuit we have an LED, 2 potentiometers, and a button. The button acts as a switch because the weather only changes when the button is acted upon. The potentiometers are analog inputs because they are more than just an on or off switch; they have a large variety of values they can be. The led is an output from the information arduino takes in from P5 input. In step 3, I will further discuss the board layout and what each element is connected to.

Fabrication

Snapchat-952365103~2.jpg
Snapchat-1168191962~2.jpg

This step allows for two options: you can make the box completely by hand or you can use a laser cuter to cut out your box for you. Either way works, but using a laser cuter is a much more professional approach. The most important part is that you create openings for your various components. Our goal is to allow interactivity without being able to see the inner works and wiring. For my project I was originally going to use a slider, but I had complications with my slider getting super overheated and decided to use a second potentiometer instead. I put the second potentiometer in the slider slot and secured and also found the I could pass my micro usb to usb through the slot as well.

Setting Up the Board

Snapchat-1199695785~2.jpg
Snapchat-699500342~2.jpg
Snapchat-931718524~2.jpg
Snapchat-1496418286~2.jpg

This project had a rather easy setup associated with the board, as can be seen by the size of board I used. Both my potentiometers are connected to a pin, a ground, and a power source. My led is connected to a pin and ground. My battery is connected to a power source, ground, and a pin. If I were to add more controls my board would get much more complicated, but this project is meant to be more of an introduction to creating a controller.

Ardunio & P5 Code

My Code

Here is my code in github. The github includes both my arduino code and my p5 code. My arduino code is where I "created" all my elements (button, led, potentiometers) , and my p5 code is where I use those elements to create changes on the screen. With my two codes working together, I am able to turn my led on/off, change the size of the buildings, and change the weather on the screen.

Transmitting From Arduino to P5

Screenshot (18).png
Screenshot (20).png
Screenshot (23).png
Screenshot (24).png
Screenshot (25).png

I first wrote my code in arduino where I identified my elements (button, potentiometers, and led). I used the p5 serial controller app to allow me to connect my controller to my p5 code. I started by created rectangles that my potentiometers could control; one potentiometer controls their height, while the other potentiometer controls their width. I decided I wanted to have random circles appear, and that these circles would represent rain when the button was pushed. I set up my code with actions that happen while my button == 0 and when my button == 1. When my button isn't being pushed the background is blue and the sun is out. When my button is pushed the background is grey, clouds appear, and rain occurs. To make the led light up, you type 'h' for high and 'l' for low.

Final Project

Weather Controller

A video of my weather controller in action! I really enjoyed taking a new approach to creating a physical interactive system. As someone who really enjoys video games, I really appreciated this assignment; I'm hoping in the future that I can create something similar to use within Unity, since I now have the knowledge on how to create this type of interactive system. Overall, this project was really fun for me and helped me understand better the connection between software and hardware.