Author Topic: Dead Oak - No Blinking Light  (Read 7474 times)

DanT

  • Newbie
  • *
  • Posts: 8
Dead Oak - No Blinking Light
« on: February 11, 2017, 10:26:23 am »
Hi,

I got 2 Oaks from the kick starter campaign.

I was able to do the registration procedure with both of them (with some difficulties).  But when I downloaded my software to the first Oak, it went into some n on-operating state. 

After several tries at that, I downloaded the software to the other Oak and it is working fine.  I is collecting some environmental data for me and has bee running for over a month.

the non-working Oak has the power LED lit and that is all.  I can’t find any evidence of a network running like there was when I registered it. I have tried powering up with P1 grounded and then with P2 grounded with no effect.  I am currently powering the device from a powered hub where the Oak is the only device attached.  The hub has worked well with other devices.

I have searched through the forum for similar problems but without success.

Can you give me any advice or suggestions?

Dan

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Dead Oak - No Blinking Light
« Reply #1 on: February 11, 2017, 10:50:07 am »
Dan, Do you have a FTDI to USB (3.3V compatible) adapter? Almost a must if you are going to play with and use Oak's. If have an adapter, you can start by determining if the ESP8266 is booting. At power on I believe the baud is 74880. You should see the initial boot messages coming from the Oak. If that looks OK then I would start dumping sectors to see if the Oak has been provisioned.

At boot you should see something (but not exactly) like this...

 ets Jan  8 2013,rst cause:2, boot mode:(3,0)

load 0x40100000, len 3632, room 16
tail 0
chksum 0xc0
load 0x3ffe8000, len 352, room 8
tail 8
chksum 0x82
csum 0x82

OakBoot v1 - W,BU,0

Start there and post your results.

DanT

  • Newbie
  • *
  • Posts: 8
Re: Dead Oak - No Blinking Light
« Reply #2 on: February 11, 2017, 03:14:33 pm »
Thanks for the response.

My Win 7 computer will not do 74880 baud rate, but I set it at 9600 and got the following:

▒<]▒▒Y▒H▒Y▒F▒f8<^▒@No BMP sensor detected

Exception (0):
epc1=0x401063b9 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont
sp: 3fff2960 end: 3fff2bd0 offset: 01a0

>>>stack>>>
3fff2b00:  4022bb9f 00000004 3fff1a24 402094e5
3fff2b10:  0000ffff 00000000 3fff19c4 40208e3c
3fff2b20:  3fff19c4 3fff19f0 3fff1a24 40208148
3fff2b30:  3fff19c4 00000000 3fff1a24 402084a5
3fff2b40:  00000000 00000004 4021b79c 3fff1b9c
3fff2b50:  40202650 00000000 00000000 3fff1ba4
3fff2b60:  3fffdc20 00000000 3fff1a24 402086d9
3fff2b70:  3fff19dc 3ffe86e8 00000001 4020ae16
3fff2b80:  00000002 00000016 3fff2c24 4021176c
3fff2b90:  3ffe8678 3fff1ad8 00000000 3fff1ba4
3fff2ba0:  3fffdc20 00000000 3fff2c24 3fff1ba4
3fff2bb0:  3fffdc20 00000000 3fff1b9c 40209b96
3fff2bc0:  00000000 00000000 3fff1bb0 40100114
<<<stack<<<
c_'RS▒fJS
         j▒c_7▒RS▒fJSz*

The "No BMP sensor detected" is a message from my software.

I don't really know what to do with the error or stack contents.

Thanks, Dan

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Dead Oak - No Blinking Light
« Reply #3 on: February 11, 2017, 04:01:43 pm »
Well if the message is coming from your code then it sounds like the Oak is booting and running your sketch. If you are willing to show us the sketch it may help reveal the problem.

PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: Dead Oak - No Blinking Light
« Reply #4 on: February 12, 2017, 01:28:10 am »
re: baud rate - It's probably just the software you're running... if you use something like Termite, RealTerm or even the Arduino Serial Monitor you'll be able to shove in 74880 baud as the baud to run at.

Yeah, for you to be getting an exception, it must be a glitch/incompatibility with your code. Perhaps the BMP library (Adafruit? version?) didn't co-operate well with the Oak?

I'm not sure why the P1 -> GND on boot up isn't working... the bootloader appears to in at 74880 baud (the "▒<]▒▒Y▒H▒Y▒F▒f8<^▒@" bit which isn't coming through as it's at the wrong baud rate), and then your code switches the board to 9600 hence it becomes readable.

P2 -> GND won't help though, unless you intend to upload the Oak's firmware again or upload to the Oak via serial, as it puts it into serial programming mode.

