Tuesday, April 11, 2017

Week of April 10th - 14th


  • Started using the Raspberry Pi in order to collect data.
  • In the process of generating plots and then analyzing them. 
  • Ordering an additional Raspberry Pi so we can collect additional data.
  • Rebuilding the original apparatus (Arduino Uno and WiFi) and going to collect vibration data close to the elevators location.
  • In addition, I am in the process of building a temperature sensor using the Arduino Mega 2560 as well as incorporating the Arduino WiFi Shield 101.
  • A block diagram has been created in MATLAB Simulink (shown below) that is ready to be ran. 
  • I will need to find a way to incorporate the Arduino WiFi Shield 101 into the block diagram so temperature data can be collected through the internet. 

Week of April 3rd - 7th


  • Decided to switch from the WiFi Shield 101 and the Arduino Uno to the Raspberry Pi. 
  • The reason for this is because vibration data collection through the WiFi was unreliable. The connection to the schools wifi network would interrupt data collection... least thats what we are speculating. 



This is the location below the possible observatory site
where data is being collected.  




Week of March 27th - 31st


  • Presented at the Rochester Symposium.
  • After presenting, one of the students suggested that we should measure vibrational data in two areas: one in a "vibration-free" area and one in a heaving vibrational area.
  • We decided to attach the apparatus close to the location of the elevator in the science building.
  • For an area that is "vibration-free", we plan on collecting vibration data outside of the science building after checking the forecast.



acceleration-vs-time-2017Mar27.png

Results from accelerometer mounted to the support pier for ~ 30 minutes.


Sunday, March 19, 2017

Week of March 20th - 24th

-In the process of generating a MATLAB script in order to collect vibration data.
-Currently having trouble developing the code that will allow data to be collected.
-In addition, I downsized the original apparatus into a more compact apparatus (seen below). A smaller breadboard was used.
-A covering for the Arduino was ordered as well to ensure the protection of the equipment.

Week of March 13th - 17th

-Turns out that ThingSpeak collects data every 15 seconds and we need to collect data every .0025 of second. As a result we cannot used ThingSpeak.
-Since we have connection through WiFi using the Arduino WiFi Shield we are able to generate a script to collect data from the Arduino.
-Currently in the process of deciding whether to use a MATLAB script or to develop a Simulink Diagram in order to initialize vibration data collection.

Monday, March 6, 2017

Week of March 6th - 10th

-Data will be collected using ThingSpeak.
-An account was made and now I am trying to test the collection of data using a provided example (the code used is displayed below).
-There is an issue with displaying the voltage from A0 (analog) pin in ThingSpeak. I need to conduct further research in order to properly collect the data in ThingSpeak.

WriteVoltage Code to test ThingSpeak:


*/

#include "ThingSpeak.h"

// ***********************************************************************************************************
// This example selects the correct library to use based on the board selected under the Tools menu in the IDE.
// Yun, Ethernet shield, WiFi101 shield, esp8266, and MXR1000 are all supported.
// With Yun, the default is that you're using the Ethernet connection.
// If you're using a wi-fi 101 or ethernet shield (http://www.arduino.cc/en/Main/ArduinoWiFiShield), uncomment the corresponding line below
// ***********************************************************************************************************

#define USE_WIFI101_SHIELD
//#define USE_ETHERNET_SHIELD

#if defined(ARDUINO_AVR_YUN)
    #include "YunClient.h"
    YunClient client;
#else
  #if defined(USE_WIFI101_SHIELD) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_ARCH_ESP8266)
    // Use WiFi
    #ifdef ARDUINO_ARCH_ESP8266
      #include <ESP8266WiFi.h>
    #else
      #include <SPI.h>
      #include <WiFi101.h>
    #endif
    char ssid[] = "<SOS_Wirless>";    //  your network SSID (name) 
    char pass[] = "";   // your network password
    int status = WL_IDLE_STATUS;
    WiFiClient  client;
  #elif defined(USE_ETHERNET_SHIELD)
    // Use wired ethernet shield
    #include <SPI.h>
    #include <Ethernet.h>
    byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
    EthernetClient client;
  #endif
