My specific gravity sensor is made using a photon and an accelerometer. The photon wakes up once an hour and sends data. The accelerometer however stays on continuously . Would it be possible to run the power to the accel thru a transistor somehow or something so the accel is turned on when the photons wakes?
@murmsk, which accelerometer are you using? It may be possible to power it from a Photon pin directly.
I never thought of that!!
@murmsk, based on the MPU6050 specs, with the Gyroscope, Accelerometer and DMP enabled, current draw is 3.9ma at 3.3v. A Photon GPIO pin can easily accommodate that so you could power the MPU6050 directly via a GPIO pin.
If you put a capacitor on the line for bypass filtering, make sure and take care not to go from HI to LO without considering the short-circuit current from the filter cap.
You might be able to use INPUT_PULLDOWN mode to address that issue though. It’s not available in every processor, but it seems to be there in the Photon.
I would not use a filter cap on the GPIO line if you choose to power it this way. Be mindful that you should keep the distance between the Photon and the MPU6050 as short as possible.
Fantastic. I’ll try it. Thanks for you insight and ideas
ok so i rewired my sg sensor. It seems to turn on but I am getting results of zero I think it is because this line of code
has to be in the area before setup so the accelerometer is still off when it is run
am I right and does anyone have a solution?
You can look up the implementation of the library and that shows this for the default constructor
devAddr = MPU6050_DEFAULT_ADDRESS;
So no power for the sensor required at that time.
How and when (in respect to your
accellgyro.initialize() call) do you power up the sensor?
the SG sensor powers up once an hour so I have tried to power the mpu6050 off of a pin so it will shut off when the photon is sleeping. The LED comes on so there is some power but maybe not enough. It powers up with the following statements in the setup loop
pinMode (accel, OUTPUT);
digitalWrite (accel, HIGH);
where the var accel is the pin number
the accellgyro.initialize() is further down in the setup loop
@murmsk, perhaps I should have asked… are you using an MPU6050 breakout board and if so, which. The MPU6050 itself requires little power but extra components on a board including LED, voltage regulator, etc can take extra current.
can I pull power off of 2 pins?
yes it is a breakout board with led I intend to remove the led when everything is working
@murmsk, which breakout board?
its one off of ebay says itg/mpu on it and gy-521
@murmsk, the LDO regulator may cause issues and if not, will consume a small amount of current. The LED will consume 1-2ma I suspect. The unit I looked at has 2.2K I2C pull-ups which could will draw some current when active but again, not much.
I put a short delay after pin was turned on and all is well