Author Topic: Very strange Oak power on issue  (Read 3563 times)

exeng

  • Sr. Member
  • ****
  • Posts: 452
Very strange Oak power on issue
« on: March 21, 2016, 12:46:16 am »
I tried to create my own relay shield for the Oak and I am experiencing a strange behavior at power on.

First the background...
Powering the Oak via a 7.2V 1A wall wart through VIN and GND.
Using a 5V relay driven by a 2N3904 through a 1K resistor via pin 1.
Have a 1N4007 diode across the relay coil in the proper orientation.
Using the on board LED as a visual indication that the relay should close at about 1 second intervals.

This all can be very easily prototyped on a breadboard.

So here is what happens... It didn't work and the sketch did not seem to run. So off to debug land I went.

First I thought I completely messed up my handmade shield so I boiled it down to the essence.  If everything is connected at power on, the sketch does not run and the relay clicks in immediately and remains closed. However, if I have pin 0 physically disconnected from the transistor base through the resistor and wait for the sketch to start (as indicated by the blinking onboard LED), then connect pin 0, the relay begins to cycle in sync with the onboard LED.

In the failure mode, it's as if the pin is output on power up (before any setup) and I guess is demanding enough current to cause the Oak not to boot properly. At least that's my SWAG at what may be going on. Also if I put a scope on the pin 0 when this all fails, it's appears that pin 0 is spewing data, as is TX. Can't be sure but it looks like a well formed square wave.

So now I appeal to the sharper EE's and microcontroller experts out there for a clue as to how to fix this. It's really going to suck if I can't have outputs connected on power on. This is not the behavior I would expect for driving a simple relay.

Does anyone have a clue?


Z69

  • Newbie
  • *
  • Posts: 28
Re: Very strange Oak power on issue
« Reply #1 on: March 21, 2016, 03:40:35 am »
Can you upload a drawing of your exact wiring?

emardee

  • Full Member
  • ***
  • Posts: 135
Re: Very strange Oak power on issue
« Reply #2 on: March 21, 2016, 04:34:24 am »
Can you try a different pin? I think I read somewhere that some pins do things during boot-up that I think might cause issues (but not sure about that).... but others should be fine to remain connected. Anyone able to confirm or deny this, and give specifics of this if true?

exeng

  • Sr. Member
  • ****
  • Posts: 452
Re: Very strange Oak power on issue
« Reply #3 on: March 21, 2016, 08:50:41 am »
@Z69 Here is the essence of what the circuit looks like. The 1N4004 is actually a 1N4007 since that what I had laying around. The ultimate circuit has more things, such as 2 sensor inputs and a light sensor on ADC. But these are not in circuit as I debug. I only have what you see in the schematic connected.

@emardee Originally I was using P1 but it caused a different problem. Basically it must have looked liked it was being pulled to ground by the external circuit and would immediately dive into safe mode (3 rapid blink) state. I theorized that on power up the pin must have been driving the transistor base to the emitter to ground and thus appears as P1 pulled LOW.

Arrrgh! Which pins are safe to use in this configuration? Any help is welcome.

I'm off to learn about power on sequences and pin states as the processor comes alive. As a stab at an experiment (I'm thrashing now) I thought about using a cap on the supply voltage to have power come up gracefully.

Still welcoming any suggestions or insight.

exeng

exeng

  • Sr. Member
  • ****
  • Posts: 452
Re: Very strange Oak power on issue
« Reply #4 on: March 21, 2016, 09:26:03 am »
Could this be a clue?
See table below from here... https://github.com/esp8266/esp8266-wiki/wiki/Boot-Process


exeng

  • Sr. Member
  • ****
  • Posts: 452
Re: Very strange Oak power on issue (SOLVED)
« Reply #5 on: March 21, 2016, 10:24:14 am »
OK, The problem is definitely related to the use of pin 0. It must be related to the boot mode use of pin 0. Also, pin 1 is probably off limits for this type of circuit has it triggers safe mode (does that mean pin 6 too?).

Switched to using pin 5 as an output to drive the transistor controlling the relay and all is well. I guess, it's back to the bench to move some I/O's around on my home ground shield. Not going to be fun as it's tight quarters on the shield. Should have prototyped on a breadboard first. Much easier that way. So much for thinking I was so smart.

exeng

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Very strange Oak power on issue
« Reply #6 on: March 21, 2016, 01:48:45 pm »

exeng

  • Sr. Member
  • ****
  • Posts: 452
Re: Very strange Oak power on issue
« Reply #7 on: March 21, 2016, 02:04:53 pm »
Erik, what about pin 1? In my initial attempt I was using pin 1 (or at least intended to) to drive the transistor. It must have seen ground at power up as it immediately dove into safe mode (3 blink pattern). The pinout tutorial does not mention pin 1.
« Last Edit: March 21, 2016, 04:47:21 pm by exeng »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Very strange Oak power on issue
« Reply #8 on: March 21, 2016, 06:04:09 pm »
Added pin 1 - good point

PeterF

  • Hero Member
  • *****
  • Posts: 883
Re: Very strange Oak power on issue
« Reply #9 on: March 22, 2016, 04:07:10 am »
Shouldn't that be Pin 1 must not be held low at boot? As the tute now lists it as being in the "it must be held high at boot" category!  And I'm too afraid to change it just in case there is some held high state to be avoided also... :o ;D ;D

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Very strange Oak power on issue
« Reply #10 on: March 22, 2016, 10:12:27 am »
opps - corrected!