#endif

#ifdef ARDUINO_ARCH_AVR
  // On Arduino:  0 - 1023 maps to 0 - 5 volts
  #define VOLTAGE_MAX 5.0
  #define VOLTAGE_MAXCOUNTS 1023.0
#elif ARDUINO_SAMD_MKR1000
  // On MKR1000:  0 - 1023 maps to 0 - 3.3 volts
  #define VOLTAGE_MAX 3.3
  #define VOLTAGE_MAXCOUNTS 1023.0
#elif ARDUINO_SAM_DUE
  // On Due:  0 - 1023 maps to 0 - 3.3 volts
  #define VOLTAGE_MAX 3.3
  #define VOLTAGE_MAXCOUNTS 1023.0  
#elif ARDUINO_ARCH_ESP8266
  // On ESP8266:  0 - 1023 maps to 0 - 1 volts
  #define VOLTAGE_MAX 1.0
  #define VOLTAGE_MAXCOUNTS 1023.0
#endif

/*
  *****************************************************************************************
  **** Visit https://www.thingspeak.com to sign up for a free account and create
  **** a channel.  The video tutorial http://community.thingspeak.com/tutorials/thingspeak-channels/ 
  **** has more information. You need to change this to your channel, and your write API key
  **** IF YOU SHARE YOUR CODE WITH OTHERS, MAKE SURE YOU REMOVE YOUR WRITE API KEY!!
  *****************************************************************************************/
unsigned long myChannelNumber = 235301;
const char * myWriteAPIKey = "QS700Q79W3I9693X";

void setup() {
  
  #ifdef ARDUINO_AVR_YUN
    Bridge.begin();
  #else   
    #if defined(ARDUINO_ARCH_ESP8266) || defined(USE_WIFI101_SHIELD) || defined(ARDUINO_SAMD_MKR1000)
      WiFi.begin(ssid, pass);
    #else
      Ethernet.begin(mac);
    #endif
  #endif

  ThingSpeak.begin(client);
}

void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // Convert the analog reading 
  // On Uno,Mega,YunArduino:  0 - 1023 maps to 0 - 5 volts
  // On ESP8266:  0 - 1023 maps to 0 - 1 volts
  // On MKR1000,Due: 0 - 4095 maps to 0 - 3.3 volts
  float voltage = sensorValue * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
  Serial.print(voltage);

  // Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
  // pieces of information in a channel.  Here, we write to field 1.
  ThingSpeak.writeField(myChannelNumber, 1, voltage, myWriteAPIKey);
  delay(20000); // ThingSpeak will only accept updates every 15 seconds.
}

Wednesday, March 1, 2017

Week of February 27th - March 3rd

-Code has been fixed so that the print statement displays our acceleration out to 6 decimal places.
-The Arduino C code in order to connect the WiFi 101 Shield to the wireless router was also completed.

Here are the corresponding codes

Updated Vibrational Code:



*/
/**************************************************************************/

#include <Wire.h>
#include <Adafruit_MMA8451.h>
#include <Adafruit_Sensor.h>

Adafruit_MMA8451 mma = Adafruit_MMA8451();

void setup(void) {
  Serial.begin(9600);
  
  Serial.println("Adafruit MMA8451 test!");
  

  if (! mma.begin()) {
    Serial.println("Couldnt start");
    while (1);
  }
  Serial.println("MMA8451 found!");
  
  mma.setRange(MMA8451_RANGE_2_G);
  
  Serial.print("Range = "); Serial.print(2 << mma.getRange());  
  Serial.println("G");
  
}

