I am creating a wearable for myself with this mini Arduino:
I have a 500mAh 3.7v battery.
My problem is that I have a sensor that consumes too much electricity, I will not always use that sensor. I want to be able to turn it on and off. What dou you recommend?
I can't use a relay because as I told you, I'm creating a wearable and I have to keep the system small.
Is there a way to turn off (cut all electricity) all the sensors and turn it on when I want?
Depends in part the power requirements for the sensor. If the sensor requires 20mA or less, the uC can "source" the positive voltage (less a small voltage drop.)
Otherwise, the Internet is full of driver circuits: FET, transistor.
Could be, but this one (IRF520) does not work with a 3.3volt-logic seeeduino,
and is a poor choice for a 5volt-logic Arduino.
Tell us exactly what sensor you are going to use (weblink please),
and this seeeduino is not an Arduino, and a big step up for "a complete novice".
Leo..
The sensor that I will use is DW1000, it consumes 160 mAh and in sleep mode it consumes <5mA. It has a function to put it in sleep mode, but the documentation is not clear, that's why I'm looking for an alternative.
Part of my code is (It works to turn it off once it's on, but not to turn it on, I thought I'd do a reset to turn it on again, but it's an unorthodox method) :
void loop() {
DW1000Ranging.loop();
if (Serial.available()) {
int state = Serial.parseInt();
if (state == 1) {
Serial.println("ON");
//DW1000.spiWakeup();
//delay(500);
//DW1000.reset();
//DW1000.softReset();
//delay(200);
//DW1000Ranging.loop();
}
if (state == 2) {
Serial.println("OFF");
DW1000.deepSleep();
delay(500);
}
}
}
But as I said, an easy solution is to force the sensor off with a MOSFET.
I imagine there are alternatives, right? Another MOSFET?
If it's safe to switch supply (high-side) or ground (low-side) with a mosfet depends on the idle state of the data lines of the chip.
If you do it wrong, then phantom-powering could easily fry the chip.
Leo..
@raym3d You have 2 different questions about the same project. Asking the same question twice is definitely against the forum rules, asking 2 different questions about the same project is OK but please make it clear in your OP that that's what you are doing. I have added a comment to both questions linking them together.