spectraphilic / wasp_sketches

Waspmote sketches develoded by our group
1 stars 0 forks source link

AS765X sensors #44

Open ArcticSnow opened 5 years ago

ArcticSnow commented 5 years ago

Integrating the radiometers AS765X into waspmote

  1. Tried the Sparkfun Triad sensor board with arduino nano using i2c. This was a plug and play
  2. Cut the I2C pull-up resistor on the triad board to connect to waspmote (as there already exist pull up resistors on the waspmtoe for I2C). I copied the sparkfun simple script into waspmote IDE:
#include <SparkFun_AS7265X.h> //Click here to get the library: http://librarymanager/All#SparkFun_AS7265X
AS7265X sensor;

void setup() {
  PWR.setSensorPower(SENS_3V3, SENS_ON);
  delay(100);
  pinMode(DIGITAL2, OUTPUT);  \\ to plug the sensor via the Lemming board
  digitalWrite(DIGITAL2, HIGH);    \\ to plug the sensor via the Lemming board
  delay(100);
  USB.println((long)I2C.scan(0x49));
  delay(100);
  USB.ON();
  USB.println("AS7265x Spectral Triad Example");

  if(sensor.isConnected() == false)
  {
    USB.println("Sensor not connected...");
  }
  if(sensor.begin() == false)
  {
    USB.println("Sensor does not appear to be connected. Please check wiring. Freezing...");
  }
  USB.println("A,B,C,D,E,F,G,H,I,J,K,L,R,S,T,U,V,W");
}

void loop() {
  sensor.takeMeasurements(); //This is a hard wait while all 18 channels are measured
  USB.print(sensor.getCalibratedA());
  USB.print(",");
  USB.print(sensor.getCalibratedB());
  USB.print(",");
  USB.print(sensor.getCalibratedC());
  USB.print(",");
  USB.print(sensor.getCalibratedD());
  USB.print(",");
  USB.print(sensor.getCalibratedE());
  USB.print(",");
  USB.print(sensor.getCalibratedF());
  USB.print(",");
  USB.print(sensor.getCalibratedG());
  USB.print(",");
  USB.print(sensor.getCalibratedH());
  USB.print(",");
  USB.print(sensor.getCalibratedI());
  USB.print(",");
  USB.print(sensor.getCalibratedJ());
  USB.print(",");
  USB.print(sensor.getCalibratedK());
  USB.print(",");
  USB.print(sensor.getCalibratedL());
  USB.print(",");
  USB.print(sensor.getCalibratedR());
  USB.print(",");
  USB.print(sensor.getCalibratedS());
  USB.print(",");
  USB.print(sensor.getCalibratedT());
  USB.print(",");
  USB.print(sensor.getCalibratedU());
  USB.print(",");
  USB.print(sensor.getCalibratedV());
  USB.print(",");
  USB.print(sensor.getCalibratedW());
  USB.print(",");

  USB.println();
}

As a result, the scan 0x49 does not find the sensor, and any subsequent actions are failing. The original sparfun library includes beginTransmission() and ednTransmission() functions, not available into waspmote I2C library. The problem is most likely software.

Step 1: Get the AS765X on Lagopus board to work with Arduino nano. for that we need to push the firmware to the flash chip, and then used the board that the sensors have been switched.

Step 2: If AS765X can be ran from the Sparkfun Triad board, then figure out how to flush the memory chip and test out with the Lagopus board (where the sensors 1 and 2 have been swapped)