Friday, June 13, 2014

Weather Station: Day 19- June 13

Today we cleaned up the raspberry pi that we were using and renamed all of the programs. We then saved them on a flash drive for later use.

Then we made a simpler circuit so that the ardiuino and RFM could fit in a small enclosure. We had to solder the RFM down onto a protoshield with many resistors and wires connecting everything. This is what our final circuit looks like:

We tested this and it works!!! Good way to finish research! Thank you to everyone who has helped and made this a fun experience!

21 cm Detector: Day 19 -June 13

Today is the last day of research! We have mixed emotions! It has been a lot of fun and a great experience to work on our projects and learn with each other! Today we were pleasantly surprised and were able to test our 21 cm detector thanks to Dr. Hassel! He found a new way to connect it to the tv dongle so we were able to get a reading of the microwaves as shown below in our pictures.

 
We were still not able to find out how to load our webcam pictures or video to a public website. So, as of right now you can only view them if you are on Siena Air.
 
We had a great time working with everyone on the Viper Project! Thanks to all the professors for your help!


 
 
 

Thursday, June 12, 2014

Weather Station: Day 18- June 12

We finally did it! The weather station data can be read on one graph in plotly. The following code is what worked:

#!/usr/bin/python

import plotly.plotly as py
import time
import datetime
import serial
#from plotly.graph_objs import Figure, Data,Scatter, Layout

from plotly.graph_objs import *

#reads the data from the sensors and splits the line into the correct variables
def getpoint(ser):
        data = ser.readline().split()
        temp_C = float(data[0])
        humidity = float(data[1])
        rain = float(data[2])
        windDc = float(data[3])
        windDir = float(data[4])
        gustDc = float(data[5])


        # convert celsius to fahrenheit
        temperature = ( temp_C * 9.0 / 5.0 ) + 32

        #convert wind deci meters to meters
        wind = windDc/10
        gust = gustDc/10

        date_stamp = datetime.datetime.now()

        return date_stamp,temperature,humidity,rain,wind,windDir,gust


ser = serial.Serial('/dev/ttyACM0',9600)
py.sign_in('physuser','aldyw0r26q')

x1=[]
x2=[]
x3=[]
y1=[]
y2=[]
y3=[]
x4=[]
x5=[]
x6=[]
y4=[]
y5=[]
y6=[]

my_data1 = Scatter(x=x1,y=y1, stream=dict(token='tvfuqv0s6g'), name ='Temp(F)')

my_data2 = Scatter(x=x2,y=y2,
stream=dict(token='bjo44dghec'),xaxis='x2',yaxis='y2', name =
'Humidity')
#data=Data([my_data1,my_data2])

my_data3 = Scatter(x=x3,y=y3,
stream=dict(token='4tv7be960v'),xaxis='x3',yaxis='y3', name = 'Rain')
#data=Data([my_data1,my_data2,my_data3])