void loop() {
  // Read the 'raw' data in 14-bit counts
  mma.read();
  Serial.print("X:\t"); Serial.print(mma.x); 
  Serial.print("\tY:\t"); Serial.print(mma.y); 
  Serial.print("\tZ:\t"); Serial.print(mma.z); 
  Serial.println();

  /* Get a new sensor event */ 
  sensors_event_t event; 
  mma.getEvent(&event);

  /* Display the results (acceleration is measured in m/s^2) */
  Serial.print("X: \t"); Serial.print(event.acceleration.x,6); Serial.print("\t");
  Serial.print("Y: \t"); Serial.print(event.acceleration.y,6); Serial.print("\t");
  Serial.print("Z: \t"); Serial.print(event.acceleration.z,6); Serial.print("\t");
  Serial.println("m/s^2 ");
  
  /* Get the orientation of the sensor */
  uint8_t o = mma.getOrientation();
  
  switch (o) {
    case MMA8451_PL_PUF: 
      Serial.println("Portrait Up Front");
      break;
    case MMA8451_PL_PUB: 
      Serial.println("Portrait Up Back");
      break;    
    case MMA8451_PL_PDF: 
      Serial.println("Portrait Down Front");
      break;
    case MMA8451_PL_PDB: 
      Serial.println("Portrait Down Back");
      break;
    case MMA8451_PL_LRF: 
      Serial.println("Landscape Right Front");
      break;
    case MMA8451_PL_LRB: 
      Serial.println("Landscape Right Back");
      break;
    case MMA8451_PL_LLF: 
      Serial.println("Landscape Left Front");
      break;
    case MMA8451_PL_LLB: 
      Serial.println("Landscape Left Back");
      break;
    }
  Serial.println();
  delay(500);
  
}

Wifi Code (Connect Arduino):


/*

 This example connects to an unencrypted WiFi network.
 Then it prints the  MAC address of the WiFi shield,
 the IP address obtained, and other network details.

 Circuit:
 * WiFi shield attached

 created 13 July 2010
 by dlf (Metodo2 srl)
 modified 31 May 2012
 by Tom Igoe
 */
#include <SPI.h>
#include <WiFi101.h>

char ssid[] = "SOS_Wireless";     // the name of your network
int status = WL_IDLE_STATUS;     // the WiFi radio's status

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  }

  // attempt to connect to WiFi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to open SSID: ");
    Serial.println(ssid);
    status = WiFi.begin(ssid);

    // wait 10 seconds for connection:
    delay(10000);
  }

  // you're connected now, so print out the data:
  Serial.print("You're connected to the network");
  printCurrentNet();
  printWiFiData();
}

void loop() {
  // check the network connection once every 10 seconds:
  delay(10000);
  printCurrentNet();
}

void printWiFiData() {
  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);
  Serial.println(ip);

  // print your MAC address:
  byte mac[6];
  WiFi.macAddress(mac);
  Serial.print("MAC address: ");
  Serial.print(mac[5], HEX);
  Serial.print(":");
  Serial.print(mac[4], HEX);
  Serial.print(":");
  Serial.print(mac[3], HEX);
  Serial.print(":");
  Serial.print(mac[2], HEX);
  Serial.print(":");
  Serial.print(mac[1], HEX);
  Serial.print(":");
  Serial.println(mac[0], HEX);

  // print your subnet mask:
  IPAddress subnet = WiFi.subnetMask();
  Serial.print("NetMask: ");
  Serial.println(subnet);

  // print your gateway address:
  IPAddress gateway = WiFi.gatewayIP();
  Serial.print("Gateway: ");
  Serial.println(gateway);
}

void printCurrentNet() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print the MAC address of the router you're attached to:
  byte bssid[6];
  WiFi.BSSID(bssid);
  Serial.print("BSSID: ");
  Serial.print(bssid[5], HEX);
  Serial.print(":");
  Serial.print(bssid[4], HEX);
  Serial.print(":");
  Serial.print(bssid[3], HEX);
  Serial.print(":");
  Serial.print(bssid[2], HEX);
  Serial.print(":");
  Serial.print(bssid[1], HEX);
  Serial.print(":");
  Serial.println(bssid[0], HEX);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(rssi);

  // print the encryption type:
  byte encryption = WiFi.encryptionType();
  Serial.print("Encryption Type:");
  Serial.println(encryption, HEX);

}

Tuesday, February 14, 2017

Week of February 8th - 15th

-This week I continued to edit my code but kept running into difficulty. I am trying to display an acceleration in the micro range (10^-6) and higher.

-Meeting with my advisor this week so we can discuss the issue.