As exeng said, we'd probably need to see your code to see if there is something going on there that explains the failure.

DanT

  • Newbie
  • *
  • Posts: 8
Re: Dead Oak - No Blinking Light
« Reply #5 on: February 12, 2017, 04:12:43 am »
Thanks.

Here is the code - with warts - not everything planned is implemented (sqlite3 and gas sensor) and some pieces that didn't work the way I thought they would are commented out.  Any comments or criticisms are welcome.

This Oak is currently on a breadboard with connections to my Windows 7 desktop via the FTDI to USB only.  It is connected to a powered hub and is the only device on the hub.

This code is currently running on my other Oak.

// Oak environmental monitor
// Interfaces with photoresistor, DHT22 temperature/humidity sensor,
// MQ135 gas sensor, and on-board LED (with console using usb-serial adapter)
   
/*-----------------------------------------
 *   DHT22 Wiring
 *   1 -- 3V3  -- 3V3 -- Red
 *   2 -- Data -- D7  -- White
 *   3 -- ..   -- nc  -- ..
 *   4 -- GND  -- GND -- Black
 *   4.7 Kohm resistor between pins 1 and 2
 *
 *   BMP180 Wiring
 *   1 -- SDA -- 0
 *   2 -- SCL -- 2
 *   3 -- GND
 *   4 -- 3V3
 */
#include "DHT.h"
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
#include <SPI.h>
#include "sqlite3.h"

#define DEBUG 1

#define DHTPIN 5 
#define DHTTYPE DHT22

// variables to store our readings
int light = 0;
int count = 0;
double tempc = 0.0;
double tempf = 0.0;
double humidity = 0.0;
double dewpt = 0.0;
double heatidx = 0.0;
double BMPtemp = 0.0;
float bmptemp = 0.0;
double BMPpressure = 0.0;
float bmppress = 0.0;

DHT dht(DHTPIN, DHTTYPE);

void readDHT22(){
  humidity = dht.readHumidity();
  tempc = dht.readTemperature();     // Read as Celsius
  tempf = tempc * 1.8 + 32.0;        // convert to Fahrenheit
  dewpt = dewPoint(tempc, humidity);
  heatidx = dht.computeHeatIndex(tempf, humidity);
  //heatidx = dht.computeHeatIndex(tempc, humidity);
}

// Virtual Pins of the BMP180 widget.
#define BAROMETER_PIN V1
#define TEMPERATURE_PIN V2

Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10180);
bool bmpSensorDetected = true;

void readBMP180(){
  if (bmpSensorDetected){
    bmp.getTemperature(&bmptemp);
    bmptemp = bmptemp * 1.8 + 32.0;   // convert to F
    BMPtemp = bmptemp;
    bmp.getPressure(&bmppress);
    bmppress = bmppress * 0.0002953337;   // convert to inHg
    BMPpressure = bmppress;
  }
}

double dewPoint(double celsius, double humidity)
{
  // (1) Saturation Vapor Pressure = ESGG(T)
  double RATIO = 373.15 / (273.15 + celsius);
  double RHS = -7.90298 * (RATIO - 1);
  RHS += 5.02808 * log10(RATIO);
  RHS += -1.3816e-7 * (pow(10, (11.344 * (1 - 1 / RATIO ))) - 1) ;
  RHS += 8.1328e-3 * (pow(10, (-3.49149 * (RATIO - 1))) - 1) ;
  RHS += log10(1013.246);

  // factor -3 is to adjust units - Vapor Pressure SVP * humidity
  double VP = pow(10, RHS - 3) * humidity;

  // (2) DEWPOINT = F(Vapor Pressure)
  double T = log(VP / 0.61078); // temp var
  return ((241.88 * T) / (17.558 - T))*1.8 + 32.0;  // change to Fahrenheit
}

void setup()
{               
  // enable the on-board LED as an output
  pinMode(1, OUTPUT);
 
  // initialize the analog pin as an input
  pinMode(A0, INPUT);

  // start serial communication and create a variable for particle.io access
  Serial.begin(9600);
 
  dht.begin();
 
  if (!bmp.begin()) {
    Serial.println("No BMP sensor detected");
    bmpSensorDetected = false;
  }
 
  Particle.variable("light", light);
  Particle.variable("count", count);
  Particle.variable("temp", tempf);
  Particle.variable("humidity", humidity);
  Particle.variable("dewpoint", dewpt);
  Particle.variable("heatindex", heatidx);
  Particle.variable("BMPtemp", BMPtemp);
  Particle.variable("BMPpress", BMPpressure);
}