my_data4 = Scatter(x=x4,y=y4,
stream=dict(token='onmmq775to'),xaxis='x4',yaxis='y4', name = 'Wind
Speed')
#data=Data([my_data1,my_data2,my_data3])

my_data5 = Scatter(x=x5,y=y5,
stream=dict(token='g97c3g3475'),xaxis='x5',yaxis='y5', name = 'Wind
direction')
#data=Data([my_data1,my_data2,my_data3])

my_data6 = Scatter(x=x6,y=y6,
stream=dict(token='6l3o4sttj6'),xaxis='x6',yaxis='y6', name = 'Gust')
data=Data([my_data1,my_data2,my_data3,my_data4,my_data5,my_data6])

layout=Layout(title='Siena
Weather',xaxis1=XAxis(anchor='y1',title='time',showline=True),yaxis=YAxis(domain=[0,.12],title='Temperature(Degrees
F)',showline=True),xaxis2=XAxis(anchor='y2',title='time',showline=True),yaxis2=YAxis(domain=[0.18,0.30],title='Relative
Humidity(%)',showline=True),xaxis3=XAxis(anchor='y3',title='time',showline=True),yaxis3=YAxis(domain=[0.36,0.48],title='Rain',showline=True),
xaxis4=XAxis(anchor='y4',title='yaxis4=YAxis(domain=[0.53,0.65],title='Wind
Speed(m/s)',showline=True),xaxis5=XAxis(anchor='y5',title='time',showline=True),yaxis5=YAxis(domain=[0.71,0.83],title='Wind
Direction(Degrees)',showline=True),xaxis6=XAxis(anchor='y6',title='time',showline=True),yaxis6=YAxis(domain=[0.89,1],title='Gust(m/s)',showline=True),
width=900, height = 1200, autosize=False)


my_fig1=Figure(data=data,layout=layout)
py.plot(my_fig1, auto_open = False)

s1 = py.Stream('tvfuqv0s6g')
s2 = py.Stream('bjo44dghec')
s3 = py.Stream('4tv7be960v')
s4 = py.Stream('onmmq775to')
s5 = py.Stream('g97c3g3475')
s6 = py.Stream('6l3o4sttj6')

s1.open()
s2.open()
s3.open()
s4.open()
s5.open()
s6.open()

while True: #while loop for temperature
        pt = getpoint(ser)
        s1.write(dict(x=pt[0], y=pt[1] ))
        s2.write(dict(x=pt[0], y=pt[2]))
        s3.write(dict(x=pt[0], y=pt[3]))
        s4.write(dict(x=pt[0], y=pt[4] ))
        s5.write(dict(x=pt[0], y=pt[5]))
        s6.write(dict(x=pt[0], y=pt[6]))

        time.sleep(5)

s1.close()
s2.close()
s3.close()
s4.close()
s5.close()
s6.close()


This is what this looks like in plotly:


Now we need to just clean up the RFM and arduino set up. We need to solder the RFM chip to little pins that stick directly into a breadboard. This makes the circuit neater and so that nothing will move around when we put it an enclosure on the roof.

21 cm Detector: Day 18 -June 12

This is a picture that our camera took at night. This means that as long as there is some light on the telescope, you will be able to see what is occurring on the telescope.


Today we figured out how to start and stop motion at a certain time each day. We also were able to delete files that were more than a day old. The code we used is shown below.
 
 
Tomorrow is the last day. :-( Unfortunately, we will not be able to test the 21 cm detector again this week because a pin broke that connects it to the TV dongle. We hope to find more information on how to upload pictures to a public website and to write out instructions on how we got our webcam working.

21 cm Detector: Day 17 -June 11

Even in the rain we managed to place our 21 cm detector in the telescope at Union.
Unfortunately, our test was not successful. We got closer and closer each time we went to Union so we are hoping the next time it is tested it works!
 
 

Weather Station: Day 17- June 11

Today we started by testing the split method that is used to separate the line of data into two separate values. This works for the DHT sensor because there are only two values to read (temperature and humidity) but we needed to make sure that this would work with the weather station which has six different values. First we wrote a simple code using a string to test the split() method. We then wrote another simple code that read data from the serial monitor of the arduino. The values aren't coming in right because of the weather station.

We also worked on getting the streaming graphs from plotly to show up on one graph. We finally got three graphs to show up on one graph with the data from the DHT sensor which is shown below:


We used the same code that is on our previous blog for the arduino to read signals from the RFM transceiver. We had to change the code that goes in the raspberry pi terminal which is below: 

#!/usr/bin/python

import plotly.plotly as py
import time
import datetime
import serial
#from plotly.graph_objs import Figure, Data,Scatter, Layout

from plotly.graph_objs import *

#reads the data from the sensors and splits the line into the correct variables
def getpoint(ser):
        data = ser.readline().split()
        humidity = float(data[0])
        temp_C = float(data[1])

        # convert celsius to fahrenheit
        temperature = ( temp_C * 9.0 / 5.0 ) + 32

        date_stamp = datetime.datetime.now()

        return date_stamp,temperature,humidity,temp_C

# token info
ser = serial.Serial('/dev/ttyACM0',9600)
py.sign_in('physuser','aldyw0r26q')

x1=[]
x2=[]
x3=[]
y1=[]
y2=[]
y3=[]
my_data1 = Scatter(x=x1,y=y1, stream=dict(token='tvfuqv0s6g'), name ='Temp(F)')

my_data2 = Scatter(x=x2,y=y2,
stream=dict(token='bjo44dghec'),xaxis='x2',yaxis='y2', name =
'Humidity')
data=Data([my_data1,my_data2])

my_data3 = Scatter(x=x3,y=y3,
stream=dict(token='4tv7be960v'),xaxis='x3',yaxis='y3', name =
'Temp(C)')
data=Data([my_data1,my_data2,my_data3])

layout=Layout(title='Temp and
Humidity',xaxis1=XAxis(anchor='y1',title='time',showline=True),yaxis=YAxis(domain=[0,.20],title='Temperature(F)',showline=True),xaxis2=XAxis(anchor='y2',title='time',showline=True),yaxis2=YAxis(domain=[0.35,0.60],title='Humidity',showline=True),xaxis3=XAxis(anchor='y3',title='time',showline=True),yaxis3=YAxis(domain=[0.75,1],title='Temperature(C)',showline=True),
width=900, height = 1200, autosize=False)

my_fig1=Figure(data=data,layout=layout)
py.plot(my_fig1, auto_open = False)
s1 = py.Stream('tvfuqv0s6g')

s2 = py.Stream('bjo44dghec')
s3=py.Stream('4tv7be960v')

s1.open()
s2.open()
s3.open()
while True: #while loop for temperature
        pt = getpoint(ser)
        s1.write(dict(x=pt[0], y=pt[1] ))
        s2.write(dict(x=pt[0], y=pt[2]))
        s3.write(dict(x=pt[0], y=pt[3]))

        time.sleep(5)

s1.close()
s2.close()
s3.close()

We used the following website to guide us into making these subplots: https://plot.ly/python/subplots/
We also added axes titles, black lines of the axes, changed the figure size and the size of each individual graph. These go under the layout section and we used this link: https://plot.ly/python/labels/

Now we need to figure out how to add three other plots onto this one graph because the weather station has six different values. 

The time that shows up on the x-axis of the plotly graphs were in the wrong time zone. To fix this we had to change the time on the raspberry pi. First, you have to type in "sudo /usr/bin/raspi-config" in the raspberry pi terminal. We then clicked the "Internationalization options" and followed the simple steps to change the time zone. Now we have the correct time, but still in military time. 

Wednesday, June 11, 2014

21 cm Detector Day 17

Today we went to Union College to test the 21cm Detector. When we arrived, the Raspberry Pi would not load. The SD card seems to be corrupted. We were able to run the program on a laptop. We kept getting a peak that did not move when switching wavelengths. Our second computer crashed and would not reload Debian. We will test again. We are now reinstalling the program on the new SD card and hope to have it working soon. Pictures from today will be up soon.

Weather Station: Day 16 - June 10

The following code is the arduino code that we have been using to read the temperature and the humidity from the DHT sensor:

#include <SPI.h>
#include "DHT.h"


// DHT Sensor Setup
#define DHTPIN 2 // We have connected the DHT to Digital Pin 2
#define DHTTYPE DHT22 // This is the type of DHT Sensor (Change it to
DHT11 if you're using that model)
DHT dht(DHTPIN, DHTTYPE); // Initialize DHT object


void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  dht.begin();
}

float h, t;

void loop() {
      h = dht.readHumidity();
      t = dht.readTemperature();
      Serial.print(h);
      Serial.print("\t");
      Serial.println(t);
      delay(10000);

We worked all day on the following code which goes in the Raspberry Pi terminal:

#!/usr/bin/python

import plotly.plotly as py
import time
import datetime
import serial
from plotly.graph_objs import Figure, Data,Scatter

#reads the data from the sensors and splits the line into the correct variables
def getpoint(ser):
        data = ser.readline().split()
        humidity = float(data[0])
        temp_C = float(data[1])

        # convert celsius to fahrenheit
        temperature = ( temp_C * 9.0 / 5.0 ) + 32

        date_stamp = datetime.datetime.now()

        return date_stamp,temperature,humidity

# token info
ser = serial.Serial('/dev/ttyACM0',9600)
py.sign_in('physuser','aldyw0r26q')
my_data1 = Data([Scatter(x=[],y=[], stream=dict(token='tvfuqv0s6g'))])
my_fig1=Figure(data=my_data1)
py.plot(my_fig1, auto_open = False)
s1 = py.Stream('tvfuqv0s6g')

my_data2 = Data([Scatter(x=[],y=[], stream=dict(token='bjo44dghec'))])
my_fig2=Figure(data=my_data2)
py.plot(my_fig2, auto_open = False)
s2 = py.Stream('bjo44dghec')


s1.open()
s2.open()
while True: #while loop for temperature
        pt = getpoint(ser)
        s1.write(dict(x=pt[0], y=pt[1] ))
        s2.write(dict(x=pt[0], y=pt[2]))
        time.sleep(5)

s1.close()
s2.close()


This python code sends two graphs to plotly. One graph is for the temperature and the other graph is for the humidity which are both measured by the DHT sensor in our circuit. Our goal is to get the two graphs to appear on the same graph that way we can use plotly to make subgraphs. 

We finally figured out how to get rid of the window that kept popping up when we ran the program. This was just a simple line of code auto_open=False. Yesterday we kept getting incorrect values for the humidity but we discovered that you have to open the serial monitor on the arduino in order for that value to be correct in python.

We also emailed the Matt Sundquist, the cofounder at plotly,  to ask about how to make the two traces appear on one graph and we are just waiting to hear back from him. 

Once we get this working, we will have to change the code to work for our weather station which includes temperature, humidity, rain, wind speed, wind direction, and gust.





Tuesday, June 10, 2014

21 cm Detector: Day 16 -June 10

Exciting morning for us!!!!! We now have the video streaming and pictures uploading online! If you are on SienaAir test it out!!!!
Video: http://10.69.97.113:8081
Pictures: http://10.69.97.113:8080

YAY!
This is what the archive of photos looks like. It is accessing the folder that apache2 creates for online. The problem is that the raspberry pi has to be on in order to access the photos. You also have to be on the SienaAir network to access the photos. We are working on editing a cron tab that allows you to delete photos in the archive after a certain number of days. We should be able to go for a long time before the images need to be deleted. That's because today we left motion running and took over 4000 photos and used up only .1GB out of the 8GB on the SD card. We are also trying to access our raspberry pi from a public IP. The hope is that we will be able to view the last snapshot that was taken on the Siena website. If we can not figure out how to do that, we can try and convert the images in python or matlab. Tonight we are going to run the camera of the raspberry pi by the window starting at 10pm. We turned on auto brightness and hope that the camera will be able to take picture outside at night well. 

Muon Detector Last Week of Research

During this week we have been trying to find the lifetime of a muon. First, we did a tutorial on LabView and we worked on this same program to collect and store the data from our oscilloscope. Next, we worked with Matlab and created a code to isolate the double pulses. We wanted to get rid of the pulses that didn't show a double pulse. We used old data to test the code on Matlab and after a long period of time we got the code to work. Lastly, we worked on our write up to help us present in the brown bag lunch during the school year. Currently we are writing up our results and conclusion.

Recap of Last Week Muon Detector

Last week we sealed our tank after filling it with the new fluid and attached a piece of plastic over the hole on the lid.  We glued our PMT into place and sealed it to avoid any light leaks.  We set up our apparatus and the wiring the same way it was on the smaller scale but ran into a problem.  We realized that we had a few bad wires so we weren't getting any data.  After fixing the issue, we were able to start collecting data and observing how our muon detector works at a larger scale.

Our Muon detector on a larger scale.


Monday, June 9, 2014

21 cm Detector: Day 15- June 9

Today we made some progress and found that cron job worked. We were very excited to see that cron job could run motion whenever we wanted after it not working for a couple of days. We high fived for excitement! It doesn't take much to make us happy! Since we got it to work, the web cam got us in action!

We also tested our 21 cm detector to see if it read any waves. This is a picture of what the graph looked like before we tested it so that we could see if there was a change when we turned on the 10.5 giga hertz microwave optic source, as shown below.


I know the picture quality isn't the best, but you can see that the graph did change, so our 21 cm detector is reading something! This was very exciting for us to see the graph change.


Tomorrow we hope to figure out how to send pictures from the raspberry pi to a website. We are planning to go to union on Wednesday to test our 21 cm detector with their telescope. It will be our third visit so we are hoping that the third time's the charm!