1
\$\begingroup\$

I am currently trying to connect an ADXL362 accelerometer to an ESP8266 and have them communicate through SPI.

My final goal is to build a battery-powered device that submits motion events (activity or inactivity) through ESP's WiFi connection.

I use components from Sparkfun (Sparkfun ADXL362 breakout board / Sparkfun Thing (ESP8266))

SPI communication between both components works fine when power for the accelerometer is provided by ESP8266's 3v3-Pins:

Working version

However, to extend battery life, I'd like to be able to completely power down the ESP8266 after ADXL362 was set to wake-up mode (waiting for movement). As a first step towards this goal, I'd like to make the power supply for ADXL362 independent of the ESP8266 - my (naive) approach looks like this:

Non-Working version

In this scenario, I cannot get any meaningful sensor readings. ADXL 362's status register reads "255" even after a soft reset was issued, apparently indicating a SEU fault.

In both cases two AA batteries are used as a power supply (~3.2V).

All this is leading me to my question: How can ADXL362 be powered independent of an MCU such that SPI communication is still possible?

Currently, I don't use any additional capacitors, resistors or voltage regulators although they may well be part of the solution. I assume that my source code is not causing the perceived issue - however, I'd be happy to share the code if needed.

Thanks in advance for any of your ideas to help a newbie :)

\$\endgroup\$

2 Answers 2

0
\$\begingroup\$

I figured out that adding three 330 ohms resistors in between MISO / MOSI and SCK resolved my communication problems. I still don't really know why it works but it does.

I was inspired by the images in this rather unrelated issue.

\$\endgroup\$
1
  • \$\begingroup\$ The wires connecting your ESP8266 and the ADXL362 have some inductance. This inductance has some impedance at high frequency. If you drive high frequency signals (like SPI) between the devices, it will cause dips and spikes on the power nodes relative to the other device. This can ruin your communication. Adding resistors likely slowed down the edges, and also had the benefit of damping any reflections (most critically on the SCK line). \$\endgroup\$
    – user4574
    Mar 21, 2022 at 3:19
0
\$\begingroup\$

Components that talk to each other generally need to use approximately the same voltage for those signals (to simplify a bit), which often is just their supply voltage. The resistors you inserted can sometimes make it work, but are not reliable and not the proper way to do it, because their voltage drop depends on the currents, which are not well defined for voltage-based signals.

Two possible solutions are:

  • Add a separate converter to power the accelerometer with 3.3 V as well. That is, if the 3V3 pin on the ESP board is actually putting out that voltage, which is unlikely when (under)powering it from 3.2 V.
  • Insert a logic level converter into the signal lines.

That said, how are you planning to power down the ESP? You may be able to just put that chip to sleep while still running the accelerometer from the regulator on that board.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.