-Started to design the apparatus so I can separate the Arduino and accelerometer in order to minimize any additional vibrations.

-I attached a picture of the current setup.



Tuesday, February 7, 2017

Week of February 1st - 8th

-Locations have been chosen to measure vibration data

  • Elevator Shaft
  • Comp Sci Classroom (directly under telescope location)

-Ready to collect data based on my calculated parameters.
  • Data will be recorded at a period of 0.01 seconds (T = 0.01sec)
  • Record at a rate of 100Hz - 50Hz
  • Resolution of 0.0025 of a second
-Need to make a few more changes to the code based on these parameters.

For the following week I want to determine the best way to record data. I used the plotter in Arduino (attached screenshots to the post).





Week of Jan 25th - February 1st

-Continuing to improve Arduino code in order to start collecting data.
-Adjusted the delay based on Arduino capablilties.
-Below is the code used in order to start collecting data

Will continue to improve this code in the coming week.

*/
/**************************************************************************/

#include <Wire.h>
#include <Adafruit_MMA8451.h>
#include <Adafruit_Sensor.h>

Adafruit_MMA8451 mma = Adafruit_MMA8451();

void setup(void) {
  Serial.begin(9600);
  
  Serial.println("Adafruit MMA8451 test!");
  

  if (! mma.begin()) {
    Serial.println("Couldnt start");
    while (1);
  }
  Serial.println("MMA8451 found!");
  
  mma.setRange(MMA8451_RANGE_2_G);
  
  Serial.print("Range = "); Serial.print(2 << mma.getRange());  
  Serial.println("G");
  
}

void loop() {
  // Read the 'raw' data in 14-bit counts
  mma.read();
  Serial.print("X:\t"); Serial.print(mma.x); 
  Serial.print("\tY:\t"); Serial.print(mma.y); 
  Serial.print("\tZ:\t"); Serial.print(mma.z); 
  Serial.println();

  /* Get a new sensor event */ 
  sensors_event_t event; 
  mma.getEvent(&event);

  /* Display the results (acceleration is measured in m/s^2) */
  Serial.print("X: \t"); Serial.print(event.acceleration.x); Serial.print("\t");
  Serial.print("Y: \t"); Serial.print(event.acceleration.y); Serial.print("\t");
  Serial.print("Z: \t"); Serial.print(event.acceleration.z); Serial.print("\t");
  Serial.println("m/s^2 ");
  
  /* Get the orientation of the sensor */
  uint8_t o = mma.getOrientation();
  
  switch (o) {
    case MMA8451_PL_PUF: 
      Serial.println("Portrait Up Front");
      break;
    case MMA8451_PL_PUB: 
      Serial.println("Portrait Up Back");
      break;    
    case MMA8451_PL_PDF: 
      Serial.println("Portrait Down Front");
      break;
    case MMA8451_PL_PDB: 
      Serial.println("Portrait Down Back");
      break;
    case MMA8451_PL_LRF: 
      Serial.println("Landscape Right Front");
      break;
    case MMA8451_PL_LRB: 
      Serial.println("Landscape Right Back");
      break;
    case MMA8451_PL_LLF: 
      Serial.println("Landscape Left Front");
      break;
    case MMA8451_PL_LLB: 
      Serial.println("Landscape Left Back");
      break;
    }
  Serial.println();
  delay(500);
  
}

Monday, January 23, 2017

Week of Jan 18th - 25th

-For this past week I continued to edit my Arduino C Code. I have been getting compiling errors so I have attempted to correct these errors so I can continue working on the project. In addition, I scheduled a meeting time with my advisor for each week.
-For the upcoming week I plan on having my code working so I begin data collection using the accelerometer and Arduino. In addition, I will begin to find potential test sites to start measuring vibrational magnitude.

Parts

Arduino Shield Wifi 101
-Arduino Uno
-3-Axis 14-Bit Accelerometer (16,384 bits of memory)
-Breadboard



Wednesday, January 18, 2017

Project - Overview

- Linked an accelerometer to an Arduino to initialize vibrational data collection at a possible observatory site.
-Analyzed data to determine the vibration source and assess its magnitude.