Weather Candle - Weather and Temperature at a Glance

About: 3D printing and designing RaspberryPI projects for a few years now

Using this magic candle, you can tell the current temperature and conditions outside instantly

Step 1: Color Range 0 to 100*F

Step 2: Flashing RaspberriPi Hard Disk / Install Required Software (Using Ubuntu Linux)

Download "RASPBIAN JESSIE LITE" https://www.raspberrypi.org/downloads/raspbian/

Create your new hard disk for DashboardPI

Insert the microSD to your computer via USB adapter and create the disk image using the dd command

Locate your inserted microSD card via the df -h command, unmount it and create the disk image with the disk copy dd command

$ df -h /dev/sdb1 7.4G 32K 7.4G 1% /media/XXX/1234-5678

$ umount /dev/sdb1

Caution: be sure the command is completely accurate, you can damage other disks with this command

if=location of RASPBIAN JESSIE LITE image file of=location of your microSD card

$ sudo dd bs=4M if=/path/to/raspbian-jessie-lite.img of=/dev/sdb (note: in this case, it's /dev/sdb, /dev/sdb1 was an existing factory partition on the microSD)

Setting up your RaspberriPi

Insert your new microSD card to the raspberrypi and power it on with a monitor connected to the HDMI port

Login

user: pi

pass: raspberry

Change your account password for security

sudo passwd pi

Enable RaspberriPi

Advanced Options

sudo raspi-config

Choose: 1 Expand File System

9 Advanced Options

A2 Hostname change it to "WeatherJar"

A4 SSH Enable SSH Server

A7 I2C Enable i2c interface

Enable the English/US Keyboard

sudo nano /etc/default/keyboard

Change the following line: XKBLAYOUT="us"

Reboot PI for Keyboard layout changes / file system resizing to take effect

$ sudo shutdown -r now

Auto-Connect to your WiFi

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add the following lines to have your raspberrypi automatically connect to your home WiFi (if your wireless network is named "linksys" for example, in the following example)

network={
ssid="linksys"
psk="WIRELESS PASSWORD HERE"
}

Reboot PI to connect to WiFi network

$ sudo shutdown -r now

Now that your PI is finally on the local network, you can login remotely to it via SSH. But first you need to get the IP address it currently has.

$ ifconfig Look for "inet addr: 192.168.XXX.XXX" in the following command's output for your PI's IP Address

Go to another machine and login to your raspberrypi via ssh

$ ssh pi@192.168.XXX.XXX

Start Installing required packages

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo apt-get install memcached vim git python-smbus i2c-tools python-imaging python-smbus build-essential python-dev rpi.gpio python3 python3-pip python-memcache

**Update local timezone settings

$ sudo dpkg-reconfigure tzdata

select your timezone using the interface

Setup the simple directory l command [optional]

vi ~/.bashrc

add the following line:

alias l='ls -lh'

source ~/.bashrc

Fix VIM default syntax highlighting [optional]

sudo vi /etc/vim/vimrc

uncomment the following line:

syntax on

Install i2c Python Drivers

Install the NeoPixel Driver as follows

sudo apt-get install build-essential python-dev git scons swig

sudo pip3 install --upgrade setuptools

sudo pip3 install rpi_ws281x

cd rpi_ws281x

scons

cd python

sudo python setup.py install

cd examples/

sudo python strandtest.py

Step 3: Supplies Needed

RaspberryPi Zero

USB WIFI (if not a PiZero W)

NeoPixel Ring

Frosted Lamp Shade

Step 4: Building the WeatherJar

Solder the leads to connect the NeoPixel Ring to the Pi, needs 5V, GND and GPIO pin 18 connected

*Note: since we're only using one ring with not ever showing full brightness / bright white colors, we can rely on the power source of the RPi itself. Ordinarily they recommend the 5050 RGB pixesl such as these to have their own power source.


Wiring the Components
Connect the NeoPixel to 5v and GND on the RPi, connect the "in" pin on the NeoPixel ring to GPIO Pin #18


Print the Enclosure
In the 3D-Print/ folder of this project, print the lid and the base of the candle to contain the device.

Step 5: Build the Candle

Using a hot glue gun, glue the pi zero to the bottom of the candle base

Drill a hole to allow for the power USB cable to come in.

I've used some simple tape to hold the NeoPixel Ring to the button of the candle, tucking the wires away to ensure the light is blocked by any strange shadows inside.

Step 6: Creating the Temperature API

Python Flash API for displaying temperatures as color gradients installation instructions

Installation
Clone the project webserver folder locally on your webserver from this project [/var/www]

Create the Apache configuration to point to this project (Python Flask API)

Required Packages for Python Flash on Apache

$> sudo apt-get install libapache2-mod-wsgi python-dev python-pip python-pil

$> sudo a2enmod wsgi

$> sudo service apache2 restart

$> pip install flask

http://mytempuratureapi.com/neopixel?temperature=7...

Step 7: Setup RPi Cronjob for Candle to Operate

Set pi user crontab

Enter the following line for a minute by minute crontab

$ crontab -e

*/1 * * * * python /home/pi/WeatherJar/weather.py

Set root user crontab (this library requires root access)
Set "on reboot" to run the candle python script forever

$ sudo su

$ crontab -e

@reboot python /home/pi/WeatherJar/candle.py

Step 8: Finished!

Be sure to place this new URL you generated in your project settings so you can now have the weather jar respond to your current outdoor temperatures.

Make it Glow Contest 2018

This is an entry in the
Make it Glow Contest 2018

Share

    Recommendations

    • Toys Contest

      Toys Contest
    • First Time Author

      First Time Author
    • Big and Small Contest

      Big and Small Contest

    Discussions