Eelectron brown out cycles (D7 LED dimly lit) when sensor added


I have encountered a hard to pin down problem, (for me) I am wondering if any one has seen something similar to this or has any ideas for a remedy or work around.

The Problem:
As soon as the electron is powered it enters what my guess is a brown out cycle. The status LED is white with short flickers of off, and the D7 LED is very dimly lit blue. No code is executed.

Some background:
I am building a remote ultrasonic sensor using an electron as the communication path, an accelerometer, and two maxbotix MB7040 ultrasonic sensors. This device needs to run on battery’s for a long period of time, so it spends most of its time in DEEP_SLEEP. In order to save power the ultrasonic sensors and the pull up resistors for the I2C lines have been placed on a high side switch, when the system wakes it triggers the high side switch which passes the 3.3V rail (from the electron) to the I2C bus, and the ultrasonic sensors.

So my first guess is that it is a current draw problem, even though the MB7040’s only draw 3mA and I was only testing with one. I placed an ammeter on the v+ wire of the ultrasonic sensor and powered the electron (with the included LiPo) and it work perfectly fine, what?, so I removed the meter and it went back to the brown out cycle.

After further trials, if the electron is started with the ammeter in the circuit, it can be removed and the systems continues to function fine, until it goes to sleep and wakes up again.

My guess would be there is some resistance or capacitance introduced by the meter that is fixing the problem, but before I start adding random components I am curious if anyone has seen something similar. (or if I made a mistake)

Here is a rough schematic:

It exhibits the above problem when in “test 1”, but works under “test2”

Any help is very much appreciated.

A test you could try:
Disconnect D1 and D0 from your SCL/SDA lines (but leave them connected to power, each other, etc). If the problem still exhibits itself then it seems to be related to an interaction where the MB7040 is drawing power in a funky way. If it doesn’t then there may be something with the interaction on the specific pins.

Are you on a breadboard? PCB?

Are D1/D0 set up as a particular pinmode?

Have you tried monitoring serial output with a simple logging firmware to see if it’s actually browning out?

What is the logic with B0? Can you put a scope on B0, VCC, and “POWER” to see if anything is dipping?

Try without the LiPo and with a high quality supply - do you have the same behavior? If not that indicates possible problems with your battery/input power power switching.

Fast reply! thanks.

I have tested with out the ultrasonic I2C pins connected and the problem persists, but it is on proto board so disconnecting the D1/D0 is harder.

How the code functions, it sets B0 high (turn on the high side switch) then calls Wire.begin()

I have logging with Serial1LogHandler, going to an external serial to USB cable. During the problem it loops the starting statement for the device: <time stamp> [system] INFO: Device <device ID>

I added a 475 ohm resistor (not chosen for any particular reason) in place of the ammeter and it has the same effect of fixing the brown out loop.

scope screens
yellow -> B0
purple -> VCC (3.3V from regulator on the electron)
blue -> POWER

this is what it should look like, the ultrasonic sensors vcc is disconnected

This is with the problem, ultrasonic sensor connected

here is zoomed in on the first blue spike

Possibly the resister is acting as a current limit?

The same problem appeared when powered from two 18650 battery’s connected to Vin.