// the loop() routine runs over and over again
void loop()
{
  // take a reading
  light = analogRead(A0); 
  // print it out
  Serial.println("Light: " + String(light));

  readDHT22();
  Serial.println("DHT22: Temp: " + String(tempf) + " Humidity: " + String(humidity));
  Serial.println("DHT22: Dewpoint: " + String(dewpt) + " Heat Index: " + String(heatidx));
 
  readBMP180();
  Serial.println("BMP180: Temp: " + String(bmptemp) + " Pressure: " + String(bmppress));
 
//  Battv = adc_single_channel_read(adc_single_ch6);
//  Solarv = adc_single_channel_read(adc_single_ch7);
//  Serial.println("Battery: " + String(Battv) + " Solar: " + String(Solarv));


  // turn on/off the LED based on light reading
  if(light < 350) { digitalWrite(1, HIGH); }
  if(light >= 350) {digitalWrite(1, LOW); }
 
  count++;
 
  // a short delay
  delay(15000);
}

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Dead Oak - No Blinking Light
« Reply #6 on: February 12, 2017, 08:01:26 am »
Don't see anything obvious. Perhaps Pete has a better eye than me.

I would start by commenting out different parts of your code to see if the problem goes away which would help narrow down the code that is causing the problem. You could start with the bmp.begin();

Also, you may want to try a different lib. I noticed that the Oak weather station shield uses the BMP180 also but uses the BMP180_Breakout_Arduino_Library from https://github.com/sparkfun/BMP180_Breakout_Arduino_Library. The methods might be different for the supporting functions.

DanT

  • Newbie
  • *
  • Posts: 8
Re: Dead Oak - No Blinking Light
« Reply #7 on: February 12, 2017, 09:18:54 am »
I would like to be able to change the code, but this failure prevents reloading anything.  I'll try the other BMP180 library when I can.  Thanks.

Dan

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Dead Oak - No Blinking Light
« Reply #8 on: February 12, 2017, 03:39:33 pm »
Quote
I have tried powering up with P1 grounded and then with P2 grounded with no effect.

I assume when you say you tried P1 to GND, you realize that you do this on power up for a few seconds and then remove the P1 to GND. You should then see the 3 blink pattern at which point you should be able to load a new sketch. Is this not the case?

PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: Dead Oak - No Blinking Light
« Reply #9 on: February 12, 2017, 08:03:18 pm »
Nothing is jumping out at me either. However, on second thoughts, a code issue should only really affect the running sketch... it shouldn't be preventing you from getting into config mode as that is not normally touched.

If you're not getting into config/safe mode, and the sketch on the Oak is not responding, it is probably best to simply do the Easy Serial update, which will hopefully remove any firmware corruption issues.


DanT

  • Newbie
  • *
  • Posts: 8
Re: Dead Oak - No Blinking Light
« Reply #10 on: February 13, 2017, 04:07:42 am »
I did the P1 / P2 ground, power up, count to 5, remove ground procedure multiple times and did not see any blinking.

I'll see what the easy serial update can do.  I only have an FT232 adapter and mya have to purchase a CH340G device.

Thanks for the input.
Dan

DanT

  • Newbie
  • *
  • Posts: 8
Re: Dead Oak - No Blinking Light
« Reply #11 on: February 13, 2017, 04:23:05 am »
FT232 adapter didn't work - unable to open COM7 port. Ordering a CH340G version.  Due here Saturday.
Dan

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Dead Oak - No Blinking Light
« Reply #12 on: February 13, 2017, 09:09:34 am »
Quote
I did the P1 / P2 ground, power up, count to 5, remove ground procedure multiple times and did not see any blinking.

Well it sounds like something may have gotten corrupted in flash. Factory Restore when you get your new FTDI device and hopefully that will get you back on track.
« Last Edit: February 13, 2017, 08:51:35 pm by exeng »

DanT

  • Newbie
  • *
  • Posts: 8
Re: Dead Oak - No Blinking Light
« Reply #13 on: February 18, 2017, 07:30:02 am »
Success!

I received the CH340G USB-Serial adapter in the mail last night.  I connected it this morning and ran the 'Easy Serial update' with no problems.  The Oak was happily doing ' blink-blink-blink-pause'; over and over again.

Then (following directions) made multiple tries at connecting/configuring with no success over about a three hour period.

Finally, decided to just try to down load the Oak example - Start. I downloaded it and the Oak is working fine blinking at about one second intervals.

Next, I'll try to download and run actual, useful code.

Thanks to all who helped out.

Dan

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Dead Oak - No Blinking Light
« Reply #14 on: February 18, 2017, 08:39:18 am »
Glad to hear that it's working again. You will begin to cherish your FTDI board but hopefully will only need it on rare occasions.
« Last Edit: February 18, 2017, 04:30:21 pm by exeng »